diff --git a/src/App.vue b/src/App.vue
index 3ecba08..b5db4a8 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -39,32 +39,12 @@ button {
line-height: 1;
outline: none;
box-sizing: border-box;
- -webkit-tap-highlight-color: transparent; /* 添加这行,去除点击高亮 */
}
button::after {
border: none;
}
-/* 修改点击态样式 */
-button:active {
- border: none;
- background: none !important; /* 添加 !important 确保覆盖默认样式 */
- opacity: 1 !important; /* 防止透明度变化 */
-}
-
-/* 去除按钮的默认边框和点击效果 */
-button[plain] {
- border: none;
- background: none !important;
-}
-
-/* 去除点击态的所有效果 */
-button:hover,
-button.hover {
- background: none !important;
-}
-
.guide-tips {
display: flex;
flex-direction: column;
diff --git a/src/apis.js b/src/apis.js
index 1e70183..210f24c 100644
--- a/src/apis.js
+++ b/src/apis.js
@@ -72,6 +72,10 @@ export const createPractiseAPI = (arrows) => {
});
};
+export const getPractiseAPI = (id) => {
+ return request("GET", `/user/practice/get?id=${id}`);
+};
+
export const createRoomAPI = (gameType, teamSize) => {
return request("POST", "/user/createroom", {
gameType,
@@ -207,6 +211,5 @@ export const getBattleListAPI = async (page, battleType) => {
.sort((a, b) => b.totalScore - a.totalScore),
});
});
- console.log(1111, result);
return data;
};
diff --git a/src/components/AppFooter.vue b/src/components/AppFooter.vue
index 88fe31c..120d0f5 100644
--- a/src/components/AppFooter.vue
+++ b/src/components/AppFooter.vue
@@ -4,6 +4,13 @@ import { storeToRefs } from "pinia";
const store = useStore();
const { user } = storeToRefs(store);
+const props = defineProps({
+ signin: {
+ type: Function,
+ default: () => {},
+ },
+});
+
const tabs = [
{ image: "../static/tab-vip.png" },
{ image: "../static/tab-grow.png" },
@@ -11,12 +18,7 @@ const tabs = [
];
function handleTabClick(index) {
- if (!user.value.id) {
- return uni.showToast({
- title: "还未登录",
- icon: "none",
- });
- }
+ if (!user.value.id) return props.signin();
if (index === 1) {
uni.navigateTo({
url: "/pages/my-growth",
diff --git a/src/components/BowData.vue b/src/components/BowData.vue
new file mode 100644
index 0000000..34ec99e
--- /dev/null
+++ b/src/components/BowData.vue
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+ {{ arrows.length }}
+ 支箭,共
+ {{ arrows.reduce((a, b) => a + b.ring, 0) }}
+ 环
+
+
+
+
+
+
diff --git a/src/components/BowTarget.vue b/src/components/BowTarget.vue
index c583cc0..08bb0ae 100644
--- a/src/components/BowTarget.vue
+++ b/src/components/BowTarget.vue
@@ -41,16 +41,20 @@ const props = defineProps({
});
const showRoundTips = ref(false);
+const showLatestArrow = ref(false);
+const prevLength = ref(0);
watch(
() => props.scores,
(newVal) => {
- if (newVal.length > 0) {
+ if (newVal.length - prevLength.value === 1) {
showRoundTips.value = true;
+ showLatestArrow.value = true;
setTimeout(() => {
showRoundTips.value = false;
- }, 2000);
+ }, 1000);
}
+ prevLength.value = newVal.length;
},
{
deep: true,
@@ -93,7 +97,7 @@ function calcRealY(num) {
v-for="(bow, index) in scores"
:key="index"
:src="
- index === scores.length - 1 && !blueScores.length
+ index === scores.length - 1 && !blueScores.length && showLatestArrow
? '../static/hit-icon-green.png'
: '../static/hit-icon.png'
"
diff --git a/src/components/Container.vue b/src/components/Container.vue
index ba7b84a..0ce4d82 100644
--- a/src/components/Container.vue
+++ b/src/components/Container.vue
@@ -26,7 +26,7 @@ defineProps({
diff --git a/src/components/Swiper.vue b/src/components/Swiper.vue
index 6cce7db..671bbae 100644
--- a/src/components/Swiper.vue
+++ b/src/components/Swiper.vue
@@ -69,7 +69,7 @@ const handleChange = (e) => {
.dots {
position: absolute;
- bottom: 12%;
+ bottom: 14%;
left: 50%;
transform: translateX(-50%);
display: flex;
diff --git a/src/components/UserItem.vue b/src/components/UserItem.vue
index a54c1de..49aba96 100644
--- a/src/components/UserItem.vue
+++ b/src/components/UserItem.vue
@@ -20,13 +20,13 @@ defineProps({
-
+
{{ title }}
-
+
diff --git a/src/manifest.json b/src/manifest.json
index 78df3e2..aa432b2 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -61,11 +61,7 @@
"usingComponents": true,
"darkmode": true,
"themeLocation": "theme.json",
- "permission": {
- "scope.userInfo": {
- "desc": "用于完善用户资料"
- }
- },
+ "permission": {},
"requiredPrivateInfos": ["getLocation", "chooseLocation"]
}
}
diff --git a/src/pages/first-try.vue b/src/pages/first-try.vue
index 2587fa5..1da48e1 100644
--- a/src/pages/first-try.vue
+++ b/src/pages/first-try.vue
@@ -192,9 +192,11 @@ const onClose = () => {
:result="practiseResult"
/>
- {{
- stepButtonTexts[step]
- }}
+
+ {{
+ stepButtonTexts[step]
+ }}
+
diff --git a/src/pages/index.vue b/src/pages/index.vue
index 155f968..e97af44 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -4,69 +4,15 @@ import AppFooter from "@/components/AppFooter.vue";
import AppBackground from "@/components/AppBackground.vue";
import UserHeader from "@/components/UserHeader.vue";
import SModal from "@/components/SModal.vue";
-import SButton from "@/components/SButton.vue";
-import { getAppConfig, getHomeData, getMyDevicesAPI, loginAPI } from "@/apis";
+import Signin from "@/components/Signin.vue";
+import { getAppConfig, getHomeData, getMyDevicesAPI } from "@/apis";
import useStore from "@/store";
-
import { storeToRefs } from "pinia";
const store = useStore();
const { updateConfig, updateUser, updateDevice } = store;
// 使用storeToRefs,用于UI里显示,保持响应性
const { user } = storeToRefs(store);
const showModal = ref(false);
-const agree = ref(false);
-
-const getDevice = async () => {
- const devices = await getMyDevicesAPI();
- if (devices.bindings.length) {
- updateDevice(devices.bindings[0].deviceId, devices.bindings[0].deviceName);
- }
-};
-
-const handleAgree = () => {
- agree.value = !agree.value;
-};
-const handleLogin = () => {
- if (!agree.value) {
- return uni.showToast({
- title: "请先同意协议",
- icon: "none",
- });
- }
-
- // 先调用wx.getUserProfile获取用户信息
- wx.getUserProfile({
- desc: "用于完善用户资料", // 声明获取用户个人信息后的用途
- success: (res) => {
- const { nickName, avatarUrl } = res.userInfo;
- // 再获取登录凭证
- uni.login({
- provider: "weixin",
- success: async (loginRes) => {
- const { code } = loginRes;
- const result = await loginAPI(nickName, avatarUrl, code);
- updateUser({ ...result.user, nickName, avatarUrl });
- await getDevice();
- showModal.value = false;
- },
- fail: (err) => {
- uni.showToast({
- title: "登录失败",
- icon: "none",
- });
- console.error("登录失败:", err);
- },
- });
- },
- fail: (err) => {
- console.log("获取用户信息失败:", err);
- uni.showToast({
- title: "获取用户信息失败",
- icon: "none",
- });
- },
- });
-};
const toPage = (path) => {
if (!user.value.id) {
@@ -86,7 +32,13 @@ onMounted(async () => {
const result = await getHomeData();
if (result.user) {
updateUser(result.user);
- await getDevice();
+ const devices = await getMyDevicesAPI();
+ if (devices.bindings.length) {
+ updateDevice(
+ devices.bindings[0].deviceId,
+ devices.bindings[0].deviceName
+ );
+ }
}
console.log("首页数据:", result);
} catch (error) {
@@ -103,14 +55,11 @@ onMounted(async () => {
- (showModal = true)"
- :style="{ marginTop: '20px', paddingLeft: '10px' }"
- >
- 微信登录
+ (showModal = true)">
+ 新来的弓箭手你好呀~
+ 微信登录 >
-
@@ -204,38 +153,21 @@ onMounted(async () => {
-
-
-
- 登录/注册
-
-
-
-
- 已同意并阅读《用户协议》及《隐私协议》内容
-
-
+
diff --git a/src/pages/melee-match.vue b/src/pages/melee-match.vue
index 55d349e..4a7ed1f 100644
--- a/src/pages/melee-match.vue
+++ b/src/pages/melee-match.vue
@@ -115,7 +115,7 @@ onUnmounted(() => {
-
+
@@ -143,10 +143,12 @@ onUnmounted(() => {
/>
- {{
- matching ? "取消匹配" : "开始匹配"
- }}
- 准备完毕
+
+ {{
+ matching ? "取消匹配" : "开始匹配"
+ }}
+ 准备完毕
+
diff --git a/src/pages/my-growth.vue b/src/pages/my-growth.vue
index 81fc787..9c68a59 100644
--- a/src/pages/my-growth.vue
+++ b/src/pages/my-growth.vue
@@ -2,7 +2,12 @@
import { onMounted } from "vue";
import Container from "@/components/Container.vue";
import Avatar from "@/components/Avatar.vue";
-import { getBattleListAPI, getPractiseResultListAPI } from "@/apis";
+import BowData from "@/components/BowData.vue";
+import {
+ getBattleListAPI,
+ getPractiseResultListAPI,
+ getPractiseAPI,
+} from "@/apis";
import { ref } from "vue";
@@ -12,6 +17,8 @@ const matchList = ref([]);
const battlePage = ref(1);
const battleList = ref([]);
const practiseList = ref([]);
+const showBowData = ref(false);
+const arrows = ref([]);
const handleSelect = async (index) => {
if (index === 0 && matchList.value.length === 0) {
@@ -36,6 +43,11 @@ const toMatchDetail = (id) => {
url: `/pages/match-detail?id=${id}`,
});
};
+const getPractiseDetail = async (id) => {
+ const result = await getPractiseAPI(id);
+ arrows.value = JSON.parse(result.UserPracticeRound.arrows);
+ showBowData.value = true;
+};
onMounted(async () => {
const result = await getBattleListAPI(matchPage.value, 2);
matchList.value = result;
@@ -154,12 +166,18 @@ onMounted(async () => {
v-for="(item, index) in practiseList"
:key="index"
class="practice-record"
+ @click="() => getPractiseDetail(item.id)"
>
单组练习 {{ item.createdAt }}
+
diff --git a/src/pages/practise-one.vue b/src/pages/practise-one.vue
index 2f31a31..e596ddb 100644
--- a/src/pages/practise-one.vue
+++ b/src/pages/practise-one.vue
@@ -8,6 +8,10 @@ import ScoreResult from "@/components/ScoreResult.vue";
import SButton from "@/components/SButton.vue";
import { createPractiseAPI } from "@/apis";
import { MESSAGETYPES, roundsName } from "@/constants";
+import useStore from "@/store";
+import { storeToRefs } from "pinia";
+const store = useStore();
+const { user } = storeToRefs(store);
const start = ref(false);
const showScore = ref(false);
const scores = ref([]);
@@ -18,12 +22,13 @@ const power = ref(0);
const onReady = async () => {
await createPractiseAPI(total);
start.value = true;
+ scores.value = [];
};
async function onReceiveMessage(content) {
const messages = JSON.parse(content).data.updates || [];
messages.forEach((msg) => {
- if (start.value && msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
+ if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
scores.value.push(msg.target);
power.value = msg.target.battery;
if (scores.value.length === total) {
@@ -67,8 +72,8 @@ onUnmounted(() => {
/>
@@ -81,7 +86,9 @@ onUnmounted(() => {
:result="practiseResult"
/>
- 准备好了,直接开始
+
+ 准备好了,直接开始
+
diff --git a/src/pages/practise-two.vue b/src/pages/practise-two.vue
index 9adf448..9442946 100644
--- a/src/pages/practise-two.vue
+++ b/src/pages/practise-two.vue
@@ -8,6 +8,10 @@ import ScoreResult from "@/components/ScoreResult.vue";
import SButton from "@/components/SButton.vue";
import { createPractiseAPI } from "@/apis";
import { MESSAGETYPES } from "@/constants";
+import useStore from "@/store";
+import { storeToRefs } from "pinia";
+const store = useStore();
+const { user } = storeToRefs(store);
const start = ref(false);
const showScore = ref(false);
const scores = ref([]);
@@ -59,7 +63,7 @@ onUnmounted(() => {
@@ -77,7 +81,9 @@ onUnmounted(() => {
:result="practiseResult"
/>
- 准备好了,直接开始
+
+ 准备好了,直接开始
+
diff --git a/src/pages/team-match.vue b/src/pages/team-match.vue
index 684cf2d..d0972d4 100644
--- a/src/pages/team-match.vue
+++ b/src/pages/team-match.vue
@@ -141,7 +141,11 @@ onUnmounted(() => {
-
+
@@ -180,10 +184,12 @@ onUnmounted(() => {
/>
- {{
- matching ? "取消匹配" : "开始匹配"
- }}
- 准备完毕
+
+ {{
+ matching ? "取消匹配" : "开始匹配"
+ }}
+ 准备完毕
+