diff --git a/src/apis.js b/src/apis.js index 76297c2..d675c01 100644 --- a/src/apis.js +++ b/src/apis.js @@ -525,3 +525,24 @@ export const removePointRecord = async (id) => { export const getPhoneNumberAPI = (data) => { return request("POST", "/index/getPhone", data); }; + +export const getPointBookRankListAPI = (page = 1, pageSize = 10) => { + return request( + "GET", + `/user/score/sheet/week/shoot/rank/list?pageNum=${page}&pageSize=${pageSize}` + ); +}; + +export const clickLikeAPI = (userId, ifLike) => { + return request("POST", "/user/score/sheet/week/shoot/rank/like", { + userId, + ifLike, + }); +}; + +export const getMyLikeList = (page = 1, pageSize = 10) => { + return request( + "GET", + `/user/score/sheet/week/shoot/rank/like/list?pageNum=${page}&pageSize=${pageSize}` + ); +}; diff --git a/src/components/PointRankItem.vue b/src/components/PointRankItem.vue new file mode 100644 index 0000000..239d9fd --- /dev/null +++ b/src/components/PointRankItem.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/src/components/RewardUs.vue b/src/components/RewardUs.vue index 74a618c..b3be27f 100644 --- a/src/components/RewardUs.vue +++ b/src/components/RewardUs.vue @@ -148,7 +148,7 @@ onMounted(async () => { .container > image:first-child { width: 200rpx; position: absolute; - top: -114rpx; + top: -112rpx; } .container > text:nth-child(2) { font-weight: 500; diff --git a/src/pages.json b/src/pages.json index ffdb1ff..3d50b34 100644 --- a/src/pages.json +++ b/src/pages.json @@ -3,15 +3,21 @@ { "path": "pages/index" }, + { + "path": "pages/point-book" + }, + { + "path": "pages/point-book-rank" + }, + { + "path": "pages/my-like-list" + }, { "path": "pages/audio-test" }, { "path": "pages/calibration" }, - { - "path": "pages/point-book" - }, { "path": "pages/about-us" }, diff --git a/src/pages/my-like-list.vue b/src/pages/my-like-list.vue new file mode 100644 index 0000000..ca3d33c --- /dev/null +++ b/src/pages/my-like-list.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/src/pages/point-book-rank.vue b/src/pages/point-book-rank.vue new file mode 100644 index 0000000..a679d83 --- /dev/null +++ b/src/pages/point-book-rank.vue @@ -0,0 +1,170 @@ + + + + + diff --git a/src/pages/point-book.vue b/src/pages/point-book.vue index 1b86c53..de00898 100644 --- a/src/pages/point-book.vue +++ b/src/pages/point-book.vue @@ -8,13 +8,13 @@ import SModal from "@/components/SModal.vue"; import Signin from "@/components/Signin.vue"; import ScreenHint2 from "@/components/ScreenHint2.vue"; import RewardUs from "@/components/RewardUs.vue"; +import PointRankItem from "@/components/PointRankItem.vue"; import { getHomeData, getPointBookConfigAPI, - getPointBookListAPI, + getPointBookRankListAPI, getPointBookStatisticsAPI, - removePointRecord, } from "@/apis"; import { getElementRect } from "@/util"; @@ -44,14 +44,20 @@ const list = ref([]); const bowTargetSrc = ref(""); const heatMapImageSrc = ref(""); // 存储热力图图片地址 const canvasVisible = ref(false); // 控制canvas显示状态 -const removeId = ref(""); +const strength = ref(0); -const toListPage = () => { +const toRecordPage = () => { uni.navigateTo({ url: "/pages/point-book-list", }); }; +const toRankPage = () => { + uni.navigateTo({ + url: "/pages/point-book-rank", + }); +}; + const onSignin = () => { showModal.value = true; }; @@ -88,10 +94,14 @@ const closeHint = () => { }; const loadData = async () => { - const result = await getPointBookListAPI(1); - list.value = result.slice(0, 3); + const result = await getPointBookRankListAPI(1); + list.value = result.list.slice(0, 3); + if (list.value.every((item) => item.id !== user.value.id)) { + list.value = [result.my, ...result.list.slice(0, 3)]; + } const result2 = await getPointBookStatisticsAPI(); data.value = result2; + strength.value = Math.min(10, (5 / 60) * result2.todayTotalArrow); const rect = await getElementRect(".heat-map"); let hot = 0; @@ -146,6 +156,10 @@ const loadData = async () => { generateHeatmapAsync(); }; +const strengthText = computed(() => { + return strength === 10 ? "重度" : strength <= 6 ? "中度" : "轻度"; +}); + watch( () => user.value.id, (id) => { @@ -269,33 +283,59 @@ onShareTimeline(() => { - {{ data.todayTotalArrow || "-" }} - 今日射箭(箭) + + {{ data.todayTotalArrow || "-" }} + + 今日射箭 + + + {{ Math.round(data.todayTotalArrow * 1.6) || "-" }} + + 今日消耗 + + + {{ strength || "-" }} + {{ strengthText }} + 运动强度 + - {{ data.totalArrow || "-" }} - 累计射箭(箭) - - - {{ data.totalDay || "-" }} - 已训练天数(天) - - - {{ data.averageRing || "-" }} - 平均环数(箭) - - - {{ - data.yellowRate !== undefined - ? Number((data.yellowRate * 100).toFixed(2)) + "%" - : "-" - }} - 黄心率 - - - + + + {{ data.totalDay || "-" }} + + 训练天数 + + + {{ data.totalArrow || "-" }} + + 累计射箭 + + + + + {{ + data.yellowRate !== undefined + ? Number((data.yellowRate * 100).toFixed(2)) + : "-" + }} + % + 黄心率 + + + {{ data.averageRing || "-" }} + + 平均环数 + + + + + + @@ -341,20 +381,22 @@ onShareTimeline(() => { - - - - + + + 排行 + 用户 + 本周箭数 + 消耗 + + + - 查看所有记录 + 查看完整榜单 @@ -382,7 +424,7 @@ onShareTimeline(() => { - diff --git a/src/pages/user.vue b/src/pages/user.vue index e1f3081..1a05fea 100644 --- a/src/pages/user.vue +++ b/src/pages/user.vue @@ -4,9 +4,9 @@ import Container from "@/components/Container.vue"; import UserHeader from "@/components/UserHeader.vue"; import UserItem from "@/components/UserItem.vue"; import Avatar from "@/components/Avatar.vue"; +import { canEenter } from "@/util"; import useStore from "@/store"; import { storeToRefs } from "pinia"; -import { canEenter } from "@/util"; const store = useStore(); const { user, device, online } = storeToRefs(store); const { updateUser } = store; diff --git a/src/static/arrow-direction.png b/src/static/arrow-direction.png deleted file mode 100644 index 670272e..0000000 Binary files a/src/static/arrow-direction.png and /dev/null differ diff --git a/src/static/like-off.png b/src/static/like-off.png new file mode 100644 index 0000000..36157c1 Binary files /dev/null and b/src/static/like-off.png differ diff --git a/src/static/like-on.png b/src/static/like-on.png new file mode 100644 index 0000000..8122f5f Binary files /dev/null and b/src/static/like-on.png differ diff --git a/src/static/point-book-title2.png b/src/static/point-book-title2.png index 09bd371..8e5daf9 100644 Binary files a/src/static/point-book-title2.png and b/src/static/point-book-title2.png differ diff --git a/src/static/point-champion.png b/src/static/point-champion.png new file mode 100644 index 0000000..1d71892 Binary files /dev/null and b/src/static/point-champion.png differ diff --git a/src/static/point-no1.png b/src/static/point-no1.png new file mode 100644 index 0000000..7c2f4bc Binary files /dev/null and b/src/static/point-no1.png differ diff --git a/src/static/point-no2.png b/src/static/point-no2.png new file mode 100644 index 0000000..926d048 Binary files /dev/null and b/src/static/point-no2.png differ diff --git a/src/static/point-no3.png b/src/static/point-no3.png new file mode 100644 index 0000000..06a10ad Binary files /dev/null and b/src/static/point-no3.png differ diff --git a/src/static/record-btn.png b/src/static/record-btn.png new file mode 100644 index 0000000..7548cd7 Binary files /dev/null and b/src/static/record-btn.png differ diff --git a/src/static/share-icon.png b/src/static/share-icon.png new file mode 100644 index 0000000..44a2835 Binary files /dev/null and b/src/static/share-icon.png differ diff --git a/src/static/start-scoring.png b/src/static/start-scoring.png index 768812d..7f1a0af 100644 Binary files a/src/static/start-scoring.png and b/src/static/start-scoring.png differ diff --git a/src/uni.scss b/src/uni.scss index 86df36f..2c43686 100644 --- a/src/uni.scss +++ b/src/uni.scss @@ -28,13 +28,12 @@ $uni-text-color-placeholder: #808080; $uni-text-color-disable: #c0c0c0; /* 背景颜色 */ -$uni-bg-color: #fff; +$uni-white: #fff; $uni-bg-color-grey: #f8f8f8; $uni-bg-color-hover: #f1f1f1; // 点击状态颜色 $uni-bg-color-mask: rgba(0, 0, 0, 0.4); // 遮罩颜色 -/* 边框颜色 */ -$uni-border-color: #c8c7cc; +$uni-border: 1rpx solid #e3e3e3; /* 尺寸变量 */ diff --git a/src/util.js b/src/util.js index 1fffa6d..1b13b3c 100644 --- a/src/util.js +++ b/src/util.js @@ -854,3 +854,5 @@ export const canEenter = (user, device, online, page = "") => { } return true; }; + +export const capsuleHeight = uni.getMenuButtonBoundingClientRect().top - 9;