From aecd2cea616920199173acf1ac0c712ffc89ca6b Mon Sep 17 00:00:00 2001 From: kron Date: Tue, 25 Nov 2025 16:53:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B5=E9=9D=A2=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/api.js | 184 +++++++ src/components/AppBackground.vue | 65 +++ src/components/Avatar.vue | 49 ++ src/components/BowTargetEdit.vue | 349 ++++++++++++ src/components/Container.vue | 73 +++ src/components/EditOption.vue | 452 ++++++++++++++++ src/components/Header.vue | 202 +++++++ src/components/IconButton.vue | 39 ++ src/components/InputRow.vue | 84 +++ src/components/PointRecord.vue | 141 +++++ src/components/RingBarChart.vue | 105 ++++ src/components/SButton.vue | 96 ++++ src/components/SModal.vue | 107 ++++ src/components/ScreenHint.vue | 67 +++ src/components/ScrollList.vue | 96 ++++ src/heatmap.js | 0 src/main.js | 14 +- src/manifest.json | 20 +- src/pages.json | 35 +- src/pages/create.vue | 152 ++++++ src/pages/detail.vue | 467 ++++++++++++++++ src/pages/edit-profile.vue | 97 ++++ src/pages/edit.vue | 276 ++++++++++ src/pages/index.vue | 405 +++++++++++++- src/pages/list.vue | 246 +++++++++ src/pages/profile.vue | 201 +++++++ src/pages/reset-pwd.vue | 52 ++ src/pages/signin.vue | 145 +++++ src/pages/signup.vue | 91 ++++ src/static/app-bg3.png | Bin 0 -> 7951 bytes src/static/app-bg5.png | Bin 0 -> 22154 bytes src/static/apple-icon.png | Bin 0 -> 2052 bytes src/static/arrow-edit-delete.png | Bin 0 -> 530 bytes src/static/arrow-edit-move.png | Bin 0 -> 702 bytes src/static/arrow-edit-save.png | Bin 0 -> 1090 bytes src/static/arrow-grey.png | Bin 0 -> 488 bytes src/static/back-black.png | Bin 0 -> 636 bytes src/static/back-grey.png | Bin 0 -> 273 bytes src/static/bow-target.png | Bin 0 -> 30545 bytes src/static/btn-loading.png | Bin 0 -> 1770 bytes src/static/checked-green2.png | Bin 0 -> 372 bytes src/static/checked.png | Bin 0 -> 2242 bytes src/static/close-grey.png | Bin 0 -> 374 bytes src/static/close-white-outline.png | Bin 0 -> 954 bytes src/static/close-yellow.png | Bin 0 -> 381 bytes src/static/delete.png | Bin 0 -> 477 bytes src/static/edit.png | Bin 0 -> 363 bytes src/static/email-yellow.png | Bin 0 -> 1132 bytes src/static/enter-arrow-blue.png | Bin 0 -> 245 bytes src/static/google-icon.png | Bin 0 -> 3077 bytes src/static/hot1.png | Bin 0 -> 1581 bytes src/static/hot2.png | Bin 0 -> 1558 bytes src/static/hot3.png | Bin 0 -> 1550 bytes src/static/hot4.png | Bin 0 -> 1506 bytes src/static/password-yellow.png | Bin 0 -> 687 bytes src/static/pen-yellow.png | Bin 0 -> 1289 bytes src/static/point-book-tip-bg.png | Bin 0 -> 5936 bytes src/static/point-book-title1.png | Bin 0 -> 3728 bytes src/static/s-question-mark.png | Bin 0 -> 760 bytes src/static/start-scoring.png | Bin 0 -> 2050 bytes src/static/unchecked.png | Bin 0 -> 1963 bytes src/static/user-icon.png | Bin 0 -> 1236 bytes src/static/user-yellow.png | Bin 0 -> 877 bytes src/static/week-check.png | Bin 0 -> 1352 bytes src/store.js | 36 ++ src/util.js | 178 +++++++ yarn.lock | 830 ++++++++++++++++++++--------- 68 files changed, 5081 insertions(+), 274 deletions(-) create mode 100644 src/api.js create mode 100644 src/components/AppBackground.vue create mode 100644 src/components/Avatar.vue create mode 100644 src/components/BowTargetEdit.vue create mode 100644 src/components/Container.vue create mode 100644 src/components/EditOption.vue create mode 100644 src/components/Header.vue create mode 100644 src/components/IconButton.vue create mode 100644 src/components/InputRow.vue create mode 100644 src/components/PointRecord.vue create mode 100644 src/components/RingBarChart.vue create mode 100644 src/components/SButton.vue create mode 100644 src/components/SModal.vue create mode 100644 src/components/ScreenHint.vue create mode 100644 src/components/ScrollList.vue create mode 100644 src/heatmap.js create mode 100644 src/pages/create.vue create mode 100644 src/pages/detail.vue create mode 100644 src/pages/edit-profile.vue create mode 100644 src/pages/edit.vue create mode 100644 src/pages/list.vue create mode 100644 src/pages/profile.vue create mode 100644 src/pages/reset-pwd.vue create mode 100644 src/pages/signin.vue create mode 100644 src/pages/signup.vue create mode 100644 src/static/app-bg3.png create mode 100644 src/static/app-bg5.png create mode 100644 src/static/apple-icon.png create mode 100644 src/static/arrow-edit-delete.png create mode 100644 src/static/arrow-edit-move.png create mode 100644 src/static/arrow-edit-save.png create mode 100644 src/static/arrow-grey.png create mode 100644 src/static/back-black.png create mode 100644 src/static/back-grey.png create mode 100644 src/static/bow-target.png create mode 100644 src/static/btn-loading.png create mode 100644 src/static/checked-green2.png create mode 100644 src/static/checked.png create mode 100644 src/static/close-grey.png create mode 100644 src/static/close-white-outline.png create mode 100644 src/static/close-yellow.png create mode 100644 src/static/delete.png create mode 100644 src/static/edit.png create mode 100644 src/static/email-yellow.png create mode 100644 src/static/enter-arrow-blue.png create mode 100644 src/static/google-icon.png create mode 100644 src/static/hot1.png create mode 100644 src/static/hot2.png create mode 100644 src/static/hot3.png create mode 100644 src/static/hot4.png create mode 100644 src/static/password-yellow.png create mode 100644 src/static/pen-yellow.png create mode 100644 src/static/point-book-tip-bg.png create mode 100644 src/static/point-book-title1.png create mode 100644 src/static/s-question-mark.png create mode 100644 src/static/start-scoring.png create mode 100644 src/static/unchecked.png create mode 100644 src/static/user-icon.png create mode 100644 src/static/user-yellow.png create mode 100644 src/static/week-check.png create mode 100644 src/store.js create mode 100644 src/util.js diff --git a/package.json b/package.json index 06b3e52..cf21d7a 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "dependencies": { "@dcloudio/uni-app": "^3.0.0-4080420251103001", "@dcloudio/uni-app-plus": "^3.0.0-4080420251103001", + "pinia": "^3.0.4", "vue": "^3.4.27" }, "devDependencies": { diff --git a/src/api.js b/src/api.js new file mode 100644 index 0000000..2d48c08 --- /dev/null +++ b/src/api.js @@ -0,0 +1,184 @@ +let BASE_URL = "https://apitest.shelingxingqiu.com/api/shoot"; // 默认正式版 + +function request(method, url, data = {}) { + const token = uni.getStorageSync("token"); + const header = {}; + if (token) header.Authorization = `Bearer ${token || ""}`; + return new Promise((resolve, reject) => { + uni.request({ + url: `${BASE_URL}${url}`, + method, + header, + data, + timeout: 10000, + success: (res) => { + if (res.data) { + const { code, data, message } = res.data; + if (code === 0) resolve(data); + else if (message) { + if (message.indexOf("登录身份已失效") !== -1) { + uni.removeStorageSync("token"); + } + if (message === "ROOM_FULL") { + resolve({ full: true }); + return; + } + if (message === "ERROR_ROOM_GAME_START") { + resolve({ started: true }); + return; + } + if (url.indexOf("/user/room") !== -1 && method === "GET") { + resolve({}); + return; + } + if (message === "ERROR_BATTLE_GAMING") { + resolve({}); + return; + } + if (message === "BIND_DEVICE") { + resolve({ binded: true }); + return; + } + if (message === "ERROR_ORDER_UNPAY") { + uni.showToast({ + title: "当前有未支付订单", + icon: "none", + }); + resolve({}); + return; + } + if (message === "ROOM_EMPTY") { + return uni.showToast({ + title: "房间已过期", + icon: "none", + }); + } + uni.showToast({ + title: message, + icon: "none", + }); + } + reject(""); + } + }, + fail: (err) => { + handleRequestError(err, url); + reject(err); + }, + }); + }); +} + +// 统一的错误处理函数 +function handleRequestError(err, url) { + console.log("请求失败:", { err, url }); + + // 根据错误类型显示不同提示 + if (err.errMsg) { + if (err.errMsg.includes("timeout")) { + showCustomToast("请求超时,请稍后重试", "timeout"); + } else if (err.errMsg.includes("fail")) { + // 检查网络状态 + uni.getNetworkType({ + success: (res) => { + if (res.networkType === "none") { + showCustomToast("网络连接已断开,请检查网络设置", "network"); + } else { + showCustomToast("服务器连接失败,请稍后重试", "server"); + } + }, + fail: () => { + showCustomToast("网络异常,请检查网络连接", "unknown"); + }, + }); + } else { + showCustomToast("请求失败,请稍后重试", "general"); + } + } else { + showCustomToast("网络异常,请稍后重试", "unknown"); + } +} + +// 自定义提示函数 +function showCustomToast(message, type) { + const config = { + title: message, + icon: "none", + duration: 3000, + }; + + // 根据错误类型可以添加不同的处理逻辑 + switch (type) { + case "timeout": + config.duration = 4000; // 超时提示显示更久 + break; + case "network": + config.duration = 5000; // 网络问题提示显示更久 + break; + default: + break; + } + + uni.showToast(config); +} + +export const getHomeData = (seasonId) => { + return request("GET", `/user/myHome?seasonId=${seasonId}`); +}; + +export const getPointBookConfigAPI = async () => { + return request("GET", "/user/score/sheet/option"); +}; + +export const getPointBookListAPI = async ( + page = 1, + bowType, + distance, + targetType +) => { + let url = `/user/score/sheet/list?pageNum=${page}&pageSize=10`; + if (bowType) url += `&bowType=${bowType}`; + if (distance) url += `&distance=${distance}`; + if (targetType) url += `&targetType=${targetType}`; + const result = await request("GET", url); + return result.list || []; +}; + +export const getPointBookStatisticsAPI = async () => { + return request("GET", `/v2/user/score/sheet/statistics`); +}; + +export const removePointRecord = async (id) => { + return request("DELETE", `/user/score/sheet/delete?id=${id}`); +}; + +export const getPointBookDetailAPI = async (id) => { + return request("GET", `/user/score/sheet/detail?id=${id}`); +}; + +export const addNoteAPI = async (id, remark) => { + return request("POST", "/user/score/sheet/remark", { id, remark }); +}; + +export const savePointBookAPI = async ( + bowType, + distance, + targetType, + groups, + arrows, + data = [] +) => { + return request("POST", "/user/score/sheet/report", { + bowType, + distance, + targetType, + groups, + arrows, + group_data: data.map((item) => + item.map((i) => ({ + ...i, + ring: i.ring === "M" ? -1 : i.ring === "X" ? 0 : Number(i.ring), + })) + ), + }); +}; diff --git a/src/components/AppBackground.vue b/src/components/AppBackground.vue new file mode 100644 index 0000000..3095318 --- /dev/null +++ b/src/components/AppBackground.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/components/Avatar.vue b/src/components/Avatar.vue new file mode 100644 index 0000000..b8a5111 --- /dev/null +++ b/src/components/Avatar.vue @@ -0,0 +1,49 @@ + + + + + diff --git a/src/components/BowTargetEdit.vue b/src/components/BowTargetEdit.vue new file mode 100644 index 0000000..0af60ae --- /dev/null +++ b/src/components/BowTargetEdit.vue @@ -0,0 +1,349 @@ + + + + + diff --git a/src/components/Container.vue b/src/components/Container.vue new file mode 100644 index 0000000..5b3cfe4 --- /dev/null +++ b/src/components/Container.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/components/EditOption.vue b/src/components/EditOption.vue new file mode 100644 index 0000000..a0c2772 --- /dev/null +++ b/src/components/EditOption.vue @@ -0,0 +1,452 @@ + + + + + diff --git a/src/components/Header.vue b/src/components/Header.vue new file mode 100644 index 0000000..53e5865 --- /dev/null +++ b/src/components/Header.vue @@ -0,0 +1,202 @@ + + + + + diff --git a/src/components/IconButton.vue b/src/components/IconButton.vue new file mode 100644 index 0000000..bc466dd --- /dev/null +++ b/src/components/IconButton.vue @@ -0,0 +1,39 @@ + + + + diff --git a/src/components/InputRow.vue b/src/components/InputRow.vue new file mode 100644 index 0000000..24ef818 --- /dev/null +++ b/src/components/InputRow.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/src/components/PointRecord.vue b/src/components/PointRecord.vue new file mode 100644 index 0000000..0e9810d --- /dev/null +++ b/src/components/PointRecord.vue @@ -0,0 +1,141 @@ + + + + + diff --git a/src/components/RingBarChart.vue b/src/components/RingBarChart.vue new file mode 100644 index 0000000..6e14673 --- /dev/null +++ b/src/components/RingBarChart.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/components/SButton.vue b/src/components/SButton.vue new file mode 100644 index 0000000..822ac9b --- /dev/null +++ b/src/components/SButton.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/src/components/SModal.vue b/src/components/SModal.vue new file mode 100644 index 0000000..e963ec5 --- /dev/null +++ b/src/components/SModal.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/src/components/ScreenHint.vue b/src/components/ScreenHint.vue new file mode 100644 index 0000000..333fe52 --- /dev/null +++ b/src/components/ScreenHint.vue @@ -0,0 +1,67 @@ + + + + + diff --git a/src/components/ScrollList.vue b/src/components/ScrollList.vue new file mode 100644 index 0000000..1ea4474 --- /dev/null +++ b/src/components/ScrollList.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/src/heatmap.js b/src/heatmap.js new file mode 100644 index 0000000..e69de29 diff --git a/src/main.js b/src/main.js index f2a35f1..d42ca05 100644 --- a/src/main.js +++ b/src/main.js @@ -1,10 +1,12 @@ -import { createSSRApp } from 'vue' -import App from './App.vue' +import { createSSRApp } from "vue"; +import { createPinia } from "pinia"; +import App from "./App.vue"; export function createApp() { - const app = createSSRApp(App) + const app = createSSRApp(App); + const pinia = createPinia(); + app.use(pinia); return { - app - } + app, + }; } - diff --git a/src/manifest.json b/src/manifest.json index f03cf61..a774564 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -38,16 +38,16 @@ "ios" : { "appid" : "com.shelingxingqiu.arcx", "devices" : "iphone", - "deploymentTarget" : "13.0", - "mobileprovision" : "/Users/makaihong/Projects/point-book-app/DistributeProfile.mobileprovision", - "p12" : "/Users/makaihong/Projects/point-book-app/Distribute_pwd_123456.p12", - "password" : "123456", - "urltypes" : [ - { - "urlschemes" : [ "pointbook" ], - "id" : "com.pointbook.scheme" - } - ], + // "deploymentTarget" : "13.0", + // "mobileprovision" : "/Users/makaihong/Projects/point-book-app/DistributeProfile.mobileprovision", + // "p12" : "/Users/makaihong/Projects/point-book-app/Distribute_pwd_123456.p12", + // "password" : "123456", + // "urltypes" : [ + // { + // "urlschemes" : [ "pointbook" ], + // "id" : "com.pointbook.scheme" + // } + // ], "privacyDescription" : { "NSCameraUsageDescription" : "Camera access is required for taking photos and scanning", "NSMicrophoneUsageDescription" : "Microphone access is required for recording and calls", diff --git a/src/pages.json b/src/pages.json index 59019a2..e951881 100644 --- a/src/pages.json +++ b/src/pages.json @@ -1,16 +1,41 @@ { "pages": [ { - "path": "pages/index", - "style": { - "navigationBarTitleText": "ARCX" - } + "path": "pages/index" + }, + { + "path": "pages/create" + }, + { + "path": "pages/detail" + }, + { + "path": "pages/edit" + }, + { + "path": "pages/list" + }, + { + "path": "pages/profile" + }, + { + "path": "pages/reset-pwd" + }, + { + "path": "pages/signin" + }, + { + "path": "pages/signup" + }, + { + "path": "pages/edit-profile" } ], "globalStyle": { "navigationBarTextStyle": "white", "navigationBarBackgroundColor": "#2c3e50", - "backgroundColor": "#ffffff" + "backgroundColor": "#ffffff", + "navigationStyle": "custom" }, "condition": { "current": 0, diff --git a/src/pages/create.vue b/src/pages/create.vue new file mode 100644 index 0000000..41c01b9 --- /dev/null +++ b/src/pages/create.vue @@ -0,0 +1,152 @@ + + + + + diff --git a/src/pages/detail.vue b/src/pages/detail.vue new file mode 100644 index 0000000..66c131e --- /dev/null +++ b/src/pages/detail.vue @@ -0,0 +1,467 @@ + + +