Files
shoot-miniprograms/src/pages/practise.vue

182 lines
4.4 KiB
Vue
Raw Normal View History

2025-05-07 23:34:15 +08:00
<script setup>
2025-08-13 17:11:30 +08:00
import { ref } from "vue";
import { onShow } from "@dcloudio/uni-app";
2025-07-02 17:21:44 +08:00
import Container from "@/components/Container.vue";
2025-05-07 23:34:15 +08:00
import Guide from "@/components/Guide.vue";
2025-08-12 18:33:39 +08:00
import Avatar from "@/components/Avatar.vue";
2025-08-13 17:11:30 +08:00
import { getPractiseDataAPI } from "@/apis";
2025-08-12 18:33:39 +08:00
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
2025-12-31 13:39:16 +08:00
const { user, device, online } = storeToRefs(store);
2025-08-13 17:11:30 +08:00
const data = ref({});
2025-05-08 22:05:53 +08:00
2025-12-31 13:39:16 +08:00
const goPractise = async (type) => {
if (!device.value.deviceId) {
return uni.showToast({
title: "请先绑定设备",
icon: "none",
});
}
if (!online.value) {
return uni.showToast({
title: "智能弓未连接",
icon: "none",
});
}
if (!user.value.trio) {
return uni.showToast({
title: "请先完成新手试炼",
icon: "none",
});
}
2025-11-26 17:12:55 +08:00
await uni.$checkAudio();
2025-05-08 22:05:53 +08:00
uni.navigateTo({
2025-12-31 13:39:16 +08:00
url: `/pages/practise-${type}`,
2025-05-08 22:05:53 +08:00
});
};
2025-08-13 17:11:30 +08:00
onShow(async () => {
const result = await getPractiseDataAPI();
data.value = result;
});
2025-05-07 23:34:15 +08:00
</script>
<template>
2025-07-02 17:21:44 +08:00
<Container title="个人练习">
<view :style="{ width: '100%' }">
<Guide>
2025-11-06 09:38:19 +08:00
<view class="guide-tips">
<text>师傅领进门修行靠自身赶紧练起来吧</text>
<text>坚持练习就能你快速升级早日加入全国排位赛</text>
</view>
2025-07-02 17:21:44 +08:00
</Guide>
2025-08-12 18:33:39 +08:00
<view class="practise-data">
<view>
<view>
<Avatar :rankLvl="user.rankLvl" :src="user.avatar" :size="30" />
2025-08-17 10:33:41 +08:00
<text class="truncate">{{ user.nickName }}</text>
2025-08-12 18:33:39 +08:00
</view>
<view>
<text>已练习打卡</text>
2025-08-13 17:11:30 +08:00
<text>{{ data.totalDay }}</text>
2025-08-12 18:33:39 +08:00
<text></text>
</view>
</view>
<view>
<view>
2025-08-13 17:11:30 +08:00
<view>
<text>{{ data.totalGroup }}</text>
<text></text>
</view>
2025-08-12 18:33:39 +08:00
<text>个人练习量</text>
</view>
<view>
2025-08-13 17:11:30 +08:00
<view>
<text>{{ data.totalArrow }}</text>
<text></text>
</view>
2025-08-12 18:33:39 +08:00
<text>射箭量</text>
</view>
<view>
<view>
<text>射灵</text>
<text>{{ user.lvl }}</text>
<text></text>
</view>
<text>当前等级</text>
</view>
</view>
</view>
2025-12-31 13:39:16 +08:00
<view class="practise-btn" @click="() => goPractise('one')">
2025-07-02 17:21:44 +08:00
<image
2025-08-04 18:36:44 +08:00
src="https://static.shelingxingqiu.com/attachment/2025-07-12/db9x668e2vdtqh0otq.png"
2025-07-02 17:21:44 +08:00
class="practise1"
mode="widthFix"
/>
</view>
2025-12-31 13:39:16 +08:00
<view class="practise-btn" @click="() => goPractise('two')">
2025-07-02 17:21:44 +08:00
<image
2025-08-04 18:36:44 +08:00
src="https://static.shelingxingqiu.com/attachment/2025-07-12/db9x668eehkvyicc08.png"
2025-07-02 17:21:44 +08:00
class="practise2"
mode="widthFix"
/>
</view>
2025-05-10 16:57:36 +08:00
</view>
2025-07-02 17:21:44 +08:00
</Container>
2025-05-07 23:34:15 +08:00
</template>
<style scoped>
2025-08-12 18:33:39 +08:00
.practise-data,
2025-05-15 12:43:40 +08:00
.practise-btn {
2025-08-12 18:33:39 +08:00
width: calc(100% - 30px);
margin: 15px;
margin-top: 0;
border-radius: 20px;
border: 1px solid #473f25;
overflow: hidden;
2025-05-15 12:43:40 +08:00
}
2025-08-12 18:33:39 +08:00
.practise-data > view {
display: flex;
align-items: center;
justify-content: space-between;
color: #fff9;
2025-08-14 10:50:17 +08:00
font-size: 12px;
2025-08-12 18:33:39 +08:00
}
.practise-data > view:first-child {
padding-bottom: 15px;
border-bottom: 1px solid #48494e;
margin: 15px;
margin-bottom: 0;
}
.practise-data > view:first-child > view {
display: flex;
align-items: flex-end;
}
.practise-data > view:first-child > view:first-child > text {
color: #fff;
margin-left: 10px;
font-size: 16px;
2025-08-17 10:33:41 +08:00
width: 120px;
2025-05-07 23:34:15 +08:00
}
2025-08-12 18:33:39 +08:00
.practise-data > view:first-child > view:last-child > text:nth-child(2) {
color: #f7d247;
margin: 0 3px;
2025-08-13 17:11:30 +08:00
font-size: 20px;
2025-08-12 18:33:39 +08:00
font-weight: 600;
transform: translateY(3px);
}
.practise-data > view:last-child {
margin-bottom: 15px;
}
.practise-data > view:last-child > view {
width: 33%;
margin-top: 15px;
display: flex;
flex-direction: column;
align-items: center;
}
.practise-data > view:last-child > view:nth-child(2) {
border-left: 1px solid #48494e;
border-right: 1px solid #48494e;
}
.practise-data > view:last-child > view > view {
display: flex;
align-items: flex-end;
}
.practise-data > view:last-child > view > view > text:nth-last-child(2) {
2025-08-13 17:11:30 +08:00
font-size: 20px;
2025-08-12 18:33:39 +08:00
font-weight: 600;
color: #fff;
margin: 0 3px;
2025-08-13 17:11:30 +08:00
transform: translateY(5px);
2025-08-12 18:33:39 +08:00
}
.practise-data > view:last-child > view > text {
margin-top: 5px;
}
.practise-btn > image {
2025-05-07 23:34:15 +08:00
width: 100%;
}
</style>