Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03fa2f4d48 | ||
|
|
c8533de5cf | ||
|
|
74bfd7a327 | ||
|
|
bbfa35e871 | ||
|
|
469487ba73 | ||
|
|
b9bbaba77f | ||
|
|
11eeb98b74 | ||
|
|
96b64e4187 | ||
|
|
45bc324f70 | ||
|
|
2eba5f87d7 | ||
|
|
9a06dcf942 | ||
|
|
35e0ee3ca0 | ||
|
|
59fa317c5a | ||
|
|
09756ae165 | ||
|
|
b89c003313 | ||
|
|
9dda58b19c | ||
|
|
962596e510 | ||
|
|
8a2fbb0780 | ||
|
|
0c0a00f742 | ||
|
|
66fc7fa8eb | ||
|
|
6363dda204 | ||
|
|
9f4fbbe4c9 | ||
|
|
45957d04b1 | ||
|
|
42cfb5c3d8 | ||
|
|
844f72489e | ||
|
|
d2571854bc | ||
|
|
bb224c9f29 | ||
|
|
82c360f1b1 | ||
|
|
63f3cada0f | ||
|
|
d60c32506f |
@@ -28,6 +28,7 @@
|
|||||||
const {
|
const {
|
||||||
updateUser,
|
updateUser,
|
||||||
updateOnline,
|
updateOnline,
|
||||||
|
updateDeviceBattery,
|
||||||
showDeviceChargingDialog,
|
showDeviceChargingDialog,
|
||||||
clearSessionState,
|
clearSessionState,
|
||||||
clearDevice
|
clearDevice
|
||||||
@@ -74,6 +75,7 @@
|
|||||||
const wasOnline = Boolean(online.value);
|
const wasOnline = Boolean(online.value);
|
||||||
const nextOnline = Boolean(data.online);
|
const nextOnline = Boolean(data.online);
|
||||||
updateOnline(nextOnline);
|
updateOnline(nextOnline);
|
||||||
|
updateDeviceBattery(nextOnline ? data?.battery ?? data?.power : null);
|
||||||
if (!device.value.deviceId || wasOnline === nextOnline) return;
|
if (!device.value.deviceId || wasOnline === nextOnline) return;
|
||||||
audioManager.play(nextOnline ? "设备已连接" : "设备连接已断开");
|
audioManager.play(nextOnline ? "设备已连接" : "设备连接已断开");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,9 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ADDONS_BASE_URL = BASE_URL.replace(/\/api\/shoot$/, "/api/shoot");
|
const ADDONS_BASE_URL = BASE_URL.replace(/\/api\/shoot$/, "/api/shoot");
|
||||||
|
const API_ROOT_URL = BASE_URL.replace(/\/api\/shoot$/, "");
|
||||||
// 统一处理业务接口请求,包含登录态、业务错误和特定接口空响应兼容。
|
// 统一处理业务接口请求,包含登录态、业务错误和特定接口空响应兼容。
|
||||||
function request(method, url, data = {}, baseUrl = BASE_URL) {
|
function request(method, url, data = {}, baseUrl = BASE_URL, successCodes = [0]) {
|
||||||
const token = uni.getStorageSync(
|
const token = uni.getStorageSync(
|
||||||
`${uni.getAccountInfoSync().miniProgram.envVersion}_token`
|
`${uni.getAccountInfoSync().miniProgram.envVersion}_token`
|
||||||
);
|
);
|
||||||
@@ -51,7 +52,7 @@ function request(method, url, data = {}, baseUrl = BASE_URL) {
|
|||||||
}
|
}
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
const {code, data, message} = res.data;
|
const {code, data, message} = res.data;
|
||||||
if (code === 0) resolve(data);
|
if (successCodes.includes(code)) resolve(data);
|
||||||
else if (message) {
|
else if (message) {
|
||||||
const error = {code, data, message};
|
const error = {code, data, message};
|
||||||
if (message.indexOf("登录身份已失效") !== -1) {
|
if (message.indexOf("登录身份已失效") !== -1) {
|
||||||
@@ -280,6 +281,10 @@ export const getMyDevicesAPI = () => {
|
|||||||
return request("GET", "/user/device/getBindings");
|
return request("GET", "/user/device/getBindings");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getDeviceDetailAPI = (deviceId) => {
|
||||||
|
return request("GET", `/user/device/getDetail?deviceId=${encodeURIComponent(deviceId)}`);
|
||||||
|
};
|
||||||
|
|
||||||
export const createPractiseAPI = (arrows, time, target) => {
|
export const createPractiseAPI = (arrows, time, target) => {
|
||||||
return request("POST", "/user/practice/create", {
|
return request("POST", "/user/practice/create", {
|
||||||
shootNumber: arrows,
|
shootNumber: arrows,
|
||||||
@@ -375,9 +380,11 @@ export const readyGameAPI = (battleId) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const simulShootAPI = (device_id, x, y) => {
|
export const simulShootAPI = (device_id, x, y, targetType = 40) => {
|
||||||
const data = {
|
const data = {
|
||||||
device_id,
|
device_id,
|
||||||
|
// 模拟射箭仅支持 20cm、40cm 靶纸,未传或传入无效值时默认使用 40cm。
|
||||||
|
targetType: Number(targetType) === 20 ? 20 : 40,
|
||||||
};
|
};
|
||||||
if (x !== undefined && y !== undefined) {
|
if (x !== undefined && y !== undefined) {
|
||||||
data.x = x;
|
data.x = x;
|
||||||
@@ -698,3 +705,76 @@ export const getMyTenRingRank = (seasonId) => {
|
|||||||
if (seasonId !== undefined && seasonId !== null) data.seasonId = seasonId;
|
if (seasonId !== undefined && seasonId !== null) data.seasonId = seasonId;
|
||||||
return request("GET", "/index/myTenRingRank", data);
|
return request("GET", "/index/myTenRingRank", data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 获取当前用户的金币统计,可按门店查询。
|
||||||
|
export const getMyGoldAPI = (storeId) => {
|
||||||
|
const data = {};
|
||||||
|
if (storeId !== undefined && storeId !== null) data.storeId = storeId;
|
||||||
|
return request("GET", "/index/gold/my", data);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 分页获取当前用户的金币流水,type:1=获得,2=兑换。
|
||||||
|
export const getGoldLogAPI = ({page = 1, pageSize = 20, type, storeId} = {}) => {
|
||||||
|
const data = {page, pageSize};
|
||||||
|
if (type !== undefined && type !== null) data.type = type;
|
||||||
|
if (storeId !== undefined && storeId !== null) data.storeId = storeId;
|
||||||
|
return request("GET", "/index/gold/log", data);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 前台礼品接口位于站点根路径,并使用 code=200 表示成功。
|
||||||
|
export const getGiftListAPI = ({
|
||||||
|
page = 1,
|
||||||
|
pageSize = 20,
|
||||||
|
sort = "coin_desc",
|
||||||
|
storeId,
|
||||||
|
} = {}) => {
|
||||||
|
const data = {page, page_size: pageSize, sort};
|
||||||
|
if (storeId !== undefined && storeId !== null && storeId !== "") {
|
||||||
|
data.store_id = storeId;
|
||||||
|
}
|
||||||
|
return request(
|
||||||
|
"GET",
|
||||||
|
"/gin/api/v1/gift/list",
|
||||||
|
data,
|
||||||
|
API_ROOT_URL,
|
||||||
|
[0, 200]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getGiftDetailAPI = (id) => {
|
||||||
|
return request(
|
||||||
|
"GET",
|
||||||
|
`/gin/api/v1/gift/${id}`,
|
||||||
|
{},
|
||||||
|
API_ROOT_URL,
|
||||||
|
[0, 200]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 根据用户定位分页获取附近门店。
|
||||||
|
export const getNearbyStoresAPI = ({
|
||||||
|
longitude,
|
||||||
|
latitude,
|
||||||
|
radius = 65535,
|
||||||
|
page = 1,
|
||||||
|
pageSize = 20,
|
||||||
|
} = {}) => {
|
||||||
|
return request("GET", "/store/nearby", {
|
||||||
|
longitude,
|
||||||
|
latitude,
|
||||||
|
radius,
|
||||||
|
page,
|
||||||
|
pageSize,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 分页获取指定门店的公开金币规则。
|
||||||
|
export const getStoreGoldRuleListAPI = ({storeId, page = 1, pageSize = 20} = {}) => {
|
||||||
|
return request(
|
||||||
|
"GET",
|
||||||
|
`/gin/api/v1/super-admin/gold-rule/store/${storeId}/list`,
|
||||||
|
{page, page_size: pageSize},
|
||||||
|
API_ROOT_URL,
|
||||||
|
[0, 200]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,5 +1,61 @@
|
|||||||
export const AUDIO_INTERRUPTION_BEGIN_EVENT = "audio-interruption-begin";
|
export const AUDIO_INTERRUPTION_BEGIN_EVENT = "audio-interruption-begin";
|
||||||
export const AUDIO_INTERRUPTION_END_EVENT = "audio-interruption-end";
|
export const AUDIO_INTERRUPTION_END_EVENT = "audio-interruption-end";
|
||||||
|
export const RHYTHM_SHOOT_WINDOW_AUDIO_KEY = "请射箭";
|
||||||
|
export const STABILITY_START_AUDIO_KEY =
|
||||||
|
"请在计时结束时能量条达到标记区域";
|
||||||
|
export const STABILITY_ENERGY_50_AUDIO_KEY = "加油!到达50%啦";
|
||||||
|
export const STABILITY_ENERGY_70_AUDIO_KEY =
|
||||||
|
"70%啦!还差一点,胜利就在眼前";
|
||||||
|
|
||||||
|
const TRAINING_START_AUDIO_KEY_MAP = Object.freeze({
|
||||||
|
base: "请于计时前完成指定环数对应箭量",
|
||||||
|
endurance: "请于计时前完成累计环数和箭量",
|
||||||
|
precision: "请射箭命中高亮区域",
|
||||||
|
rhythm: "请在读条推进到标记区间内射箭",
|
||||||
|
stability: STABILITY_START_AUDIO_KEY,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getTrainingStartAudioKey = (trainingType, fallback = "") =>
|
||||||
|
TRAINING_START_AUDIO_KEY_MAP[trainingType] || fallback;
|
||||||
|
|
||||||
|
export const getPrecisionShotAudioKeys = (shootData, directionText = "") => {
|
||||||
|
if (!shootData || typeof shootData !== "object") return [];
|
||||||
|
const ring = Number(shootData.ring);
|
||||||
|
const directionAudioKey =
|
||||||
|
shootData.angle !== null &&
|
||||||
|
shootData.angle !== undefined &&
|
||||||
|
directionText
|
||||||
|
? `向${directionText}调整`
|
||||||
|
: "";
|
||||||
|
if (!Number.isFinite(ring) || ring <= 0) {
|
||||||
|
return ["未上靶", directionAudioKey].filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
// protobuf 的 false 可能不编码;只要不是明确命中,本箭就反馈未命中。
|
||||||
|
const hitAudioKey = shootData.ok === true ? "Bingo命中目标" : "未命中";
|
||||||
|
return [directionAudioKey, hitAudioKey].filter(Boolean);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getRhythmShotAudioKeys = (shootData) => {
|
||||||
|
if (!shootData || typeof shootData !== "object") return [];
|
||||||
|
const ring = Number(shootData.ring);
|
||||||
|
const ringAudioKey =
|
||||||
|
Number.isFinite(ring) && ring > 0
|
||||||
|
? `${shootData.ringX ? "X" : ring}环`
|
||||||
|
: "未上靶";
|
||||||
|
// 节奏训练是否达标完全由服务端 ok 字段决定,前端不根据环数复算。
|
||||||
|
return [ringAudioKey, shootData.ok === true ? "Perfect" : "miss"];
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getStabilityShotAudioKeys = (shootData) => {
|
||||||
|
if (!shootData || typeof shootData !== "object") return [];
|
||||||
|
const ring = Number(shootData.ring);
|
||||||
|
const ringAudioKey =
|
||||||
|
Number.isFinite(ring) && ring > 0
|
||||||
|
? `${shootData.ringX ? "X" : ring}环`
|
||||||
|
: "未上靶";
|
||||||
|
return [ringAudioKey];
|
||||||
|
};
|
||||||
|
|
||||||
export const audioFils = {
|
export const audioFils = {
|
||||||
tententen: "https://static.shelingxingqiu.com/shootmini/static/audio/tententen.mp3",
|
tententen: "https://static.shelingxingqiu.com/shootmini/static/audio/tententen.mp3",
|
||||||
@@ -20,6 +76,22 @@ export const audioFils = {
|
|||||||
"https://static.shelingxingqiu.com/attachment/2025-09-17/dcutwrda0amn5kqr4j.mp3",
|
"https://static.shelingxingqiu.com/attachment/2025-09-17/dcutwrda0amn5kqr4j.mp3",
|
||||||
距离不足:
|
距离不足:
|
||||||
"https://static.shelingxingqiu.com/attachment/2025-11-12/de6hr2faw28t0ianh0.mp3",
|
"https://static.shelingxingqiu.com/attachment/2025-11-12/de6hr2faw28t0ianh0.mp3",
|
||||||
|
"靶纸不符!请更换靶纸":
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio/%E9%9D%B6%E7%BA%B8%E4%B8%8D%E7%AC%A6%EF%BC%81%E8%AF%B7%E6%9B%B4%E6%8D%A2%E9%9D%B6%E7%BA%B8.MP3",
|
||||||
|
"站距与靶纸合格":
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio/%E7%AB%99%E8%B7%9D%E4%B8%8E%E9%9D%B6%E7%BA%B8%E5%90%88%E6%A0%BC.MP3",
|
||||||
|
"请射箭!测试站距与靶纸":
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio/%E8%AF%B7%E5%B0%84%E7%AE%AD%EF%BC%81%E6%B5%8B%E8%AF%95%E7%AB%99%E8%B7%9D%E4%B8%8E%E9%9D%B6%E7%BA%B8.MP3",
|
||||||
|
"站距过近,靶纸正确":
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E7%AB%99%E8%B7%9D%E8%BF%87%E8%BF%91%EF%BC%8C%E9%9D%B6%E7%BA%B8%E6%AD%A3%E7%A1%AE.MP3",
|
||||||
|
"站距过近,靶纸错误":
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E7%AB%99%E8%B7%9D%E8%BF%87%E8%BF%91%EF%BC%8C%E9%9D%B6%E7%BA%B8%E9%94%99%E8%AF%AF.MP3",
|
||||||
|
"站距合格,靶纸正确":
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E7%AB%99%E8%B7%9D%E5%90%88%E6%A0%BC%EF%BC%8C%E9%9D%B6%E7%BA%B8%E6%AD%A3%E7%A1%AE.MP3",
|
||||||
|
"站距合格,靶纸错误":
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E7%AB%99%E8%B7%9D%E5%90%88%E6%A0%BC%EF%BC%8C%E9%9D%B6%E7%BA%B8%E9%94%99%E8%AF%AF.MP3",
|
||||||
|
"未识别到靶纸,请瞄准靶纸射箭":
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio/%E6%9C%AA%E8%AF%86%E5%88%AB%E5%88%B0%E9%9D%B6%E7%BA%B8%EF%BC%8C%E8%AF%B7%E7%9E%84%E5%87%86%E9%9D%B6%E7%BA%B8%E5%B0%84%E7%AE%AD.MP3",
|
||||||
"未发现靶纸,请瞄准靶纸射箭":
|
"未发现靶纸,请瞄准靶纸射箭":
|
||||||
"https://static.shelingxingqiu.com/shootmini/static/audio/%E6%9C%AA%E5%8F%91%E7%8E%B0%E9%9D%B6%E7%BA%B8%EF%BC%8C%E8%AF%B7%E7%9E%84%E5%87%86%E9%9D%B6%E7%BA%B8%E5%B0%84%E7%AE%AD.MP3",
|
"https://static.shelingxingqiu.com/shootmini/static/audio/%E6%9C%AA%E5%8F%91%E7%8E%B0%E9%9D%B6%E7%BA%B8%EF%BC%8C%E8%AF%B7%E7%9E%84%E5%87%86%E9%9D%B6%E7%BA%B8%E5%B0%84%E7%AE%AD.MP3",
|
||||||
轮到你了:
|
轮到你了:
|
||||||
@@ -54,6 +126,8 @@ export const audioFils = {
|
|||||||
"https://static.shelingxingqiu.com/shootmini/static/audio/%E5%B0%84%E7%AE%AD%E6%97%A0%E6%95%88%E6%A3%80%E6%9F%A5%E8%B7%9D%E7%A6%BB%E5%92%8C%E9%9D%B6%E7%BA%B8.mp3",
|
"https://static.shelingxingqiu.com/shootmini/static/audio/%E5%B0%84%E7%AE%AD%E6%97%A0%E6%95%88%E6%A3%80%E6%9F%A5%E8%B7%9D%E7%A6%BB%E5%92%8C%E9%9D%B6%E7%BA%B8.mp3",
|
||||||
"射箭无效,距离不足":
|
"射箭无效,距离不足":
|
||||||
"https://static.shelingxingqiu.com/shootmini/static/audio/%E5%B0%84%E7%AE%AD%E6%97%A0%E6%95%88%EF%BC%8C%E8%B7%9D%E7%A6%BB%E4%B8%8D%E8%B6%B3.MP3",
|
"https://static.shelingxingqiu.com/shootmini/static/audio/%E5%B0%84%E7%AE%AD%E6%97%A0%E6%95%88%EF%BC%8C%E8%B7%9D%E7%A6%BB%E4%B8%8D%E8%B6%B3.MP3",
|
||||||
|
"射箭无效,距离不足且靶纸错误":
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio/%E5%B0%84%E7%AE%AD%E6%97%A0%E6%95%88%EF%BC%8C%E8%B7%9D%E7%A6%BB%E4%B8%8D%E8%B6%B3%E4%B8%94%E9%9D%B6%E7%BA%B8%E9%94%99%E8%AF%AF.MP3",
|
||||||
"射箭无效,未识别到靶纸":
|
"射箭无效,未识别到靶纸":
|
||||||
"https://static.shelingxingqiu.com/shootmini/static/audio/%E5%B0%84%E7%AE%AD%E6%97%A0%E6%95%88%EF%BC%8C%E6%9C%AA%E8%AF%86%E5%88%AB%E5%88%B0%E9%9D%B6%E7%BA%B8.MP3",
|
"https://static.shelingxingqiu.com/shootmini/static/audio/%E5%B0%84%E7%AE%AD%E6%97%A0%E6%95%88%EF%BC%8C%E6%9C%AA%E8%AF%86%E5%88%AB%E5%88%B0%E9%9D%B6%E7%BA%B8.MP3",
|
||||||
"射箭无效,靶纸错误":
|
"射箭无效,靶纸错误":
|
||||||
@@ -101,6 +175,30 @@ export const audioFils = {
|
|||||||
"https://static.shelingxingqiu.com/attachment/2025-11-13/de7kzzllq0futwynso.mp3",
|
"https://static.shelingxingqiu.com/attachment/2025-11-13/de7kzzllq0futwynso.mp3",
|
||||||
练习开始:
|
练习开始:
|
||||||
"https://static.shelingxingqiu.com/attachment/2025-11-14/de88w0lmmt43nnfmoi.mp3",
|
"https://static.shelingxingqiu.com/attachment/2025-11-14/de88w0lmmt43nnfmoi.mp3",
|
||||||
|
[STABILITY_START_AUDIO_KEY]:
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E8%AF%B7%E5%9C%A8%E8%AE%A1%E6%97%B6%E7%BB%93%E6%9D%9F%E6%97%B6%E8%83%BD%E9%87%8F%E6%9D%A1%E8%BE%BE%E5%88%B0%E6%A0%87%E8%AE%B0%E5%8C%BA%E5%9F%9F.MP3",
|
||||||
|
[STABILITY_ENERGY_50_AUDIO_KEY]:
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E5%8A%A0%E6%B2%B9%EF%BC%81%E5%88%B0%E8%BE%BE50%25%E5%95%A6.MP3",
|
||||||
|
[STABILITY_ENERGY_70_AUDIO_KEY]:
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/70%25%E5%95%A6%EF%BC%81%E8%BF%98%E5%B7%AE%E4%B8%80%E7%82%B9%EF%BC%8C%E8%83%9C%E5%88%A9%E5%B0%B1%E5%9C%A8%E7%9C%BC%E5%89%8D.MP3",
|
||||||
|
请于计时前完成指定环数对应箭量:
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E8%AF%B7%E4%BA%8E%E8%AE%A1%E6%97%B6%E5%89%8D%E5%AE%8C%E6%88%90%E6%8C%87%E5%AE%9A%E7%8E%AF%E6%95%B0%E5%AF%B9%E5%BA%94%E7%AE%AD%E9%87%8F.MP3",
|
||||||
|
请于计时前完成累计环数和箭量:
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E8%AF%B7%E4%BA%8E%E8%AE%A1%E6%97%B6%E5%89%8D%E5%AE%8C%E6%88%90%E7%B4%AF%E8%AE%A1%E7%8E%AF%E6%95%B0%E5%92%8C%E7%AE%AD%E9%87%8F.MP3",
|
||||||
|
请射箭命中高亮区域:
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E8%AF%B7%E5%B0%84%E7%AE%AD%E5%91%BD%E4%B8%AD%E9%AB%98%E4%BA%AE%E5%8C%BA%E5%9F%9F.MP3",
|
||||||
|
请在读条推进到标记区间内射箭:
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E8%AF%B7%E5%9C%A8%E8%AF%BB%E6%9D%A1%E6%8E%A8%E8%BF%9B%E5%88%B0%E6%A0%87%E8%AE%B0%E5%8C%BA%E9%97%B4%E5%86%85%E5%B0%84%E7%AE%AD.MP3",
|
||||||
|
[RHYTHM_SHOOT_WINDOW_AUDIO_KEY]:
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E8%AF%B7%E5%B0%84%E7%AE%AD.MP3",
|
||||||
|
Perfect:
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/Perfect.MP3",
|
||||||
|
miss:
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/miss.MP3",
|
||||||
|
Bingo命中目标:
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/Bingo%E5%91%BD%E4%B8%AD%E7%9B%AE%E6%A0%87.MP3",
|
||||||
|
未命中:
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E6%9C%AA%E5%91%BD%E4%B8%AD.MP3",
|
||||||
练习结束:
|
练习结束:
|
||||||
"https://static.shelingxingqiu.com/shootmini/static/audio/%E7%BB%83%E4%B9%A0%E7%BB%93%E6%9D%9F.mp3",
|
"https://static.shelingxingqiu.com/shootmini/static/audio/%E7%BB%83%E4%B9%A0%E7%BB%93%E6%9D%9F.mp3",
|
||||||
射箭声音:
|
射箭声音:
|
||||||
@@ -126,16 +224,21 @@ const AUDIO_WARM_PRIORITY_KEYS = [
|
|||||||
"比赛结束",
|
"比赛结束",
|
||||||
"射击无效",
|
"射击无效",
|
||||||
"射箭无效,距离不足",
|
"射箭无效,距离不足",
|
||||||
|
"射箭无效,距离不足且靶纸错误",
|
||||||
"射箭无效,未识别到靶纸",
|
"射箭无效,未识别到靶纸",
|
||||||
"射箭无效,靶纸错误",
|
"射箭无效,靶纸错误",
|
||||||
|
"请射箭!测试站距与靶纸",
|
||||||
|
"站距过近,靶纸正确",
|
||||||
|
"站距过近,靶纸错误",
|
||||||
|
"站距合格,靶纸正确",
|
||||||
|
"站距合格,靶纸错误",
|
||||||
|
"未识别到靶纸,请瞄准靶纸射箭",
|
||||||
"中场休息",
|
"中场休息",
|
||||||
"下半场开始",
|
"下半场开始",
|
||||||
"决金箭轮",
|
"决金箭轮",
|
||||||
"请蓝方射箭",
|
"请蓝方射箭",
|
||||||
"请红方射箭",
|
"请红方射箭",
|
||||||
"距离合格",
|
"距离合格",
|
||||||
"距离不足",
|
|
||||||
"未发现靶纸,请瞄准靶纸射箭",
|
|
||||||
"未上靶",
|
"未上靶",
|
||||||
"X环",
|
"X环",
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -81,6 +81,13 @@ const props = defineProps({
|
|||||||
src="https://static.shelingxingqiu.com/shootmini/static/app-bg9.png"
|
src="https://static.shelingxingqiu.com/shootmini/static/app-bg9.png"
|
||||||
mode="widthFix"
|
mode="widthFix"
|
||||||
/>
|
/>
|
||||||
|
<!-- 我的设备未绑定/绑定成功页面背景 -->
|
||||||
|
<image
|
||||||
|
class="bg-image"
|
||||||
|
v-if="type === 12"
|
||||||
|
src="../static/device-assets/my-device-unbound-background.png"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
<image
|
<image
|
||||||
class="bg-image"
|
class="bg-image"
|
||||||
v-if="type === 10"
|
v-if="type === 10"
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function handleTabClick(index) {
|
|||||||
}
|
}
|
||||||
if (index === 2) {
|
if (index === 2) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/device-intro",
|
url: "/pages/device/device-intro",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
targetType: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 40,
|
||||||
|
},
|
||||||
targetRadius: {
|
targetRadius: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 20,
|
default: 20,
|
||||||
@@ -426,12 +430,19 @@ function getExperienceTipStyle(shot) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
const simulShoot = async () => {
|
const simulShoot = async () => {
|
||||||
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
|
if (device.value.deviceId) {
|
||||||
|
await simulShootAPI(
|
||||||
|
device.value.deviceId,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
props.targetType
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const simulShoot2 = async () => {
|
const simulShoot2 = async () => {
|
||||||
if (device.value.deviceId) {
|
if (device.value.deviceId) {
|
||||||
const r1 = Math.random() > 0.5 ? 0.01 : 0.02;
|
const r1 = Math.random() > 0.5 ? 0.01 : 0.02;
|
||||||
await simulShootAPI(device.value.deviceId, r1, r1);
|
await simulShootAPI(device.value.deviceId, r1, r1, props.targetType);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
|
|||||||
import {laserAimAPI, getBattleAPI, matchGameAPI} from "@/apis";
|
import {laserAimAPI, getBattleAPI, matchGameAPI} from "@/apis";
|
||||||
import { capsuleHeight, debounce } from "@/util";
|
import { capsuleHeight, debounce } from "@/util";
|
||||||
import { returnToBattle } from "@/utils/matchReturn";
|
import { returnToBattle } from "@/utils/matchReturn";
|
||||||
|
const emit = defineEmits(["scrolltolower"]);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -123,7 +124,7 @@ const cancelMatching = async () => {
|
|||||||
const goCalibration = async () => {
|
const goCalibration = async () => {
|
||||||
await laserAimAPI();
|
await laserAimAPI();
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/calibration",
|
url: "/pages/device/calibration",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -131,8 +132,9 @@ const goCalibration = async () => {
|
|||||||
<template>
|
<template>
|
||||||
<view :style="{ paddingTop: capsuleHeight + 'px' }">
|
<view :style="{ paddingTop: capsuleHeight + 'px' }">
|
||||||
<AppBackground :type="bgType" :bgColor="bgColor" />
|
<AppBackground :type="bgType" :bgColor="bgColor" />
|
||||||
|
<slot v-if="$slots.header" name="header"></slot>
|
||||||
<Header
|
<Header
|
||||||
v-if="!isHome"
|
v-else-if="!isHome"
|
||||||
:class="headerClass"
|
:class="headerClass"
|
||||||
:title="title"
|
:title="title"
|
||||||
:onBack="onBack"
|
:onBack="onBack"
|
||||||
@@ -158,8 +160,10 @@ const goCalibration = async () => {
|
|||||||
:enhanced="true"
|
:enhanced="true"
|
||||||
:bounces="false"
|
:bounces="false"
|
||||||
:show-scrollbar="false"
|
:show-scrollbar="false"
|
||||||
|
:lower-threshold="120"
|
||||||
|
@scrolltolower="emit('scrolltolower')"
|
||||||
:style="{
|
:style="{
|
||||||
height: `calc(100vh - ${capsuleHeight + (isHome ? 0 : 50)}px - ${
|
height: `calc(100vh - ${capsuleHeight + (($slots.header || !isHome) ? 50 : 0)}px - ${
|
||||||
$slots.bottom && showBottom ? (isIOS ? '75px' : '65px') : '0px'
|
$slots.bottom && showBottom ? (isIOS ? '75px' : '65px') : '0px'
|
||||||
})`,
|
})`,
|
||||||
}"
|
}"
|
||||||
|
|||||||
@@ -125,6 +125,8 @@ onBeforeUnmount(() => {
|
|||||||
<view
|
<view
|
||||||
:style="[{ color: whiteBackArrow ? '#fff' : '#000' }, titleStyle]"
|
:style="[{ color: whiteBackArrow ? '#fff' : '#000' }, titleStyle]"
|
||||||
>
|
>
|
||||||
|
<slot v-if="$slots.title" name="title"></slot>
|
||||||
|
<template v-else>
|
||||||
<view
|
<view
|
||||||
v-if="currentPage === 'pages/point-book'"
|
v-if="currentPage === 'pages/point-book'"
|
||||||
class="user-header"
|
class="user-header"
|
||||||
@@ -190,6 +192,7 @@ onBeforeUnmount(() => {
|
|||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="pointBook" class="point-book-info">
|
<view v-if="pointBook" class="point-book-info">
|
||||||
<text>{{ pointBook.bowType.name }}</text>
|
<text>{{ pointBook.bowType.name }}</text>
|
||||||
|
|||||||
@@ -2,7 +2,11 @@
|
|||||||
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
|
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
|
||||||
import audioManager from "@/audioManager";
|
import audioManager from "@/audioManager";
|
||||||
import { MESSAGETYPESV2 } from "@/constants";
|
import { MESSAGETYPESV2 } from "@/constants";
|
||||||
import { getDirectionText, getInvalidShotAudioKey } from "@/util";
|
import {
|
||||||
|
getDirectionText,
|
||||||
|
getInvalidShotAudioKey,
|
||||||
|
getInvalidShotText,
|
||||||
|
} from "@/util";
|
||||||
|
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
@@ -88,7 +92,7 @@ async function onReceiveMessage(message) {
|
|||||||
currentRoundEnded.value = true;
|
currentRoundEnded.value = true;
|
||||||
} else if (type === MESSAGETYPESV2.InvalidShot) {
|
} else if (type === MESSAGETYPESV2.InvalidShot) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "距离不足,无效",
|
title: getInvalidShotText(shootData),
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
audioManager.play(getInvalidShotAudioKey(shootData));
|
audioManager.play(getInvalidShotAudioKey(shootData));
|
||||||
|
|||||||
@@ -2,7 +2,11 @@
|
|||||||
import { ref, watch, onMounted, onBeforeUnmount, computed } from "vue";
|
import { ref, watch, onMounted, onBeforeUnmount, computed } from "vue";
|
||||||
import audioManager from "@/audioManager";
|
import audioManager from "@/audioManager";
|
||||||
import { MESSAGETYPESV2 } from "@/constants";
|
import { MESSAGETYPESV2 } from "@/constants";
|
||||||
import { getDirectionText, getInvalidShotAudioKey } from "@/util";
|
import {
|
||||||
|
getDirectionText,
|
||||||
|
getInvalidShotAudioKey,
|
||||||
|
getInvalidShotText,
|
||||||
|
} from "@/util";
|
||||||
|
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
@@ -171,7 +175,7 @@ async function onReceiveMessage(msg) {
|
|||||||
audioManager.play("中场休息");
|
audioManager.play("中场休息");
|
||||||
} else if (msg.type === MESSAGETYPESV2.InvalidShot) {
|
} else if (msg.type === MESSAGETYPESV2.InvalidShot) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "距离不足,无效",
|
title: getInvalidShotText(msg.shootData),
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
audioManager.play(getInvalidShotAudioKey(msg.shootData));
|
audioManager.play(getInvalidShotAudioKey(msg.shootData));
|
||||||
|
|||||||
@@ -6,10 +6,16 @@ import Avatar from "@/components/Avatar.vue";
|
|||||||
import audioManager from "@/audioManager";
|
import audioManager from "@/audioManager";
|
||||||
import { simulShootAPI } from "@/apis";
|
import { simulShootAPI } from "@/apis";
|
||||||
import { MESSAGETYPESV2 } from "@/constants";
|
import { MESSAGETYPESV2 } from "@/constants";
|
||||||
|
import {
|
||||||
|
getDistanceCheckAudioKey,
|
||||||
|
getDistanceCheckText,
|
||||||
|
getShootValidation,
|
||||||
|
} from "@/util";
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const { user, device } = storeToRefs(store);
|
const { user, device } = storeToRefs(store);
|
||||||
|
const emit = defineEmits(["passed"]);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
guide: {
|
guide: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -23,18 +29,50 @@ const props = defineProps({
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 15,
|
default: 15,
|
||||||
},
|
},
|
||||||
|
targetType: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 40,
|
||||||
|
},
|
||||||
|
autoStart: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const arrow = ref({});
|
const arrow = ref({});
|
||||||
const distance = ref(0);
|
const distance = ref(0);
|
||||||
|
const statusText = ref("");
|
||||||
const showsimul = ref(false);
|
const showsimul = ref(false);
|
||||||
const count = ref(props.count);
|
const count = ref(props.count);
|
||||||
const timer = ref(null);
|
const timer = ref(null);
|
||||||
|
const autoStartPending = ref(false);
|
||||||
|
const autoStartTriggered = ref(false);
|
||||||
|
let autoStartTimer = null;
|
||||||
|
const DISTANCE_PASSED_AUDIO_KEY = "站距合格,靶纸正确";
|
||||||
|
const AUTO_START_TIMEOUT_MS = 6000;
|
||||||
|
|
||||||
|
const clearAutoStartTimer = () => {
|
||||||
|
if (!autoStartTimer) return;
|
||||||
|
clearTimeout(autoStartTimer);
|
||||||
|
autoStartTimer = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const triggerAutoStart = () => {
|
||||||
|
if (!autoStartPending.value || autoStartTriggered.value) return;
|
||||||
|
clearAutoStartTimer();
|
||||||
|
autoStartPending.value = false;
|
||||||
|
autoStartTriggered.value = true;
|
||||||
|
emit("passed");
|
||||||
|
};
|
||||||
|
|
||||||
|
const onAudioEnded = (key) => {
|
||||||
|
if (key === DISTANCE_PASSED_AUDIO_KEY) triggerAutoStart();
|
||||||
|
};
|
||||||
|
|
||||||
const updateTimer = (value) => {
|
const updateTimer = (value) => {
|
||||||
count.value = Math.round(value);
|
count.value = Math.round(value);
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
audioManager.play("请射箭测试距离");
|
audioManager.play("请射箭!测试站距与靶纸");
|
||||||
if (props.isBattle) {
|
if (props.isBattle) {
|
||||||
timer.value = setInterval(() => {
|
timer.value = setInterval(() => {
|
||||||
count.value -= 1;
|
count.value -= 1;
|
||||||
@@ -42,28 +80,43 @@ onMounted(() => {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
uni.$on("update-timer", updateTimer);
|
uni.$on("update-timer", updateTimer);
|
||||||
|
uni.$on("audioEnded", onAudioEnded);
|
||||||
});
|
});
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
if (timer.value) clearInterval(timer.value);
|
if (timer.value) clearInterval(timer.value);
|
||||||
|
clearAutoStartTimer();
|
||||||
uni.$off("update-timer", updateTimer);
|
uni.$off("update-timer", updateTimer);
|
||||||
|
uni.$off("audioEnded", onAudioEnded);
|
||||||
});
|
});
|
||||||
|
|
||||||
async function onReceiveMessage(msg) {
|
async function onReceiveMessage(msg) {
|
||||||
if (Array.isArray(msg)) return;
|
if (Array.isArray(msg)) return;
|
||||||
if (msg.type === MESSAGETYPESV2.TestDistance) {
|
if (msg.type === MESSAGETYPESV2.TestDistance) {
|
||||||
const rawDistance = Number(msg.shootData?.distance);
|
if (autoStartPending.value || autoStartTriggered.value) return;
|
||||||
|
const rawDistance = Number(msg.shootData?.distance ?? msg.shootData?.dst);
|
||||||
distance.value = Number.isFinite(rawDistance)
|
distance.value = Number.isFinite(rawDistance)
|
||||||
? Number((rawDistance / 100).toFixed(2))
|
? Number((rawDistance / 100).toFixed(2))
|
||||||
: 0;
|
: 0;
|
||||||
if (rawDistance === 0) {
|
statusText.value = getDistanceCheckText(msg.shootData);
|
||||||
audioManager.play("未发现靶纸,请瞄准靶纸射箭");
|
const audioKey = getDistanceCheckAudioKey(msg.shootData);
|
||||||
} else if (distance.value >= 5) audioManager.play("距离合格");
|
const validation = getShootValidation(msg.shootData);
|
||||||
else audioManager.play("距离不足");
|
if (props.autoStart && validation.distanceOk && validation.targetOk) {
|
||||||
|
autoStartPending.value = true;
|
||||||
|
autoStartTimer = setTimeout(triggerAutoStart, AUTO_START_TIMEOUT_MS);
|
||||||
|
}
|
||||||
|
audioManager.play(audioKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const simulShoot = async () => {
|
const simulShoot = async () => {
|
||||||
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
|
if (device.value.deviceId) {
|
||||||
|
await simulShootAPI(
|
||||||
|
device.value.deviceId,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
props.targetType
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -101,13 +154,11 @@ onBeforeUnmount(() => {
|
|||||||
模拟射箭
|
模拟射箭
|
||||||
</button>
|
</button>
|
||||||
<view class="warnning-text">
|
<view class="warnning-text">
|
||||||
<block v-if="distance > 0">
|
<block v-if="statusText">
|
||||||
<text>当前距离{{ distance }}米</text>
|
<text>{{ statusText }}</text>
|
||||||
<text v-if="distance >= 5">已达到距离要求</text>
|
|
||||||
<text v-else>请调整站位</text>
|
|
||||||
</block>
|
</block>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<text>请射箭,测试站距</text>
|
<text>请射箭,测试站距与靶纸</text>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
<view class="user-row">
|
<view class="user-row">
|
||||||
|
|||||||
@@ -24,13 +24,20 @@ const props = defineProps({
|
|||||||
|
|
||||||
const getDisplayText = (arrow = {}) => {
|
const getDisplayText = (arrow = {}) => {
|
||||||
if (!arrow) return "";
|
if (!arrow) return "";
|
||||||
if (!arrow.ring) return "0";
|
if (!arrow.ring) return props.trainingType === "stability" ? "-" : "0";
|
||||||
return arrow.ringX ? "X" : String(arrow.ring);
|
return arrow.ringX ? "X" : String(arrow.ring);
|
||||||
};
|
};
|
||||||
|
|
||||||
const isFailed = (arrow = {}) => {
|
const isFailed = (arrow = {}) => {
|
||||||
if (!arrow) return false;
|
if (!arrow) return false;
|
||||||
if (props.recordMode && props.trainingType !== "precision") return false;
|
if (
|
||||||
|
props.recordMode &&
|
||||||
|
props.trainingType !== "precision" &&
|
||||||
|
props.trainingType !== "rhythm" &&
|
||||||
|
props.trainingType !== "stability"
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return arrow.ok !== true;
|
return arrow.ok !== true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,19 @@ import {
|
|||||||
getServerMessageTypeName,
|
getServerMessageTypeName,
|
||||||
} from "@/utils/matchProtocol";
|
} from "@/utils/matchProtocol";
|
||||||
import { MESSAGETYPESV2 } from "@/constants";
|
import { MESSAGETYPESV2 } from "@/constants";
|
||||||
import { getDirectionText, getInvalidShotAudioKey } from "@/util";
|
import {
|
||||||
|
getDirectionText,
|
||||||
|
getDistanceCheckAudioKey,
|
||||||
|
getInvalidShotAudioKey,
|
||||||
|
} from "@/util";
|
||||||
|
import {
|
||||||
|
getPrecisionShotAudioKeys,
|
||||||
|
getRhythmShotAudioKeys,
|
||||||
|
getStabilityShotAudioKeys,
|
||||||
|
getTrainingStartAudioKey,
|
||||||
|
STABILITY_ENERGY_50_AUDIO_KEY,
|
||||||
|
STABILITY_ENERGY_70_AUDIO_KEY,
|
||||||
|
} from "@/audioManager";
|
||||||
import {
|
import {
|
||||||
normalizeId,
|
normalizeId,
|
||||||
normalizeMatchInfo,
|
normalizeMatchInfo,
|
||||||
@@ -49,20 +61,6 @@ const ENABLE_REALTIME_MESSAGE_LOG = (() => {
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
function getServerMessageLogSummary(message = {}) {
|
|
||||||
const practiceInfo = message.practice_info || message.practiceInfo || {};
|
|
||||||
const matchInfo = message.match_info || message.matchInfo || {};
|
|
||||||
return {
|
|
||||||
type: message.type,
|
|
||||||
matchId: normalizeId(pickField(message, "matchId", "match_id")),
|
|
||||||
sequence: message.sequence,
|
|
||||||
practiceDetailCount: Array.isArray(practiceInfo.details)
|
|
||||||
? practiceInfo.details.length
|
|
||||||
: 0,
|
|
||||||
roundCount: Array.isArray(matchInfo.rounds) ? matchInfo.rounds.length : 0,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// 比赛服消息类型先映射成项目里已有的 V2 业务消息,页面仍然复用原来的 socket-inbox 流程。
|
// 比赛服消息类型先映射成项目里已有的 V2 业务消息,页面仍然复用原来的 socket-inbox 流程。
|
||||||
const BUSINESS_TYPE_BY_SERVER_TYPE = {
|
const BUSINESS_TYPE_BY_SERVER_TYPE = {
|
||||||
[ServerMessageType.SERVER_MSG_MATCH_READY]: MESSAGETYPESV2.AboutToStart,
|
[ServerMessageType.SERVER_MSG_MATCH_READY]: MESSAGETYPESV2.AboutToStart,
|
||||||
@@ -87,6 +85,9 @@ function normalizeShootData(shootData) {
|
|||||||
if (normalized.distance === undefined && normalized.dst !== undefined) {
|
if (normalized.distance === undefined && normalized.dst !== undefined) {
|
||||||
normalized.distance = normalized.dst;
|
normalized.distance = normalized.dst;
|
||||||
}
|
}
|
||||||
|
if (normalized.targetOk === undefined && normalized.target_ok !== undefined) {
|
||||||
|
normalized.targetOk = normalized.target_ok;
|
||||||
|
}
|
||||||
return normalized;
|
return normalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,6 +153,15 @@ function buildBusinessMessage(message) {
|
|||||||
matchInfo.status = 0;
|
matchInfo.status = 0;
|
||||||
}
|
}
|
||||||
const practiceInfo = normalizePracticeInfo(message.practice_info);
|
const practiceInfo = normalizePracticeInfo(message.practice_info);
|
||||||
|
const trainingType = String(
|
||||||
|
practiceInfo.trainingType ||
|
||||||
|
matchInfo.trainingType ||
|
||||||
|
currentContext?.trainingType ||
|
||||||
|
""
|
||||||
|
).trim();
|
||||||
|
if (currentContext && trainingType) {
|
||||||
|
currentContext.trainingType = trainingType;
|
||||||
|
}
|
||||||
const businessType = getBusinessType(message, matchInfo);
|
const businessType = getBusinessType(message, matchInfo);
|
||||||
if (!businessType) return null;
|
if (!businessType) return null;
|
||||||
|
|
||||||
@@ -204,11 +214,22 @@ function buildBusinessMessage(message) {
|
|||||||
matchWsType: message.type,
|
matchWsType: message.type,
|
||||||
matchWsTypeName: getServerMessageTypeName(message.type),
|
matchWsTypeName: getServerMessageTypeName(message.type),
|
||||||
isSecondHalfStart,
|
isSecondHalfStart,
|
||||||
|
...(trainingType ? { trainingType } : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildPracticeSyncMessage(message) {
|
function buildPracticeSyncMessage(message) {
|
||||||
const practiceInfo = normalizePracticeInfo(message.practice_info);
|
const practiceInfo = normalizePracticeInfo(message.practice_info);
|
||||||
|
if (currentContext && practiceInfo.trainingType) {
|
||||||
|
currentContext.trainingType = String(practiceInfo.trainingType).trim();
|
||||||
|
}
|
||||||
|
updateStabilityEnergyContext(practiceInfo, {
|
||||||
|
fullSnapshot: true,
|
||||||
|
detectCrossing: false,
|
||||||
|
});
|
||||||
|
updateStabilityShotContext(practiceInfo, {
|
||||||
|
detectShot: false,
|
||||||
|
});
|
||||||
const matchId = normalizeId(
|
const matchId = normalizeId(
|
||||||
pickField(message, "matchId", "match_id") ||
|
pickField(message, "matchId", "match_id") ||
|
||||||
practiceInfo.id ||
|
practiceInfo.id ||
|
||||||
@@ -367,17 +388,183 @@ function getShootResultAudioKeys(shootData) {
|
|||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeScoreSlot(value) {
|
||||||
|
const scoreSlot = Number(value);
|
||||||
|
return Number.isFinite(scoreSlot) && scoreSlot > 0 ? scoreSlot : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clampEnergy(value, scoreSlot = 0) {
|
||||||
|
const energy = Number(value);
|
||||||
|
if (!Number.isFinite(energy)) return 0;
|
||||||
|
const maxEnergy = normalizeScoreSlot(scoreSlot);
|
||||||
|
return maxEnergy > 0
|
||||||
|
? Math.min(maxEnergy, Math.max(0, energy))
|
||||||
|
: Math.max(0, energy);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getEnergyPercent(energy, scoreSlot) {
|
||||||
|
const maxEnergy = normalizeScoreSlot(scoreSlot);
|
||||||
|
if (!maxEnergy) return 0;
|
||||||
|
return Math.min(100, (clampEnergy(energy, maxEnergy) / maxEnergy) * 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStabilityArrowCount(source = {}) {
|
||||||
|
const candidates = [
|
||||||
|
Array.isArray(source.details) ? source.details.length : NaN,
|
||||||
|
Number(source.currentArrows),
|
||||||
|
Number(source.totalArrows),
|
||||||
|
].filter((value) => Number.isFinite(value) && value >= 0);
|
||||||
|
return candidates.length > 0 ? Math.max(...candidates) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateStabilityShotContext(
|
||||||
|
source = {},
|
||||||
|
{ detectShot = false } = {}
|
||||||
|
) {
|
||||||
|
const trainingType = String(
|
||||||
|
source.trainingType || currentContext?.trainingType || ""
|
||||||
|
).trim();
|
||||||
|
if (trainingType !== "stability" || !currentContext) return false;
|
||||||
|
|
||||||
|
const nextArrowCount = getStabilityArrowCount(source);
|
||||||
|
if (nextArrowCount === null) return false;
|
||||||
|
|
||||||
|
const storedArrowCount = Number(currentContext.stabilityArrowCount);
|
||||||
|
const previousArrowCount = Number.isFinite(storedArrowCount)
|
||||||
|
? storedArrowCount
|
||||||
|
: 0;
|
||||||
|
const hasNewShot =
|
||||||
|
detectShot && nextArrowCount > previousArrowCount;
|
||||||
|
|
||||||
|
if (nextArrowCount >= previousArrowCount) {
|
||||||
|
currentContext.stabilityArrowCount = nextArrowCount;
|
||||||
|
}
|
||||||
|
return hasNewShot;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 稳定训练的阈值语音必须和 ACK 使用同一份判定结果,避免页面播放了
|
||||||
|
// 里程碑语音但比赛服提前收到 ACK。能量跌破阈值后再次向上跨越可重复触发。
|
||||||
|
function updateStabilityEnergyContext(
|
||||||
|
source = {},
|
||||||
|
{ fullSnapshot = false, detectCrossing = false } = {}
|
||||||
|
) {
|
||||||
|
const trainingType = String(
|
||||||
|
source.trainingType || currentContext?.trainingType || ""
|
||||||
|
).trim();
|
||||||
|
if (trainingType !== "stability" || !currentContext) return "";
|
||||||
|
|
||||||
|
const hasCurrentEnergy = Object.prototype.hasOwnProperty.call(
|
||||||
|
source,
|
||||||
|
"currentEnergy"
|
||||||
|
);
|
||||||
|
if (!hasCurrentEnergy && !fullSnapshot) return "";
|
||||||
|
|
||||||
|
const previousScoreSlot = normalizeScoreSlot(
|
||||||
|
currentContext.stabilityScoreSlot
|
||||||
|
);
|
||||||
|
const nextScoreSlot =
|
||||||
|
normalizeScoreSlot(source.scoreSlot) || previousScoreSlot;
|
||||||
|
const previousEnergy = clampEnergy(
|
||||||
|
currentContext.stabilityEnergy,
|
||||||
|
previousScoreSlot
|
||||||
|
);
|
||||||
|
const nextEnergy = clampEnergy(
|
||||||
|
hasCurrentEnergy ? source.currentEnergy : 0,
|
||||||
|
nextScoreSlot
|
||||||
|
);
|
||||||
|
const previousPercent = getEnergyPercent(
|
||||||
|
previousEnergy,
|
||||||
|
previousScoreSlot || nextScoreSlot
|
||||||
|
);
|
||||||
|
const nextPercent = getEnergyPercent(nextEnergy, nextScoreSlot);
|
||||||
|
|
||||||
|
currentContext.stabilityEnergy = nextEnergy;
|
||||||
|
currentContext.stabilityScoreSlot = nextScoreSlot;
|
||||||
|
|
||||||
|
if (!detectCrossing) {
|
||||||
|
currentContext.stabilityEnergy50Armed = nextPercent < 50;
|
||||||
|
currentContext.stabilityEnergy70Armed = nextPercent < 70;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
let energy50Armed =
|
||||||
|
typeof currentContext.stabilityEnergy50Armed === "boolean"
|
||||||
|
? currentContext.stabilityEnergy50Armed
|
||||||
|
: previousPercent < 50;
|
||||||
|
let energy70Armed =
|
||||||
|
typeof currentContext.stabilityEnergy70Armed === "boolean"
|
||||||
|
? currentContext.stabilityEnergy70Armed
|
||||||
|
: previousPercent < 70;
|
||||||
|
|
||||||
|
if (nextPercent < 50) energy50Armed = true;
|
||||||
|
if (nextPercent < 70) energy70Armed = true;
|
||||||
|
|
||||||
|
let milestoneAudioKey = "";
|
||||||
|
if (energy70Armed && nextPercent >= 70) {
|
||||||
|
milestoneAudioKey = STABILITY_ENERGY_70_AUDIO_KEY;
|
||||||
|
energy70Armed = false;
|
||||||
|
// 同一次直接跨过两个阈值时只播70%,不能在后续补播50%。
|
||||||
|
energy50Armed = false;
|
||||||
|
} else if (energy50Armed && nextPercent >= 50) {
|
||||||
|
milestoneAudioKey = STABILITY_ENERGY_50_AUDIO_KEY;
|
||||||
|
energy50Armed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentContext.stabilityEnergy50Armed = energy50Armed;
|
||||||
|
currentContext.stabilityEnergy70Armed = energy70Armed;
|
||||||
|
return milestoneAudioKey;
|
||||||
|
}
|
||||||
|
|
||||||
function getTestDistanceAudioKeys(shootData) {
|
function getTestDistanceAudioKeys(shootData) {
|
||||||
const distance = Number(shootData?.distance ?? shootData?.dst);
|
if (!shootData) return [];
|
||||||
if (Number.isNaN(distance)) return [];
|
return [getDistanceCheckAudioKey(shootData)];
|
||||||
if (distance === 0) return ["未发现靶纸,请瞄准靶纸射箭"];
|
}
|
||||||
return [distance / 100 >= 5 ? "\u8ddd\u79bb\u5408\u683c" : "\u8ddd\u79bb\u4e0d\u8db3"];
|
|
||||||
|
function attachStabilityAudioContext(message, businessMessage) {
|
||||||
|
const fullStabilitySnapshot = [
|
||||||
|
ServerMessageType.SERVER_MSG_MATCH_START,
|
||||||
|
ServerMessageType.SERVER_MSG_SHOT,
|
||||||
|
ServerMessageType.SERVER_MSG_MATCH_END,
|
||||||
|
ServerMessageType.SERVER_MSG_TIMEOUT,
|
||||||
|
ServerMessageType.SERVER_MSG_PRACTICE_END,
|
||||||
|
].includes(message.type);
|
||||||
|
const stabilityMilestoneAudioKey = updateStabilityEnergyContext(
|
||||||
|
businessMessage,
|
||||||
|
{
|
||||||
|
fullSnapshot: fullStabilitySnapshot,
|
||||||
|
detectCrossing: message.type === ServerMessageType.SERVER_MSG_SHOT,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const stabilityHasNewShot = updateStabilityShotContext(businessMessage, {
|
||||||
|
detectShot: message.type === ServerMessageType.SERVER_MSG_SHOT,
|
||||||
|
});
|
||||||
|
if (businessMessage && stabilityMilestoneAudioKey) {
|
||||||
|
businessMessage.stabilityMilestoneAudioKey = stabilityMilestoneAudioKey;
|
||||||
|
}
|
||||||
|
if (businessMessage) {
|
||||||
|
businessMessage.stabilityHasNewShot = stabilityHasNewShot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAckAudioKeys(message, businessMessage) {
|
function getAckAudioKeys(message, businessMessage) {
|
||||||
|
const stabilityMilestoneAudioKey = String(
|
||||||
|
businessMessage?.stabilityMilestoneAudioKey || ""
|
||||||
|
).trim();
|
||||||
|
const stabilityHasNewShot =
|
||||||
|
businessMessage?.stabilityHasNewShot === true;
|
||||||
|
|
||||||
switch (message.type) {
|
switch (message.type) {
|
||||||
case ServerMessageType.SERVER_MSG_MATCH_START:
|
case ServerMessageType.SERVER_MSG_MATCH_START:
|
||||||
return [businessMessage?.isSecondHalfStart ? "下半场开始" : "比赛开始"];
|
if (businessMessage?.isSecondHalfStart) return ["下半场开始"];
|
||||||
|
// 个人训练在开始接口成功后主动播报,不再等待 MATCH_START 触发语音。
|
||||||
|
if (
|
||||||
|
getTrainingStartAudioKey(
|
||||||
|
businessMessage?.trainingType || currentContext?.trainingType
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return ["比赛开始"];
|
||||||
case ServerMessageType.SERVER_MSG_NOW_YOU:
|
case ServerMessageType.SERVER_MSG_NOW_YOU:
|
||||||
if (isMeleeMessage(message, businessMessage)) return [];
|
if (isMeleeMessage(message, businessMessage)) return [];
|
||||||
return getNowYouAudioKeys(businessMessage);
|
return getNowYouAudioKeys(businessMessage);
|
||||||
@@ -388,6 +575,27 @@ function getAckAudioKeys(message, businessMessage) {
|
|||||||
) {
|
) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
const trainingType =
|
||||||
|
businessMessage?.trainingType || currentContext?.trainingType;
|
||||||
|
if (trainingType === "precision") {
|
||||||
|
const shootData = businessMessage?.shootData;
|
||||||
|
const directionText =
|
||||||
|
shootData?.angle !== null && shootData?.angle !== undefined
|
||||||
|
? getDirectionText(shootData.angle)
|
||||||
|
: "";
|
||||||
|
return getPrecisionShotAudioKeys(shootData, directionText);
|
||||||
|
}
|
||||||
|
if (trainingType === "rhythm") {
|
||||||
|
return getRhythmShotAudioKeys(businessMessage?.shootData);
|
||||||
|
}
|
||||||
|
if (trainingType === "stability") {
|
||||||
|
return [
|
||||||
|
...(stabilityHasNewShot
|
||||||
|
? getStabilityShotAudioKeys(businessMessage?.shootData)
|
||||||
|
: []),
|
||||||
|
stabilityMilestoneAudioKey,
|
||||||
|
].filter(Boolean);
|
||||||
|
}
|
||||||
return getShootResultAudioKeys(businessMessage?.shootData);
|
return getShootResultAudioKeys(businessMessage?.shootData);
|
||||||
case ServerMessageType.SERVER_MSG_MATCH_END:
|
case ServerMessageType.SERVER_MSG_MATCH_END:
|
||||||
return ["比赛结束"];
|
return ["比赛结束"];
|
||||||
@@ -652,7 +860,9 @@ function sendHeartbeatAck() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendPracticeInfoSync() {
|
function sendPracticeInfoSync() {
|
||||||
if (!socket || !currentContext?.matchId || !currentContext?.userId) return;
|
if (!socket || !currentContext?.matchId || !currentContext?.userId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const clientMessage = {
|
const clientMessage = {
|
||||||
type: ClientMessageType.CLIENT_MSG_SYNC_PRACTICE_INFO,
|
type: ClientMessageType.CLIENT_MSG_SYNC_PRACTICE_INFO,
|
||||||
@@ -667,6 +877,12 @@ function sendPracticeInfoSync() {
|
|||||||
"CLIENT_MSG_SYNC_PRACTICE_INFO",
|
"CLIENT_MSG_SYNC_PRACTICE_INFO",
|
||||||
clientMessage
|
clientMessage
|
||||||
);
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 训练开始后可在不重连 WebSocket 的情况下主动刷新完整练习快照。
|
||||||
|
export function requestPracticeInfoSync() {
|
||||||
|
return sendPracticeInfoSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendAck({ matchId, sequence }) {
|
function sendAck({ matchId, sequence }) {
|
||||||
@@ -805,13 +1021,8 @@ function handleMessage(data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeName = getServerMessageTypeName(message.type);
|
|
||||||
if (ENABLE_REALTIME_MESSAGE_LOG) {
|
if (ENABLE_REALTIME_MESSAGE_LOG) {
|
||||||
console.log(
|
console.log("收到比赛服 WebSocket 消息", message);
|
||||||
"收到比赛服 WebSocket 消息",
|
|
||||||
typeName,
|
|
||||||
getServerMessageLogSummary(message)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const decodedMatchId = normalizeId(pickField(message, "matchId", "match_id"));
|
const decodedMatchId = normalizeId(pickField(message, "matchId", "match_id"));
|
||||||
@@ -846,6 +1057,8 @@ function handleMessage(data) {
|
|||||||
if (businessMessage?.matchId && currentContext) {
|
if (businessMessage?.matchId && currentContext) {
|
||||||
currentContext.matchId = businessMessage.matchId;
|
currentContext.matchId = businessMessage.matchId;
|
||||||
}
|
}
|
||||||
|
// 阈值事件必须先于 ACK 判断生成,确保无 sequence 的状态推送也能播放。
|
||||||
|
attachStabilityAudioContext(message, businessMessage);
|
||||||
queueAckAfterAudio(message, businessMessage);
|
queueAckAfterAudio(message, businessMessage);
|
||||||
emitBusinessMessage(businessMessage);
|
emitBusinessMessage(businessMessage);
|
||||||
}
|
}
|
||||||
@@ -879,6 +1092,7 @@ export function connectMatchWebSocket(options = {}) {
|
|||||||
requestPracticeInfoOnOpen = false,
|
requestPracticeInfoOnOpen = false,
|
||||||
appHideResumable = false,
|
appHideResumable = false,
|
||||||
practiceEndAudioKey = "",
|
practiceEndAudioKey = "",
|
||||||
|
trainingType = "",
|
||||||
force = false,
|
force = false,
|
||||||
reconnecting = false,
|
reconnecting = false,
|
||||||
reconnectReason = "",
|
reconnectReason = "",
|
||||||
@@ -886,6 +1100,7 @@ export function connectMatchWebSocket(options = {}) {
|
|||||||
const normalizedMatchId = normalizeId(matchId);
|
const normalizedMatchId = normalizeId(matchId);
|
||||||
const normalizedUserId = normalizeId(userId);
|
const normalizedUserId = normalizeId(userId);
|
||||||
const normalizedMode = Number(mode);
|
const normalizedMode = Number(mode);
|
||||||
|
const normalizedTrainingType = String(trainingType || "").trim();
|
||||||
const incomingUrl = normalizeServerUrl(serverAddr, token);
|
const incomingUrl = normalizeServerUrl(serverAddr, token);
|
||||||
const currentUrlToken = getUrlToken(currentContext?.url);
|
const currentUrlToken = getUrlToken(currentContext?.url);
|
||||||
const shouldKeepAuthenticatedUrl = !!(
|
const shouldKeepAuthenticatedUrl = !!(
|
||||||
@@ -952,6 +1167,24 @@ export function connectMatchWebSocket(options = {}) {
|
|||||||
requestPracticeInfoOnOpen: requestPracticeInfoOnOpen === true,
|
requestPracticeInfoOnOpen: requestPracticeInfoOnOpen === true,
|
||||||
appHideResumable: appHideResumable === true,
|
appHideResumable: appHideResumable === true,
|
||||||
practiceEndAudioKey: String(practiceEndAudioKey || "").trim(),
|
practiceEndAudioKey: String(practiceEndAudioKey || "").trim(),
|
||||||
|
trainingType:
|
||||||
|
normalizedTrainingType ||
|
||||||
|
(isSameContext ? currentContext?.trainingType || "" : ""),
|
||||||
|
stabilityEnergy: isSameContext
|
||||||
|
? currentContext?.stabilityEnergy
|
||||||
|
: undefined,
|
||||||
|
stabilityScoreSlot: isSameContext
|
||||||
|
? currentContext?.stabilityScoreSlot
|
||||||
|
: undefined,
|
||||||
|
stabilityEnergy50Armed: isSameContext
|
||||||
|
? currentContext?.stabilityEnergy50Armed
|
||||||
|
: undefined,
|
||||||
|
stabilityEnergy70Armed: isSameContext
|
||||||
|
? currentContext?.stabilityEnergy70Armed
|
||||||
|
: undefined,
|
||||||
|
stabilityArrowCount: isSameContext
|
||||||
|
? currentContext?.stabilityArrowCount
|
||||||
|
: undefined,
|
||||||
meleeHalfRest: isSameContext
|
meleeHalfRest: isSameContext
|
||||||
? currentContext?.meleeHalfRest === true
|
? currentContext?.meleeHalfRest === true
|
||||||
: false,
|
: false,
|
||||||
|
|||||||
@@ -21,9 +21,6 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/audio-test"
|
"path": "pages/audio-test"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "pages/calibration"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "pages/about-us"
|
"path": "pages/about-us"
|
||||||
},
|
},
|
||||||
@@ -60,12 +57,6 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/match-page"
|
"path": "pages/match-page"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "pages/my-device"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/device-intro"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "pages/user"
|
"path": "pages/user"
|
||||||
},
|
},
|
||||||
@@ -107,12 +98,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/mine-bow-data"
|
"path": "pages/mine-bow-data"
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/ota-wifi",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
@@ -133,9 +118,53 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"subPackages": [
|
"subPackages": [
|
||||||
|
{
|
||||||
|
"root": "pages/coin",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"path": "index"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "rules"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "earning-records"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "exchange-records"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "nearby-stores"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "product-detail"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"root": "pages/device",
|
"root": "pages/device",
|
||||||
"pages": [
|
"pages": [
|
||||||
|
{
|
||||||
|
"path": "my-device"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "device-bind-success"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "device-bind-failure"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "device-intro"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "ota-wifi",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "calibration"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "unbind-device"
|
"path": "unbind-device"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<script setup>
|
||||||
|
defineProps({
|
||||||
|
cumulative: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
available: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="balance-panel">
|
||||||
|
<view class="balance-list">
|
||||||
|
<view class="balance-item">
|
||||||
|
<text class="balance-item__label">累计金币:</text>
|
||||||
|
<text class="balance-item__value">{{ cumulative }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="balance-list__line" />
|
||||||
|
<view class="balance-item">
|
||||||
|
<text class="balance-item__label">可兑换金币:</text>
|
||||||
|
<text class="balance-item__value">{{ available }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.balance-panel {
|
||||||
|
width: 100%;
|
||||||
|
padding: 8rpx 28rpx 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-list {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 706rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
margin-top: 0;
|
||||||
|
border: 2rpx solid rgba(255, 217, 71, 0.25);
|
||||||
|
border-radius: 12rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: rgba(255, 217, 71, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-item {
|
||||||
|
width: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-item__label {
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-item__value {
|
||||||
|
color: #ffd947;
|
||||||
|
font-size: 30rpx;
|
||||||
|
line-height: 42rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-list__line {
|
||||||
|
width: 2rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
background-color: rgba(255, 255, 255, 0.5);
|
||||||
|
margin: 0 22rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<script setup>
|
||||||
|
defineProps({
|
||||||
|
text: {
|
||||||
|
type: String,
|
||||||
|
default: "暂无金币获取记录。",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="empty-state">
|
||||||
|
<image
|
||||||
|
src="https://static.shelingxingqiu.com/shootmini/static/coin/empty-coin-record.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
<text>{{ text }}</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.empty-state {
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 280rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state > image {
|
||||||
|
width: 162rpx;
|
||||||
|
height: 190rpx;
|
||||||
|
margin-bottom: 26rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<script setup>
|
||||||
|
import Header from "@/components/Header.vue";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
subtitle: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
onBack: {
|
||||||
|
type: Function,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="coin-header">
|
||||||
|
<Header title="" :onBack="onBack">
|
||||||
|
<template #title>
|
||||||
|
<view class="coin-header__title-group">
|
||||||
|
<text
|
||||||
|
:class="[
|
||||||
|
'coin-header__title',
|
||||||
|
subtitle ? 'coin-header__title--with-subtitle' : '',
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
{{ title }}
|
||||||
|
</text>
|
||||||
|
<text v-if="subtitle" class="coin-header__subtitle">
|
||||||
|
{{ subtitle }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</Header>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.coin-header {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 20;
|
||||||
|
width: 100%;
|
||||||
|
height: 50px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coin-header__title-group {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
width: 430rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coin-header__title {
|
||||||
|
color: #e7ba80;
|
||||||
|
font-size: 30rpx;
|
||||||
|
line-height: 42rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coin-header__title--with-subtitle {
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coin-header__subtitle {
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 20rpx;
|
||||||
|
line-height: 28rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<script setup>
|
||||||
|
defineProps({
|
||||||
|
menus: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(["select"]);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="quick-menu">
|
||||||
|
<view
|
||||||
|
v-for="item in menus"
|
||||||
|
:key="item.key"
|
||||||
|
class="quick-menu__item"
|
||||||
|
@click="emit('select', item)"
|
||||||
|
>
|
||||||
|
<image class="quick-menu__icon" :src="item.icon" mode="aspectFit" />
|
||||||
|
<text>{{ item.label }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.quick-menu {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
padding: 26rpx 46rpx 30rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-menu__item {
|
||||||
|
width: 142rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
color: #fae6bc;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-menu__icon {
|
||||||
|
width: 116rpx;
|
||||||
|
height: 116rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
<script setup>
|
||||||
|
defineProps({
|
||||||
|
records: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
mode: {
|
||||||
|
type: String,
|
||||||
|
default: "earning",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view
|
||||||
|
class="record-table"
|
||||||
|
:class="{ 'record-table--exchange': mode === 'exchange' }"
|
||||||
|
>
|
||||||
|
<view class="record-table__header">
|
||||||
|
<template v-if="mode === 'exchange'">
|
||||||
|
<text>兑换内容</text>
|
||||||
|
<text>兑换类型</text>
|
||||||
|
<text>时间</text>
|
||||||
|
<text>金币使用</text>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<text>时间</text>
|
||||||
|
<text>类型</text>
|
||||||
|
<text>金币获取</text>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
v-for="item in records"
|
||||||
|
:key="item.id"
|
||||||
|
class="record-table__row"
|
||||||
|
>
|
||||||
|
<template v-if="mode === 'exchange'">
|
||||||
|
<text class="record-table__exchange-content">{{ item.content }}</text>
|
||||||
|
<text class="record-table__exchange-type">{{ item.type }}</text>
|
||||||
|
<view class="record-table__time record-table__exchange-time">
|
||||||
|
<text>{{ item.date }}</text>
|
||||||
|
<text>{{ item.time }}</text>
|
||||||
|
</view>
|
||||||
|
<text class="record-table__amount record-table__exchange-amount">
|
||||||
|
{{ item.amount }}
|
||||||
|
</text>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="record-table__time">
|
||||||
|
<text>{{ item.date }}</text>
|
||||||
|
<text>{{ item.time }}</text>
|
||||||
|
</view>
|
||||||
|
<text class="record-table__type">{{ item.type }}</text>
|
||||||
|
<text class="record-table__amount">{{ item.amount }}</text>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.record-table {
|
||||||
|
width: 670rpx;
|
||||||
|
margin: 20rpx auto 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 2rpx solid rgba(255, 255, 255, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__header,
|
||||||
|
.record-table__row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__header {
|
||||||
|
height: 66rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__header > text {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-right: 2rpx solid rgba(255, 255, 255, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__header > text:nth-child(1),
|
||||||
|
.record-table__time {
|
||||||
|
width: 182rpx;
|
||||||
|
flex: 0 0 182rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__header > text:nth-child(2),
|
||||||
|
.record-table__type {
|
||||||
|
width: 304rpx;
|
||||||
|
flex: 0 0 304rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__header > text:nth-child(3),
|
||||||
|
.record-table__amount {
|
||||||
|
width: 180rpx;
|
||||||
|
flex: 0 0 180rpx;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__row {
|
||||||
|
height: 86rpx;
|
||||||
|
border-top: 2rpx solid rgba(255, 255, 255, 0.35);
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__row > view,
|
||||||
|
.record-table__row > text {
|
||||||
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-right: 2rpx solid rgba(255, 255, 255, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__time {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__time > text:last-child {
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__type {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__row > .record-table__amount {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 24rpx;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table__exchange-content,
|
||||||
|
.record-table__exchange-type {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 8rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table--exchange .record-table__header > text:nth-child(1),
|
||||||
|
.record-table__exchange-content {
|
||||||
|
width: 286rpx;
|
||||||
|
flex: 0 0 286rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table--exchange .record-table__header > text:nth-child(2),
|
||||||
|
.record-table__exchange-type {
|
||||||
|
width: 110rpx;
|
||||||
|
flex: 0 0 110rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table--exchange .record-table__header > text:nth-child(3),
|
||||||
|
.record-table__exchange-time {
|
||||||
|
width: 160rpx;
|
||||||
|
flex: 0 0 160rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-table--exchange .record-table__header > text:nth-child(4),
|
||||||
|
.record-table__exchange-amount {
|
||||||
|
width: 110rpx;
|
||||||
|
flex: 0 0 110rpx;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<script setup>
|
||||||
|
const emit = defineEmits(["authorize"]);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="location-state">
|
||||||
|
<image
|
||||||
|
src="https://static.shelingxingqiu.com/shootmini/static/coin/location-permission.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
<text>授权获取你的定位,以便推荐附近门店。</text>
|
||||||
|
<button hover-class="none" @click="emit('authorize')">立即授权</button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.location-state {
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 190rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 44rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.location-state > image {
|
||||||
|
width: 168rpx;
|
||||||
|
height: 190rpx;
|
||||||
|
margin-bottom: 52rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.location-state > button {
|
||||||
|
width: 360rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
margin-top: 44rpx;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 36rpx;
|
||||||
|
background-color: #ffd947;
|
||||||
|
color: #22222e;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 72rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.location-state > button::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<script setup>
|
||||||
|
defineProps({
|
||||||
|
variant: {
|
||||||
|
type: String,
|
||||||
|
default: "gold",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="exchange-notice" :class="`exchange-notice--${variant}`">
|
||||||
|
<image
|
||||||
|
src="https://static.shelingxingqiu.com/shootmini/static/coin/icon-notice.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
<text>暂不支持线上兑换,请前往线下门店进行兑换。</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.exchange-notice {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 504rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 0 16rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: rgba(255, 255, 255, 0.65);
|
||||||
|
font-size: 20rpx;
|
||||||
|
line-height: 28rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exchange-notice--gold {
|
||||||
|
border: 2rpx solid rgba(255, 217, 71, 0.28);
|
||||||
|
background-color: rgba(255, 217, 71, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.exchange-notice--red {
|
||||||
|
width: 492rpx;
|
||||||
|
height: 44rpx;
|
||||||
|
margin: 0 0 0 40rpx;
|
||||||
|
border: none;
|
||||||
|
background-color: rgba(255, 96, 96, 0.3);
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exchange-notice > image {
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
margin-right: 8rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
<script setup>
|
||||||
|
import { computed, ref } from "vue";
|
||||||
|
|
||||||
|
const DEFAULT_PRODUCT_IMAGE =
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/coin/product-hero-item.png";
|
||||||
|
const props = defineProps({
|
||||||
|
images: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const current = ref(0);
|
||||||
|
const slideImages = computed(() => {
|
||||||
|
const images = props.images.filter(
|
||||||
|
(image) => typeof image === "string" && image.trim()
|
||||||
|
);
|
||||||
|
return images.length ? images : [DEFAULT_PRODUCT_IMAGE];
|
||||||
|
});
|
||||||
|
|
||||||
|
const onChange = (event) => {
|
||||||
|
current.value = event.detail.current;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="hero-swiper">
|
||||||
|
<swiper class="hero-swiper__body" :duration="260" @change="onChange">
|
||||||
|
<swiper-item v-for="(image, index) in slideImages" :key="index">
|
||||||
|
<view class="hero-swiper__item">
|
||||||
|
<image
|
||||||
|
class="hero-swiper__background"
|
||||||
|
src="https://static.shelingxingqiu.com/shootmini/static/coin/product-hero-bg.png"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
<image class="hero-swiper__product" :src="image" mode="aspectFit" />
|
||||||
|
</view>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
<view class="hero-swiper__dots">
|
||||||
|
<view
|
||||||
|
v-for="(_, index) in slideImages"
|
||||||
|
:key="index"
|
||||||
|
class="hero-swiper__dot"
|
||||||
|
:class="{ 'hero-swiper__dot--active': current === index }"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.hero-swiper,
|
||||||
|
.hero-swiper__body,
|
||||||
|
.hero-swiper__item {
|
||||||
|
position: relative;
|
||||||
|
width: 750rpx;
|
||||||
|
height: 750rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-swiper__background,
|
||||||
|
.hero-swiper__product {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-swiper__dots {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 20rpx;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-swiper__dot {
|
||||||
|
width: 12rpx;
|
||||||
|
height: 12rpx;
|
||||||
|
margin: 0 6rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: rgba(34, 34, 46, 0.55);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-swiper__dot--active {
|
||||||
|
background-color: #ffd947;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
<script setup>
|
||||||
|
import { computed } from "vue";
|
||||||
|
|
||||||
|
const DEFAULT_PRODUCT_IMAGE =
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/coin/product-hero-bg.png";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
product: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const productImage = computed(() => {
|
||||||
|
const image = props.product?.image;
|
||||||
|
return typeof image === "string" && image.trim()
|
||||||
|
? image
|
||||||
|
: DEFAULT_PRODUCT_IMAGE;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="product-card">
|
||||||
|
<view class="product-card__image-wrap">
|
||||||
|
<image class="product-card__image" :src="productImage" mode="aspectFit" />
|
||||||
|
</view>
|
||||||
|
<text class="product-card__name">{{ product.name }}</text>
|
||||||
|
<view class="product-card__footer">
|
||||||
|
<text>{{ product.cost }}金币</text>
|
||||||
|
<text class="product-card__divider">|</text>
|
||||||
|
<text>剩余{{ product.stock }}个</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.product-card {
|
||||||
|
width: 336rpx;
|
||||||
|
height: 418rpx;
|
||||||
|
padding: 10rpx 10rpx 14rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 2rpx solid rgba(255, 217, 71, 0.1);
|
||||||
|
border-radius: 12rpx;
|
||||||
|
background-color: rgba(84, 67, 29, 0.2);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card__image-wrap {
|
||||||
|
position: relative;
|
||||||
|
width: 312rpx;
|
||||||
|
height: 312rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card__image {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card__name {
|
||||||
|
display: block;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
color: #fff0c9;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card__footer {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 4rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
font-size: 22rpx;
|
||||||
|
line-height: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card__footer > text:first-child {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card__footer > text:last-child {
|
||||||
|
color: rgba(255, 255, 255, 0.78);
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card__divider {
|
||||||
|
margin: 0 10rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.45);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
store: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(["select"]);
|
||||||
|
|
||||||
|
const selectStore = () => {
|
||||||
|
emit("select", props.store);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="store-card" hover-class="none" @click="selectStore">
|
||||||
|
<image class="store-card__photo" :src="store.image" mode="aspectFill" />
|
||||||
|
<text class="store-card__name">{{ store.name }}</text>
|
||||||
|
<view class="store-card__info">
|
||||||
|
<view class="store-card__row">
|
||||||
|
<text>地址:{{ store.address }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="store-card__row">
|
||||||
|
<text>电话:{{ store.phone }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="store-card__row">
|
||||||
|
<text>营业时间:{{ store.hours }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.store-card {
|
||||||
|
width: 650rpx;
|
||||||
|
margin: 22rpx auto 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-card__photo {
|
||||||
|
width: 650rpx;
|
||||||
|
height: 324rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-card__name {
|
||||||
|
display: block;
|
||||||
|
margin-top: 24rpx;
|
||||||
|
margin-left: 10rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 44rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-card__info {
|
||||||
|
width: 584rpx;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
margin-left: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-card__row {
|
||||||
|
margin-top: 0;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
export const quickMenus = [
|
||||||
|
{
|
||||||
|
key: "rules",
|
||||||
|
label: "金币规则",
|
||||||
|
icon: "https://static.shelingxingqiu.com/shootmini/static/coin/icon-rules.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "earningRecords",
|
||||||
|
label: "获取明细",
|
||||||
|
icon: "https://static.shelingxingqiu.com/shootmini/static/coin/icon-earning-records.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "exchangeRecords",
|
||||||
|
label: "兑换记录",
|
||||||
|
icon: "https://static.shelingxingqiu.com/shootmini/static/coin/icon-exchange-records.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "nearbyStores",
|
||||||
|
label: "附近门店",
|
||||||
|
icon: "https://static.shelingxingqiu.com/shootmini/static/coin/icon-nearby-store.png",
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
<script setup>
|
||||||
|
import { computed, ref } from "vue";
|
||||||
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
import Container from "@/components/Container.vue";
|
||||||
|
import CoinHeader from "./components/CoinHeader.vue";
|
||||||
|
import CoinRecordList from "./components/CoinRecordList.vue";
|
||||||
|
import CoinEmptyState from "./components/CoinEmptyState.vue";
|
||||||
|
import { getGoldLogAPI } from "@/apis";
|
||||||
|
|
||||||
|
const PAGE_SIZE = 20;
|
||||||
|
const storeId = ref("");
|
||||||
|
const earningRecords = ref([]);
|
||||||
|
const page = ref(0);
|
||||||
|
const total = ref(0);
|
||||||
|
const loading = ref(false);
|
||||||
|
const noMore = ref(false);
|
||||||
|
const loaded = ref(false);
|
||||||
|
const showEmpty = computed(() => loaded.value && !earningRecords.value.length);
|
||||||
|
|
||||||
|
const formatRecord = (item = {}) => {
|
||||||
|
const [date = "", time = ""] = String(item.createdAt || "").split(" ");
|
||||||
|
const amount = Number(item.amount) || 0;
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
date,
|
||||||
|
time,
|
||||||
|
type: item.remark || item.typeDesc || "-",
|
||||||
|
amount: amount > 0 ? `+${amount}` : String(amount),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// 实际接口返回 totalCount/pageCount/pageSize,同时兼容接口文档中的旧字段。
|
||||||
|
const updatePaginationState = (result, list, nextPage) => {
|
||||||
|
const currentPage = Number(result?.page) || nextPage;
|
||||||
|
const pageCount = Number(result?.pageCount);
|
||||||
|
const totalCount = Number(result?.totalCount ?? result?.total);
|
||||||
|
const responsePageSize = Number(result?.pageSize ?? result?.perPage) || PAGE_SIZE;
|
||||||
|
|
||||||
|
page.value = currentPage;
|
||||||
|
total.value = Number.isFinite(totalCount) ? totalCount : 0;
|
||||||
|
|
||||||
|
if (Number.isFinite(pageCount) && pageCount >= 0) {
|
||||||
|
noMore.value = currentPage >= pageCount;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Number.isFinite(totalCount) && totalCount >= 0) {
|
||||||
|
noMore.value = earningRecords.value.length >= totalCount;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
noMore.value = list.length < responsePageSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadRecords = async ({ reset = false } = {}) => {
|
||||||
|
if (loading.value || (!reset && noMore.value)) return;
|
||||||
|
|
||||||
|
const nextPage = reset ? 1 : page.value + 1;
|
||||||
|
loading.value = true;
|
||||||
|
if (reset) noMore.value = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await getGoldLogAPI({
|
||||||
|
page: nextPage,
|
||||||
|
pageSize: PAGE_SIZE,
|
||||||
|
type: 1,
|
||||||
|
storeId: storeId.value,
|
||||||
|
});
|
||||||
|
const list = Array.isArray(result?.list) ? result.list : [];
|
||||||
|
const mappedList = list.map(formatRecord);
|
||||||
|
earningRecords.value = reset
|
||||||
|
? mappedList
|
||||||
|
: earningRecords.value.concat(mappedList);
|
||||||
|
updatePaginationState(result, list, nextPage);
|
||||||
|
} catch (error) {
|
||||||
|
if (reset) {
|
||||||
|
earningRecords.value = [];
|
||||||
|
page.value = 0;
|
||||||
|
}
|
||||||
|
console.error("加载金币获取明细失败", error);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
loaded.value = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onLoad((options = {}) => {
|
||||||
|
const currentStoreId = String(options.storeId || "");
|
||||||
|
if (!/^\d+$/.test(currentStoreId) || Number(currentStoreId) <= 0) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: "/pages/coin/nearby-stores",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
storeId.value = currentStoreId;
|
||||||
|
loadRecords({ reset: true });
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Container :bgType="6" :isHome="true" @scrolltolower="loadRecords">
|
||||||
|
<template #header>
|
||||||
|
<CoinHeader title="金币获取明细" />
|
||||||
|
</template>
|
||||||
|
<view class="records-page">
|
||||||
|
<CoinEmptyState v-if="showEmpty" />
|
||||||
|
<CoinRecordList v-else :records="earningRecords" />
|
||||||
|
<view
|
||||||
|
v-if="loading || (noMore && earningRecords.length)"
|
||||||
|
class="records-page__status"
|
||||||
|
>
|
||||||
|
<text>{{ loading ? "加载中..." : "没有更多了" }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</Container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.records-page {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.records-page__status {
|
||||||
|
padding: 24rpx 0 32rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
<script setup>
|
||||||
|
import { computed, ref } from "vue";
|
||||||
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
import Container from "@/components/Container.vue";
|
||||||
|
import CoinHeader from "./components/CoinHeader.vue";
|
||||||
|
import CoinRecordList from "./components/CoinRecordList.vue";
|
||||||
|
import CoinEmptyState from "./components/CoinEmptyState.vue";
|
||||||
|
import { getGoldLogAPI } from "@/apis";
|
||||||
|
|
||||||
|
const PAGE_SIZE = 20;
|
||||||
|
const storeId = ref("");
|
||||||
|
const exchangeRecords = ref([]);
|
||||||
|
const page = ref(0);
|
||||||
|
const total = ref(0);
|
||||||
|
const loading = ref(false);
|
||||||
|
const noMore = ref(false);
|
||||||
|
const loaded = ref(false);
|
||||||
|
const showEmpty = computed(() => loaded.value && !exchangeRecords.value.length);
|
||||||
|
|
||||||
|
const formatRecord = (item = {}) => {
|
||||||
|
const [date = "", time = ""] = String(item.createdAt || "").split(" ");
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
content: item.remark || "-",
|
||||||
|
type: item.typeDesc || "-",
|
||||||
|
date,
|
||||||
|
time,
|
||||||
|
amount: String(Number(item.amount) || 0),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// 实际接口返回 totalCount/pageCount/pageSize,同时兼容接口文档中的旧字段。
|
||||||
|
const updatePaginationState = (result, list, nextPage) => {
|
||||||
|
const currentPage = Number(result?.page) || nextPage;
|
||||||
|
const pageCount = Number(result?.pageCount);
|
||||||
|
const totalCount = Number(result?.totalCount ?? result?.total);
|
||||||
|
const responsePageSize = Number(result?.pageSize ?? result?.perPage) || PAGE_SIZE;
|
||||||
|
|
||||||
|
page.value = currentPage;
|
||||||
|
total.value = Number.isFinite(totalCount) ? totalCount : 0;
|
||||||
|
|
||||||
|
if (Number.isFinite(pageCount) && pageCount >= 0) {
|
||||||
|
noMore.value = currentPage >= pageCount;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Number.isFinite(totalCount) && totalCount >= 0) {
|
||||||
|
noMore.value = exchangeRecords.value.length >= totalCount;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
noMore.value = list.length < responsePageSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadRecords = async ({ reset = false } = {}) => {
|
||||||
|
if (loading.value || (!reset && noMore.value)) return;
|
||||||
|
|
||||||
|
const nextPage = reset ? 1 : page.value + 1;
|
||||||
|
loading.value = true;
|
||||||
|
if (reset) noMore.value = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await getGoldLogAPI({
|
||||||
|
page: nextPage,
|
||||||
|
pageSize: PAGE_SIZE,
|
||||||
|
type: 2,
|
||||||
|
storeId: storeId.value,
|
||||||
|
});
|
||||||
|
const list = Array.isArray(result?.list) ? result.list : [];
|
||||||
|
const mappedList = list.map(formatRecord);
|
||||||
|
exchangeRecords.value = reset
|
||||||
|
? mappedList
|
||||||
|
: exchangeRecords.value.concat(mappedList);
|
||||||
|
updatePaginationState(result, list, nextPage);
|
||||||
|
} catch (error) {
|
||||||
|
if (reset) {
|
||||||
|
exchangeRecords.value = [];
|
||||||
|
page.value = 0;
|
||||||
|
}
|
||||||
|
console.error("加载金币兑换记录失败", error);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
loaded.value = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onLoad((options = {}) => {
|
||||||
|
const currentStoreId = String(options.storeId || "");
|
||||||
|
if (!/^\d+$/.test(currentStoreId) || Number(currentStoreId) <= 0) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: "/pages/coin/nearby-stores",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
storeId.value = currentStoreId;
|
||||||
|
loadRecords({ reset: true });
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Container :bgType="6" :isHome="true" @scrolltolower="loadRecords">
|
||||||
|
<template #header>
|
||||||
|
<CoinHeader title="金币兑换记录" />
|
||||||
|
</template>
|
||||||
|
<view class="records-page">
|
||||||
|
<CoinEmptyState v-if="showEmpty" text="暂无金币兑换记录。" />
|
||||||
|
<CoinRecordList v-else mode="exchange" :records="exchangeRecords" />
|
||||||
|
<view
|
||||||
|
v-if="loading || (noMore && exchangeRecords.length)"
|
||||||
|
class="records-page__status"
|
||||||
|
>
|
||||||
|
<text>{{ loading ? "加载中..." : "没有更多了" }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</Container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.records-page {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.records-page__status {
|
||||||
|
padding: 24rpx 0 32rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,216 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
import Container from "@/components/Container.vue";
|
||||||
|
import CoinHeader from "./components/CoinHeader.vue";
|
||||||
|
import CoinBalancePanel from "./components/CoinBalancePanel.vue";
|
||||||
|
import CoinQuickMenu from "./components/CoinQuickMenu.vue";
|
||||||
|
import OfflineExchangeNotice from "./components/OfflineExchangeNotice.vue";
|
||||||
|
import RewardProductCard from "./components/RewardProductCard.vue";
|
||||||
|
import { getGiftListAPI, getMyGoldAPI } from "@/apis";
|
||||||
|
import { quickMenus } from "./data";
|
||||||
|
|
||||||
|
const PAGE_SIZE = 20;
|
||||||
|
const coinSummary = ref({
|
||||||
|
cumulative: 0,
|
||||||
|
available: 0,
|
||||||
|
});
|
||||||
|
const selectedStoreId = ref("");
|
||||||
|
const selectedStoreName = ref("");
|
||||||
|
const rewardProducts = ref([]);
|
||||||
|
const productPage = ref(0);
|
||||||
|
const productTotal = ref(0);
|
||||||
|
const productLoading = ref(false);
|
||||||
|
const productNoMore = ref(false);
|
||||||
|
|
||||||
|
const loadCoinSummary = async () => {
|
||||||
|
try {
|
||||||
|
const result = await getMyGoldAPI(selectedStoreId.value);
|
||||||
|
coinSummary.value = {
|
||||||
|
cumulative: Number(result?.totalGold) || 0,
|
||||||
|
available: Number(result?.usableGold) || 0,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.error("加载金币统计失败", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadProducts = async ({ reset = false } = {}) => {
|
||||||
|
if (productLoading.value || (!reset && productNoMore.value)) return;
|
||||||
|
|
||||||
|
const nextPage = reset ? 1 : productPage.value + 1;
|
||||||
|
productLoading.value = true;
|
||||||
|
if (reset) productNoMore.value = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await getGiftListAPI({
|
||||||
|
page: nextPage,
|
||||||
|
pageSize: PAGE_SIZE,
|
||||||
|
storeId: selectedStoreId.value,
|
||||||
|
});
|
||||||
|
const list = Array.isArray(result?.list) ? result.list : [];
|
||||||
|
const mappedList = list.map((item) => ({
|
||||||
|
id: item.id,
|
||||||
|
name: item.name || "",
|
||||||
|
cost: Number(item.coin_price) || 0,
|
||||||
|
stock: Number(item.stock) || 0,
|
||||||
|
image: item.cover_image || "",
|
||||||
|
}));
|
||||||
|
|
||||||
|
rewardProducts.value = reset
|
||||||
|
? mappedList
|
||||||
|
: rewardProducts.value.concat(mappedList);
|
||||||
|
productPage.value = Number(result?.page) || nextPage;
|
||||||
|
const pageCount = Number(result?.pageCount ?? result?.page_count);
|
||||||
|
const totalCount = Number(result?.totalCount ?? result?.total);
|
||||||
|
const responsePageSize =
|
||||||
|
Number(result?.pageSize ?? result?.page_size) || PAGE_SIZE;
|
||||||
|
productTotal.value = Number.isFinite(totalCount) ? totalCount : 0;
|
||||||
|
|
||||||
|
if (Number.isFinite(pageCount) && pageCount >= 0) {
|
||||||
|
productNoMore.value = productPage.value >= pageCount;
|
||||||
|
} else if (Number.isFinite(totalCount) && totalCount >= 0) {
|
||||||
|
productNoMore.value = rewardProducts.value.length >= totalCount;
|
||||||
|
} else {
|
||||||
|
productNoMore.value = list.length < responsePageSize;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (reset) {
|
||||||
|
rewardProducts.value = [];
|
||||||
|
productPage.value = 0;
|
||||||
|
}
|
||||||
|
console.error("加载礼品列表失败", error);
|
||||||
|
} finally {
|
||||||
|
productLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const menuRoutes = {
|
||||||
|
rules: "/pages/coin/rules",
|
||||||
|
earningRecords: "/pages/coin/earning-records",
|
||||||
|
exchangeRecords: "/pages/coin/exchange-records",
|
||||||
|
};
|
||||||
|
|
||||||
|
const buildStorePageUrl = (path, extraQuery = "") => {
|
||||||
|
const query = [
|
||||||
|
`storeId=${encodeURIComponent(selectedStoreId.value)}`,
|
||||||
|
`storeName=${encodeURIComponent(selectedStoreName.value)}`,
|
||||||
|
extraQuery,
|
||||||
|
]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join("&");
|
||||||
|
return `${path}?${query}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const decodeRouteText = (value = "") => {
|
||||||
|
const text = String(value);
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(text.replace(/\+/g, " "));
|
||||||
|
} catch (error) {
|
||||||
|
console.error("门店名称解码失败", error);
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onMenuSelect = (menu) => {
|
||||||
|
if (menu.key === "nearbyStores") {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: "/pages/coin/nearby-stores",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = menuRoutes[menu.key];
|
||||||
|
if (!url) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "功能开发中",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url: buildStorePageUrl(url),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const toProductDetail = (product) => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: buildStorePageUrl(
|
||||||
|
"/pages/coin/product-detail",
|
||||||
|
`id=${encodeURIComponent(product.id)}`
|
||||||
|
),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
onLoad((options = {}) => {
|
||||||
|
const storeId = String(options.storeId || "");
|
||||||
|
if (!/^\d+$/.test(storeId) || Number(storeId) <= 0) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: "/pages/coin/nearby-stores",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedStoreId.value = storeId;
|
||||||
|
selectedStoreName.value = decodeRouteText(options.storeName);
|
||||||
|
loadCoinSummary();
|
||||||
|
loadProducts({ reset: true });
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Container :bgType="6" :isHome="true" @scrolltolower="loadProducts">
|
||||||
|
<template #header>
|
||||||
|
<CoinHeader title="我的金币" :subtitle="selectedStoreName" />
|
||||||
|
</template>
|
||||||
|
<view class="coin-page">
|
||||||
|
<CoinBalancePanel
|
||||||
|
:cumulative="coinSummary.cumulative"
|
||||||
|
:available="coinSummary.available"
|
||||||
|
/>
|
||||||
|
<CoinQuickMenu :menus="quickMenus" @select="onMenuSelect" />
|
||||||
|
<OfflineExchangeNotice />
|
||||||
|
<view class="reward-section">
|
||||||
|
<view class="reward-grid">
|
||||||
|
<view
|
||||||
|
v-for="product in rewardProducts"
|
||||||
|
:key="product.id"
|
||||||
|
class="reward-grid__item"
|
||||||
|
@click="toProductDetail(product)"
|
||||||
|
>
|
||||||
|
<RewardProductCard :product="product" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</Container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.coin-page {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
padding-bottom: 40rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reward-section {
|
||||||
|
padding: 20rpx 28rpx 40rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reward-grid {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reward-grid__item {
|
||||||
|
width: 336rpx;
|
||||||
|
margin-right: 22rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reward-grid__item:nth-child(2n) {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
import Container from "@/components/Container.vue";
|
||||||
|
import CoinHeader from "./components/CoinHeader.vue";
|
||||||
|
import LocationPermissionState from "./components/LocationPermissionState.vue";
|
||||||
|
import StoreCard from "./components/StoreCard.vue";
|
||||||
|
import { getNearbyStoresAPI } from "@/apis";
|
||||||
|
|
||||||
|
const PAGE_SIZE = 20;
|
||||||
|
const DEFAULT_STORE_IMAGE =
|
||||||
|
"https://static.shelingxingqiu.com/shootmini/static/coin/store-photo.png";
|
||||||
|
const showPermissionState = ref(false);
|
||||||
|
const stores = ref([]);
|
||||||
|
const location = ref(null);
|
||||||
|
const page = ref(0);
|
||||||
|
const total = ref(0);
|
||||||
|
const loading = ref(false);
|
||||||
|
const noMore = ref(false);
|
||||||
|
const loaded = ref(false);
|
||||||
|
|
||||||
|
const getCurrentLocation = () =>
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
|
uni.getLocation({
|
||||||
|
type: "gcj02",
|
||||||
|
success: resolve,
|
||||||
|
fail: reject,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapStore = (item = {}) => ({
|
||||||
|
id: item.id,
|
||||||
|
name: item.name || "",
|
||||||
|
address: item.address || "",
|
||||||
|
phone: item.phone || "",
|
||||||
|
hours: item.businessHours || "",
|
||||||
|
image: item.coverImage || DEFAULT_STORE_IMAGE,
|
||||||
|
});
|
||||||
|
|
||||||
|
const loadStores = async ({ reset = false } = {}) => {
|
||||||
|
if (!location.value || loading.value || (!reset && noMore.value)) return;
|
||||||
|
|
||||||
|
const nextPage = reset ? 1 : page.value + 1;
|
||||||
|
loading.value = true;
|
||||||
|
if (reset) noMore.value = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await getNearbyStoresAPI({
|
||||||
|
...location.value,
|
||||||
|
page: nextPage,
|
||||||
|
pageSize: PAGE_SIZE,
|
||||||
|
});
|
||||||
|
const list = Array.isArray(result?.list) ? result.list : [];
|
||||||
|
const mappedList = list.map(mapStore);
|
||||||
|
stores.value = reset ? mappedList : stores.value.concat(mappedList);
|
||||||
|
page.value = Number(result?.page) || nextPage;
|
||||||
|
const pageCount = Number(result?.pageCount);
|
||||||
|
const totalCount = Number(result?.totalCount ?? result?.total);
|
||||||
|
const responsePageSize = Number(result?.pageSize) || PAGE_SIZE;
|
||||||
|
total.value = Number.isFinite(totalCount) ? totalCount : 0;
|
||||||
|
|
||||||
|
if (Number.isFinite(pageCount) && pageCount >= 0) {
|
||||||
|
noMore.value = page.value >= pageCount;
|
||||||
|
} else if (Number.isFinite(totalCount) && totalCount >= 0) {
|
||||||
|
noMore.value = stores.value.length >= totalCount;
|
||||||
|
} else {
|
||||||
|
noMore.value = list.length < responsePageSize;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (reset) {
|
||||||
|
stores.value = [];
|
||||||
|
page.value = 0;
|
||||||
|
}
|
||||||
|
console.error("加载附近门店失败", error);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
loaded.value = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const locateAndLoadStores = async () => {
|
||||||
|
try {
|
||||||
|
const position = await getCurrentLocation();
|
||||||
|
location.value = {
|
||||||
|
longitude: position.longitude,
|
||||||
|
latitude: position.latitude,
|
||||||
|
};
|
||||||
|
showPermissionState.value = false;
|
||||||
|
await loadStores({ reset: true });
|
||||||
|
} catch (error) {
|
||||||
|
showPermissionState.value = true;
|
||||||
|
loaded.value = true;
|
||||||
|
console.error("获取定位失败", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const authorizeLocation = () => {
|
||||||
|
uni.openSetting({
|
||||||
|
success: locateAndLoadStores,
|
||||||
|
fail: locateAndLoadStores,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择门店后替换当前页面,返回时直接回到进入金币模块前的页面。
|
||||||
|
const selectStore = (store) => {
|
||||||
|
const storeId = String(store?.id || "");
|
||||||
|
if (!/^\d+$/.test(storeId) || Number(storeId) <= 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "门店信息无效",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const storeName = encodeURIComponent(store?.name || "");
|
||||||
|
uni.redirectTo({
|
||||||
|
url: `/pages/coin/index?storeId=${encodeURIComponent(storeId)}&storeName=${storeName}`,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
onLoad(locateAndLoadStores);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Container :bgType="6" :isHome="true" @scrolltolower="loadStores">
|
||||||
|
<template #header>
|
||||||
|
<CoinHeader title="附近门店" />
|
||||||
|
</template>
|
||||||
|
<view class="stores-page">
|
||||||
|
<LocationPermissionState
|
||||||
|
v-if="showPermissionState"
|
||||||
|
@authorize="authorizeLocation"
|
||||||
|
/>
|
||||||
|
<template v-else>
|
||||||
|
<StoreCard
|
||||||
|
v-for="store in stores"
|
||||||
|
:key="store.id"
|
||||||
|
:store="store"
|
||||||
|
@select="selectStore"
|
||||||
|
/>
|
||||||
|
<text v-if="loaded && !stores.length" class="stores-page__more">
|
||||||
|
附近暂无门店~
|
||||||
|
</text>
|
||||||
|
<text v-else-if="noMore" class="stores-page__more">没有更多门店了~</text>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</Container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.stores-page {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
padding-bottom: 54rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stores-page__more {
|
||||||
|
display: block;
|
||||||
|
width: 650rpx;
|
||||||
|
margin: 26rpx auto 0;
|
||||||
|
color: rgba(255, 255, 255, 0.72);
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
import Container from "@/components/Container.vue";
|
||||||
|
import CoinHeader from "./components/CoinHeader.vue";
|
||||||
|
import ProductHeroSwiper from "./components/ProductHeroSwiper.vue";
|
||||||
|
import OfflineExchangeNotice from "./components/OfflineExchangeNotice.vue";
|
||||||
|
import { getGiftDetailAPI } from "@/apis";
|
||||||
|
|
||||||
|
const productDetail = ref({
|
||||||
|
name: "",
|
||||||
|
coinPrice: 0,
|
||||||
|
stock: 0,
|
||||||
|
images: [],
|
||||||
|
descriptions: [],
|
||||||
|
});
|
||||||
|
|
||||||
|
const loadProductDetail = async (id) => {
|
||||||
|
try {
|
||||||
|
const result = await getGiftDetailAPI(id);
|
||||||
|
const images = Array.isArray(result?.images)
|
||||||
|
? result.images
|
||||||
|
.slice()
|
||||||
|
.sort((first, second) =>
|
||||||
|
(Number(first?.sort_order) || 0) - (Number(second?.sort_order) || 0)
|
||||||
|
)
|
||||||
|
.map((item) => item?.image_url)
|
||||||
|
.filter(Boolean)
|
||||||
|
: [];
|
||||||
|
|
||||||
|
productDetail.value = {
|
||||||
|
...productDetail.value,
|
||||||
|
name: result?.name || "",
|
||||||
|
coinPrice: Number(result?.coin_price) || 0,
|
||||||
|
stock: Number(result?.stock) || 0,
|
||||||
|
images,
|
||||||
|
descriptions: result?.description
|
||||||
|
? String(result.description).split(/\r?\n/).filter(Boolean)
|
||||||
|
: [],
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.error("加载礼品详情失败", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onLoad((options = {}) => {
|
||||||
|
const id = Number(options.id);
|
||||||
|
if (!Number.isInteger(id) || id <= 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "商品参数无效",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadProductDetail(id);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Container :bgType="6" :isHome="true">
|
||||||
|
<template #header>
|
||||||
|
<CoinHeader title="商品详情" />
|
||||||
|
</template>
|
||||||
|
<view class="product-detail">
|
||||||
|
<ProductHeroSwiper
|
||||||
|
:images="productDetail.images"
|
||||||
|
/>
|
||||||
|
<view class="product-detail__summary">
|
||||||
|
<text class="product-detail__name">{{ productDetail.name }}</text>
|
||||||
|
<view class="product-detail__balance">
|
||||||
|
<text>金币:</text>
|
||||||
|
<text class="product-detail__amount">{{ productDetail.coinPrice }}</text>
|
||||||
|
<text>(剩余{{ productDetail.stock }}个)</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<OfflineExchangeNotice variant="red" />
|
||||||
|
<view class="product-detail__content">
|
||||||
|
<text
|
||||||
|
v-for="(description, index) in productDetail.descriptions"
|
||||||
|
:key="index"
|
||||||
|
class="product-detail__paragraph"
|
||||||
|
>
|
||||||
|
{{ description }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</Container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.product-detail {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
padding-bottom: 60rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: #22222e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-detail__summary {
|
||||||
|
padding: 30rpx 40rpx 20rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-detail__name {
|
||||||
|
color: #ffd947;
|
||||||
|
font-size: 52rpx;
|
||||||
|
line-height: 74rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-detail__balance {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.75);
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-detail__amount {
|
||||||
|
margin-right: 6rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 36rpx;
|
||||||
|
line-height: 50rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-detail__content {
|
||||||
|
padding: 38rpx 40rpx 60rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-bottom: 2rpx solid rgba(255, 217, 71, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-detail__paragraph {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.75);
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
<script setup>
|
||||||
|
import { computed, ref } from "vue";
|
||||||
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
import Container from "@/components/Container.vue";
|
||||||
|
import CoinHeader from "./components/CoinHeader.vue";
|
||||||
|
import CoinEmptyState from "./components/CoinEmptyState.vue";
|
||||||
|
import { getStoreGoldRuleListAPI } from "@/apis";
|
||||||
|
|
||||||
|
const PAGE_SIZE = 20;
|
||||||
|
const storeId = ref("");
|
||||||
|
const coinRules = ref([]);
|
||||||
|
const page = ref(0);
|
||||||
|
const loading = ref(false);
|
||||||
|
const noMore = ref(false);
|
||||||
|
const loaded = ref(false);
|
||||||
|
const showEmpty = computed(() => loaded.value && !coinRules.value.length);
|
||||||
|
|
||||||
|
const updatePaginationState = (result, list, nextPage) => {
|
||||||
|
const currentPage = Number(result?.page) || nextPage;
|
||||||
|
const pageCount = Number(result?.pageCount ?? result?.page_count);
|
||||||
|
const totalCount = Number(result?.totalCount ?? result?.total);
|
||||||
|
const responsePageSize =
|
||||||
|
Number(result?.pageSize ?? result?.page_size) || PAGE_SIZE;
|
||||||
|
|
||||||
|
page.value = currentPage;
|
||||||
|
if (Number.isFinite(pageCount) && pageCount >= 0) {
|
||||||
|
noMore.value = currentPage >= pageCount;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Number.isFinite(totalCount) && totalCount >= 0) {
|
||||||
|
noMore.value = coinRules.value.length >= totalCount;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
noMore.value = list.length < responsePageSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadRules = async ({ reset = false } = {}) => {
|
||||||
|
if (loading.value || (!reset && noMore.value)) return;
|
||||||
|
|
||||||
|
const nextPage = reset ? 1 : page.value + 1;
|
||||||
|
loading.value = true;
|
||||||
|
if (reset) noMore.value = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await getStoreGoldRuleListAPI({
|
||||||
|
storeId: storeId.value,
|
||||||
|
page: nextPage,
|
||||||
|
pageSize: PAGE_SIZE,
|
||||||
|
});
|
||||||
|
const list = Array.isArray(result?.list) ? result.list : [];
|
||||||
|
const mappedList = list.map((item) => ({
|
||||||
|
id: item.id,
|
||||||
|
content: item.content || "",
|
||||||
|
}));
|
||||||
|
|
||||||
|
coinRules.value = reset ? mappedList : coinRules.value.concat(mappedList);
|
||||||
|
updatePaginationState(result, list, nextPage);
|
||||||
|
} catch (error) {
|
||||||
|
if (reset) {
|
||||||
|
coinRules.value = [];
|
||||||
|
page.value = 0;
|
||||||
|
}
|
||||||
|
console.error("加载金币规则失败", error);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
loaded.value = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onLoad((options = {}) => {
|
||||||
|
const currentStoreId = String(options.storeId || "");
|
||||||
|
if (!/^\d+$/.test(currentStoreId) || Number(currentStoreId) <= 0) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: "/pages/coin/nearby-stores",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
storeId.value = currentStoreId;
|
||||||
|
loadRules({ reset: true });
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Container :bgType="6" :isHome="true" @scrolltolower="loadRules">
|
||||||
|
<template #header>
|
||||||
|
<CoinHeader title="金币规则" />
|
||||||
|
</template>
|
||||||
|
<view class="rules-page">
|
||||||
|
<CoinEmptyState v-if="showEmpty" text="暂无金币规则。" />
|
||||||
|
<template v-else>
|
||||||
|
<view
|
||||||
|
v-for="rule in coinRules"
|
||||||
|
:key="rule.id"
|
||||||
|
class="rules-page__item"
|
||||||
|
>
|
||||||
|
<rich-text class="rules-page__content" :nodes="rule.content" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<view v-if="loading" class="rules-page__status">
|
||||||
|
<text>加载中...</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</Container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.rules-page {
|
||||||
|
width: 100%;
|
||||||
|
padding: 28rpx 38rpx 60rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rules-page__item {
|
||||||
|
margin-bottom: 26rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.88);
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 52rpx;
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rules-page__content {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rules-page__status {
|
||||||
|
padding: 12rpx 0 20rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
import { bindDeviceAPIV2 } from "@/apis";
|
||||||
|
|
||||||
|
export function useDeviceBinding({
|
||||||
|
token,
|
||||||
|
confirmBindTip,
|
||||||
|
binding,
|
||||||
|
updateDevice,
|
||||||
|
deviceDetails,
|
||||||
|
refreshDeviceStatus,
|
||||||
|
}) {
|
||||||
|
const showBindFailurePage = () => {
|
||||||
|
uni.hideToast();
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/device/device-bind-failure",
|
||||||
|
fail: (error) => {
|
||||||
|
console.error("打开绑定失败页失败", error);
|
||||||
|
uni.showToast({ title: "二维码不正确,请重新扫码", icon: "none" });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleScan = () => {
|
||||||
|
uni.scanCode({
|
||||||
|
onlyFromCamera: true,
|
||||||
|
scanType: ["qrCode"],
|
||||||
|
success: (result) => {
|
||||||
|
if (!result?.result) {
|
||||||
|
showBindFailurePage();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
token.value = result.result;
|
||||||
|
confirmBindTip.value = true;
|
||||||
|
},
|
||||||
|
fail: (error) => {
|
||||||
|
const message = String(error?.errMsg || error?.message || "");
|
||||||
|
if (/cancel|取消/i.test(message)) return;
|
||||||
|
showBindFailurePage();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const confirmBind = async () => {
|
||||||
|
if (!token.value || binding.value) return;
|
||||||
|
binding.value = true;
|
||||||
|
try {
|
||||||
|
const result = await bindDeviceAPIV2(token.value);
|
||||||
|
confirmBindTip.value = false;
|
||||||
|
if (result?.binded) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "设备已绑定其他账号,请解绑后再绑定",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const deviceId = String(result?.deviceId || "").trim();
|
||||||
|
const deviceName = String(result?.name || result?.deviceName || "").trim();
|
||||||
|
if (!deviceId || !deviceName) {
|
||||||
|
confirmBindTip.value = false;
|
||||||
|
token.value = "";
|
||||||
|
showBindFailurePage();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const applyBoundDevice = () => {
|
||||||
|
updateDevice(deviceId, deviceName);
|
||||||
|
deviceDetails.value = result || {};
|
||||||
|
void refreshDeviceStatus();
|
||||||
|
};
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/device/device-bind-success?deviceId=${encodeURIComponent(deviceId)}`,
|
||||||
|
success: applyBoundDevice,
|
||||||
|
fail: (navigationError) => {
|
||||||
|
applyBoundDevice();
|
||||||
|
console.error("打开绑定成功页失败", navigationError);
|
||||||
|
uni.showToast({ title: "绑定成功,请返回查看设备", icon: "none" });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error("绑定设备失败", error);
|
||||||
|
confirmBindTip.value = false;
|
||||||
|
token.value = "";
|
||||||
|
showBindFailurePage();
|
||||||
|
} finally {
|
||||||
|
binding.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return { confirmBind, handleScan, showBindFailurePage };
|
||||||
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
import { computed, ref } from "vue";
|
||||||
|
import { getDeviceBatteryAPI, getMyDevicesAPI, unbindDeviceAPI } from "@/apis";
|
||||||
|
|
||||||
|
export const DEVICE_NAME_STORAGE_KEY = "device_name_overrides";
|
||||||
|
|
||||||
|
export function useDeviceStatus({
|
||||||
|
user,
|
||||||
|
device,
|
||||||
|
online,
|
||||||
|
updateDevice,
|
||||||
|
updateOnline,
|
||||||
|
clearDevice,
|
||||||
|
unbindDialogVisible,
|
||||||
|
}) {
|
||||||
|
const deviceStatus = ref({});
|
||||||
|
const deviceDetails = ref({});
|
||||||
|
|
||||||
|
const isDeviceOnline = computed(
|
||||||
|
() => deviceStatus.value.online === true || online.value === true
|
||||||
|
);
|
||||||
|
const statusText = computed(() => (isDeviceOnline.value ? "已连接" : "未连接"));
|
||||||
|
const statusClass = computed(() =>
|
||||||
|
isDeviceOnline.value ? "device-status--online" : "device-status--offline"
|
||||||
|
);
|
||||||
|
const battery = computed(() => {
|
||||||
|
const value = Number(
|
||||||
|
deviceStatus.value.battery ?? deviceStatus.value.power ?? 0
|
||||||
|
);
|
||||||
|
return Number.isFinite(value) && value > 0 ? Math.min(100, value) : 0;
|
||||||
|
});
|
||||||
|
const batteryText = computed(() =>
|
||||||
|
battery.value ? `${battery.value}%` : "暂无数据"
|
||||||
|
);
|
||||||
|
const networkText = computed(() => {
|
||||||
|
const netType = String(deviceStatus.value.netType || "").toLowerCase();
|
||||||
|
if (netType === "wifi") return "WiFi";
|
||||||
|
if (netType === "4g") return "4G";
|
||||||
|
return isDeviceOnline.value ? "在线" : "未连接";
|
||||||
|
});
|
||||||
|
const maskedDeviceId = computed(() => {
|
||||||
|
const id = String(device.value.deviceId || "");
|
||||||
|
if (!id) return "暂无设备编号";
|
||||||
|
if (id.length <= 3) return id;
|
||||||
|
return `${"*".repeat(Math.min(5, id.length - 3))}${id.slice(-3)}`;
|
||||||
|
});
|
||||||
|
const deviceRows = computed(() => [
|
||||||
|
{ label: "设备型号", value: deviceDetails.value.model || "射灵智能弓" },
|
||||||
|
{ label: "当前电量", value: batteryText.value },
|
||||||
|
{ label: "连接方式", value: networkText.value },
|
||||||
|
{ label: "设备编号", value: maskedDeviceId.value },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const getDeviceNameOverrides = () => {
|
||||||
|
const value = uni.getStorageSync(DEVICE_NAME_STORAGE_KEY);
|
||||||
|
return value && typeof value === "object" ? value : {};
|
||||||
|
};
|
||||||
|
|
||||||
|
const refreshDeviceStatus = async () => {
|
||||||
|
if (!device.value.deviceId) return;
|
||||||
|
try {
|
||||||
|
const result = await getDeviceBatteryAPI();
|
||||||
|
deviceStatus.value = result || {};
|
||||||
|
updateOnline(result?.online === true);
|
||||||
|
} catch (error) {
|
||||||
|
deviceStatus.value = {};
|
||||||
|
console.log("获取设备状态失败", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const syncDeviceBinding = async () => {
|
||||||
|
if (!user.value.id) return;
|
||||||
|
try {
|
||||||
|
const devices = await getMyDevicesAPI();
|
||||||
|
if (Array.isArray(devices?.bindings) && devices.bindings.length > 0) {
|
||||||
|
const currentDevice = devices.bindings[0];
|
||||||
|
const nameOverrides = getDeviceNameOverrides();
|
||||||
|
deviceDetails.value = currentDevice;
|
||||||
|
updateDevice(
|
||||||
|
currentDevice.deviceId,
|
||||||
|
nameOverrides[currentDevice.deviceId] ||
|
||||||
|
currentDevice.deviceName ||
|
||||||
|
currentDevice.name ||
|
||||||
|
"我的智能弓"
|
||||||
|
);
|
||||||
|
await refreshDeviceStatus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clearDevice();
|
||||||
|
deviceStatus.value = {};
|
||||||
|
deviceDetails.value = {};
|
||||||
|
} catch (error) {
|
||||||
|
console.log("同步设备绑定失败", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const unbindDevice = async () => {
|
||||||
|
if (!device.value.deviceId) return;
|
||||||
|
try {
|
||||||
|
await unbindDeviceAPI(device.value.deviceId);
|
||||||
|
uni.setStorageSync("calibration", false);
|
||||||
|
clearDevice();
|
||||||
|
deviceStatus.value = {};
|
||||||
|
deviceDetails.value = {};
|
||||||
|
unbindDialogVisible.value = false;
|
||||||
|
uni.showToast({ title: "解绑成功", icon: "success" });
|
||||||
|
} catch (error) {
|
||||||
|
console.error("解绑设备失败", error);
|
||||||
|
if (error?.type === "DEVICE_BIND_INVALID") {
|
||||||
|
clearDevice();
|
||||||
|
unbindDialogVisible.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
batteryText,
|
||||||
|
deviceDetails,
|
||||||
|
deviceRows,
|
||||||
|
getDeviceNameOverrides,
|
||||||
|
isDeviceOnline,
|
||||||
|
maskedDeviceId,
|
||||||
|
networkText,
|
||||||
|
refreshDeviceStatus,
|
||||||
|
statusClass,
|
||||||
|
statusText,
|
||||||
|
syncDeviceBinding,
|
||||||
|
unbindDevice,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
<script setup>
|
||||||
|
import Container from "@/components/Container.vue";
|
||||||
|
|
||||||
|
// 失败页由设备页进入,返回时优先回到上一页;页面栈异常时兜底回到设备页。
|
||||||
|
const goBackToDevicePage = () => {
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
if (pages.length > 1) {
|
||||||
|
uni.navigateBack({ delta: 1 });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.redirectTo({ url: "/pages/device/my-device" });
|
||||||
|
};
|
||||||
|
|
||||||
|
// 返回设备页后沿用原有扫码绑定流程,不在结果页重复处理二维码数据。
|
||||||
|
const retryScan = () => {
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
if (pages.length > 1) {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
success: () => uni.$emit("device-bind-retry-scan"),
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.redirectTo({ url: "/pages/device/my-device?retryScan=1" });
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="device-bind-failure-page">
|
||||||
|
<Container
|
||||||
|
:bgType="12"
|
||||||
|
bgColor="transparent"
|
||||||
|
:onBack="goBackToDevicePage"
|
||||||
|
headerClass="bind-failure-header"
|
||||||
|
:scroll="false"
|
||||||
|
:usePageScroll="true"
|
||||||
|
>
|
||||||
|
<view class="bind-failure-page">
|
||||||
|
<view class="bind-failure-scene">
|
||||||
|
<view class="bind-failure-hero-wrap">
|
||||||
|
<view class="bind-failure-hero-shadow"></view>
|
||||||
|
<image
|
||||||
|
class="bind-failure-hero"
|
||||||
|
src="../../static/device-assets/device-bind-failure-hero.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="bind-failure-message">
|
||||||
|
<text>二维码不正确,</text>
|
||||||
|
<text>仅支持扫描射灵智能弓箭的设备二维码。</text>
|
||||||
|
</view>
|
||||||
|
<view class="bind-failure-retry" @click="$clickSound(retryScan)">
|
||||||
|
<text>重新扫码</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</Container>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.device-bind-failure-page {
|
||||||
|
position: relative;
|
||||||
|
min-height: 100vh;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-failure-header {
|
||||||
|
position: relative;
|
||||||
|
z-index: 20;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 与绑定成功页共用固定画布,页面内的视觉尺寸全部按 375 宽设计稿换算为 rpx。 */
|
||||||
|
.bind-failure-page {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1;
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-failure-scene {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-failure-hero-wrap,
|
||||||
|
.bind-failure-message,
|
||||||
|
.bind-failure-retry {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-failure-hero-wrap {
|
||||||
|
top: 568rpx;
|
||||||
|
left: 244rpx;
|
||||||
|
width: 260rpx;
|
||||||
|
height: 222rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-failure-hero-shadow {
|
||||||
|
position: absolute;
|
||||||
|
left: 22rpx;
|
||||||
|
bottom: 0;
|
||||||
|
width: 238rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-failure-hero {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 260rpx;
|
||||||
|
height: 222rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-failure-message {
|
||||||
|
top: 824rpx;
|
||||||
|
left: 122rpx;
|
||||||
|
display: flex;
|
||||||
|
width: 504rpx;
|
||||||
|
min-height: 80rpx;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
color: #ffffff;
|
||||||
|
font-family: PingFang SC-Regular;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 40rpx;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-failure-retry {
|
||||||
|
top: 960rpx;
|
||||||
|
left: 195rpx;
|
||||||
|
display: flex;
|
||||||
|
width: 360rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border: 2rpx solid #ffd947;
|
||||||
|
border-radius: 78rpx;
|
||||||
|
color: #ffd947;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 26rpx;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,248 @@
|
|||||||
|
<script setup>
|
||||||
|
import { computed, ref } from "vue";
|
||||||
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
import Container from "@/components/Container.vue";
|
||||||
|
import { getDeviceDetailAPI, getHomeData } from "@/apis";
|
||||||
|
|
||||||
|
const bindResult = ref({
|
||||||
|
isFirstBind: false,
|
||||||
|
expireDate: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
const bindSuccessHero = computed(() =>
|
||||||
|
bindResult.value.isFirstBind
|
||||||
|
? "../../static/device-assets/device-bind-success-hero-first.png"
|
||||||
|
: "../../static/device-assets/device-bind-success-hero-nonfirst.png"
|
||||||
|
);
|
||||||
|
const bindRewardExpireDate = computed(() => bindResult.value.expireDate);
|
||||||
|
|
||||||
|
// 与会员页使用相同的到期时间格式,设备详情接口本身不提供会员有效期。
|
||||||
|
const formatVipDate = (value) => {
|
||||||
|
if (!value) return "";
|
||||||
|
const numericValue = Number(value);
|
||||||
|
const timestamp = Number.isNaN(numericValue)
|
||||||
|
? new Date(value).getTime()
|
||||||
|
: numericValue < 1000000000000
|
||||||
|
? numericValue * 1000
|
||||||
|
: numericValue;
|
||||||
|
const date = new Date(timestamp);
|
||||||
|
if (Number.isNaN(date.getTime())) return "";
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||||
|
const day = String(date.getDate()).padStart(2, "0");
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadBindResult = async (deviceId) => {
|
||||||
|
if (!deviceId) return;
|
||||||
|
try {
|
||||||
|
const data = await getDeviceDetailAPI(deviceId);
|
||||||
|
if (data?.detail?.isFirstBind !== true) return;
|
||||||
|
bindResult.value.isFirstBind = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const homeData = await getHomeData();
|
||||||
|
bindResult.value.expireDate = formatVipDate(
|
||||||
|
homeData?.user?.normalVipExpiredAt
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取赠送会员有效期失败", error);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取设备详情失败", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const toFirstTryPage = () => {
|
||||||
|
uni.navigateTo({ url: "/pages/first-try" });
|
||||||
|
};
|
||||||
|
|
||||||
|
// 成功页由设备页 navigateTo 进入,优先返回上一页;页面栈异常时兜底回到设备页。
|
||||||
|
const goBackToDevicePage = () => {
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
if (pages.length > 1) {
|
||||||
|
uni.navigateBack({ delta: 1 });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.redirectTo({ url: "/pages/device/my-device" });
|
||||||
|
};
|
||||||
|
|
||||||
|
onLoad((options = {}) => {
|
||||||
|
bindResult.value = {
|
||||||
|
isFirstBind: false,
|
||||||
|
expireDate: "",
|
||||||
|
};
|
||||||
|
void loadBindResult(options.deviceId);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="device-bind-success-page">
|
||||||
|
<Container
|
||||||
|
:bgType="12"
|
||||||
|
bgColor="transparent"
|
||||||
|
:onBack="goBackToDevicePage"
|
||||||
|
headerClass="bind-success-header"
|
||||||
|
:scroll="false"
|
||||||
|
:usePageScroll="true"
|
||||||
|
>
|
||||||
|
<view class="bind-success-page">
|
||||||
|
<view
|
||||||
|
class="bind-success-scene"
|
||||||
|
:class="{ 'bind-success-scene--first': bindResult.isFirstBind }"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="bind-success-confetti"
|
||||||
|
src="../../static/device-assets/device-bind-success-confetti.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
<image class="bind-success-hero" :src="bindSuccessHero" mode="aspectFit" />
|
||||||
|
<image
|
||||||
|
class="bind-success-title-image"
|
||||||
|
src="../../static/device-assets/device-bind-success-title.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
<view v-if="bindResult.isFirstBind" class="bind-reward-card">
|
||||||
|
<image
|
||||||
|
class="bind-reward-gift"
|
||||||
|
src="../../static/device-assets/device-bind-success-reward-gift.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
<text class="bind-reward-text">
|
||||||
|
新设备首次绑定礼包:
|
||||||
|
<text class="bind-reward-highlight">6个月射灵会员</text>
|
||||||
|
已自动发放至本账号<text v-if="bindRewardExpireDate">,有效期{{ bindRewardExpireDate }}</text>。
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class="bind-success-tutorial" @click="$clickSound(toFirstTryPage)">
|
||||||
|
<text>立即查看新手教程</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</Container>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.device-bind-success-page {
|
||||||
|
position: relative;
|
||||||
|
min-height: 100vh;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-success-header {
|
||||||
|
position: relative;
|
||||||
|
z-index: 20;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 绑定结果页使用固定画布,背景和前景素材按蓝湖 375 x 812 画布定位。 */
|
||||||
|
.bind-success-page {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1;
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-success-scene {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-success-confetti,
|
||||||
|
.bind-success-hero,
|
||||||
|
.bind-success-title-image,
|
||||||
|
.bind-reward-card,
|
||||||
|
.bind-success-tutorial {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-success-confetti {
|
||||||
|
top: 488rpx;
|
||||||
|
left: 78rpx;
|
||||||
|
width: 588rpx;
|
||||||
|
height: 508rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-success-hero {
|
||||||
|
top: 568rpx;
|
||||||
|
left: 244rpx;
|
||||||
|
width: 260rpx;
|
||||||
|
height: 222rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-success-scene--first .bind-success-confetti {
|
||||||
|
top: 314rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-success-scene--first .bind-success-hero {
|
||||||
|
top: 400rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-success-title-image {
|
||||||
|
top: 828rpx;
|
||||||
|
left: 216rpx;
|
||||||
|
width: 316rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-success-scene--first .bind-success-title-image {
|
||||||
|
top: 660rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-reward-card {
|
||||||
|
top: 768rpx;
|
||||||
|
left: 170rpx;
|
||||||
|
width: 508rpx;
|
||||||
|
height: 152rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 16rpx 16rpx 16rpx 90rpx;
|
||||||
|
border-radius: 16rpx 64rpx 16rpx 64rpx;
|
||||||
|
background: rgba(0, 0, 0, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-reward-gift {
|
||||||
|
position: absolute;
|
||||||
|
top: -18rpx;
|
||||||
|
left: -100rpx;
|
||||||
|
width: 178rpx;
|
||||||
|
height: 176rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-reward-text {
|
||||||
|
display: block;
|
||||||
|
width: 380rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-family: PingFang SC-Regular;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-reward-highlight {
|
||||||
|
color: #ffd947;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-success-tutorial {
|
||||||
|
top: 960rpx;
|
||||||
|
left: 195rpx;
|
||||||
|
display: flex;
|
||||||
|
width: 360rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border: 2rpx solid #ffd947;
|
||||||
|
border-radius: 78rpx;
|
||||||
|
color: #ffd947;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 26rpx;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -38,7 +38,7 @@ const onScrollView = (e) => {
|
|||||||
mode="widthFix"
|
mode="widthFix"
|
||||||
/>
|
/>
|
||||||
<navigator open-type="navigateBack">
|
<navigator open-type="navigateBack">
|
||||||
<image class="header-back" src="../static/back.png" mode="widthFix" />
|
<image class="header-back" src="../../static/back.png" mode="widthFix" />
|
||||||
</navigator>
|
</navigator>
|
||||||
<text
|
<text
|
||||||
:style="{ opacity: addBg ? 1 : 0, color: '#fff', fontWeight: 'bold' }"
|
:style="{ opacity: addBg ? 1 : 0, color: '#fff', fontWeight: 'bold' }"
|
||||||
@@ -0,0 +1,961 @@
|
|||||||
|
<script setup>
|
||||||
|
import { computed, onMounted, onUnmounted, ref } from "vue";
|
||||||
|
import { onLoad, onShow } from "@dcloudio/uni-app";
|
||||||
|
import Container from "@/components/Container.vue";
|
||||||
|
import ScreenHint from "@/components/ScreenHint.vue";
|
||||||
|
import ModalDialog from "@/components/ModalDialog.vue";
|
||||||
|
import { laserAimAPI } from "@/apis";
|
||||||
|
import useStore from "@/store";
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
|
import { useDeviceBinding } from "./composables/useDeviceBinding";
|
||||||
|
import {
|
||||||
|
DEVICE_NAME_STORAGE_KEY,
|
||||||
|
useDeviceStatus,
|
||||||
|
} from "./composables/useDeviceStatus";
|
||||||
|
|
||||||
|
const store = useStore();
|
||||||
|
const { updateDevice, updateOnline, clearDevice } = store;
|
||||||
|
const { user, device, online } = storeToRefs(store);
|
||||||
|
|
||||||
|
const showTip = ref(false);
|
||||||
|
const confirmBindTip = ref(false);
|
||||||
|
const unbindDialogVisible = ref(false);
|
||||||
|
const nameEditorVisible = ref(false);
|
||||||
|
const qrVisible = ref(false);
|
||||||
|
const qrSaved = ref(false);
|
||||||
|
const editingName = ref("");
|
||||||
|
const token = ref("");
|
||||||
|
const binding = ref(false);
|
||||||
|
const retryScanOnShow = ref(false);
|
||||||
|
const calibration = ref(false);
|
||||||
|
|
||||||
|
const {
|
||||||
|
deviceDetails,
|
||||||
|
deviceRows,
|
||||||
|
getDeviceNameOverrides,
|
||||||
|
isDeviceOnline,
|
||||||
|
maskedDeviceId,
|
||||||
|
refreshDeviceStatus,
|
||||||
|
statusClass,
|
||||||
|
statusText,
|
||||||
|
syncDeviceBinding,
|
||||||
|
unbindDevice,
|
||||||
|
} = useDeviceStatus({
|
||||||
|
user,
|
||||||
|
device,
|
||||||
|
online,
|
||||||
|
updateDevice,
|
||||||
|
updateOnline,
|
||||||
|
clearDevice,
|
||||||
|
unbindDialogVisible,
|
||||||
|
});
|
||||||
|
|
||||||
|
const { confirmBind, handleScan } = useDeviceBinding({
|
||||||
|
token,
|
||||||
|
confirmBindTip,
|
||||||
|
binding,
|
||||||
|
updateDevice,
|
||||||
|
deviceDetails,
|
||||||
|
refreshDeviceStatus,
|
||||||
|
});
|
||||||
|
|
||||||
|
const qrImageUrl = computed(
|
||||||
|
() =>
|
||||||
|
deviceDetails.value.qrCode ||
|
||||||
|
deviceDetails.value.qrcode ||
|
||||||
|
deviceDetails.value.qrUrl ||
|
||||||
|
"../../static/device-assets/my-device-qrcode.png"
|
||||||
|
);
|
||||||
|
const isScanPage = computed(() => !device.value.deviceId && !qrVisible.value);
|
||||||
|
const containerBgType = computed(() =>
|
||||||
|
isScanPage.value ? 12 : 0
|
||||||
|
);
|
||||||
|
const containerBgColor = computed(() =>
|
||||||
|
containerBgType.value === 12 || containerBgType.value === -1
|
||||||
|
? "transparent"
|
||||||
|
: "#050b19"
|
||||||
|
);
|
||||||
|
|
||||||
|
// 解绑前展示统一确认弹窗,避免误触解除绑定。
|
||||||
|
const openUnbindDialog = () => {
|
||||||
|
unbindDialogVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeUnbindDialog = () => {
|
||||||
|
unbindDialogVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const openNameEditor = () => {
|
||||||
|
editingName.value = device.value.deviceName || "我的智能弓";
|
||||||
|
nameEditorVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeNameEditor = () => {
|
||||||
|
nameEditorVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 当前接口列表没有设备改名接口,先更新页面和本地缓存,后端接口接入时可替换为请求。
|
||||||
|
const confirmName = () => {
|
||||||
|
const name = String(editingName.value || "").trim();
|
||||||
|
if (!name) {
|
||||||
|
uni.showToast({ title: "请输入设备名", icon: "none" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (name.length > 10 || !/^[\u4e00-\u9fa5A-Za-z0-9_-]+$/.test(name)) {
|
||||||
|
uni.showToast({ title: "设备名格式不正确", icon: "none" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
updateDevice(device.value.deviceId, name);
|
||||||
|
deviceDetails.value = { ...deviceDetails.value, deviceName: name };
|
||||||
|
const nameOverrides = getDeviceNameOverrides();
|
||||||
|
nameOverrides[device.value.deviceId] = name;
|
||||||
|
uni.setStorageSync(DEVICE_NAME_STORAGE_KEY, nameOverrides);
|
||||||
|
nameEditorVisible.value = false;
|
||||||
|
uni.showToast({ title: "设备名已更新", icon: "success" });
|
||||||
|
};
|
||||||
|
|
||||||
|
const toDeviceIntroPage = () => {
|
||||||
|
uni.navigateTo({ url: "/pages/device/device-intro" });
|
||||||
|
};
|
||||||
|
|
||||||
|
const joinWifi = () => {
|
||||||
|
uni.navigateTo({ url: "/pages/device/ota-wifi" });
|
||||||
|
};
|
||||||
|
|
||||||
|
const goFirmwareUpdate = () => {
|
||||||
|
if (!isDeviceOnline.value) {
|
||||||
|
uni.showToast({ title: "请先开启智能弓", icon: "none" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.navigateTo({ url: "/pages/device/ota-wifi" });
|
||||||
|
};
|
||||||
|
|
||||||
|
const goCalibration = async () => {
|
||||||
|
try {
|
||||||
|
await laserAimAPI();
|
||||||
|
uni.navigateTo({ url: "/pages/device/calibration" });
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({ title: "设备未连接,暂时无法调瞄", icon: "none" });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const copyEmail = () => {
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: "shelingxingqiu@163.com",
|
||||||
|
success: () => uni.showToast({ title: "邮箱已复制", icon: "success" }),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const openQr = () => {
|
||||||
|
qrSaved.value = false;
|
||||||
|
qrVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeTip = () => {
|
||||||
|
showTip.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeConfirmBindTip = () => {
|
||||||
|
confirmBindTip.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeQr = () => {
|
||||||
|
qrVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 保存二维码到相册;远程二维码先下载到临时目录,失败时保留长按保存提示。
|
||||||
|
const saveQrCode = async () => {
|
||||||
|
let filePath = qrImageUrl.value;
|
||||||
|
try {
|
||||||
|
if (/^https?:\/\//.test(filePath)) {
|
||||||
|
filePath = await new Promise((resolve, reject) => {
|
||||||
|
uni.downloadFile({
|
||||||
|
url: filePath,
|
||||||
|
success: (result) =>
|
||||||
|
result.statusCode === 200
|
||||||
|
? resolve(result.tempFilePath)
|
||||||
|
: reject(new Error("二维码下载失败")),
|
||||||
|
fail: reject,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
uni.saveImageToPhotosAlbum({ success: resolve, fail: reject, filePath });
|
||||||
|
});
|
||||||
|
qrSaved.value = true;
|
||||||
|
uni.showToast({ title: "已保存至相册", icon: "success" });
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({ title: "请长按二维码保存", icon: "none" });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onLoad((options = {}) => {
|
||||||
|
retryScanOnShow.value = options.retryScan === "1";
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
uni.$on("device-bind-retry-scan", handleScan);
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
uni.$off("device-bind-retry-scan", handleScan);
|
||||||
|
});
|
||||||
|
|
||||||
|
onShow(async () => {
|
||||||
|
calibration.value = uni.getStorageSync("calibration");
|
||||||
|
await syncDeviceBinding();
|
||||||
|
if (retryScanOnShow.value) {
|
||||||
|
retryScanOnShow.value = false;
|
||||||
|
handleScan();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="my-device-page" :class="{ 'my-device-page--scan': isScanPage }">
|
||||||
|
<Container
|
||||||
|
:bgType="containerBgType"
|
||||||
|
:bgColor="containerBgColor"
|
||||||
|
:scroll="!isScanPage"
|
||||||
|
:usePageScroll="false"
|
||||||
|
>
|
||||||
|
<view v-if="qrVisible" class="qr-page" @click="closeQr">
|
||||||
|
<view class="qr-canvas" @click.stop>
|
||||||
|
<view class="qr-corner qr-corner--top"></view>
|
||||||
|
<view class="qr-corner qr-corner--bottom"></view>
|
||||||
|
<text class="qr-title">射灵智能弓箭二维码</text>
|
||||||
|
<image class="qr-image" :src="qrImageUrl" mode="aspectFit" show-menu-by-longpress />
|
||||||
|
<text v-if="qrSaved" class="qr-device-id">设备ID:{{ maskedDeviceId }}</text>
|
||||||
|
<view v-else class="qr-save-button" @click="saveQrCode">
|
||||||
|
<text>保存至相册</text>
|
||||||
|
</view>
|
||||||
|
<text class="qr-description">
|
||||||
|
该二维码为当前绑定弓箭的二维码,你可以截图保存到相册,以便当二维码丢失或不在身边时,可以扫描二维码进行设备绑定。
|
||||||
|
</text>
|
||||||
|
<text class="qr-note">注:解除绑定后将无法查看该二维码。</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view v-else-if="!device.deviceId" class="scan-code">
|
||||||
|
<view class="unbound-content">
|
||||||
|
<button class="scan-entry" hover-class="none" @click="$clickSound(handleScan)">
|
||||||
|
<image src="../../static/device-assets/my-device-unbound-scan.png" mode="aspectFit" />
|
||||||
|
</button>
|
||||||
|
<view class="scan-title">
|
||||||
|
<text>请扫描</text>
|
||||||
|
<text class="highlight-text">射灵智能弓箭</text>
|
||||||
|
<text>设备上的二维码</text>
|
||||||
|
</view>
|
||||||
|
<view class="benefit-copy">
|
||||||
|
<text>新设备首次绑定账号可获赠</text>
|
||||||
|
<text class="highlight-text">6个月射灵会员礼包</text>
|
||||||
|
<text>,</text>
|
||||||
|
<text>该礼包仅可使用一次,请确保当前登录账号为您本人账号。</text>
|
||||||
|
</view>
|
||||||
|
<button class="help-link" hover-class="none" @click="showTip = true">
|
||||||
|
<text>没找到二维码或遇到问题></text>
|
||||||
|
</button>
|
||||||
|
<button class="product-link" hover-class="none" @click="toDeviceIntroPage">
|
||||||
|
<text>还没有射灵智能弓箭?点我获取></text>
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view v-else class="device-page">
|
||||||
|
|
||||||
|
<view class="device-card">
|
||||||
|
<view class="device-card-header">
|
||||||
|
<view class="device-status" :class="statusClass">
|
||||||
|
<view class="status-dot"></view>
|
||||||
|
<text>{{ statusText }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="edit-name" @click="openNameEditor">修改设备名</view>
|
||||||
|
</view>
|
||||||
|
<view class="device-identity">
|
||||||
|
<image class="device-avatar" src="../../static/device-assets/my-device-avatar.png" mode="aspectFill" />
|
||||||
|
<view class="device-identity-text">
|
||||||
|
<text class="device-name">{{ device.deviceName || "我的智能弓" }}</text>
|
||||||
|
<text class="device-id">{{ maskedDeviceId }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="device-stats">
|
||||||
|
<view v-for="item in deviceRows" :key="item.label" class="device-stat">
|
||||||
|
<text class="device-stat-label">{{ item.label }}</text>
|
||||||
|
<text class="device-stat-value">{{ item.value }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="device-actions">
|
||||||
|
<view class="action-item" @click="toDeviceIntroPage">
|
||||||
|
<text class="action-icon">⌁</text>
|
||||||
|
<text>设备介绍</text>
|
||||||
|
</view>
|
||||||
|
<view class="action-item" @click="goCalibration">
|
||||||
|
<text class="action-icon">⌖</text>
|
||||||
|
<text>弓箭调瞄</text>
|
||||||
|
</view>
|
||||||
|
<view class="action-item" @click="goFirmwareUpdate">
|
||||||
|
<text class="action-icon">↻</text>
|
||||||
|
<text>固件更新</text>
|
||||||
|
</view>
|
||||||
|
<view class="action-item" @click="joinWifi">
|
||||||
|
<text class="action-icon">◌</text>
|
||||||
|
<text>WIFI设置</text>
|
||||||
|
</view>
|
||||||
|
<view class="action-item" @click="openQr">
|
||||||
|
<text class="action-icon">▦</text>
|
||||||
|
<text>设备二维码</text>
|
||||||
|
</view>
|
||||||
|
<view class="action-item action-item--danger" @click="openUnbindDialog">
|
||||||
|
<text class="action-icon">⊗</text>
|
||||||
|
<text>解除绑定</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view v-if="calibration" class="calibration-tip">
|
||||||
|
<text>如有场地或距离变化,请重新校准以保证智能弓射箭精准度</text>
|
||||||
|
<view @click="goCalibration">重新校准</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<ScreenHint mode="square" :show="showTip" :onClose="closeTip">
|
||||||
|
<view class="scan-tips">
|
||||||
|
<text class="scan-tips-title">扫码绑定射灵弓箭</text>
|
||||||
|
<text class="scan-tips-subtitle">设备底部二维码样例</text>
|
||||||
|
<image
|
||||||
|
class="scan-tips-qr"
|
||||||
|
src="../../static/device-assets/my-device-unbound-qr-sample.png"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
<text class="scan-tips-note">【注】已被绑定的弓箭无法再次绑定。</text>
|
||||||
|
<view class="scan-tips-contact">
|
||||||
|
<text>如有任何疑问,请随时联系:</text>
|
||||||
|
<button hover-class="none" @click="copyEmail">shelingxingqiu@163.com</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</ScreenHint>
|
||||||
|
|
||||||
|
<ScreenHint :show="confirmBindTip" :onClose="closeConfirmBindTip">
|
||||||
|
<view class="confirm-bind">
|
||||||
|
<text>智能弓箭和系统账号需一一对应,你确定要将当前登录用户账号绑定这把弓箭吗?绑定后不可随意更换。</text>
|
||||||
|
<view class="confirm-actions">
|
||||||
|
<view
|
||||||
|
class="primary-action"
|
||||||
|
:class="{ 'primary-action--disabled': binding }"
|
||||||
|
@click="confirmBind"
|
||||||
|
>
|
||||||
|
{{ binding ? "绑定中..." : "确认绑定" }}
|
||||||
|
</view>
|
||||||
|
<view class="secondary-action" @click="confirmBindTip = false">取消</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</ScreenHint>
|
||||||
|
|
||||||
|
<ModalDialog
|
||||||
|
:show="unbindDialogVisible"
|
||||||
|
title="解除设备绑定"
|
||||||
|
content="解除绑定后,将无法使用智能弓箭进行对战,确定继续吗?"
|
||||||
|
cancelText="取消"
|
||||||
|
confirmText="解除绑定"
|
||||||
|
:onCancel="closeUnbindDialog"
|
||||||
|
:onConfirm="unbindDevice"
|
||||||
|
></ModalDialog>
|
||||||
|
|
||||||
|
<view v-if="nameEditorVisible" class="name-mask" @click="closeNameEditor">
|
||||||
|
<view class="name-sheet" @click.stop>
|
||||||
|
<view class="name-input-row">
|
||||||
|
<input
|
||||||
|
v-model="editingName"
|
||||||
|
class="name-input"
|
||||||
|
focus
|
||||||
|
maxlength="10"
|
||||||
|
confirm-type="done"
|
||||||
|
placeholder="请输入设备名(最长10个汉字)"
|
||||||
|
placeholder-class="name-placeholder"
|
||||||
|
@confirm="confirmName"
|
||||||
|
/>
|
||||||
|
<view class="name-confirm" @click="confirmName">确定</view>
|
||||||
|
</view>
|
||||||
|
<text class="name-helper">仅支持中文、英文、数字、下划线、减号</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</Container>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.my-device-page {
|
||||||
|
position: relative;
|
||||||
|
min-height: 100vh;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-device-page--scan {
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-code,
|
||||||
|
.device-page {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
min-height: calc(100vh - 100rpx);
|
||||||
|
box-sizing: border-box;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-code {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
justify-content: flex-start;
|
||||||
|
padding-top: 0;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unbound-content {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
min-height: calc(100vh - 100rpx);
|
||||||
|
box-sizing: border-box;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 170rpx 32rpx 160rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-entry,
|
||||||
|
.help-link,
|
||||||
|
.product-link {
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
line-height: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-entry::after,
|
||||||
|
.help-link::after,
|
||||||
|
.product-link::after {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-entry {
|
||||||
|
display: flex;
|
||||||
|
width: 276rpx;
|
||||||
|
height: 276rpx;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-entry image {
|
||||||
|
width: 276rpx;
|
||||||
|
height: 276rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 48rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 40rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.benefit-copy {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.74);
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 44rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.help-link {
|
||||||
|
margin-top: 72rpx;
|
||||||
|
color: #ffd947;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-link {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 104rpx;
|
||||||
|
bottom: calc(env(safe-area-inset-bottom) + 104rpx);
|
||||||
|
left: 0;
|
||||||
|
z-index: 2;
|
||||||
|
width: 100%;
|
||||||
|
color: #ffd947;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlight-text {
|
||||||
|
color: #fed847;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-page {
|
||||||
|
padding: 36rpx 32rpx 80rpx;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-card {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1rpx solid rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 24rpx;
|
||||||
|
background: linear-gradient(145deg, rgba(45, 54, 76, 0.96), rgba(19, 25, 43, 0.98));
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-card {
|
||||||
|
padding: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-card-header,
|
||||||
|
.device-identity,
|
||||||
|
.device-stats,
|
||||||
|
.confirm-actions,
|
||||||
|
.name-input-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-card-header {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-dot {
|
||||||
|
width: 14rpx;
|
||||||
|
height: 14rpx;
|
||||||
|
margin-right: 12rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status--online {
|
||||||
|
color: #62e4a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status--online .status-dot {
|
||||||
|
background: #62e4a1;
|
||||||
|
box-shadow: 0 0 16rpx rgba(98, 228, 161, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status--offline {
|
||||||
|
color: #ff6e6e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status--offline .status-dot {
|
||||||
|
background: #ff6e6e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-name {
|
||||||
|
color: #fed847;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-identity {
|
||||||
|
margin-top: 42rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-avatar {
|
||||||
|
width: 144rpx;
|
||||||
|
height: 144rpx;
|
||||||
|
margin-right: 26rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-identity-text {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-name {
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-id {
|
||||||
|
margin-top: 14rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.52);
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-stats {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
padding-top: 28rpx;
|
||||||
|
border-top: 1rpx solid rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-stat {
|
||||||
|
width: 48%;
|
||||||
|
margin-bottom: 22rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-stat-label,
|
||||||
|
.device-stat-value {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-stat-label {
|
||||||
|
color: rgba(255, 255, 255, 0.5);
|
||||||
|
font-size: 22rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-stat-value {
|
||||||
|
margin-top: 8rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-actions {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-top: 28rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
background: rgba(30, 38, 58, 0.88);
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-item {
|
||||||
|
display: flex;
|
||||||
|
width: 33.3333%;
|
||||||
|
height: 142rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-item--danger {
|
||||||
|
color: #ff9898;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-icon {
|
||||||
|
display: flex;
|
||||||
|
width: 56rpx;
|
||||||
|
height: 56rpx;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
border: 1rpx solid currentColor;
|
||||||
|
border-radius: 50%;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calibration-tip {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 24rpx;
|
||||||
|
padding: 20rpx 24rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background: rgba(40, 127, 255, 0.12);
|
||||||
|
color: rgba(255, 255, 255, 0.65);
|
||||||
|
font-size: 22rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calibration-tip > text {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calibration-tip > view {
|
||||||
|
margin-left: 18rpx;
|
||||||
|
color: #5bbdff;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-action,
|
||||||
|
.secondary-action {
|
||||||
|
display: flex;
|
||||||
|
min-width: 150rpx;
|
||||||
|
height: 68rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 34rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-action {
|
||||||
|
color: #111111;
|
||||||
|
background: #fed847;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-action--disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-action {
|
||||||
|
color: #ffffff;
|
||||||
|
background: rgba(255, 255, 255, 0.16);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-tips {
|
||||||
|
display: flex;
|
||||||
|
width: 90%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-top: 20%;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-tips-title {
|
||||||
|
color: #fed847;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 42rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-tips-subtitle {
|
||||||
|
margin-top: 14rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.72);
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-tips-qr {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-tips-note {
|
||||||
|
margin-top: 16rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-tips-contact {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-tips button {
|
||||||
|
padding: 0;
|
||||||
|
color: #39a8ff;
|
||||||
|
background: transparent;
|
||||||
|
font-size: 30rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.confirm-bind {
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 42rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.confirm-actions {
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 24rpx;
|
||||||
|
gap: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.confirm-actions > view {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-page {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
min-height: calc(100vh - 100rpx);
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
|
background: radial-gradient(circle at 50% 46%, rgba(95, 78, 58, 0.9), rgba(8, 10, 25, 1) 70%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-page::before,
|
||||||
|
.qr-page::after {
|
||||||
|
position: absolute;
|
||||||
|
width: 620rpx;
|
||||||
|
height: 1rpx;
|
||||||
|
content: "";
|
||||||
|
background: rgba(255, 255, 255, 0.07);
|
||||||
|
box-shadow: 0 180rpx rgba(255, 255, 255, 0.05), 0 360rpx rgba(255, 255, 255, 0.04), 0 540rpx rgba(255, 255, 255, 0.03);
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-page::before {
|
||||||
|
top: 380rpx;
|
||||||
|
left: -160rpx;
|
||||||
|
transform: rotate(48deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-page::after {
|
||||||
|
top: 420rpx;
|
||||||
|
right: -160rpx;
|
||||||
|
transform: rotate(-48deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-corner {
|
||||||
|
position: absolute;
|
||||||
|
width: 300rpx;
|
||||||
|
height: 300rpx;
|
||||||
|
background: #ffeb00;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-corner--top {
|
||||||
|
top: -220rpx;
|
||||||
|
right: -170rpx;
|
||||||
|
transform: rotate(42deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-corner--bottom {
|
||||||
|
bottom: -220rpx;
|
||||||
|
left: -170rpx;
|
||||||
|
transform: rotate(42deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-canvas {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
min-height: calc(100vh - 100rpx);
|
||||||
|
box-sizing: border-box;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 260rpx 62rpx 70rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-title {
|
||||||
|
color: #ffe846;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-image {
|
||||||
|
width: 432rpx;
|
||||||
|
height: 432rpx;
|
||||||
|
margin-top: 48rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-device-id {
|
||||||
|
margin-top: 24rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.62);
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-save-button {
|
||||||
|
display: flex;
|
||||||
|
width: 360rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 34rpx;
|
||||||
|
border: 1rpx solid #e8c840;
|
||||||
|
border-radius: 36rpx;
|
||||||
|
color: #ffe846;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-description,
|
||||||
|
.qr-note {
|
||||||
|
width: 100%;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
font-size: 22rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-description {
|
||||||
|
margin-top: 42rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-note {
|
||||||
|
margin-top: 12rpx;
|
||||||
|
color: rgba(255, 232, 70, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.name-mask {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
box-sizing: border-box;
|
||||||
|
align-items: flex-end;
|
||||||
|
background: rgba(0, 0, 0, 0.68);
|
||||||
|
}
|
||||||
|
|
||||||
|
.name-sheet {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 34rpx 32rpx 48rpx;
|
||||||
|
border-top: 1rpx solid rgba(255, 226, 153, 0.4);
|
||||||
|
border-radius: 28rpx 28rpx 0 0;
|
||||||
|
background: linear-gradient(180deg, #57462b, #2c241b);
|
||||||
|
}
|
||||||
|
|
||||||
|
.name-input-row {
|
||||||
|
width: 100%;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name-input {
|
||||||
|
flex: 1;
|
||||||
|
height: 76rpx;
|
||||||
|
padding: 0 22rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
background: rgba(0, 0, 0, 0.22);
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name-placeholder {
|
||||||
|
color: rgba(255, 255, 255, 0.45);
|
||||||
|
}
|
||||||
|
|
||||||
|
.name-confirm {
|
||||||
|
display: flex;
|
||||||
|
width: 132rpx;
|
||||||
|
height: 76rpx;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-left: 18rpx;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
color: #1b160d;
|
||||||
|
background: #fed847;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name-helper {
|
||||||
|
display: block;
|
||||||
|
margin-top: 18rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.6);
|
||||||
|
font-size: 22rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted, onUnmounted } from "vue";
|
import { ref, computed, onMounted, onUnmounted } from "vue";
|
||||||
import { onLoad, onShow } from "@dcloudio/uni-app";
|
import { onLoad, onShow } from "@dcloudio/uni-app";
|
||||||
import Container from "@/components/Container.vue";
|
import Container from "@/components/Container.vue";
|
||||||
@@ -650,16 +650,16 @@ onUnmounted(() => {
|
|||||||
</view>
|
</view>
|
||||||
<view v-if="currentState === 'CONNECTED'" class="wifi-list-card connected-wifi-card">
|
<view v-if="currentState === 'CONNECTED'" class="wifi-list-card connected-wifi-card">
|
||||||
<view class="wifi-item connected-wifi-item">
|
<view class="wifi-item connected-wifi-item">
|
||||||
<image class="check-icon" src="../static/sicon/check.png" mode="aspectFit" />
|
<image class="check-icon" src="../../static/sicon/check.png" mode="aspectFit" />
|
||||||
<text class="wifi-ssid connected-wifi-ssid">{{ connectedWifi?.SSID }}</text>
|
<text class="wifi-ssid connected-wifi-ssid">{{ connectedWifi?.SSID }}</text>
|
||||||
<view class="wifi-icons connected-wifi-icons">
|
<view class="wifi-icons connected-wifi-icons">
|
||||||
<image
|
<image
|
||||||
v-if="connectedWifi?.secure"
|
v-if="connectedWifi?.secure"
|
||||||
class="security-icon"
|
class="security-icon"
|
||||||
src="../static/sicon/pwd.png"
|
src="../../static/sicon/pwd.png"
|
||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
/>
|
/>
|
||||||
<image class="signal-icon" src="../static/sicon/wifi.png" mode="aspectFit" />
|
<image class="signal-icon" src="../../static/sicon/wifi.png" mode="aspectFit" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -668,7 +668,7 @@ onUnmounted(() => {
|
|||||||
<view class="section-label-row">
|
<view class="section-label-row">
|
||||||
<text class="section-label">网络</text>
|
<text class="section-label">网络</text>
|
||||||
<image
|
<image
|
||||||
src="../static/sicon/refresh.png"
|
src="../../static/sicon/refresh.png"
|
||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
:style="{ width: '34rpx', height: '34rpx', marginLeft: '8rpx', opacity: isRefreshing ? 0.3 : 0.7 }"
|
:style="{ width: '34rpx', height: '34rpx', marginLeft: '8rpx', opacity: isRefreshing ? 0.3 : 0.7 }"
|
||||||
@click="startScanning"
|
@click="startScanning"
|
||||||
@@ -699,10 +699,10 @@ onUnmounted(() => {
|
|||||||
<image
|
<image
|
||||||
v-if="wifi.secure"
|
v-if="wifi.secure"
|
||||||
class="security-icon"
|
class="security-icon"
|
||||||
src="../static/sicon/pwd.png"
|
src="../../static/sicon/pwd.png"
|
||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
/>
|
/>
|
||||||
<image class="signal-icon" src="../static/sicon/wifi.png" mode="aspectFit" />
|
<image class="signal-icon" src="../../static/sicon/wifi.png" mode="aspectFit" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="wifi-item" @click="selectOther">
|
<view class="wifi-item" @click="selectOther">
|
||||||
@@ -763,7 +763,7 @@ onUnmounted(() => {
|
|||||||
<block v-if="connectMode === 'secure'">
|
<block v-if="connectMode === 'secure'">
|
||||||
<view class="sheet-header">
|
<view class="sheet-header">
|
||||||
<view class="sheet-nav-btn" @click="closeConnectSheet">
|
<view class="sheet-nav-btn" @click="closeConnectSheet">
|
||||||
<image src="../static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" />
|
<image src="../../static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" />
|
||||||
</view>
|
</view>
|
||||||
<text class="sheet-title">加入"{{ connectInput.ssid }}"</text>
|
<text class="sheet-title">加入"{{ connectInput.ssid }}"</text>
|
||||||
<view
|
<view
|
||||||
@@ -771,7 +771,7 @@ onUnmounted(() => {
|
|||||||
:class="{ 'nav-disabled': joinDisabled }"
|
:class="{ 'nav-disabled': joinDisabled }"
|
||||||
@click="joinNetwork"
|
@click="joinNetwork"
|
||||||
>
|
>
|
||||||
<image src="../static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" />
|
<image src="../../static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="input-row-card">
|
<view class="input-row-card">
|
||||||
@@ -789,7 +789,7 @@ onUnmounted(() => {
|
|||||||
<!-- 密码显示/隐藏切换按钮 -->
|
<!-- 密码显示/隐藏切换按钮 -->
|
||||||
<view class="pwd-eye-btn" @click="togglePasswordVisibility">
|
<view class="pwd-eye-btn" @click="togglePasswordVisibility">
|
||||||
<image
|
<image
|
||||||
:src="showPassword ? '../static/sicon/eye-on.png' : '../static/sicon/eye-off.png'"
|
:src="showPassword ? '../../static/sicon/eye-on.png' : '../../static/sicon/eye-off.png'"
|
||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
style="width: 40rpx; height: 40rpx;"
|
style="width: 40rpx; height: 40rpx;"
|
||||||
/>
|
/>
|
||||||
@@ -803,11 +803,11 @@ onUnmounted(() => {
|
|||||||
<block v-else-if="connectMode === 'open'">
|
<block v-else-if="connectMode === 'open'">
|
||||||
<view class="sheet-header">
|
<view class="sheet-header">
|
||||||
<view class="sheet-nav-btn" @click="closeConnectSheet">
|
<view class="sheet-nav-btn" @click="closeConnectSheet">
|
||||||
<image src="../static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" />
|
<image src="../../static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" />
|
||||||
</view>
|
</view>
|
||||||
<text class="sheet-title">加入"{{ connectInput.ssid }}"</text>
|
<text class="sheet-title">加入"{{ connectInput.ssid }}"</text>
|
||||||
<view class="sheet-nav-btn" @click="joinNetwork">
|
<view class="sheet-nav-btn" @click="joinNetwork">
|
||||||
<image src="../static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" />
|
<image src="../../static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<text v-if="connectStatusText" class="connect-status">{{ connectStatusText }}</text>
|
<text v-if="connectStatusText" class="connect-status">{{ connectStatusText }}</text>
|
||||||
@@ -819,7 +819,7 @@ onUnmounted(() => {
|
|||||||
<block v-else-if="connectMode === 'manual'">
|
<block v-else-if="connectMode === 'manual'">
|
||||||
<view class="sheet-header">
|
<view class="sheet-header">
|
||||||
<view class="sheet-nav-btn" @click="closeConnectSheet">
|
<view class="sheet-nav-btn" @click="closeConnectSheet">
|
||||||
<image src="../static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" />
|
<image src="../../static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" />
|
||||||
</view>
|
</view>
|
||||||
<text class="sheet-title">加入无线网络</text>
|
<text class="sheet-title">加入无线网络</text>
|
||||||
<view
|
<view
|
||||||
@@ -827,7 +827,7 @@ onUnmounted(() => {
|
|||||||
:class="{ 'nav-disabled': joinDisabled }"
|
:class="{ 'nav-disabled': joinDisabled }"
|
||||||
@click="joinNetwork"
|
@click="joinNetwork"
|
||||||
>
|
>
|
||||||
<image src="../static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" />
|
<image src="../../static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="input-row-card">
|
<view class="input-row-card">
|
||||||
@@ -854,7 +854,7 @@ onUnmounted(() => {
|
|||||||
<!-- 密码显示/隐藏切换按钮 -->
|
<!-- 密码显示/隐藏切换按钮 -->
|
||||||
<view class="pwd-eye-btn" @click="togglePasswordVisibility">
|
<view class="pwd-eye-btn" @click="togglePasswordVisibility">
|
||||||
<image
|
<image
|
||||||
:src="showPassword ? '../static/sicon/eye-on.png' : '../static/sicon/eye-off.png'"
|
:src="showPassword ? '../../static/sicon/eye-on.png' : '../../static/sicon/eye-off.png'"
|
||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
style="width: 40rpx; height: 40rpx;"
|
style="width: 40rpx; height: 40rpx;"
|
||||||
/>
|
/>
|
||||||
@@ -22,7 +22,12 @@ import {
|
|||||||
} from "@/apis";
|
} from "@/apis";
|
||||||
import { connectMatchWebSocket, closeMatchWebSocket } from "@/matchWebsocket";
|
import { connectMatchWebSocket, closeMatchWebSocket } from "@/matchWebsocket";
|
||||||
import { sharePractiseData } from "@/canvas";
|
import { sharePractiseData } from "@/canvas";
|
||||||
import { wxShare, debounce } from "@/util";
|
import {
|
||||||
|
wxShare,
|
||||||
|
debounce,
|
||||||
|
getDistanceCheckAudioKey,
|
||||||
|
getShootValidation,
|
||||||
|
} from "@/util";
|
||||||
import { MESSAGETYPESV2 } from "@/constants";
|
import { MESSAGETYPESV2 } from "@/constants";
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
@@ -109,7 +114,7 @@ const createPractise = async (arrows) => {
|
|||||||
const result = await createPractiseAPI(
|
const result = await createPractiseAPI(
|
||||||
arrows,
|
arrows,
|
||||||
120,
|
120,
|
||||||
1,
|
2,
|
||||||
device.value.deviceId
|
device.value.deviceId
|
||||||
);
|
);
|
||||||
if (result) practiseId.value = result.id;
|
if (result) practiseId.value = result.id;
|
||||||
@@ -154,14 +159,11 @@ async function onReceiveMessage(msg) {
|
|||||||
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
|
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
|
||||||
setTimeout(() => onOver(msg), 1500);
|
setTimeout(() => onOver(msg), 1500);
|
||||||
} else if (msg.type === MESSAGETYPESV2.TestDistance && step.value === 3) {
|
} else if (msg.type === MESSAGETYPESV2.TestDistance && step.value === 3) {
|
||||||
const rawDistance = Number(msg.shootData?.distance);
|
const result = getShootValidation(msg.shootData);
|
||||||
if (rawDistance === 0) {
|
const isQualified = result.distanceOk && result.targetOk;
|
||||||
audioManager.play("未发现靶纸,请瞄准靶纸射箭");
|
audioManager.play(getDistanceCheckAudioKey(msg.shootData));
|
||||||
} else if (rawDistance / 100 >= 5) {
|
btnDisabled.value = !isQualified;
|
||||||
audioManager.play("距离合格");
|
showGuide.value = isQualified;
|
||||||
btnDisabled.value = false;
|
|
||||||
showGuide.value = true;
|
|
||||||
} else audioManager.play("距离不足");
|
|
||||||
}
|
}
|
||||||
// messages.forEach((msg) => {
|
// messages.forEach((msg) => {
|
||||||
// if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
|
// if (msg.constructor === MESSAGETYPES.ShootSyncMeArrowID) {
|
||||||
@@ -382,7 +384,7 @@ const getResultTipSrc = (result = {}) => {
|
|||||||
<text>请完成以上步骤校准智能弓</text>
|
<text>请完成以上步骤校准智能弓</text>
|
||||||
</view>
|
</view>
|
||||||
<ShootProgress v-if="step === 5" tips="请开始连续射箭" :start="start" />
|
<ShootProgress v-if="step === 5" tips="请开始连续射箭" :start="start" />
|
||||||
<TestDistance v-if="step === 3" :guide="false" />
|
<TestDistance v-if="step === 3" :guide="false" :targetType="40" />
|
||||||
<view
|
<view
|
||||||
class="user-row"
|
class="user-row"
|
||||||
v-if="step === 5"
|
v-if="step === 5"
|
||||||
@@ -397,6 +399,8 @@ const getResultTipSrc = (result = {}) => {
|
|||||||
:totalRound="step === 5 ? total : 0"
|
:totalRound="step === 5 ? total : 0"
|
||||||
:scores="scores"
|
:scores="scores"
|
||||||
:isSvip="isSvip"
|
:isSvip="isSvip"
|
||||||
|
:targetType="40"
|
||||||
|
stable-shot-effect
|
||||||
/>
|
/>
|
||||||
<ScorePanel
|
<ScorePanel
|
||||||
v-if="step === 5"
|
v-if="step === 5"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {onMounted, onUnmounted, ref, watch} from "vue";
|
import {computed, onMounted, onUnmounted, ref, watch} from "vue";
|
||||||
import {onShareAppMessage, onShareTimeline, onShow} from "@dcloudio/uni-app";
|
import {onHide, onShareAppMessage, onShareTimeline, onShow} from "@dcloudio/uni-app";
|
||||||
import Container from "@/components/Container.vue";
|
import Container from "@/components/Container.vue";
|
||||||
import AppFooter from "@/components/AppFooter.vue";
|
import AppFooter from "@/components/AppFooter.vue";
|
||||||
import UserHeader from "@/components/UserHeader.vue";
|
import UserHeader from "@/components/UserHeader.vue";
|
||||||
@@ -34,12 +34,123 @@ const {
|
|||||||
getLvlName,
|
getLvlName,
|
||||||
getLvlNameByScore,
|
getLvlNameByScore,
|
||||||
updateOnline,
|
updateOnline,
|
||||||
|
updateDeviceBattery,
|
||||||
} = store;
|
} = store;
|
||||||
const {user, device, online, game} = storeToRefs(store);
|
const {user, device, online, deviceBattery, game} = storeToRefs(store);
|
||||||
|
|
||||||
const showModal = ref(false);
|
const showModal = ref(false);
|
||||||
const showGuide = ref(false);
|
const showGuide = ref(false);
|
||||||
const scoreRankList = ref([]);
|
const scoreRankList = ref([]);
|
||||||
|
const HOME_DEVICE_STATUS_POLL_INTERVAL = 10000;
|
||||||
|
let isHomePageVisible = false;
|
||||||
|
let homeDeviceStatusTimer = null;
|
||||||
|
let isHomeDeviceStatusRequesting = false;
|
||||||
|
|
||||||
|
// 设备状态接口可能返回布尔值、数字或字符串,统一成 true / false / null。
|
||||||
|
// null 表示接口没有给出可判断的状态,调用方应保留已有状态。
|
||||||
|
const normalizeDeviceOnline = (value) => {
|
||||||
|
if (typeof value === "boolean") return value;
|
||||||
|
if (typeof value === "number") return value === 1;
|
||||||
|
|
||||||
|
const normalized = String(value ?? "").trim().toLowerCase();
|
||||||
|
if (["true", "1", "online", "connected"].includes(normalized)) return true;
|
||||||
|
if (["false", "0", "offline", "disconnected"].includes(normalized)) return false;
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 将设备状态接口响应统一同步到首页 Store,离线时清空无效电量。
|
||||||
|
const applyHomeDeviceStatus = (data) => {
|
||||||
|
const normalizedOnline = normalizeDeviceOnline(data?.online);
|
||||||
|
if (normalizedOnline !== null) {
|
||||||
|
updateOnline(normalizedOnline);
|
||||||
|
}
|
||||||
|
if (normalizedOnline === false) {
|
||||||
|
updateDeviceBattery(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const battery = data?.battery ?? data?.power;
|
||||||
|
if (battery !== undefined && battery !== null) {
|
||||||
|
updateDeviceBattery(battery);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 刷新首页设备在线状态和电量;上一轮未结束时跳过,避免请求堆积。
|
||||||
|
const refreshHomeDeviceStatus = async () => {
|
||||||
|
if (
|
||||||
|
!isHomePageVisible ||
|
||||||
|
!user.value?.id ||
|
||||||
|
!device.value?.deviceId ||
|
||||||
|
isHomeDeviceStatusRequesting
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isHomeDeviceStatusRequesting = true;
|
||||||
|
try {
|
||||||
|
const data = await getDeviceBatteryAPI();
|
||||||
|
if (isHomePageVisible) {
|
||||||
|
applyHomeDeviceStatus(data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// 请求失败时保留上一次有效状态,等待下一轮自动恢复。
|
||||||
|
console.log("刷新首页设备状态失败", error);
|
||||||
|
} finally {
|
||||||
|
isHomeDeviceStatusRequesting = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const stopHomeDeviceStatusPolling = () => {
|
||||||
|
clearInterval(homeDeviceStatusTimer);
|
||||||
|
homeDeviceStatusTimer = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 首页可见且用户已绑定设备时,每 10 秒刷新一次设备状态。
|
||||||
|
const startHomeDeviceStatusPolling = () => {
|
||||||
|
stopHomeDeviceStatusPolling();
|
||||||
|
if (!isHomePageVisible || !user.value?.id || !device.value?.deviceId) return;
|
||||||
|
|
||||||
|
homeDeviceStatusTimer = setInterval(() => {
|
||||||
|
void refreshHomeDeviceStatus();
|
||||||
|
}, HOME_DEVICE_STATUS_POLL_INTERVAL);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 首页停留期间登录或绑定状态变化时,及时启停设备状态轮询。
|
||||||
|
watch(
|
||||||
|
[() => user.value?.id, () => device.value?.deviceId],
|
||||||
|
() => {
|
||||||
|
if (isHomePageVisible) {
|
||||||
|
startHomeDeviceStatusPolling();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 首页设备卡片按“未绑定 / 已绑定未连接 / 已绑定已连接”三态展示。
|
||||||
|
const deviceCardState = computed(() => {
|
||||||
|
// 未登录时始终展示绑定入口,避免本地残留设备状态误显示为已绑定。
|
||||||
|
if (!user.value?.id || !device.value?.deviceId) return "unbound";
|
||||||
|
return normalizeDeviceOnline(online.value) === true ? "online" : "offline";
|
||||||
|
});
|
||||||
|
|
||||||
|
const deviceCardAssets = {
|
||||||
|
unbound: {
|
||||||
|
bow: "../static/home-device/device-bow--unbound.png",
|
||||||
|
background: "../static/home-device/device-card-bg--unbound.png",
|
||||||
|
actionBackground: "../static/home-device/device-action-bg--bind.png",
|
||||||
|
},
|
||||||
|
offline: {
|
||||||
|
bow: "../static/home-device/device-bow--offline.png",
|
||||||
|
background: "../static/home-device/device-card-bg--bound.png",
|
||||||
|
actionBackground: "../static/home-device/device-action-bg--device.png",
|
||||||
|
},
|
||||||
|
online: {
|
||||||
|
bow: "../static/home-device/device-bow--online.png",
|
||||||
|
background: "../static/home-device/device-card-bg--bound.png",
|
||||||
|
actionBackground: "../static/home-device/device-action-bg--device.png",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const deviceCardAsset = computed(() => deviceCardAssets[deviceCardState.value]);
|
||||||
|
|
||||||
// OTA 相关
|
// OTA 相关
|
||||||
const otaVisible = ref(false);
|
const otaVisible = ref(false);
|
||||||
@@ -50,6 +161,7 @@ const otaInfo = ref({
|
|||||||
versionInfo: "",
|
versionInfo: "",
|
||||||
resourceUrl: "",
|
resourceUrl: "",
|
||||||
forceUpdate: false,
|
forceUpdate: false,
|
||||||
|
needUpdate: false,
|
||||||
});
|
});
|
||||||
const isStartingOta = ref(false);
|
const isStartingOta = ref(false);
|
||||||
let isCheckingOta = false;
|
let isCheckingOta = false;
|
||||||
@@ -107,6 +219,8 @@ const applyOtaVersionInfo = (versionInfo) => {
|
|||||||
versionInfo: versionInfo?.versionInfo || "",
|
versionInfo: versionInfo?.versionInfo || "",
|
||||||
resourceUrl: versionInfo?.resourceUrl || "",
|
resourceUrl: versionInfo?.resourceUrl || "",
|
||||||
forceUpdate: Number(versionInfo?.forceUpdate) === 1,
|
forceUpdate: Number(versionInfo?.forceUpdate) === 1,
|
||||||
|
needUpdate:
|
||||||
|
versionInfo?.needUpdate === true || Number(versionInfo?.needUpdate) === 1,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -122,7 +236,7 @@ const checkOtaUpdate = async () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (deviceStatus?.online !== true || otaVisible.value) return;
|
if (normalizeDeviceOnline(deviceStatus?.online) !== true || otaVisible.value) return;
|
||||||
|
|
||||||
let versionInfo;
|
let versionInfo;
|
||||||
try {
|
try {
|
||||||
@@ -130,8 +244,9 @@ const checkOtaUpdate = async () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!versionInfo?.needUpdate || otaVisible.value) return;
|
if (otaVisible.value) return;
|
||||||
applyOtaVersionInfo(versionInfo);
|
applyOtaVersionInfo(versionInfo);
|
||||||
|
if (!otaInfo.value.needUpdate) return;
|
||||||
|
|
||||||
const dismissedAt = uni.getStorageSync("ota_dismissed_at");
|
const dismissedAt = uni.getStorageSync("ota_dismissed_at");
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
@@ -165,7 +280,7 @@ const getOtaWifiUrl = () => {
|
|||||||
`versionNumber=${encodeURIComponent(versionNumber)}`,
|
`versionNumber=${encodeURIComponent(versionNumber)}`,
|
||||||
`resourceUrl=${encodeURIComponent(resourceUrl)}`,
|
`resourceUrl=${encodeURIComponent(resourceUrl)}`,
|
||||||
].join("&");
|
].join("&");
|
||||||
return `/pages/ota-wifi?${query}`;
|
return `/pages/device/ota-wifi?${query}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理 OTA 弹窗暂不更新,强制更新时不允许关闭。
|
// 处理 OTA 弹窗暂不更新,强制更新时不允许关闭。
|
||||||
@@ -189,6 +304,7 @@ const completeHomeOtaUpdate = (runId) => {
|
|||||||
if (!isOtaUpdateRunActive(runId)) return;
|
if (!isOtaUpdateRunActive(runId)) return;
|
||||||
invalidateOtaUpdateRun();
|
invalidateOtaUpdateRun();
|
||||||
isStartingOta.value = false;
|
isStartingOta.value = false;
|
||||||
|
otaInfo.value = {...otaInfo.value, needUpdate: false};
|
||||||
otaProgress.value = 100;
|
otaProgress.value = 100;
|
||||||
const completedRunId = otaUpdateRunId;
|
const completedRunId = otaUpdateRunId;
|
||||||
otaResultTimer = setTimeout(() => {
|
otaResultTimer = setTimeout(() => {
|
||||||
@@ -284,7 +400,7 @@ const handleOtaUpdate = async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deviceStatus?.online !== true) {
|
if (normalizeDeviceOnline(deviceStatus?.online) !== true) {
|
||||||
isStartingOta.value = false;
|
isStartingOta.value = false;
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "请先开启智能弓",
|
title: "请先开启智能弓",
|
||||||
@@ -336,13 +452,72 @@ const toRankListPage = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 清理首页设备相关状态;clearDevice 会同步清空 deviceId 和在线状态。
|
||||||
|
const clearHomeDeviceState = () => {
|
||||||
|
clearDevice();
|
||||||
|
uni.setStorageSync("calibration", false);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 从后端同步首页设备绑定关系和连接状态,绑定关系与在线状态共同决定卡片三态。
|
||||||
|
const syncHomeDevice = async () => {
|
||||||
|
let devices;
|
||||||
|
try {
|
||||||
|
devices = await getMyDevicesAPI();
|
||||||
|
} catch (error) {
|
||||||
|
// 绑定接口失败时保留当前设备,避免网络抖动被误判为未绑定。
|
||||||
|
console.log("同步首页设备绑定失败", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bindings = devices?.bindings;
|
||||||
|
|
||||||
|
// 服务端用 null 或空数组表示当前账号没有绑定设备。
|
||||||
|
if (bindings === null || (Array.isArray(bindings) && bindings.length === 0)) {
|
||||||
|
clearHomeDeviceState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// bindings 缺失或类型错误才属于异常响应,保留已有设备状态。
|
||||||
|
if (!Array.isArray(bindings)) {
|
||||||
|
console.log("首页设备绑定响应格式异常", devices);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentDevice = bindings.find((item) => item?.deviceId);
|
||||||
|
if (!currentDevice) {
|
||||||
|
clearHomeDeviceState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const previousDeviceId = String(device.value?.deviceId || "");
|
||||||
|
const deviceId = String(currentDevice.deviceId || "");
|
||||||
|
updateDevice(
|
||||||
|
deviceId,
|
||||||
|
currentDevice.deviceName || currentDevice.name || ""
|
||||||
|
);
|
||||||
|
|
||||||
|
// 切换到新设备时先以离线态初始化,避免沿用上一台设备的在线状态。
|
||||||
|
if (previousDeviceId !== deviceId) {
|
||||||
|
updateOnline(false);
|
||||||
|
updateDeviceBattery(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
await refreshHomeDeviceStatus();
|
||||||
|
};
|
||||||
|
|
||||||
onShow(async (options) => {
|
onShow(async (options) => {
|
||||||
|
isHomePageVisible = true;
|
||||||
|
startHomeDeviceStatusPolling();
|
||||||
|
|
||||||
const env = uni.getAccountInfoSync().miniProgram.envVersion;
|
const env = uni.getAccountInfoSync().miniProgram.envVersion;
|
||||||
const token = uni.getStorageSync(`${env}_token`);
|
const token = uni.getStorageSync(`${env}_token`);
|
||||||
|
|
||||||
// 检查是否从 OTA 更新页面返回
|
// 检查是否从 OTA 更新页面返回
|
||||||
if (options && options.updateResult) {
|
if (options && options.updateResult) {
|
||||||
otaState.value = options.updateResult;
|
otaState.value = options.updateResult;
|
||||||
|
if (options.updateResult === "update_success") {
|
||||||
|
otaInfo.value = {...otaInfo.value, needUpdate: false};
|
||||||
|
}
|
||||||
otaVisible.value = true;
|
otaVisible.value = true;
|
||||||
} else if (token || user.value.id) {
|
} else if (token || user.value.id) {
|
||||||
await checkOtaUpdate();
|
await checkOtaUpdate();
|
||||||
@@ -400,19 +575,17 @@ onShow(async (options) => {
|
|||||||
showGuide.value = false;
|
showGuide.value = false;
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
const devices = await getMyDevicesAPI();
|
await syncHomeDevice();
|
||||||
if (devices.bindings && devices.bindings.length) {
|
|
||||||
updateDevice(
|
|
||||||
devices.bindings[0].deviceId,
|
|
||||||
devices.bindings[0].deviceName
|
|
||||||
);
|
|
||||||
const data = await getDeviceBatteryAPI();
|
|
||||||
updateOnline(data.online);
|
|
||||||
} else {
|
|
||||||
clearDevice();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 登录态或绑定设备可能在本次 onShow 中发生变化,按最新状态重建轮询。
|
||||||
|
startHomeDeviceStatusPolling();
|
||||||
|
});
|
||||||
|
|
||||||
|
onHide(() => {
|
||||||
|
isHomePageVisible = false;
|
||||||
|
stopHomeDeviceStatusPolling();
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
@@ -422,6 +595,8 @@ onMounted(async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
isHomePageVisible = false;
|
||||||
|
stopHomeDeviceStatusPolling();
|
||||||
invalidateOtaUpdateRun();
|
invalidateOtaUpdateRun();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -468,30 +643,90 @@ onShareTimeline(() => {
|
|||||||
/> -->
|
/> -->
|
||||||
</view>
|
</view>
|
||||||
<UserHeader showRank :onSignin="() => (showModal = true)"/>
|
<UserHeader showRank :onSignin="() => (showModal = true)"/>
|
||||||
<view :style="{ padding: '12px 10px' }">
|
<view :style="{ padding: '24rpx 20rpx' }">
|
||||||
<view class="feature-grid">
|
<view class="feature-grid">
|
||||||
<view class="bow-card">
|
<view class="bow-card">
|
||||||
|
<view
|
||||||
|
class="device-visual"
|
||||||
|
@click="$clickSound(() => toPage('/pages/device/my-device'))"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="device-visual-background"
|
||||||
|
:src="deviceCardAsset.background"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
<image
|
||||||
|
class="device-visual-bow"
|
||||||
|
:src="deviceCardAsset.bow"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
<view
|
||||||
|
v-if="user.id && deviceCardState === 'offline'"
|
||||||
|
class="device-status-badge device-status-badge--offline"
|
||||||
|
@click.stop="$clickSound(() => toPage('/pages/device/my-device'))"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="device-status-icon"
|
||||||
|
src="../static/home-device/device-state-dot--offline.png"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
<text>未连接</text>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
v-if="user.id && deviceCardState === 'online'"
|
||||||
|
class="device-status-badge device-status-badge--online"
|
||||||
|
@click.stop="$clickSound(() => toPage('/pages/device/my-device'))"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
v-if="otaInfo.needUpdate"
|
||||||
|
class="device-status-refresh"
|
||||||
|
src="../static/home-device/device-state-refresh.png"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
<view class="device-battery-value">
|
||||||
|
<image
|
||||||
|
class="device-battery-frame"
|
||||||
|
src="../static/home-device/device-state-battery.png"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
<text class="device-battery-text">{{ deviceBattery === null ? "--" : deviceBattery }}</text>
|
||||||
|
</view>
|
||||||
|
<image
|
||||||
|
class="device-status-icon device-status-icon--online"
|
||||||
|
src="../static/home-device/device-state-dot--online.png"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="device-action-badge"
|
||||||
|
:class="`device-action-badge--${deviceCardState}`"
|
||||||
|
@click.stop="$clickSound(() => toPage('/pages/device/my-device'))"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="device-action-background"
|
||||||
|
:src="deviceCardAsset.actionBackground"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
<image
|
||||||
|
v-if="deviceCardState === 'unbound'"
|
||||||
|
class="device-action-bind-icon"
|
||||||
|
src="../static/home-device/device-action-bind-icon.png"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
<text
|
||||||
|
:class="{
|
||||||
|
'device-action-text--bound': deviceCardState !== 'unbound'
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
{{ deviceCardState === "unbound" ? "绑定智能弓箭" : "我的设备" }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<image
|
<image
|
||||||
v-if="online"
|
class="device-tutorial"
|
||||||
src="https://static.shelingxingqiu.com/attachment/2025-08-07/dbvt1o6dvhr2rop3kn.webp"
|
|
||||||
mode="widthFix"
|
|
||||||
@click="() => toPage('/pages/my-device')"
|
|
||||||
/>
|
|
||||||
<image
|
|
||||||
v-else
|
|
||||||
src="https://static.shelingxingqiu.com/attachment/2026-01-04/dffohwtk1gwh0xfa6h.png"
|
|
||||||
mode="widthFix"
|
|
||||||
@click="$clickSound(() => toPage('/pages/my-device'))"
|
|
||||||
/>
|
|
||||||
<block v-if="user.id">
|
|
||||||
<text v-if="!device.deviceId">绑定我的智能弓</text>
|
|
||||||
<text v-else-if="!online">设备离线</text>
|
|
||||||
<text v-else-if="online">设备在线</text>
|
|
||||||
</block>
|
|
||||||
<image
|
|
||||||
src="https://static.shelingxingqiu.com/shootmini/static/first-try.png"
|
src="https://static.shelingxingqiu.com/shootmini/static/first-try.png"
|
||||||
mode="widthFix"
|
mode="scaleToFill"
|
||||||
@click="() => toPage('/pages/first-try')"
|
@click="$clickSound(() => toPage('/pages/first-try'))"
|
||||||
/>
|
/>
|
||||||
<BubbleTip v-if="showGuide" :location="{ top: '60%', left: '47%' }">
|
<BubbleTip v-if="showGuide" :location="{ top: '60%', left: '47%' }">
|
||||||
<text>新人必刷!</text>
|
<text>新人必刷!</text>
|
||||||
@@ -599,7 +834,7 @@ onShareTimeline(() => {
|
|||||||
.feature-grid {
|
.feature-grid {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.feature-grid > view {
|
.feature-grid > view {
|
||||||
@@ -614,22 +849,168 @@ onShareTimeline(() => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.feature-grid > view > image {
|
.device-visual {
|
||||||
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 390rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #16161e;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bow-card > text {
|
.device-visual-background,
|
||||||
|
.device-visual-bow {
|
||||||
|
display: flex;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 66%;
|
pointer-events: none;
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
white-space: nowrap;
|
|
||||||
font-size: 13px;
|
|
||||||
color: #b3b3b3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.bow-card > image:nth-child(3) {
|
.device-visual-background {
|
||||||
transform: translateY(-1px);
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-visual-bow {
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 388rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status-badge,
|
||||||
|
.device-action-badge {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 10rpx;
|
||||||
|
right: 14rpx;
|
||||||
|
z-index: 2;
|
||||||
|
height: 34rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-family: Inter-Regular, sans-serif;
|
||||||
|
font-size: 18rpx;
|
||||||
|
line-height: 18rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status-badge--online {
|
||||||
|
top: 9rpx;
|
||||||
|
right: 10rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status-badge--offline .device-status-icon {
|
||||||
|
margin-right: 6rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status-badge--online .device-status-icon--online {
|
||||||
|
margin-left: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status-icon {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status-icon--online {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status-refresh {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 三个状态项使用等大的方形槽位,电池框在槽位内垂直居中。 */
|
||||||
|
.device-battery-value {
|
||||||
|
position: relative;
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
margin-left: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-battery-frame {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 38rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 文字容器只覆盖电池主体(60rpx),避开右侧凸起,使数字在框内水平垂直居中。 */
|
||||||
|
.device-battery-text {
|
||||||
|
position: absolute;
|
||||||
|
top: 9rpx;
|
||||||
|
left: 0x;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 36rpx;
|
||||||
|
height: 20rpx;
|
||||||
|
font-size: 14rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-action-badge {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 28rpx;
|
||||||
|
left: 50%;
|
||||||
|
z-index: 2;
|
||||||
|
width: 218rpx;
|
||||||
|
height: 56rpx;
|
||||||
|
justify-content: center;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 22rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-action-badge--offline,
|
||||||
|
.device-action-badge--online {
|
||||||
|
width: 166rpx;
|
||||||
|
height: 44rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-action-background {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-action-badge > text,
|
||||||
|
.device-action-bind-icon {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-action-text--bound {
|
||||||
|
background: linear-gradient(90deg, #fcfeef 0%, #fdeaa1 100%);
|
||||||
|
background-clip: text;
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
color: transparent;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-action-bind-icon {
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
margin-right: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-tutorial {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 114rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.play-card {
|
.play-card {
|
||||||
@@ -642,8 +1023,8 @@ onShareTimeline(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ranking-section {
|
.ranking-section {
|
||||||
border-radius: 15px;
|
border-radius: 30rpx;
|
||||||
padding: 15px;
|
padding: 30rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -657,23 +1038,23 @@ onShareTimeline(() => {
|
|||||||
|
|
||||||
.into-btn {
|
.into-btn {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 40px;
|
top: 80rpx;
|
||||||
left: calc(50% - 100px);
|
left: calc(50% - 200rpx);
|
||||||
width: 200px;
|
width: 400rpx;
|
||||||
height: 100px;
|
height: 200rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ranking-players {
|
.ranking-players {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 40rpx;
|
||||||
margin-top: 42%;
|
margin-top: 42%;
|
||||||
border-bottom: 1rpx solid rgba(255, 255, 255, 0.2);
|
border-bottom: 1rpx solid rgba(255, 255, 255, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ranking-players > image:first-child {
|
.ranking-players > image:first-child {
|
||||||
width: 28%;
|
width: 28%;
|
||||||
transform: translateX(-10px) translateY(-8px);
|
transform: translateX(-20rpx) translateY(-16rpx);
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-avatars {
|
.player-avatars {
|
||||||
@@ -682,10 +1063,10 @@ onShareTimeline(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.divide-line {
|
.divide-line {
|
||||||
width: 1px;
|
width: 2rpx;
|
||||||
height: 35px;
|
height: 70rpx;
|
||||||
background-color: #80808033;
|
background-color: #80808033;
|
||||||
margin-right: 8px;
|
margin-right: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-avatar,
|
.player-avatar,
|
||||||
@@ -712,10 +1093,10 @@ onShareTimeline(() => {
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: #777777;
|
background: #777777;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 10px;
|
font-size: 20rpx;
|
||||||
line-height: 18px;
|
line-height: 36rpx;
|
||||||
width: 18px;
|
width: 36rpx;
|
||||||
height: 18px;
|
height: 36rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,20 +1108,20 @@ onShareTimeline(() => {
|
|||||||
|
|
||||||
.more-players {
|
.more-players {
|
||||||
background: #3c445a;
|
background: #3c445a;
|
||||||
font-size: 9px;
|
font-size: 18rpx;
|
||||||
line-height: 80rpx;
|
line-height: 80rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.more-players > text {
|
.more-players > text {
|
||||||
margin-left: 2px;
|
margin-left: 4rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.my-data {
|
.my-data {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-top: 20px;
|
margin-top: 40rpx;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -750,7 +1131,7 @@ onShareTimeline(() => {
|
|||||||
|
|
||||||
.my-data > view:first-child > image {
|
.my-data > view:first-child > image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
transform: translateX(-8px);
|
transform: translateX(-16rpx);
|
||||||
}
|
}
|
||||||
|
|
||||||
.my-data > view:nth-child(2) {
|
.my-data > view:nth-child(2) {
|
||||||
@@ -767,7 +1148,7 @@ onShareTimeline(() => {
|
|||||||
|
|
||||||
.my-data > view:nth-child(2) > view {
|
.my-data > view:nth-child(2) > view {
|
||||||
width: 28%;
|
width: 28%;
|
||||||
border-radius: 10px;
|
border-radius: 20rpx;
|
||||||
background: linear-gradient(180deg, #303b4c 30%, #2c384a 100%);
|
background: linear-gradient(180deg, #303b4c 30%, #2c384a 100%);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -777,7 +1158,7 @@ onShareTimeline(() => {
|
|||||||
|
|
||||||
.my-data > view:nth-child(2) > view > text:last-child {
|
.my-data > view:nth-child(2) > view > text:last-child {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
line-height: 25px;
|
line-height: 50rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -787,7 +1168,7 @@ onShareTimeline(() => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 60px;
|
height: 120rpx;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ const { user, online } = storeToRefs(store);
|
|||||||
const title = ref("");
|
const title = ref("");
|
||||||
const start = ref(null);
|
const start = ref(null);
|
||||||
const battleId = ref("");
|
const battleId = ref("");
|
||||||
|
const targetType = ref(20);
|
||||||
/** 对战模式:1=好友约战 2=排位赛,用于结算页跳转判断 */
|
/** 对战模式:1=好友约战 2=排位赛,用于结算页跳转判断 */
|
||||||
const way = ref(0);
|
const way = ref(0);
|
||||||
const currentRound = ref(1);
|
const currentRound = ref(1);
|
||||||
@@ -254,6 +255,8 @@ watch(online, (newVal, oldVal) => {
|
|||||||
function recoverData(battleInfo, { force = false } = {}) {
|
function recoverData(battleInfo, { force = false } = {}) {
|
||||||
battleInfo = normalizeBattleInfo(battleInfo);
|
battleInfo = normalizeBattleInfo(battleInfo);
|
||||||
if (!battleInfo) return;
|
if (!battleInfo) return;
|
||||||
|
const nextTargetType = Number(battleInfo.targetType ?? battleInfo.target_type);
|
||||||
|
if ([20, 40].includes(nextTargetType)) targetType.value = nextTargetType;
|
||||||
if (battleInfo.status !== undefined) {
|
if (battleInfo.status !== undefined) {
|
||||||
battleEnded = [2, 4].includes(Number(battleInfo.status));
|
battleEnded = [2, 4].includes(Number(battleInfo.status));
|
||||||
}
|
}
|
||||||
@@ -374,6 +377,7 @@ function onMatchSocketState(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onLoad(async (options) => {
|
onLoad(async (options) => {
|
||||||
|
targetType.value = 20;
|
||||||
const returnSnapshot = options.fromReturn ? takeMatchReturnSnapshot() : null;
|
const returnSnapshot = options.fromReturn ? takeMatchReturnSnapshot() : null;
|
||||||
skipNextRestoreOnShow = false;
|
skipNextRestoreOnShow = false;
|
||||||
if (returnSnapshot?.matchId) battleId.value = returnSnapshot.matchId;
|
if (returnSnapshot?.matchId) battleId.value = returnSnapshot.matchId;
|
||||||
@@ -468,6 +472,7 @@ onShow(() => {
|
|||||||
:guide="false"
|
:guide="false"
|
||||||
:isBattle="true"
|
:isBattle="true"
|
||||||
:count="readyTime"
|
:count="readyTime"
|
||||||
|
:targetType="targetType"
|
||||||
/>
|
/>
|
||||||
<ShootProgress
|
<ShootProgress
|
||||||
:show="start"
|
:show="start"
|
||||||
@@ -490,6 +495,7 @@ onShow(() => {
|
|||||||
:totalRound="12"
|
:totalRound="12"
|
||||||
:scores="playersScores.map((r) => r[user.id]).flat()"
|
:scores="playersScores.map((r) => r[user.id]).flat()"
|
||||||
:isSvip="isCurrentUserSvip"
|
:isSvip="isCurrentUserSvip"
|
||||||
|
:targetType="targetType"
|
||||||
:stop="halfRest"
|
:stop="halfRest"
|
||||||
stable-shot-effect
|
stable-shot-effect
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -13,19 +13,10 @@ const { user } = storeToRefs(store);
|
|||||||
const arrows = ref([]);
|
const arrows = ref([]);
|
||||||
const isSvip = ref(false);
|
const isSvip = ref(false);
|
||||||
const practiseDetail = ref({});
|
const practiseDetail = ref({});
|
||||||
const trainingTypeNameMap = Object.freeze({
|
|
||||||
base: "基础训练",
|
|
||||||
endurance: "耐力训练",
|
|
||||||
precision: "精准训练",
|
|
||||||
rhythm: "节奏训练",
|
|
||||||
});
|
|
||||||
|
|
||||||
const trainingType = computed(() =>
|
const trainingType = computed(() =>
|
||||||
String(practiseDetail.value.trainingType || "").trim().toLowerCase()
|
String(practiseDetail.value.trainingType || "").trim().toLowerCase()
|
||||||
);
|
);
|
||||||
const trainingTypeName = computed(
|
|
||||||
() => trainingTypeNameMap[trainingType.value] || "自由训练"
|
|
||||||
);
|
|
||||||
const targetTypeText = computed(() => {
|
const targetTypeText = computed(() => {
|
||||||
const targetType = Number(practiseDetail.value.targetType);
|
const targetType = Number(practiseDetail.value.targetType);
|
||||||
return targetType > 0 ? `${targetType}CM靶` : "";
|
return targetType > 0 ? `${targetType}CM靶` : "";
|
||||||
@@ -82,7 +73,7 @@ onLoad(async (options) => {
|
|||||||
</view> -->
|
</view> -->
|
||||||
<view v-if="practiseDetail.id" class="practice-meta">
|
<view v-if="practiseDetail.id" class="practice-meta">
|
||||||
<text v-if="targetTypeText">{{ targetTypeText }}</text>
|
<text v-if="targetTypeText">{{ targetTypeText }}</text>
|
||||||
<text>{{ trainingTypeName }}</text>
|
<text>{{ practiseDetail.trainingTypeText }}</text>
|
||||||
<text v-if="difficultyText">{{ difficultyText }}</text>
|
<text v-if="difficultyText">{{ difficultyText }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view :style="{ marginBottom: '20px' }">
|
<view :style="{ marginBottom: '20px' }">
|
||||||
|
|||||||
@@ -1,526 +0,0 @@
|
|||||||
<script setup>
|
|
||||||
import { computed, ref } from "vue";
|
|
||||||
import { onShow } from "@dcloudio/uni-app";
|
|
||||||
import Container from "@/components/Container.vue";
|
|
||||||
import ScreenHint from "@/components/ScreenHint.vue";
|
|
||||||
import SButton from "@/components/SButton.vue";
|
|
||||||
import {
|
|
||||||
bindDeviceAPI,
|
|
||||||
getMyDevicesAPI,
|
|
||||||
unbindDeviceAPI,
|
|
||||||
laserAimAPI, bindDeviceAPIV2,
|
|
||||||
} from "@/apis";
|
|
||||||
import useStore from "@/store";
|
|
||||||
import { storeToRefs } from "pinia";
|
|
||||||
const showTip = ref(false);
|
|
||||||
const confirmBindTip = ref(false);
|
|
||||||
const addDevice = ref();
|
|
||||||
const store = useStore();
|
|
||||||
const { updateDevice, clearDevice } = store;
|
|
||||||
const { user, device } = storeToRefs(store);
|
|
||||||
const justBind = ref(false);
|
|
||||||
const calibration = ref(false);
|
|
||||||
const token = ref(null);
|
|
||||||
const isSVip = computed(() => user.value.sVip === true);
|
|
||||||
const isVip = computed(() => user.value.vip === true && !isSVip.value);
|
|
||||||
|
|
||||||
// 扫描二维码方法
|
|
||||||
const handleScan = () => {
|
|
||||||
// 调用扫码API
|
|
||||||
uni.scanCode({
|
|
||||||
// 只支持扫码二维码
|
|
||||||
onlyFromCamera: true,
|
|
||||||
scanType: ["qrCode"],
|
|
||||||
success: async (res) => {
|
|
||||||
try {
|
|
||||||
// const base64Decode = (str) => {
|
|
||||||
// // 将 base64 转换为 utf8 字符串
|
|
||||||
// const bytes = wx.base64ToArrayBuffer(str);
|
|
||||||
// return String.fromCharCode.apply(null, new Uint8Array(bytes));
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// addDevice.value = JSON.parse(base64Decode(res.result));
|
|
||||||
token.value = res.result;
|
|
||||||
confirmBindTip.value = true;
|
|
||||||
} catch (err) {
|
|
||||||
uni.showToast({
|
|
||||||
title: "无效二维码",
|
|
||||||
icon: "none",
|
|
||||||
duration: 2000,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
console.error("扫码失败:", err);
|
|
||||||
uni.showToast({
|
|
||||||
title: "扫码失败",
|
|
||||||
icon: "error",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const confirmBind = async () => {
|
|
||||||
if (!justBind.value && token.value) {
|
|
||||||
const result = await bindDeviceAPIV2(token.value);
|
|
||||||
confirmBindTip.value = false;
|
|
||||||
if (result.binded) {
|
|
||||||
return uni.showToast({
|
|
||||||
title: "设备已绑定其他账号,请解绑后再绑定",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
updateDevice(result.deviceId, result.name);
|
|
||||||
justBind.value = true;
|
|
||||||
uni.showToast({
|
|
||||||
title: "绑定成功",
|
|
||||||
icon: "success",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const toFristTryPage = () => {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pages/first-try",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const unbindDevice = async () => {
|
|
||||||
try {
|
|
||||||
await unbindDeviceAPI(device.value.deviceId);
|
|
||||||
} catch (error) {
|
|
||||||
if (error?.type === "DEVICE_BIND_INVALID") {
|
|
||||||
uni.setStorageSync("calibration", false);
|
|
||||||
clearDevice();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uni.setStorageSync("calibration", false);
|
|
||||||
uni.showToast({
|
|
||||||
title: "解绑成功",
|
|
||||||
icon: "success",
|
|
||||||
});
|
|
||||||
clearDevice();
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 连接wifi跳转到wifi列表页面 */
|
|
||||||
const joinWifi = () => {
|
|
||||||
uni.navigateTo({ url: "/pages/ota-wifi" });
|
|
||||||
};
|
|
||||||
|
|
||||||
const toDeviceIntroPage = () => {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pages/device-intro",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const backToHome = () => {
|
|
||||||
uni.navigateBack();
|
|
||||||
};
|
|
||||||
|
|
||||||
const copyEmail = () => {
|
|
||||||
uni.setClipboardData({
|
|
||||||
data: "shelingxingqiu@163.com",
|
|
||||||
success: () => {
|
|
||||||
uni.showToast({
|
|
||||||
title: "邮箱已复制",
|
|
||||||
icon: "success",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const goCalibration = async () => {
|
|
||||||
await laserAimAPI();
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pages/calibration",
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const syncDeviceBinding = async () => {
|
|
||||||
if (!user.value.id) return;
|
|
||||||
try {
|
|
||||||
const devices = await getMyDevicesAPI();
|
|
||||||
if (devices.bindings && devices.bindings.length) {
|
|
||||||
updateDevice(devices.bindings[0].deviceId, devices.bindings[0].deviceName);
|
|
||||||
} else {
|
|
||||||
clearDevice();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log("sync device binding error", error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
onShow(async () => {
|
|
||||||
calibration.value = uni.getStorageSync("calibration");
|
|
||||||
await syncDeviceBinding();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Container title="弓箭绑定">
|
|
||||||
<view v-if="!device.deviceId" class="scan-code">
|
|
||||||
<button hover-class="none" @click="$clickSound(handleScan)">
|
|
||||||
<image src="https://static.shelingxingqiu.com/shootmini/static/scan.png" mode="widthFix" />
|
|
||||||
</button>
|
|
||||||
<button hover-class="none" @click="showTip = true">
|
|
||||||
<text>扫</text>
|
|
||||||
<text :style="{ color: '#fed847' }">射灵弓箭</text>
|
|
||||||
<text>上的二维码</text>
|
|
||||||
<image src="../static/s-question-mark-white.png" mode="widthFix" />
|
|
||||||
</button>
|
|
||||||
<text>射灵智能弓箭,三模传感系统与独创靶环算法,</text>
|
|
||||||
<text>毫秒级在线实时对战,让你拥有全球约战的乐趣!</text>
|
|
||||||
<button hover-class="none" @click="toDeviceIntroPage">
|
|
||||||
<image src="https://static.shelingxingqiu.com/shootmini/static/have-no-device.png" mode="widthFix" />
|
|
||||||
</button>
|
|
||||||
<ScreenHint
|
|
||||||
mode="square"
|
|
||||||
:show="showTip"
|
|
||||||
:onClose="() => (showTip = false)"
|
|
||||||
>
|
|
||||||
<view class="scan-tips">
|
|
||||||
<text>扫码绑定设灵弓箭</text>
|
|
||||||
<image
|
|
||||||
src="https://static.shelingxingqiu.com/attachment/2025-08-05/dbuacrelri7jr3axiy.png"
|
|
||||||
mode="widthFix"
|
|
||||||
/>
|
|
||||||
<text>【注】已被绑定的弓箭无法再次绑定。</text>
|
|
||||||
<view>
|
|
||||||
<text>如有任何疑问,请随时联系:</text>
|
|
||||||
<button hover-class="none" @click="copyEmail">
|
|
||||||
shelingxingqiu@163.com
|
|
||||||
</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</ScreenHint>
|
|
||||||
<ScreenHint
|
|
||||||
:show="confirmBindTip"
|
|
||||||
:onClose="() => (confirmBindTip = false)"
|
|
||||||
>
|
|
||||||
<view class="confirm-bind">
|
|
||||||
<text
|
|
||||||
>智能弓箭和系统账号需一一对应,你确定要将<text
|
|
||||||
:style="{ color: '#fed847' }"
|
|
||||||
>当前登录用户账号</text
|
|
||||||
>绑定<text :style="{ color: '#fed847' }">这把弓箭</text>吗?
|
|
||||||
绑定后不可随意更换。</text
|
|
||||||
>
|
|
||||||
<view>
|
|
||||||
<view @click="confirmBind">确认绑定</view>
|
|
||||||
<view @click="() => (confirmBindTip = false)">取消</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</ScreenHint>
|
|
||||||
</view>
|
|
||||||
<view v-if="justBind" class="just-bind">
|
|
||||||
<view
|
|
||||||
class="device-binded"
|
|
||||||
:style="{ marginBottom: calibration ? '250rpx' : '100rpx' }"
|
|
||||||
>
|
|
||||||
<view>
|
|
||||||
<image src="https://static.shelingxingqiu.com/shootmini/static/device-icon.png" mode="widthFix" />
|
|
||||||
<text>{{ device.deviceName }}</text>
|
|
||||||
<view class="calibration" v-if="calibration">
|
|
||||||
<button hover-class="none" @click="goCalibration">
|
|
||||||
<text>重新校准</text>
|
|
||||||
<image src="../static/enter-arrow-blue.png" mode="widthFix" />
|
|
||||||
</button>
|
|
||||||
<view>
|
|
||||||
<image src="../static/calibration-tip.png" mode="widthFix" />
|
|
||||||
<text>如有场地/距离变化,需重新校准以保证智能弓射箭精准度</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<image src="../static/bind-success.png" mode="widthFix" />
|
|
||||||
<view>
|
|
||||||
<image
|
|
||||||
:src="user.avatar || '../static/user-icon.png'"
|
|
||||||
mode="widthFix"
|
|
||||||
:style="{ borderRadius: '50%' }"
|
|
||||||
/>
|
|
||||||
<view
|
|
||||||
:class="[
|
|
||||||
'member-nickname',
|
|
||||||
isVip ? 'member-nickname--vip' : '',
|
|
||||||
isSVip ? 'member-nickname--svip' : '',
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<text class="member-nickname__text">{{ user.nickName }}</text>
|
|
||||||
<text v-if="isSVip" class="member-nickname__shine">{{
|
|
||||||
user.nickName
|
|
||||||
}}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- <block v-if="calibration"> -->
|
|
||||||
<view>
|
|
||||||
<text>恭喜,你的弓箭和账号已成功绑定!</text>
|
|
||||||
<text :style="{ color: '#fed847' }">已赠送6个月射灵世界会员</text>
|
|
||||||
</view>
|
|
||||||
<!-- <SButton :onClick="goCalibration" width="60vw" :rounded="40">
|
|
||||||
开启智能弓进行校准
|
|
||||||
</SButton>
|
|
||||||
<text :style="{ marginTop: '20rpx', fontSize: '24rpx', color: '#fff9' }"
|
|
||||||
>校准时弓箭激光将开启,请勿直视激光</text
|
|
||||||
> -->
|
|
||||||
|
|
||||||
<view>
|
|
||||||
<SButton
|
|
||||||
:onClick="backToHome"
|
|
||||||
backgroundColor="#fff3"
|
|
||||||
color="#fff"
|
|
||||||
width="60vw"
|
|
||||||
:rounded="40"
|
|
||||||
>返回首页</SButton
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
<view :style="{ marginTop: '15px' }">
|
|
||||||
<SButton :onClick="toFristTryPage" width="60vw" :rounded="40">进入新手试炼</SButton>
|
|
||||||
</view>
|
|
||||||
<!-- </block> -->
|
|
||||||
<!-- <block v-else>
|
|
||||||
|
|
||||||
</block> -->
|
|
||||||
</view>
|
|
||||||
<view v-if="device.deviceId && !justBind" class="has-device">
|
|
||||||
<view class="device-binded">
|
|
||||||
<view>
|
|
||||||
<image src="https://static.shelingxingqiu.com/shootmini/static/device-icon.png" mode="widthFix" />
|
|
||||||
<text>{{ device.deviceName }}</text>
|
|
||||||
<view class="calibration">
|
|
||||||
<button hover-class="none" @click="goCalibration">
|
|
||||||
<text>去校准</text>
|
|
||||||
<image src="../static/enter-arrow-blue.png" mode="widthFix" />
|
|
||||||
</button>
|
|
||||||
<view>
|
|
||||||
<image src="../static/calibration-tip.png" mode="widthFix" />
|
|
||||||
<text
|
|
||||||
>首次绑定智能弓或场地/距离变化时,应进行校准以确保射箭精度</text
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<image src="../static/bind.png" mode="widthFix" />
|
|
||||||
<view>
|
|
||||||
<image
|
|
||||||
:src="user.avatar || '../static/user-icon.png'"
|
|
||||||
mode="widthFix"
|
|
||||||
:style="{ borderRadius: '50%' }"
|
|
||||||
/>
|
|
||||||
<view
|
|
||||||
:class="[
|
|
||||||
'member-nickname',
|
|
||||||
isVip ? 'member-nickname--vip' : '',
|
|
||||||
isSVip ? 'member-nickname--svip' : '',
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<text class="member-nickname__text">{{ user.nickName }}</text>
|
|
||||||
<text v-if="isSVip" class="member-nickname__shine">{{
|
|
||||||
user.nickName
|
|
||||||
}}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view :style="{ marginTop: '240rpx' }">
|
|
||||||
<SButton :onClick="() => $clickSound(unbindDevice)" width="80vw" :rounded="40"
|
|
||||||
>解绑</SButton
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
<view :style="{ marginTop: '20rpx' }">
|
|
||||||
<SButton :onClick="() => $clickSound(joinWifi)" width="80vw" :rounded="40"
|
|
||||||
>设备连接WIFI</SButton
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</Container>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.scan-code,
|
|
||||||
.just-bind,
|
|
||||||
.has-device {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-around;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.scan-code {
|
|
||||||
justify-content: flex-start;
|
|
||||||
}
|
|
||||||
.scan-code > button:first-child {
|
|
||||||
margin-top: 22%;
|
|
||||||
}
|
|
||||||
.scan-code > button:first-child > image {
|
|
||||||
width: 300rpx;
|
|
||||||
}
|
|
||||||
.scan-code > button:nth-child(2) {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
font-size: 26rpx;
|
|
||||||
color: #ffffff;
|
|
||||||
margin: 50rpx;
|
|
||||||
}
|
|
||||||
.scan-code > button:nth-child(2) > image {
|
|
||||||
width: 28rpx;
|
|
||||||
margin-left: 10rpx;
|
|
||||||
}
|
|
||||||
.scan-code > text {
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #fff9;
|
|
||||||
}
|
|
||||||
.scan-code > button:nth-child(5) {
|
|
||||||
margin-top: 25%;
|
|
||||||
}
|
|
||||||
.scan-code > button:nth-child(5) > image {
|
|
||||||
width: 380rpx;
|
|
||||||
}
|
|
||||||
.scan-tips {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
font-size: 14px;
|
|
||||||
width: 90%;
|
|
||||||
margin-top: 20%;
|
|
||||||
}
|
|
||||||
.scan-tips > text {
|
|
||||||
margin-bottom: 2px;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 24rpx;
|
|
||||||
}
|
|
||||||
.scan-tips > text:first-child {
|
|
||||||
color: #fed847;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
font-size: 32rpx;
|
|
||||||
}
|
|
||||||
.scan-tips > view {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-start;
|
|
||||||
}
|
|
||||||
.scan-tips > view:last-child {
|
|
||||||
margin-top: 5px;
|
|
||||||
font-size: 26rpx;
|
|
||||||
}
|
|
||||||
.scan-tips > view:last-child > button {
|
|
||||||
font-size: 30rpx;
|
|
||||||
color: #39a8ff;
|
|
||||||
}
|
|
||||||
.scan-tips > image {
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
.confirm-bind {
|
|
||||||
color: #fff9;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.confirm-bind > view:last-child {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
.confirm-bind > view:last-child > view {
|
|
||||||
width: 48%;
|
|
||||||
border-radius: 20px;
|
|
||||||
background-color: #fed847;
|
|
||||||
color: #000;
|
|
||||||
line-height: 40px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.confirm-bind > view:last-child > view:nth-child(2) {
|
|
||||||
color: #fff;
|
|
||||||
background-color: #fff3;
|
|
||||||
}
|
|
||||||
.device-binded {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 14px;
|
|
||||||
margin-top: 200rpx;
|
|
||||||
}
|
|
||||||
.device-binded > view {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
position: relative;
|
|
||||||
font-size: 26rpx;
|
|
||||||
}
|
|
||||||
.device-binded > view > image {
|
|
||||||
width: 140rpx;
|
|
||||||
height: 140rpx;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
border-radius: 12px;
|
|
||||||
}
|
|
||||||
.device-binded > view > text {
|
|
||||||
width: 120px;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.device-binded .member-nickname {
|
|
||||||
justify-content: center;
|
|
||||||
width: 120px;
|
|
||||||
}
|
|
||||||
.device-binded .member-nickname__text,
|
|
||||||
.device-binded .member-nickname__shine {
|
|
||||||
font-size: 26rpx;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.device-binded > image {
|
|
||||||
width: 100rpx;
|
|
||||||
margin: 0 20px;
|
|
||||||
}
|
|
||||||
.has-device,
|
|
||||||
.just-bind {
|
|
||||||
justify-content: flex-start;
|
|
||||||
}
|
|
||||||
.has-device > view:nth-child(2),
|
|
||||||
.just-bind > view:nth-child(2) {
|
|
||||||
color: #fff9;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 28rpx;
|
|
||||||
margin-bottom: 100rpx;
|
|
||||||
}
|
|
||||||
.has-device > view:nth-child(2) > text,
|
|
||||||
.just-bind > view:nth-child(2) > text {
|
|
||||||
margin: 5px;
|
|
||||||
}
|
|
||||||
.calibration {
|
|
||||||
position: absolute;
|
|
||||||
bottom: -145rpx;
|
|
||||||
left: 20rpx;
|
|
||||||
}
|
|
||||||
.calibration > button {
|
|
||||||
font-size: 26rpx;
|
|
||||||
color: #287fff;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding-bottom: 15rpx;
|
|
||||||
padding-left: 50rpx;
|
|
||||||
}
|
|
||||||
.calibration > button > image {
|
|
||||||
width: 28rpx;
|
|
||||||
height: 28rpx;
|
|
||||||
}
|
|
||||||
.calibration > view {
|
|
||||||
position: relative;
|
|
||||||
font-size: 22rpx;
|
|
||||||
color: #fff9;
|
|
||||||
padding-top: 34rpx;
|
|
||||||
padding-left: 35rpx;
|
|
||||||
width: 322rpx;
|
|
||||||
}
|
|
||||||
.calibration > view > image {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 370rpx;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -15,17 +15,6 @@ const selectedIndex = ref(0);
|
|||||||
const matchList = ref([]);
|
const matchList = ref([]);
|
||||||
const battleList = ref([]);
|
const battleList = ref([]);
|
||||||
const practiseList = ref([]);
|
const practiseList = ref([]);
|
||||||
const trainingTypeNameMap = Object.freeze({
|
|
||||||
base: "基础训练",
|
|
||||||
endurance: "耐力训练",
|
|
||||||
precision: "精准训练",
|
|
||||||
rhythm: "节奏训练",
|
|
||||||
});
|
|
||||||
|
|
||||||
const getTrainingTypeName = (trainingType) => {
|
|
||||||
const normalizedType = String(trainingType || "").trim().toLowerCase();
|
|
||||||
return trainingTypeNameMap[normalizedType] || "自由训练";
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatPractiseTime = (value) => {
|
const formatPractiseTime = (value) => {
|
||||||
const normalizedTime = String(value || "").trim();
|
const normalizedTime = String(value || "").trim();
|
||||||
@@ -172,7 +161,7 @@ onLoad((options) => {
|
|||||||
@click="() => getPractiseDetail(item.id)"
|
@click="() => getPractiseDetail(item.id)"
|
||||||
>
|
>
|
||||||
<text
|
<text
|
||||||
>{{ getTrainingTypeName(item.trainingType) }}
|
>{{ item.trainingTypeText }}
|
||||||
{{ formatPractiseTime(item.createTime) }}</text
|
{{ formatPractiseTime(item.createTime) }}</text
|
||||||
>
|
>
|
||||||
<image src="../static/back.png" mode="widthFix" />
|
<image src="../static/back.png" mode="widthFix" />
|
||||||
|
|||||||
@@ -1,16 +1,35 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import Signin from "@/components/Signin.vue";
|
import Signin from "@/components/Signin.vue";
|
||||||
import SButton from "@/components/SButton.vue";
|
import SButton from "@/components/SButton.vue";
|
||||||
|
import Avatar from "@/components/Avatar.vue";
|
||||||
|
import AppBackground from "@/components/AppBackground.vue";
|
||||||
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
|
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
|
||||||
import { tempBindOrgAPI } from "@/apis";
|
import { tempBindOrgAPI } from "@/apis";
|
||||||
|
import useStore from "@/store";
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
|
|
||||||
|
const store = useStore();
|
||||||
|
const { user } = storeToRefs(store);
|
||||||
|
|
||||||
const scene = ref("");
|
const scene = ref("");
|
||||||
const status = ref("idle");
|
const status = ref("idle");
|
||||||
const errorMessage = ref("");
|
const errorMessage = ref("");
|
||||||
const showSignin = ref(false);
|
const showSignin = ref(false);
|
||||||
const binding = ref(false);
|
const binding = ref(false);
|
||||||
|
const bindInfo = ref({});
|
||||||
|
|
||||||
|
const successInfo = computed(() => {
|
||||||
|
const result = bindInfo.value || {};
|
||||||
|
|
||||||
|
return {
|
||||||
|
avatar: user.value.avatar,
|
||||||
|
nickName: user.value.nickName || "--",
|
||||||
|
mobile: result.mobile || "--",
|
||||||
|
storeName: result.storeName || "--",
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const getToken = () => {
|
const getToken = () => {
|
||||||
try {
|
try {
|
||||||
@@ -40,9 +59,17 @@ const bindOrg = async () => {
|
|||||||
binding.value = true;
|
binding.value = true;
|
||||||
status.value = "binding";
|
status.value = "binding";
|
||||||
errorMessage.value = "";
|
errorMessage.value = "";
|
||||||
|
bindInfo.value = {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await tempBindOrgAPI(scene.value);
|
const result = (await tempBindOrgAPI(scene.value)) || {};
|
||||||
|
if (result.success !== true) {
|
||||||
|
status.value = "failed";
|
||||||
|
errorMessage.value = result.msg || "授权登录失败,请稍后重试。";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bindInfo.value = result;
|
||||||
status.value = "success";
|
status.value = "success";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error?.type === "AUTH_INVALID") {
|
if (error?.type === "AUTH_INVALID") {
|
||||||
@@ -61,6 +88,10 @@ const handleLoginSuccess = async () => {
|
|||||||
await bindOrg();
|
await bindOrg();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const goHome = () => {
|
||||||
|
uni.reLaunch({ url: "/pages/index" });
|
||||||
|
};
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
try {
|
try {
|
||||||
const value = decodeURIComponent(String(options?.scene || ""));
|
const value = decodeURIComponent(String(options?.scene || ""));
|
||||||
@@ -83,45 +114,74 @@ onLoad((options) => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="page">
|
<view class="page">
|
||||||
|
<AppBackground :type="6" bgColor="#20202c" />
|
||||||
|
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<text class="title">机构设备绑定</text>
|
<text class="title">登录门店Pad端</text>
|
||||||
|
|
||||||
<view v-if="status === 'idle' || status === 'binding'" class="state">
|
<view
|
||||||
<text class="state-title">正在绑定</text>
|
v-if="status === 'idle' || status === 'binding'"
|
||||||
<text class="description">正在绑定机构设备,请稍候……</text>
|
class="state message-state"
|
||||||
|
>
|
||||||
|
<text class="state-title">正在授权登录</text>
|
||||||
|
<text class="description">正在登录门店Pad端,请稍候……</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-else-if="status === 'login'" class="state">
|
<view v-else-if="status === 'login'" class="state login-state">
|
||||||
<text class="state-title">请先登录</text>
|
<image
|
||||||
<text class="description">
|
class="login-icon"
|
||||||
{{
|
src="../static/org-bind/login-icon.png"
|
||||||
errorMessage ||
|
mode="aspectFit"
|
||||||
"登录后即可绑定当前机构设备。关闭登录窗口后,也可以再次点击下方按钮继续。"
|
/>
|
||||||
}}
|
<text class="login-title">{{
|
||||||
</text>
|
errorMessage || "请先登录小程序"
|
||||||
<SButton width="560rpx" :rounded="20" :onClick="openSignin">
|
}}</text>
|
||||||
<text>立即登录</text>
|
<SButton width="600rpx" :rounded="22" :onClick="openSignin">
|
||||||
|
<text>微信授权登录</text>
|
||||||
</SButton>
|
</SButton>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-else-if="status === 'success'" class="state">
|
<view v-else-if="status === 'success'" class="state success-state">
|
||||||
<text class="state-title">绑定成功</text>
|
<view class="avatar-wrap">
|
||||||
<text class="description">
|
<Avatar
|
||||||
您的账号已成功绑定机构设备,请返回 iPad 继续操作。
|
:src="successInfo.avatar"
|
||||||
</text>
|
:size="176"
|
||||||
|
sizeUnit="rpx"
|
||||||
|
imageMode="aspectFill"
|
||||||
|
/>
|
||||||
|
<image
|
||||||
|
class="success-badge"
|
||||||
|
src="../static/org-bind/green-gou.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<text class="success-title">已成功授权登录射灵星球门店Pad端。</text>
|
||||||
|
<view class="account-info">
|
||||||
|
<text>登录账号:{{ successInfo.nickName }}</text>
|
||||||
|
<text>手机号:{{ successInfo.mobile }}</text>
|
||||||
|
<text>登录门店:{{ successInfo.storeName }}</text>
|
||||||
|
<text class="warm-tip">
|
||||||
|
温馨提示:离开门店时候记得在Pad退出登录哦!
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class="success-action">
|
||||||
|
<SButton width="600rpx" :rounded="22" :onClick="goHome">
|
||||||
|
<text>回到首页</text>
|
||||||
|
</SButton>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-else-if="status === 'failed'" class="state">
|
<view v-else-if="status === 'failed'" class="state message-state">
|
||||||
<text class="state-title">绑定失败</text>
|
<text class="state-title">授权登录失败</text>
|
||||||
<text class="description">{{ errorMessage }}</text>
|
<text class="description">{{ errorMessage }}</text>
|
||||||
<SButton width="560rpx" :rounded="20" :onClick="bindOrg">
|
<SButton width="600rpx" :rounded="22" :onClick="bindOrg">
|
||||||
<text>重新绑定</text>
|
<text>重新登录</text>
|
||||||
</SButton>
|
</SButton>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-else class="state">
|
<view v-else class="state message-state">
|
||||||
<text class="state-title">二维码无效</text>
|
<text class="state-title">二维码无效</text>
|
||||||
<text class="description">请重新扫描机构设备上的小程序码。</text>
|
<text class="description">请重新扫描门店Pad端上的小程序码。</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -139,32 +199,99 @@ onLoad((options) => {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
padding: calc(var(--status-bar-height) + 120rpx) 48rpx 80rpx;
|
padding: calc(var(--status-bar-height) + 64rpx) 48rpx 80rpx;
|
||||||
background-color: #000;
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 44rpx;
|
color: #d8ad69;
|
||||||
font-weight: 600;
|
font-size: 30rpx;
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.state {
|
.state {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 120rpx;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.login-state,
|
||||||
|
.success-state {
|
||||||
|
margin-top: 320rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-state {
|
||||||
|
margin-top: 240rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-icon {
|
||||||
|
width: 176rpx;
|
||||||
|
height: 176rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-title {
|
||||||
|
width: 600rpx;
|
||||||
|
margin: 28rpx 0 60rpx;
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar-wrap {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success-badge {
|
||||||
|
position: absolute;
|
||||||
|
right: -2rpx;
|
||||||
|
bottom: 4rpx;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success-title {
|
||||||
|
width: 572rpx;
|
||||||
|
margin-top: 28rpx;
|
||||||
|
color: #fed847;
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 48rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.account-info {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 572rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 52rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warm-tip {
|
||||||
|
margin-top: 40rpx;
|
||||||
|
color: #b8b8bd;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success-action {
|
||||||
|
margin-top: 64rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.state-title {
|
.state-title {
|
||||||
font-size: 36rpx;
|
font-size: 38rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, nextTick, onMounted, onBeforeUnmount } from "vue";
|
import { computed, ref, nextTick, onMounted, onBeforeUnmount } from "vue";
|
||||||
import { onHide, onLoad, onShow } from "@dcloudio/uni-app";
|
import { onHide, onLoad, onShow } from "@dcloudio/uni-app";
|
||||||
import Container from "@/components/Container.vue";
|
import Container from "@/components/Container.vue";
|
||||||
import ShootProgress from "@/components/ShootProgress.vue";
|
import ShootProgress from "@/components/ShootProgress.vue";
|
||||||
@@ -37,6 +37,7 @@ const store = useStore();
|
|||||||
const { user, device } = storeToRefs(store);
|
const { user, device } = storeToRefs(store);
|
||||||
|
|
||||||
const start = ref(false);
|
const start = ref(false);
|
||||||
|
const practiceStarting = ref(false);
|
||||||
const scores = ref([]);
|
const scores = ref([]);
|
||||||
const isSvip = ref(false);
|
const isSvip = ref(false);
|
||||||
const total = 12;
|
const total = 12;
|
||||||
@@ -46,6 +47,9 @@ const serverAddr = ref("");
|
|||||||
const showGuide = ref(false);
|
const showGuide = ref(false);
|
||||||
const tips = ref("");
|
const tips = ref("");
|
||||||
const targetType = ref(1);
|
const targetType = ref(1);
|
||||||
|
const simulatorTargetType = computed(() =>
|
||||||
|
[2, 40].includes(Number(targetType.value)) ? 40 : 20
|
||||||
|
);
|
||||||
const sharing = ref(false);
|
const sharing = ref(false);
|
||||||
const exiting = ref(false);
|
const exiting = ref(false);
|
||||||
const hiddenWhileActive = ref(false);
|
const hiddenWhileActive = ref(false);
|
||||||
@@ -156,12 +160,18 @@ const beginPractise = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onReady = async () => {
|
const onReady = async () => {
|
||||||
const result = await beginPractise();
|
if (practiceStarting.value || start.value) return;
|
||||||
if (!result) return;
|
practiceStarting.value = true;
|
||||||
scores.value = [];
|
try {
|
||||||
isSvip.value = false;
|
const result = await beginPractise();
|
||||||
start.value = true;
|
if (!result) return;
|
||||||
audioManager.play("练习开始");
|
scores.value = [];
|
||||||
|
isSvip.value = false;
|
||||||
|
start.value = true;
|
||||||
|
audioManager.play("练习开始");
|
||||||
|
} finally {
|
||||||
|
practiceStarting.value = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onOver = async (message) => {
|
const onOver = async (message) => {
|
||||||
@@ -438,7 +448,12 @@ onBeforeUnmount(() => {
|
|||||||
:onBack="exitPractise"
|
:onBack="exitPractise"
|
||||||
>
|
>
|
||||||
<view>
|
<view>
|
||||||
<TestDistance v-if="!start && !practiseResult.id" />
|
<TestDistance
|
||||||
|
v-if="!start && !practiseResult.id"
|
||||||
|
:targetType="simulatorTargetType"
|
||||||
|
:autoStart="true"
|
||||||
|
@passed="onReady"
|
||||||
|
/>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<ShootProgress
|
<ShootProgress
|
||||||
:tips="`${
|
:tips="`${
|
||||||
@@ -466,6 +481,7 @@ onBeforeUnmount(() => {
|
|||||||
:currentRound="scores.length % 3"
|
:currentRound="scores.length % 3"
|
||||||
:scores="scores"
|
:scores="scores"
|
||||||
:isSvip="isSvip"
|
:isSvip="isSvip"
|
||||||
|
:targetType="simulatorTargetType"
|
||||||
stable-shot-effect
|
stable-shot-effect
|
||||||
/>
|
/>
|
||||||
<ScorePanel2 :arrows="scores" />
|
<ScorePanel2 :arrows="scores" />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, nextTick, onMounted, onBeforeUnmount } from "vue";
|
import { computed, ref, nextTick, onMounted, onBeforeUnmount } from "vue";
|
||||||
import { onHide, onLoad, onShow } from "@dcloudio/uni-app";
|
import { onHide, onLoad, onShow } from "@dcloudio/uni-app";
|
||||||
import Container from "@/components/Container.vue";
|
import Container from "@/components/Container.vue";
|
||||||
import ShootProgress from "@/components/ShootProgress.vue";
|
import ShootProgress from "@/components/ShootProgress.vue";
|
||||||
@@ -37,6 +37,7 @@ const store = useStore();
|
|||||||
const { user, device } = storeToRefs(store);
|
const { user, device } = storeToRefs(store);
|
||||||
|
|
||||||
const start = ref(false);
|
const start = ref(false);
|
||||||
|
const practiceStarting = ref(false);
|
||||||
const scores = ref([]);
|
const scores = ref([]);
|
||||||
const isSvip = ref(false);
|
const isSvip = ref(false);
|
||||||
const total = 36;
|
const total = 36;
|
||||||
@@ -45,6 +46,9 @@ const practiseId = ref("");
|
|||||||
const serverAddr = ref("");
|
const serverAddr = ref("");
|
||||||
const showGuide = ref(false);
|
const showGuide = ref(false);
|
||||||
const targetType = ref(1);
|
const targetType = ref(1);
|
||||||
|
const simulatorTargetType = computed(() =>
|
||||||
|
[2, 40].includes(Number(targetType.value)) ? 40 : 20
|
||||||
|
);
|
||||||
const sharing = ref(false);
|
const sharing = ref(false);
|
||||||
const exiting = ref(false);
|
const exiting = ref(false);
|
||||||
const hiddenWhileActive = ref(false);
|
const hiddenWhileActive = ref(false);
|
||||||
@@ -155,12 +159,18 @@ const beginPractise = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onReady = async () => {
|
const onReady = async () => {
|
||||||
const result = await beginPractise();
|
if (practiceStarting.value || start.value) return;
|
||||||
if (!result) return;
|
practiceStarting.value = true;
|
||||||
scores.value = [];
|
try {
|
||||||
isSvip.value = false;
|
const result = await beginPractise();
|
||||||
start.value = true;
|
if (!result) return;
|
||||||
audioManager.play("练习开始");
|
scores.value = [];
|
||||||
|
isSvip.value = false;
|
||||||
|
start.value = true;
|
||||||
|
audioManager.play("练习开始");
|
||||||
|
} finally {
|
||||||
|
practiceStarting.value = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onOver = async (message) => {
|
const onOver = async (message) => {
|
||||||
@@ -452,7 +462,12 @@ onBeforeUnmount(() => {
|
|||||||
:onBack="exitPractise"
|
:onBack="exitPractise"
|
||||||
>
|
>
|
||||||
<view>
|
<view>
|
||||||
<TestDistance v-if="!start && !practiseResult.id" />
|
<TestDistance
|
||||||
|
v-if="!start && !practiseResult.id"
|
||||||
|
:targetType="simulatorTargetType"
|
||||||
|
:autoStart="true"
|
||||||
|
@passed="onReady"
|
||||||
|
/>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<ShootProgress
|
<ShootProgress
|
||||||
:tips="`请连续射${total}支箭`"
|
:tips="`请连续射${total}支箭`"
|
||||||
@@ -475,6 +490,7 @@ onBeforeUnmount(() => {
|
|||||||
:totalRound="start ? total : 0"
|
:totalRound="start ? total : 0"
|
||||||
:scores="scores"
|
:scores="scores"
|
||||||
:isSvip="isSvip"
|
:isSvip="isSvip"
|
||||||
|
:targetType="simulatorTargetType"
|
||||||
/>
|
/>
|
||||||
<ScorePanel
|
<ScorePanel
|
||||||
v-if="start"
|
v-if="start"
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
targetType: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 20,
|
||||||
|
},
|
||||||
targetRadius: {
|
targetRadius: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 20,
|
default: 20,
|
||||||
@@ -422,12 +426,19 @@ function getExperienceTipStyle(shot) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
const simulShoot = async () => {
|
const simulShoot = async () => {
|
||||||
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
|
if (device.value.deviceId) {
|
||||||
|
await simulShootAPI(
|
||||||
|
device.value.deviceId,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
props.targetType
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const simulShoot2 = async () => {
|
const simulShoot2 = async () => {
|
||||||
if (device.value.deviceId) {
|
if (device.value.deviceId) {
|
||||||
const r1 = Math.random() > 0.5 ? 0.01 : 0.02;
|
const r1 = Math.random() > 0.5 ? 0.01 : 0.02;
|
||||||
await simulShootAPI(device.value.deviceId, r1, r1);
|
await simulShootAPI(device.value.deviceId, r1, r1, props.targetType);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ const cancelMatching = async () => {
|
|||||||
const goCalibration = async () => {
|
const goCalibration = async () => {
|
||||||
await laserAimAPI();
|
await laserAimAPI();
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/calibration",
|
url: "/pages/device/calibration",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import Avatar from "./Avatar.vue";
|
|||||||
import audioManager from "@/audioManager";
|
import audioManager from "@/audioManager";
|
||||||
import { simulShootAPI } from "@/apis";
|
import { simulShootAPI } from "@/apis";
|
||||||
import { MESSAGETYPESV2 } from "@/constants";
|
import { MESSAGETYPESV2 } from "@/constants";
|
||||||
|
import { getDistanceCheckAudioKey, getDistanceCheckText } from "@/util";
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
@@ -23,9 +24,14 @@ const props = defineProps({
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 15,
|
default: 15,
|
||||||
},
|
},
|
||||||
|
targetType: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 20,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const arrow = ref({});
|
const arrow = ref({});
|
||||||
const distance = ref(0);
|
const distance = ref(0);
|
||||||
|
const statusText = ref("");
|
||||||
const showsimul = ref(false);
|
const showsimul = ref(false);
|
||||||
const count = ref(props.count);
|
const count = ref(props.count);
|
||||||
const timer = ref(null);
|
const timer = ref(null);
|
||||||
@@ -34,7 +40,7 @@ const updateTimer = (value) => {
|
|||||||
count.value = Math.round(value);
|
count.value = Math.round(value);
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
audioManager.play("请射箭测试距离");
|
audioManager.play("请射箭!测试站距与靶纸");
|
||||||
if (props.isBattle) {
|
if (props.isBattle) {
|
||||||
timer.value = setInterval(() => {
|
timer.value = setInterval(() => {
|
||||||
count.value -= 1;
|
count.value -= 1;
|
||||||
@@ -51,19 +57,24 @@ onBeforeUnmount(() => {
|
|||||||
async function onReceiveMessage(msg) {
|
async function onReceiveMessage(msg) {
|
||||||
if (Array.isArray(msg)) return;
|
if (Array.isArray(msg)) return;
|
||||||
if (msg.type === MESSAGETYPESV2.TestDistance) {
|
if (msg.type === MESSAGETYPESV2.TestDistance) {
|
||||||
const rawDistance = Number(msg.shootData?.distance);
|
const rawDistance = Number(msg.shootData?.distance ?? msg.shootData?.dst);
|
||||||
distance.value = Number.isFinite(rawDistance)
|
distance.value = Number.isFinite(rawDistance)
|
||||||
? Number((rawDistance / 100).toFixed(2))
|
? Number((rawDistance / 100).toFixed(2))
|
||||||
: 0;
|
: 0;
|
||||||
if (rawDistance === 0) {
|
statusText.value = getDistanceCheckText(msg.shootData);
|
||||||
audioManager.play("未发现靶纸,请瞄准靶纸射箭");
|
audioManager.play(getDistanceCheckAudioKey(msg.shootData));
|
||||||
} else if (distance.value >= 5) audioManager.play("距离合格");
|
|
||||||
else audioManager.play("距离不足");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const simulShoot = async () => {
|
const simulShoot = async () => {
|
||||||
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
|
if (device.value.deviceId) {
|
||||||
|
await simulShootAPI(
|
||||||
|
device.value.deviceId,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
props.targetType
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -101,13 +112,11 @@ onBeforeUnmount(() => {
|
|||||||
模拟射箭
|
模拟射箭
|
||||||
</button>
|
</button>
|
||||||
<view class="warnning-text">
|
<view class="warnning-text">
|
||||||
<block v-if="distance > 0">
|
<block v-if="statusText">
|
||||||
<text>当前距离{{ distance }}米</text>
|
<text>{{ statusText }}</text>
|
||||||
<text v-if="distance >= 5">已达到距离要求</text>
|
|
||||||
<text v-else>请调整站位</text>
|
|
||||||
</block>
|
</block>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<text>请射箭,测试站距</text>
|
<text>请射箭,测试站距与靶纸</text>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
<view class="user-row">
|
<view class="user-row">
|
||||||
|
|||||||
@@ -20,7 +20,11 @@ import {
|
|||||||
MATCH_WS_STATE_EVENT,
|
MATCH_WS_STATE_EVENT,
|
||||||
} from "@/matchWebsocket";
|
} from "@/matchWebsocket";
|
||||||
import { MESSAGETYPESV2 } from "@/constants";
|
import { MESSAGETYPESV2 } from "@/constants";
|
||||||
import { getDirectionText, getInvalidShotAudioKey } from "@/util";
|
import {
|
||||||
|
getDirectionText,
|
||||||
|
getInvalidShotAudioKey,
|
||||||
|
getInvalidShotText,
|
||||||
|
} from "@/util";
|
||||||
import { takeMatchReturnSnapshot } from "@/utils/matchReturn";
|
import { takeMatchReturnSnapshot } from "@/utils/matchReturn";
|
||||||
import audioManager, {
|
import audioManager, {
|
||||||
AUDIO_INTERRUPTION_BEGIN_EVENT,
|
AUDIO_INTERRUPTION_BEGIN_EVENT,
|
||||||
@@ -63,6 +67,7 @@ const COUNTDOWN_READY_EVENT = "team-battle-countdown-ready";
|
|||||||
const start = ref(null);
|
const start = ref(null);
|
||||||
const tips = ref("");
|
const tips = ref("");
|
||||||
const battleId = ref("");
|
const battleId = ref("");
|
||||||
|
const targetType = ref(20);
|
||||||
const currentRound = ref(0);
|
const currentRound = ref(0);
|
||||||
const roundTipRound = ref(0);
|
const roundTipRound = ref(0);
|
||||||
const goldenRound = ref(0);
|
const goldenRound = ref(0);
|
||||||
@@ -650,6 +655,8 @@ function applyBattleBase(battleInfo) {
|
|||||||
battleInfo = normalizeBattleInfo(battleInfo);
|
battleInfo = normalizeBattleInfo(battleInfo);
|
||||||
if (!battleInfo) return;
|
if (!battleInfo) return;
|
||||||
if (battleInfo.matchId) battleId.value = battleInfo.matchId;
|
if (battleInfo.matchId) battleId.value = battleInfo.matchId;
|
||||||
|
const nextTargetType = Number(battleInfo.targetType ?? battleInfo.target_type);
|
||||||
|
if ([20, 40].includes(nextTargetType)) targetType.value = nextTargetType;
|
||||||
if (battleInfo.status !== undefined) {
|
if (battleInfo.status !== undefined) {
|
||||||
start.value = battleInfo.status !== 0;
|
start.value = battleInfo.status !== 0;
|
||||||
matchStatus.value = battleInfo.status;
|
matchStatus.value = battleInfo.status;
|
||||||
@@ -1133,7 +1140,7 @@ async function runBattleEndTask(task, runId) {
|
|||||||
async function runInvalidShotTask(task, runId) {
|
async function runInvalidShotTask(task, runId) {
|
||||||
if (!isQueueAlive(runId)) return;
|
if (!isQueueAlive(runId)) return;
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "距离不足,无效",
|
title: getInvalidShotText(task.message?.shootData),
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
await playAudioKeys(getInvalidShotAudioKey(task.message?.shootData), {
|
await playAudioKeys(getInvalidShotAudioKey(task.message?.shootData), {
|
||||||
@@ -1261,6 +1268,7 @@ onLoad((options) => {
|
|||||||
start.value = null;
|
start.value = null;
|
||||||
tips.value = "";
|
tips.value = "";
|
||||||
battleId.value = returnSnapshot?.matchId || options.battleId || "";
|
battleId.value = returnSnapshot?.matchId || options.battleId || "";
|
||||||
|
targetType.value = 20;
|
||||||
currentRound.value = 0;
|
currentRound.value = 0;
|
||||||
roundTipRound.value = 0;
|
roundTipRound.value = 0;
|
||||||
goldenRound.value = 0;
|
goldenRound.value = 0;
|
||||||
@@ -1394,6 +1402,7 @@ onShow(() => {
|
|||||||
:guide="false"
|
:guide="false"
|
||||||
:isBattle="true"
|
:isBattle="true"
|
||||||
:count="readyTime"
|
:count="readyTime"
|
||||||
|
:targetType="targetType"
|
||||||
/>
|
/>
|
||||||
<!-- 比赛进行中显示:左右队伍、进度条、靶面和底部比分。 -->
|
<!-- 比赛进行中显示:左右队伍、进度条、靶面和底部比分。 -->
|
||||||
<view v-if="start" class="players-row">
|
<view v-if="start" class="players-row">
|
||||||
@@ -1419,6 +1428,7 @@ onShow(() => {
|
|||||||
:latestShotFlash="latestShotFlash"
|
:latestShotFlash="latestShotFlash"
|
||||||
:redTeam="redTeam"
|
:redTeam="redTeam"
|
||||||
:blueTeam="blueTeam"
|
:blueTeam="blueTeam"
|
||||||
|
:targetType="targetType"
|
||||||
stable-shot-effect
|
stable-shot-effect
|
||||||
/>
|
/>
|
||||||
<BattleFooter
|
<BattleFooter
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ const props = defineProps({
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
|
trainingType: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -72,6 +76,7 @@ const props = defineProps({
|
|||||||
:rowCount="total === 12 ? 6 : 9"
|
:rowCount="total === 12 ? 6 : 9"
|
||||||
:total="total"
|
:total="total"
|
||||||
:arrows="arrows"
|
:arrows="arrows"
|
||||||
|
:trainingType="trainingType"
|
||||||
:margin="total === 12 ? 4 : 1"
|
:margin="total === 12 ? 4 : 1"
|
||||||
:fontSize="total === 12 ? 25 : 22"
|
:fontSize="total === 12 ? 25 : 22"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
targetType: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 40,
|
||||||
|
},
|
||||||
coordinateRadius: {
|
coordinateRadius: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 20,
|
default: 20,
|
||||||
@@ -433,12 +437,19 @@ watch(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const simulShoot = async () => {
|
const simulShoot = async () => {
|
||||||
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
|
if (device.value.deviceId) {
|
||||||
|
await simulShootAPI(
|
||||||
|
device.value.deviceId,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
props.targetType
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const simulShoot2 = async () => {
|
const simulShoot2 = async () => {
|
||||||
if (device.value.deviceId) {
|
if (device.value.deviceId) {
|
||||||
const r1 = Math.random() > 0.5 ? 0.01 : 0.02;
|
const r1 = Math.random() > 0.5 ? 0.01 : 0.02;
|
||||||
await simulShootAPI(device.value.deviceId, r1, r1);
|
await simulShootAPI(device.value.deviceId, r1, r1, props.targetType);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
trainingType: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const items = ref(new Array(props.total).fill(9));
|
const items = ref(new Array(props.total).fill(9));
|
||||||
const bgImages = [
|
const bgImages = [
|
||||||
@@ -34,7 +38,11 @@ const getDisplayText = (arrow) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const isLowScore = (arrow) => {
|
const isLowScore = (arrow) => {
|
||||||
if (!arrow || arrow.ringX) return false;
|
if (!arrow) return false;
|
||||||
|
if (["rhythm", "stability"].includes(props.trainingType)) {
|
||||||
|
return arrow.ok !== true;
|
||||||
|
}
|
||||||
|
if (arrow.ringX) return false;
|
||||||
const ring = Number(arrow.ring);
|
const ring = Number(arrow.ring);
|
||||||
return Number.isFinite(ring) && ring < 6;
|
return Number.isFinite(ring) && ring < 6;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -54,6 +54,18 @@ const showComment = ref(false);
|
|||||||
const showBowData = ref(false);
|
const showBowData = ref(false);
|
||||||
const showUpgrade = ref(false);
|
const showUpgrade = ref(false);
|
||||||
|
|
||||||
|
const isCompleted = computed(() => props.result.completed === true);
|
||||||
|
const heroBackground = computed(() =>
|
||||||
|
isCompleted.value
|
||||||
|
? "https://static.shelingxingqiu.com/shootmini/static/training-difficulty-design/result-bg.png"
|
||||||
|
: "https://static.shelingxingqiu.com/shootmini/static/training-difficulty-design/result-bg-fail.png"
|
||||||
|
);
|
||||||
|
const titleBackground = computed(() =>
|
||||||
|
isCompleted.value
|
||||||
|
? "https://static.shelingxingqiu.com/shootmini/static/training-difficulty-design/result-t-bg.png"
|
||||||
|
: "https://static.shelingxingqiu.com/shootmini/static/training-difficulty-design/result-t-bg-fail.png"
|
||||||
|
);
|
||||||
|
|
||||||
const closePanel = () => {
|
const closePanel = () => {
|
||||||
showPanel.value = false;
|
showPanel.value = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -219,6 +231,13 @@ const metricConfigs = {
|
|||||||
deltaKeys: ["deltaStability", "delta_stability"],
|
deltaKeys: ["deltaStability", "delta_stability"],
|
||||||
deltaUnit: "",
|
deltaUnit: "",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "十环次数",
|
||||||
|
valueKeys: ["tenRingCount", "ten_ring_count"],
|
||||||
|
unit: "次",
|
||||||
|
deltaKeys: ["deltaTenRingCount", "delta_ten_ring_count"],
|
||||||
|
deltaUnit: "次",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
rhythm: [
|
rhythm: [
|
||||||
{
|
{
|
||||||
@@ -235,6 +254,39 @@ const metricConfigs = {
|
|||||||
deltaKeys: ["deltaTotalRings", "delta_total_rings"],
|
deltaKeys: ["deltaTotalRings", "delta_total_rings"],
|
||||||
deltaUnit: "环",
|
deltaUnit: "环",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "十环次数",
|
||||||
|
valueKeys: ["tenRingCount", "ten_ring_count"],
|
||||||
|
unit: "次",
|
||||||
|
deltaKeys: ["deltaTenRingCount", "delta_ten_ring_count"],
|
||||||
|
deltaUnit: "次",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
stability: [
|
||||||
|
{
|
||||||
|
label: "能量最高值",
|
||||||
|
valueKeys: ["maxEnergyPercent", "max_energy_percent"],
|
||||||
|
unit: "%",
|
||||||
|
deltaKeys: [
|
||||||
|
"deltaMaxEnergyPercent",
|
||||||
|
"delta_max_energy_percent",
|
||||||
|
],
|
||||||
|
deltaUnit: "%",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "达标箭数",
|
||||||
|
valueKeys: ["qualifiedArrows", "qualified_arrows"],
|
||||||
|
unit: "箭",
|
||||||
|
deltaKeys: ["deltaQualifiedArrows", "delta_qualified_arrows"],
|
||||||
|
deltaUnit: "箭",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "达标率",
|
||||||
|
valueKeys: ["qualifiedRate", "qualified_rate"],
|
||||||
|
unit: "%",
|
||||||
|
deltaKeys: ["deltaQualifiedRate", "delta_qualified_rate"],
|
||||||
|
deltaUnit: "%",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
endurance: [
|
endurance: [
|
||||||
{
|
{
|
||||||
@@ -251,41 +303,43 @@ const metricConfigs = {
|
|||||||
deltaKeys: ["deltaTotalRings", "delta_total_rings"],
|
deltaKeys: ["deltaTotalRings", "delta_total_rings"],
|
||||||
deltaUnit: "环",
|
deltaUnit: "环",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "平均环数",
|
||||||
|
valueKeys: ["averageRing", "average_ring"],
|
||||||
|
unit: "环",
|
||||||
|
deltaKeys: ["deltaAverageRing", "delta_average_ring"],
|
||||||
|
deltaUnit: "环",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
precision: [
|
precision: [
|
||||||
{
|
{
|
||||||
label: "共命中目标",
|
label: "命中目标数",
|
||||||
valueKeys: ["totalHits", "total_hits"],
|
valueKeys: ["totalHits", "total_hits"],
|
||||||
fallback: () => 0,
|
fallback: () => 0,
|
||||||
unit: "次",
|
unit: "次",
|
||||||
deltaKeys: [
|
deltaKeys: ["deltaTotalHits", "delta_total_hits"],
|
||||||
"deltaTotalHits",
|
|
||||||
"delta_total_hits",
|
|
||||||
"hitCompare",
|
|
||||||
"hitDiff",
|
|
||||||
"hitDelta",
|
|
||||||
],
|
|
||||||
deltaUnit: "次",
|
deltaUnit: "次",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "用时",
|
label: "射箭数",
|
||||||
valueKeys: ["duration", "usedTime", "shootTime", "time"],
|
valueKeys: ["totalArrows", "total_arrows"],
|
||||||
unit: "",
|
unit: "箭",
|
||||||
deltaKeys: [
|
deltaKeys: ["deltaTotalArrows", "delta_total_arrows"],
|
||||||
"deltaDuration",
|
deltaUnit: "箭",
|
||||||
"delta_duration",
|
},
|
||||||
"timeCompare",
|
{
|
||||||
"timeDiff",
|
label: "命中率",
|
||||||
"durationDiff",
|
valueKeys: ["hitRate", "hit_rate"],
|
||||||
],
|
unit: "%",
|
||||||
deltaUnit: "",
|
deltaKeys: ["deltaHitRate", "delta_hit_rate"],
|
||||||
duration: true,
|
deltaUnit: "%",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const resultRows = computed(() => {
|
const resultRows = computed(() => {
|
||||||
const configs = metricConfigs[resultTrainingType.value] || metricConfigs.precision;
|
const configs =
|
||||||
|
metricConfigs[resultTrainingType.value] || metricConfigs.precision;
|
||||||
return configs.map((config) => {
|
return configs.map((config) => {
|
||||||
const fallback = config.fallback ? config.fallback() : 0;
|
const fallback = config.fallback ? config.fallback() : 0;
|
||||||
const value = readMetricNumber(config.valueKeys, fallback);
|
const value = readMetricNumber(config.valueKeys, fallback);
|
||||||
@@ -314,20 +368,17 @@ const handlePrimary = () => {
|
|||||||
retryPractice();
|
retryPractice();
|
||||||
};
|
};
|
||||||
|
|
||||||
const calories = computed(
|
|
||||||
() => formatMetricNumber(readMetricNumber(["calories", "calorie", "kcal"]))
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view :class="['result-mask', showPanel ? 'result-mask--show' : 'result-mask--hide']">
|
<view :class="['result-mask', showPanel ? 'result-mask--show' : 'result-mask--hide']">
|
||||||
<image class="hero-glow" src="https://static.shelingxingqiu.com/shootmini/static/training-difficulty-design/result-bg.png" mode="widthFix" />
|
<image class="hero-glow" :src="heroBackground" mode="widthFix" />
|
||||||
<view class="result-title">
|
<view class="result-title">
|
||||||
<image class="result-title-bg" src="https://static.shelingxingqiu.com/shootmini/static/training-difficulty-design/result-t-bg.png" mode="widthFix" />
|
<image class="result-title-bg" :src="titleBackground" mode="widthFix" />
|
||||||
<view class="result-title-text">Lv{{ resultDifficultyLevel }}</view>
|
<view class="result-title-text">Lv{{ resultDifficultyLevel }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="result-panel">
|
<view :class="['result-panel', { 'result-panel--fail': !isCompleted }]">
|
||||||
<view class="line-top"></view>
|
<view class="line-top"></view>
|
||||||
<view class="line-bottom"></view>
|
<view class="line-bottom"></view>
|
||||||
<view class="stats">
|
<view class="stats">
|
||||||
@@ -352,25 +403,6 @@ const calories = computed(
|
|||||||
<view v-else class="stat-value">--</view>
|
<view v-else class="stat-value">--</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="stat-row">
|
|
||||||
<image class="stat-bg" src="https://static.shelingxingqiu.com/shootmini/static/training-difficulty-design/result-c-bg.png" mode="scaleToFill" />
|
|
||||||
<view class="stat-cell">
|
|
||||||
<text class="stat-label">消耗卡路里</text>
|
|
||||||
<view class="stat-value">
|
|
||||||
<text>{{ calories }}卡</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<text class="stat-equal">≈</text>
|
|
||||||
<!-- <view class="stat-divider"></view> -->
|
|
||||||
<view class="stat-cell stat-cell--compare">
|
|
||||||
<view class="stat-value">
|
|
||||||
<image v-for="index in 3" :key="index" class="rice-icon"
|
|
||||||
src="https://static.shelingxingqiu.com/shootmini/static/training-difficulty-design/result-rice.png" mode="widthFix" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<view class="actions">
|
<view class="actions">
|
||||||
<view class="action-item" @click="() => (showBowData = true)">
|
<view class="action-item" @click="() => (showBowData = true)">
|
||||||
<image class="action-icon" src="https://static.shelingxingqiu.com/shootmini/static/training-difficulty-design/result-icon-1.png" mode="widthFix" />
|
<image class="action-icon" src="https://static.shelingxingqiu.com/shootmini/static/training-difficulty-design/result-icon-1.png" mode="widthFix" />
|
||||||
@@ -435,7 +467,7 @@ const calories = computed(
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</ScreenHint>
|
</ScreenHint>
|
||||||
<BowData :total="arrows.length" :arrows="result.details" :show="showBowData"
|
<BowData :total="details.length" :arrows="details" :show="showBowData" :trainingType="resultTrainingType"
|
||||||
:onClose="() => (showBowData = false)" />
|
:onClose="() => (showBowData = false)" />
|
||||||
<UserUpgrade :show="showUpgrade" :onClose="() => (showUpgrade = false)" :lvl="userLevel" />
|
<UserUpgrade :show="showUpgrade" :onClose="() => (showUpgrade = false)" :lvl="userLevel" />
|
||||||
</view>
|
</view>
|
||||||
@@ -517,6 +549,10 @@ const calories = computed(
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.result-panel--fail {
|
||||||
|
background: rgba(34, 34, 46, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
.stats {
|
.stats {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 34rpx;
|
margin-top: 34rpx;
|
||||||
@@ -610,14 +646,6 @@ const calories = computed(
|
|||||||
transform: skewX(12deg);
|
transform: skewX(12deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-equal{
|
|
||||||
width: 30rpx;
|
|
||||||
height: 40rpx;
|
|
||||||
color: #F3E0B9;
|
|
||||||
font-size: 30rpx;
|
|
||||||
margin-left: 10rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.trend-icon {
|
.trend-icon {
|
||||||
width: 28rpx;
|
width: 28rpx;
|
||||||
height: 42rpx;
|
height: 42rpx;
|
||||||
@@ -636,18 +664,6 @@ const calories = computed(
|
|||||||
height: 62rpx;
|
height: 62rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rice-list {
|
|
||||||
width: 160rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rice-icon {
|
|
||||||
width: 36rpx;
|
|
||||||
height: 34rpx;
|
|
||||||
margin-right: 14rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.oper-box {
|
.oper-box {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|||||||
@@ -1,8 +1,22 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch, onMounted, onBeforeUnmount, computed } from "vue";
|
import {
|
||||||
import audioManager from "@/audioManager";
|
ref,
|
||||||
|
watch,
|
||||||
|
onMounted,
|
||||||
|
onBeforeUnmount,
|
||||||
|
computed,
|
||||||
|
nextTick,
|
||||||
|
} from "vue";
|
||||||
|
import audioManager, {
|
||||||
|
getTrainingStartAudioKey,
|
||||||
|
RHYTHM_SHOOT_WINDOW_AUDIO_KEY,
|
||||||
|
} from "@/audioManager";
|
||||||
import { MESSAGETYPESV2 } from "@/constants";
|
import { MESSAGETYPESV2 } from "@/constants";
|
||||||
import { getDirectionText, getInvalidShotAudioKey } from "@/util";
|
import {
|
||||||
|
getDirectionText,
|
||||||
|
getInvalidShotAudioKey,
|
||||||
|
getInvalidShotText,
|
||||||
|
} from "@/util";
|
||||||
import Avatar from "@/components/Avatar.vue";
|
import Avatar from "@/components/Avatar.vue";
|
||||||
|
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
@@ -35,6 +49,38 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: "precision",
|
default: "precision",
|
||||||
},
|
},
|
||||||
|
roundTime: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
shootTime: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
shootWindowStart: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
inShootWindow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
serverTimestamp: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
hitReq: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
energyPercent: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
energyReqPercent: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
isVip: {
|
isVip: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
@@ -89,12 +135,100 @@ const currentRoundEnded = ref(false);
|
|||||||
const halfTime = ref(false);
|
const halfTime = ref(false);
|
||||||
const wait = ref(0);
|
const wait = ref(0);
|
||||||
const transitionStyle = ref("all 1s linear");
|
const transitionStyle = ref("all 1s linear");
|
||||||
|
const rhythmRemainingMs = ref(0);
|
||||||
|
const rhythmRemainingSeconds = ref(0);
|
||||||
|
const rhythmIsShootWindow = ref(false);
|
||||||
|
const rhythmTransitionStyle = ref("none");
|
||||||
|
let rhythmCountdownTimer = null;
|
||||||
|
let rhythmTransitionTimer = null;
|
||||||
|
let rhythmServerClockOffsetMs = 0;
|
||||||
|
let rhythmSyncGeneration = 0;
|
||||||
|
|
||||||
|
const isRhythmTraining = computed(() => props.trainingType === "rhythm");
|
||||||
|
const isStabilityTraining = computed(
|
||||||
|
() => props.trainingType === "stability"
|
||||||
|
);
|
||||||
|
|
||||||
|
const normalizePositiveInteger = (value) => {
|
||||||
|
const numberValue = Number(value);
|
||||||
|
return Number.isFinite(numberValue) && numberValue > 0
|
||||||
|
? Math.round(numberValue)
|
||||||
|
: 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 服务端时间戳可能由 protobuf int64 以字符串形式下发。
|
||||||
|
const normalizeTimestamp = (value) => {
|
||||||
|
const numberValue = Number(value);
|
||||||
|
if (!Number.isFinite(numberValue) || numberValue <= 0) return 0;
|
||||||
|
return numberValue < 1e12 ? numberValue * 1000 : numberValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
const validRhythmRoundTime = computed(() =>
|
||||||
|
normalizePositiveInteger(props.roundTime)
|
||||||
|
);
|
||||||
|
const validRhythmShootTime = computed(() =>
|
||||||
|
Math.min(
|
||||||
|
normalizePositiveInteger(props.shootTime),
|
||||||
|
validRhythmRoundTime.value
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const validRhythmHitReq = computed(() =>
|
||||||
|
normalizePositiveInteger(props.hitReq)
|
||||||
|
);
|
||||||
|
const rhythmRoundDurationMs = computed(
|
||||||
|
() => validRhythmRoundTime.value * 1000
|
||||||
|
);
|
||||||
|
const rhythmShootDurationMs = computed(
|
||||||
|
() => validRhythmShootTime.value * 1000
|
||||||
|
);
|
||||||
|
|
||||||
const progressPercent = computed(() => {
|
const progressPercent = computed(() => {
|
||||||
if (!props.countdownEnabled || !props.total) return 0;
|
if (!props.countdownEnabled || !props.total) return 0;
|
||||||
return Math.max(0, Math.min(100, (remain.value / props.total) * 100));
|
return Math.max(0, Math.min(100, (remain.value / props.total) * 100));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const stabilityEnergyPercent = computed(() =>
|
||||||
|
Math.max(0, Math.min(100, Number(props.energyPercent) || 0))
|
||||||
|
);
|
||||||
|
const stabilityEnergyReqPercent = computed(() =>
|
||||||
|
Math.max(0, Math.min(100, Number(props.energyReqPercent) || 0))
|
||||||
|
);
|
||||||
|
const stabilityEnergyReached = computed(
|
||||||
|
() =>
|
||||||
|
stabilityEnergyReqPercent.value > 0 &&
|
||||||
|
stabilityEnergyPercent.value >= stabilityEnergyReqPercent.value
|
||||||
|
);
|
||||||
|
|
||||||
|
const rhythmMarkerPercent = computed(() => {
|
||||||
|
if (!validRhythmRoundTime.value) return 0;
|
||||||
|
return Math.max(
|
||||||
|
0,
|
||||||
|
Math.min(
|
||||||
|
100,
|
||||||
|
(validRhythmShootTime.value / validRhythmRoundTime.value) * 100
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const rhythmProgressPercent = computed(() => {
|
||||||
|
if (!rhythmRoundDurationMs.value) return 0;
|
||||||
|
return Math.max(
|
||||||
|
0,
|
||||||
|
Math.min(
|
||||||
|
100,
|
||||||
|
(rhythmRemainingMs.value / rhythmRoundDurationMs.value) * 100
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const rhythmTitle = computed(() => {
|
||||||
|
if (!validRhythmShootTime.value) return "节奏训练";
|
||||||
|
if (!validRhythmHitReq.value) {
|
||||||
|
return `在最后的${validRhythmShootTime.value}秒内射箭`;
|
||||||
|
}
|
||||||
|
return `在最后的${validRhythmShootTime.value}秒并命中${validRhythmHitReq.value}环内`;
|
||||||
|
});
|
||||||
|
|
||||||
const displayName = computed(() => {
|
const displayName = computed(() => {
|
||||||
return (
|
return (
|
||||||
user.value?.nickName ||
|
user.value?.nickName ||
|
||||||
@@ -139,8 +273,147 @@ const clearTimer = () => {
|
|||||||
timer.value = null;
|
timer.value = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const clearRhythmTimers = () => {
|
||||||
|
if (rhythmCountdownTimer) {
|
||||||
|
clearTimeout(rhythmCountdownTimer);
|
||||||
|
rhythmCountdownTimer = null;
|
||||||
|
}
|
||||||
|
if (rhythmTransitionTimer) {
|
||||||
|
clearTimeout(rhythmTransitionTimer);
|
||||||
|
rhythmTransitionTimer = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getRhythmServerNow = () => Date.now() + rhythmServerClockOffsetMs;
|
||||||
|
|
||||||
|
const getRhythmRoundRemainingMs = () => {
|
||||||
|
const shootWindowStart = normalizeTimestamp(props.shootWindowStart);
|
||||||
|
if (!shootWindowStart || !rhythmRoundDurationMs.value) return 0;
|
||||||
|
|
||||||
|
const firstRoundEnd = shootWindowStart + rhythmShootDurationMs.value;
|
||||||
|
const serverNow = getRhythmServerNow();
|
||||||
|
let roundEnd = firstRoundEnd;
|
||||||
|
|
||||||
|
// 服务端锚点过期后继续按 round_time 推演下一轮,避免进度停在 0。
|
||||||
|
if (serverNow >= firstRoundEnd) {
|
||||||
|
const elapsedRounds =
|
||||||
|
Math.floor(
|
||||||
|
(serverNow - firstRoundEnd) / rhythmRoundDurationMs.value
|
||||||
|
) + 1;
|
||||||
|
roundEnd = firstRoundEnd + elapsedRounds * rhythmRoundDurationMs.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.max(
|
||||||
|
0,
|
||||||
|
Math.min(rhythmRoundDurationMs.value, roundEnd - serverNow)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateRhythmShootWindow = (isInWindow) => {
|
||||||
|
const nextIsInWindow = Boolean(isInWindow);
|
||||||
|
const enteredShootWindow =
|
||||||
|
nextIsInWindow && !rhythmIsShootWindow.value;
|
||||||
|
rhythmIsShootWindow.value = nextIsInWindow;
|
||||||
|
|
||||||
|
// 只在进入窗口的边沿立即提示;预热和播放均为异步,不阻塞倒计时。
|
||||||
|
if (enteredShootWindow && props.start && isRhythmTraining.value) {
|
||||||
|
audioManager.play(RHYTHM_SHOOT_WINDOW_AUDIO_KEY);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 每秒只更新一次目标宽度,实际推进交给 CSS transition,减少响应式刷新。
|
||||||
|
const scheduleRhythmCountdownStep = () => {
|
||||||
|
rhythmCountdownTimer = null;
|
||||||
|
const currentRemaining = getRhythmRoundRemainingMs();
|
||||||
|
if (currentRemaining <= 0) {
|
||||||
|
rhythmTransitionStyle.value = "none";
|
||||||
|
rhythmRemainingMs.value = 0;
|
||||||
|
rhythmRemainingSeconds.value = 0;
|
||||||
|
updateRhythmShootWindow(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 数字展示使用服务端校准后的真实剩余时间,不读取提前写入的动画目标值。
|
||||||
|
rhythmRemainingSeconds.value = Math.ceil(currentRemaining / 1000);
|
||||||
|
updateRhythmShootWindow(
|
||||||
|
currentRemaining <= rhythmShootDurationMs.value
|
||||||
|
);
|
||||||
|
|
||||||
|
// 一轮结束后先无动画恢复至 100%,再开始下一轮向左递减。
|
||||||
|
if (currentRemaining - rhythmRemainingMs.value > 1000) {
|
||||||
|
rhythmTransitionStyle.value = "none";
|
||||||
|
rhythmRemainingMs.value = currentRemaining;
|
||||||
|
rhythmTransitionTimer = setTimeout(() => {
|
||||||
|
rhythmTransitionTimer = null;
|
||||||
|
scheduleRhythmCountdownStep();
|
||||||
|
}, 50);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const targetRemaining = Math.max(
|
||||||
|
0,
|
||||||
|
(Math.ceil(currentRemaining / 1000) - 1) * 1000
|
||||||
|
);
|
||||||
|
const stepDuration = Math.max(50, currentRemaining - targetRemaining);
|
||||||
|
rhythmTransitionStyle.value = `width ${stepDuration}ms linear`;
|
||||||
|
rhythmRemainingMs.value = targetRemaining;
|
||||||
|
rhythmCountdownTimer = setTimeout(
|
||||||
|
scheduleRhythmCountdownStep,
|
||||||
|
stepDuration
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const syncRhythmCountdown = async () => {
|
||||||
|
const generation = ++rhythmSyncGeneration;
|
||||||
|
clearRhythmTimers();
|
||||||
|
|
||||||
|
if (!isRhythmTraining.value) {
|
||||||
|
rhythmTransitionStyle.value = "none";
|
||||||
|
rhythmRemainingMs.value = 0;
|
||||||
|
rhythmRemainingSeconds.value = 0;
|
||||||
|
updateRhythmShootWindow(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const serverTimestamp = normalizeTimestamp(props.serverTimestamp);
|
||||||
|
rhythmServerClockOffsetMs = serverTimestamp
|
||||||
|
? serverTimestamp - Date.now()
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!validRhythmRoundTime.value ||
|
||||||
|
!validRhythmShootTime.value ||
|
||||||
|
!normalizeTimestamp(props.shootWindowStart)
|
||||||
|
) {
|
||||||
|
rhythmTransitionStyle.value = "none";
|
||||||
|
rhythmRemainingMs.value = 0;
|
||||||
|
rhythmRemainingSeconds.value = 0;
|
||||||
|
updateRhythmShootWindow(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
rhythmTransitionStyle.value = "none";
|
||||||
|
rhythmRemainingMs.value = getRhythmRoundRemainingMs();
|
||||||
|
rhythmRemainingSeconds.value = Math.ceil(rhythmRemainingMs.value / 1000);
|
||||||
|
updateRhythmShootWindow(
|
||||||
|
rhythmRemainingMs.value > 0 &&
|
||||||
|
rhythmRemainingMs.value <= rhythmShootDurationMs.value
|
||||||
|
);
|
||||||
|
await nextTick();
|
||||||
|
if (generation !== rhythmSyncGeneration) return;
|
||||||
|
|
||||||
|
rhythmTransitionTimer = setTimeout(() => {
|
||||||
|
rhythmTransitionTimer = null;
|
||||||
|
scheduleRhythmCountdownStep();
|
||||||
|
}, 50);
|
||||||
|
};
|
||||||
|
|
||||||
const resetTimer = (count) => {
|
const resetTimer = (count) => {
|
||||||
clearTimer();
|
clearTimer();
|
||||||
|
if (isRhythmTraining.value) {
|
||||||
|
remain.value = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!props.countdownEnabled) {
|
if (!props.countdownEnabled) {
|
||||||
remain.value = 0;
|
remain.value = 0;
|
||||||
return;
|
return;
|
||||||
@@ -173,9 +446,12 @@ const resetTimer = (count) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => [props.start, props.countdownEnabled],
|
() => [props.start, props.countdownEnabled, props.trainingType],
|
||||||
([started, countdownEnabled]) => {
|
([started, countdownEnabled, trainingType]) => {
|
||||||
if (started && countdownEnabled) {
|
if (trainingType === "rhythm") {
|
||||||
|
clearTimer();
|
||||||
|
remain.value = 0;
|
||||||
|
} else if (started && countdownEnabled) {
|
||||||
resetTimer(props.total);
|
resetTimer(props.total);
|
||||||
} else {
|
} else {
|
||||||
clearTimer();
|
clearTimer();
|
||||||
@@ -187,6 +463,18 @@ watch(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => [
|
||||||
|
props.trainingType,
|
||||||
|
props.roundTime,
|
||||||
|
props.shootTime,
|
||||||
|
props.shootWindowStart,
|
||||||
|
props.serverTimestamp,
|
||||||
|
],
|
||||||
|
syncRhythmCountdown,
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
const tipContent = computed(() => {
|
const tipContent = computed(() => {
|
||||||
if (halfTime.value) {
|
if (halfTime.value) {
|
||||||
return props.battleId ? "中场休息" : `中场休息(${wait.value}秒)`;
|
return props.battleId ? "中场休息" : `中场休息(${wait.value}秒)`;
|
||||||
@@ -203,11 +491,14 @@ async function onReceiveMessage(msg) {
|
|||||||
if (Array.isArray(msg)) return;
|
if (Array.isArray(msg)) return;
|
||||||
if (msg.type === MESSAGETYPESV2.BattleStart) {
|
if (msg.type === MESSAGETYPESV2.BattleStart) {
|
||||||
halfTime.value = false;
|
halfTime.value = false;
|
||||||
audioManager.play("比赛开始");
|
// 已实现的个人训练由页面播放专属提示,避免重复播报。
|
||||||
|
if (!getTrainingStartAudioKey(props.trainingType)) {
|
||||||
|
audioManager.play("比赛开始");
|
||||||
|
}
|
||||||
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
|
} else if (msg.type === MESSAGETYPESV2.BattleEnd) {
|
||||||
audioManager.play("练习结束", false);
|
audioManager.play("练习结束", false);
|
||||||
} else if (msg.type === MESSAGETYPESV2.ShootResult) {
|
} else if (msg.type === MESSAGETYPESV2.ShootResult) {
|
||||||
// 精准训练由页面统一等待语音和飞箭结束,其他训练保持原播放链路。
|
// 精准和节奏训练由页面统一处理专属结果语音,其他训练保持原播放链路。
|
||||||
if (props.externalShootResultAudio) return;
|
if (props.externalShootResultAudio) return;
|
||||||
const latestDetail =
|
const latestDetail =
|
||||||
Array.isArray(msg.details) && msg.details.length > 0
|
Array.isArray(msg.details) && msg.details.length > 0
|
||||||
@@ -238,7 +529,7 @@ async function onReceiveMessage(msg) {
|
|||||||
audioManager.play("中场休息");
|
audioManager.play("中场休息");
|
||||||
} else if (msg.type === MESSAGETYPESV2.InvalidShot) {
|
} else if (msg.type === MESSAGETYPESV2.InvalidShot) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "距离不足,无效",
|
title: getInvalidShotText(msg.shootData),
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
audioManager.play(getInvalidShotAudioKey(msg.shootData));
|
audioManager.play(getInvalidShotAudioKey(msg.shootData));
|
||||||
@@ -260,12 +551,66 @@ onBeforeUnmount(() => {
|
|||||||
uni.$off("socket-inbox", onReceiveMessage);
|
uni.$off("socket-inbox", onReceiveMessage);
|
||||||
uni.$off("play-sound", playSound);
|
uni.$off("play-sound", playSound);
|
||||||
clearTimer();
|
clearTimer();
|
||||||
|
rhythmSyncGeneration += 1;
|
||||||
|
clearRhythmTimers();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view v-if="show" class="progress-card">
|
<view
|
||||||
<view class="progress-card__header">
|
v-if="show"
|
||||||
|
:class="
|
||||||
|
isRhythmTraining
|
||||||
|
? 'rhythm-progress'
|
||||||
|
: isStabilityTraining
|
||||||
|
? 'stability-progress'
|
||||||
|
: 'progress-card'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<template v-if="isStabilityTraining">
|
||||||
|
<text class="stability-progress__time">{{ remain }}秒</text>
|
||||||
|
<view class="stability-progress__track">
|
||||||
|
<view
|
||||||
|
class="stability-progress__fill"
|
||||||
|
:class="{
|
||||||
|
'stability-progress__fill--reached': stabilityEnergyReached,
|
||||||
|
}"
|
||||||
|
:style="{ width: `${stabilityEnergyPercent}%` }"
|
||||||
|
/>
|
||||||
|
<view
|
||||||
|
class="stability-progress__marker"
|
||||||
|
:style="{ left: `${stabilityEnergyReqPercent}%` }"
|
||||||
|
/>
|
||||||
|
<text class="stability-progress__value">
|
||||||
|
{{ Math.round(stabilityEnergyPercent) }}%
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="isRhythmTraining">
|
||||||
|
<text class="rhythm-progress__title">{{ rhythmTitle }}</text>
|
||||||
|
<view class="rhythm-progress__track">
|
||||||
|
<view
|
||||||
|
class="rhythm-progress__fill"
|
||||||
|
:class="{
|
||||||
|
'rhythm-progress__fill--shooting': rhythmIsShootWindow,
|
||||||
|
}"
|
||||||
|
:style="{
|
||||||
|
width: `${rhythmProgressPercent}%`,
|
||||||
|
transition: rhythmTransitionStyle,
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
<view
|
||||||
|
class="rhythm-progress__marker"
|
||||||
|
:style="{ left: `${rhythmMarkerPercent}%` }"
|
||||||
|
/>
|
||||||
|
<text
|
||||||
|
v-if="rhythmRemainingSeconds > 0"
|
||||||
|
class="rhythm-progress__window-label"
|
||||||
|
>{{ rhythmRemainingSeconds }}秒</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="progress-card__header">
|
||||||
<view class="progress-card__profile">
|
<view class="progress-card__profile">
|
||||||
<view class="progress-card__avatar-shell">
|
<view class="progress-card__avatar-shell">
|
||||||
<Avatar
|
<Avatar
|
||||||
@@ -297,16 +642,16 @@ onBeforeUnmount(() => {
|
|||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
/>
|
/>
|
||||||
</button> -->
|
</button> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="progress-card__track-wrap">
|
<view class="progress-card__track-wrap">
|
||||||
<image
|
<image
|
||||||
class="progress-card__titile"
|
class="progress-card__titile"
|
||||||
:src="trainingTitleIcon"
|
:src="trainingTitleIcon"
|
||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
/>
|
/>
|
||||||
<view v-if="countdownEnabled" class="progress-card__track">
|
<view v-if="countdownEnabled" class="progress-card__track">
|
||||||
<view
|
<view
|
||||||
class="progress-card__fill"
|
class="progress-card__fill"
|
||||||
:style="{
|
:style="{
|
||||||
width: `${progressPercent}%`,
|
width: `${progressPercent}%`,
|
||||||
@@ -314,13 +659,14 @@ onBeforeUnmount(() => {
|
|||||||
right: tips.includes('红队') ? 0 : 'unset',
|
right: tips.includes('红队') ? 0 : 'unset',
|
||||||
transition: transitionStyle,
|
transition: transitionStyle,
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
<view class="progress-card__badge">
|
<view class="progress-card__badge">
|
||||||
<text class="progress-card__badge-text">剩余{{ remain }}秒</text>
|
<text class="progress-card__badge-text">剩余{{ remain }}秒</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- <text v-if="tipContent" class="progress-card__tip">{{ tipContent }}123</text> -->
|
||||||
</view>
|
</view>
|
||||||
<!-- <text v-if="tipContent" class="progress-card__tip">{{ tipContent }}123</text> -->
|
</template>
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -459,4 +805,131 @@ onBeforeUnmount(() => {
|
|||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.stability-progress {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 32rpx 84rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stability-progress__time {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 48rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stability-progress__track {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 24rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
background: #444444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stability-progress__fill {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
background: linear-gradient(90deg, #87f1df 0%, #5ba8e8 100%);
|
||||||
|
transition: width 240ms linear, background 240ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stability-progress__fill--reached {
|
||||||
|
background: linear-gradient(90deg, #a5df62 0%, #61c787 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stability-progress__marker {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 2;
|
||||||
|
width: 4rpx;
|
||||||
|
transform: translateX(-2rpx);
|
||||||
|
background: rgba(26, 24, 22, 0.92);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stability-progress__value {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 3;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #eefaff;
|
||||||
|
font-size: 18rpx;
|
||||||
|
line-height: 24rpx;
|
||||||
|
text-align: center;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-progress {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 32rpx 84rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-progress__title {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 42rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-progress__track {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 24rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
background: #444444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-progress__fill {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
background: linear-gradient(133deg, #ffd19a 0%, #a17636 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-progress__fill--shooting {
|
||||||
|
background: linear-gradient(90deg, #e2bd2e 0%, #fff047 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-progress__marker {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 2;
|
||||||
|
width: 4rpx;
|
||||||
|
transform: translateX(-2rpx);
|
||||||
|
background: rgba(26, 24, 22, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rhythm-progress__window-label {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 50%;
|
||||||
|
z-index: 3;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
color: #fff7de;
|
||||||
|
font-size: 18rpx;
|
||||||
|
line-height: 24rpx;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -6,10 +6,16 @@ import Avatar from "@/components/Avatar.vue";
|
|||||||
import audioManager from "@/audioManager";
|
import audioManager from "@/audioManager";
|
||||||
import { simulShootAPI } from "@/apis";
|
import { simulShootAPI } from "@/apis";
|
||||||
import { MESSAGETYPESV2 } from "@/constants";
|
import { MESSAGETYPESV2 } from "@/constants";
|
||||||
|
import {
|
||||||
|
getDistanceCheckAudioKey,
|
||||||
|
getDistanceCheckText,
|
||||||
|
getShootValidation,
|
||||||
|
} from "@/util";
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const { user, device } = storeToRefs(store);
|
const { user, device } = storeToRefs(store);
|
||||||
|
const emit = defineEmits(["passed"]);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
guide: {
|
guide: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -27,18 +33,46 @@ const props = defineProps({
|
|||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
|
autoStart: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const arrow = ref({});
|
const arrow = ref({});
|
||||||
const distance = ref(0);
|
const distance = ref(0);
|
||||||
|
const statusText = ref("");
|
||||||
const showsimul = ref(false);
|
const showsimul = ref(false);
|
||||||
const count = ref(props.count);
|
const count = ref(props.count);
|
||||||
const timer = ref(null);
|
const timer = ref(null);
|
||||||
|
const autoStartPending = ref(false);
|
||||||
|
const autoStartTriggered = ref(false);
|
||||||
|
let autoStartTimer = null;
|
||||||
|
const DISTANCE_PASSED_AUDIO_KEY = "站距合格,靶纸正确";
|
||||||
|
const AUTO_START_TIMEOUT_MS = 6000;
|
||||||
|
|
||||||
|
const clearAutoStartTimer = () => {
|
||||||
|
if (!autoStartTimer) return;
|
||||||
|
clearTimeout(autoStartTimer);
|
||||||
|
autoStartTimer = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const triggerAutoStart = () => {
|
||||||
|
if (!autoStartPending.value || autoStartTriggered.value) return;
|
||||||
|
clearAutoStartTimer();
|
||||||
|
autoStartPending.value = false;
|
||||||
|
autoStartTriggered.value = true;
|
||||||
|
emit("passed");
|
||||||
|
};
|
||||||
|
|
||||||
|
const onAudioEnded = (key) => {
|
||||||
|
if (key === DISTANCE_PASSED_AUDIO_KEY) triggerAutoStart();
|
||||||
|
};
|
||||||
|
|
||||||
const updateTimer = (value) => {
|
const updateTimer = (value) => {
|
||||||
count.value = Math.round(value);
|
count.value = Math.round(value);
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
audioManager.play("请射箭测试距离");
|
audioManager.play("请射箭!测试站距与靶纸");
|
||||||
if (props.isBattle) {
|
if (props.isBattle) {
|
||||||
timer.value = setInterval(() => {
|
timer.value = setInterval(() => {
|
||||||
count.value -= 1;
|
count.value -= 1;
|
||||||
@@ -46,28 +80,43 @@ onMounted(() => {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
uni.$on("update-timer", updateTimer);
|
uni.$on("update-timer", updateTimer);
|
||||||
|
uni.$on("audioEnded", onAudioEnded);
|
||||||
});
|
});
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
if (timer.value) clearInterval(timer.value);
|
if (timer.value) clearInterval(timer.value);
|
||||||
|
clearAutoStartTimer();
|
||||||
uni.$off("update-timer", updateTimer);
|
uni.$off("update-timer", updateTimer);
|
||||||
|
uni.$off("audioEnded", onAudioEnded);
|
||||||
});
|
});
|
||||||
|
|
||||||
async function onReceiveMessage(msg) {
|
async function onReceiveMessage(msg) {
|
||||||
if (Array.isArray(msg)) return;
|
if (Array.isArray(msg)) return;
|
||||||
if (msg.type === MESSAGETYPESV2.TestDistance) {
|
if (msg.type === MESSAGETYPESV2.TestDistance) {
|
||||||
const rawDistance = Number(msg.shootData?.distance);
|
if (autoStartPending.value || autoStartTriggered.value) return;
|
||||||
|
const rawDistance = Number(msg.shootData?.distance ?? msg.shootData?.dst);
|
||||||
distance.value = Number.isFinite(rawDistance)
|
distance.value = Number.isFinite(rawDistance)
|
||||||
? Number((rawDistance / 100).toFixed(2))
|
? Number((rawDistance / 100).toFixed(2))
|
||||||
: 0;
|
: 0;
|
||||||
if (rawDistance === 0) {
|
statusText.value = getDistanceCheckText(msg.shootData);
|
||||||
audioManager.play("未发现靶纸,请瞄准靶纸射箭");
|
const audioKey = getDistanceCheckAudioKey(msg.shootData);
|
||||||
} else if (distance.value >= 5) audioManager.play("距离合格");
|
const validation = getShootValidation(msg.shootData);
|
||||||
else audioManager.play("距离不足");
|
if (props.autoStart && validation.distanceOk && validation.targetOk) {
|
||||||
|
autoStartPending.value = true;
|
||||||
|
autoStartTimer = setTimeout(triggerAutoStart, AUTO_START_TIMEOUT_MS);
|
||||||
|
}
|
||||||
|
audioManager.play(audioKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const simulShoot = async () => {
|
const simulShoot = async () => {
|
||||||
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
|
if (device.value.deviceId) {
|
||||||
|
await simulShootAPI(
|
||||||
|
device.value.deviceId,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
props.targetType
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -100,13 +149,11 @@ onBeforeUnmount(() => {
|
|||||||
</button>
|
</button>
|
||||||
<view class="warnning-text">
|
<view class="warnning-text">
|
||||||
<view class="target-tip">当前靶纸为<text class="text-yellow">{{ targetType }}cm</text>全环靶</view>
|
<view class="target-tip">当前靶纸为<text class="text-yellow">{{ targetType }}cm</text>全环靶</view>
|
||||||
<block v-if="distance > 0">
|
<block v-if="statusText">
|
||||||
<text>当前距离<text class="text-yellow">{{ distance }}</text>米</text>
|
<text>{{ statusText }}</text>
|
||||||
<text v-if="distance >= 5">已达到距离要求</text>
|
|
||||||
<text v-else>请调整站位</text>
|
|
||||||
</block>
|
</block>
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<text>请射箭,测试站距</text>
|
<text>请射箭,测试站距与靶纸</text>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
<view class="user-row">
|
<view class="user-row">
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
showUnlockProgress: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
completedProgress: {
|
completedProgress: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
@@ -106,6 +110,15 @@ const handleClick = () => {
|
|||||||
<view class="difficulty-badge__label">{{ node.label }}</view>
|
<view class="difficulty-badge__label">{{ node.label }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view
|
||||||
|
v-if="showUnlockProgress"
|
||||||
|
class="difficulty-badge__unlock-progress"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="difficulty-badge__unlock-progress-completed"
|
||||||
|
:style="{ width: `${progressValue}%` }"
|
||||||
|
></view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -315,6 +328,25 @@ const handleClick = () => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.difficulty-badge__unlock-progress {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 30rpx);
|
||||||
|
left: 50%;
|
||||||
|
width: 120rpx;
|
||||||
|
height: 10rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
background: rgba(0, 0, 0, 0.6);
|
||||||
|
transform: translateX(-50%);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty-badge__unlock-progress-completed {
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
background: rgba(255, 217, 71, 1);
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes badge-orbit-spin {
|
@keyframes badge-orbit-spin {
|
||||||
from {
|
from {
|
||||||
transform: translate(-50%, -50%) rotate(0deg);
|
transform: translate(-50%, -50%) rotate(0deg);
|
||||||
|
|||||||
@@ -13,7 +13,20 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const previewLines = computed(() => {
|
const previewLines = computed(() => {
|
||||||
return props.lines.map((line) => String(line || "").trim()).filter(Boolean);
|
return props.lines
|
||||||
|
.map((line) => {
|
||||||
|
const rawParts = Array.isArray(line?.parts)
|
||||||
|
? line.parts
|
||||||
|
: [{ text: line }];
|
||||||
|
const parts = rawParts
|
||||||
|
.map((part) => ({
|
||||||
|
text: String(part?.text ?? part ?? "").trim(),
|
||||||
|
}))
|
||||||
|
.filter((part) => part.text);
|
||||||
|
|
||||||
|
return { parts };
|
||||||
|
})
|
||||||
|
.filter((line) => line.parts.length > 0);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -27,13 +40,16 @@ const previewLines = computed(() => {
|
|||||||
<view class="difficulty-preview__content">
|
<view class="difficulty-preview__content">
|
||||||
<text class="difficulty-preview__title">{{ title }}</text>
|
<text class="difficulty-preview__title">{{ title }}</text>
|
||||||
<view class="difficulty-preview__copy">
|
<view class="difficulty-preview__copy">
|
||||||
<text
|
<view
|
||||||
v-for="(line, index) in previewLines"
|
v-for="(line, index) in previewLines"
|
||||||
:key="`${line}-${index}`"
|
:key="index"
|
||||||
class="difficulty-preview__line"
|
class="difficulty-preview__line"
|
||||||
>
|
>
|
||||||
{{ line }}
|
<text
|
||||||
</text>
|
v-for="(part, partIndex) in line.parts"
|
||||||
|
:key="partIndex"
|
||||||
|
>{{ part.text }}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -86,6 +102,4 @@ const previewLines = computed(() => {
|
|||||||
.difficulty-preview__line {
|
.difficulty-preview__line {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
} from "@/apis";
|
} from "@/apis";
|
||||||
|
|
||||||
// 难度页接口数据源:
|
// 难度页接口数据源:
|
||||||
// 1. 接口:GET /training/difficulty/list?type=base/endurance/precision/rhythm
|
// 1. 接口:GET /training/difficulty/list?type=base/endurance/precision/rhythm/stability
|
||||||
// 2. 当前进度:接口 user_levels / list.completed,路由参数可覆盖选中难度
|
// 2. 当前进度:接口 user_levels / list.completed,路由参数可覆盖选中难度
|
||||||
const trainingDifficultyStorageKey = "training-selection";
|
const trainingDifficultyStorageKey = "training-selection";
|
||||||
const defaultTrainingType = "precision";
|
const defaultTrainingType = "precision";
|
||||||
@@ -35,6 +35,10 @@ const trainingTypeMetaMap = {
|
|||||||
key: "rhythm",
|
key: "rhythm",
|
||||||
title: "节奏训练",
|
title: "节奏训练",
|
||||||
},
|
},
|
||||||
|
stability: {
|
||||||
|
key: "stability",
|
||||||
|
title: "稳定训练",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const routeModeTypeMap = {
|
const routeModeTypeMap = {
|
||||||
basic: "base",
|
basic: "base",
|
||||||
@@ -42,6 +46,9 @@ const routeModeTypeMap = {
|
|||||||
endurance: "endurance",
|
endurance: "endurance",
|
||||||
precision: "precision",
|
precision: "precision",
|
||||||
rhythm: "rhythm",
|
rhythm: "rhythm",
|
||||||
|
stability: "stability",
|
||||||
|
// 兼容历史上已经分享出去的 power 深链,实际创建仍统一传 stability。
|
||||||
|
power: "stability",
|
||||||
};
|
};
|
||||||
const defaultTargetType = 1;
|
const defaultTargetType = 1;
|
||||||
|
|
||||||
@@ -83,10 +90,6 @@ const checkDifficultyCompleted = (item = {}) => {
|
|||||||
return Boolean(item.completed) || (promoteCnt > 0 && completedCnt >= promoteCnt);
|
return Boolean(item.completed) || (promoteCnt > 0 && completedCnt >= promoteCnt);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDifficultyModeText = (mode) => {
|
|
||||||
return Number(mode) === 1 ? "随机区域+指定环数" : "随机区域命中";
|
|
||||||
};
|
|
||||||
|
|
||||||
const createEmptyModeConfig = (type = defaultTrainingType) => {
|
const createEmptyModeConfig = (type = defaultTrainingType) => {
|
||||||
const meta = trainingTypeMetaMap[type] || trainingTypeMetaMap[defaultTrainingType];
|
const meta = trainingTypeMetaMap[type] || trainingTypeMetaMap[defaultTrainingType];
|
||||||
|
|
||||||
@@ -107,14 +110,13 @@ const createDifficultySummary = (item = {}) => {
|
|||||||
const timeLimit = toNumber(item.time_limit);
|
const timeLimit = toNumber(item.time_limit);
|
||||||
const hitReq = toNumber(item.hit_req);
|
const hitReq = toNumber(item.hit_req);
|
||||||
const totalReq = toNumber(item.total_req);
|
const totalReq = toNumber(item.total_req);
|
||||||
const promoteCnt = toNumber(item.promote_cnt);
|
const energyReqPercent = toNumber(item.energy_req_percent);
|
||||||
const shootingTimeText =
|
const shootingTimeText =
|
||||||
timeLimit > 0 ? `在${timeLimit}秒内进行射箭` : "不限时进行射箭";
|
timeLimit > 0 ? `在${timeLimit}秒内进行射箭` : "不限时进行射箭";
|
||||||
const enduranceTimeText =
|
const enduranceTimeText =
|
||||||
timeLimit > 0
|
timeLimit > 0
|
||||||
? `在${timeLimit}秒内完成${arrows}箭`
|
? `在${timeLimit}秒内完成${arrows}箭`
|
||||||
: `不限时完成${arrows}箭`;
|
: `不限时完成${arrows}箭`;
|
||||||
const promoteText = promoteCnt > 0 ? `完成${promoteCnt}次晋级` : "";
|
|
||||||
|
|
||||||
const summaryMap = {
|
const summaryMap = {
|
||||||
base: [
|
base: [
|
||||||
@@ -130,15 +132,30 @@ const createDifficultySummary = (item = {}) => {
|
|||||||
`需要有${arrows}箭命中高亮区域`,
|
`需要有${arrows}箭命中高亮区域`,
|
||||||
],
|
],
|
||||||
rhythm: [
|
rhythm: [
|
||||||
desc || `间隔${timeLimit}秒射击`,
|
arrows > 0
|
||||||
[
|
? `需要在指定时间节点射出${arrows}射箭`
|
||||||
`${arrows}箭`,
|
: "需要在指定时间节点射箭",
|
||||||
hitReq > 0 ? `每箭${hitReq}环以上` : "上靶即可",
|
hitReq > 0 ? `且每箭命中${hitReq}环内` : "且每箭命中指定区域",
|
||||||
getDifficultyModeText(item.mode),
|
],
|
||||||
promoteText,
|
stability: [
|
||||||
]
|
{
|
||||||
.filter(Boolean)
|
parts: [
|
||||||
.join(" · "),
|
{ text: timeLimit > 0 ? "在" : "" },
|
||||||
|
{
|
||||||
|
text: timeLimit > 0 ? `${timeLimit}秒` : "不限时",
|
||||||
|
highlight: true,
|
||||||
|
},
|
||||||
|
{ text: timeLimit > 0 ? "内射箭,命中" : "射箭,命中" },
|
||||||
|
{ text: `${hitReq}环`, highlight: true },
|
||||||
|
{ text: "可获得能量" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
parts: [
|
||||||
|
{ text: "计时结束能量需要大于" },
|
||||||
|
{ text: `${energyReqPercent}%`, highlight: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -612,6 +629,23 @@ const createPracticeQuery = (difficulty) => {
|
|||||||
rhythm: {
|
rhythm: {
|
||||||
hitReq: toNumber(difficulty.hit_req),
|
hitReq: toNumber(difficulty.hit_req),
|
||||||
mode: toNumber(difficulty.mode),
|
mode: toNumber(difficulty.mode),
|
||||||
|
roundTime: toNumber(difficulty.round_time ?? difficulty.roundTime),
|
||||||
|
shootTime: toNumber(difficulty.shoot_time ?? difficulty.shootTime),
|
||||||
|
},
|
||||||
|
stability: {
|
||||||
|
hitReq: toNumber(difficulty.hit_req),
|
||||||
|
scoreSlot: toNumber(
|
||||||
|
difficulty.score_slot ?? difficulty.scoreSlot
|
||||||
|
),
|
||||||
|
energyPerHit: toNumber(
|
||||||
|
difficulty.energy_per_hit ?? difficulty.energyPerHit
|
||||||
|
),
|
||||||
|
energyCostPerSec: toNumber(
|
||||||
|
difficulty.energy_cost_per_sec ?? difficulty.energyCostPerSec
|
||||||
|
),
|
||||||
|
energyReqPercent: toNumber(
|
||||||
|
difficulty.energy_req_percent ?? difficulty.energyReqPercent
|
||||||
|
),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -645,6 +679,21 @@ const saveTrainingContext = (practice = {}) => {
|
|||||||
difficultyLabel: difficulty.label,
|
difficultyLabel: difficulty.label,
|
||||||
targetType: defaultTargetType,
|
targetType: defaultTargetType,
|
||||||
targetPaperType: difficulty.targetPaperType,
|
targetPaperType: difficulty.targetPaperType,
|
||||||
|
roundTime: toNumber(difficulty.round_time ?? difficulty.roundTime),
|
||||||
|
shootTime: toNumber(difficulty.shoot_time ?? difficulty.shootTime),
|
||||||
|
hitReq: toNumber(difficulty.hit_req ?? difficulty.hitReq),
|
||||||
|
scoreSlot: toNumber(
|
||||||
|
difficulty.score_slot ?? difficulty.scoreSlot
|
||||||
|
),
|
||||||
|
energyPerHit: toNumber(
|
||||||
|
difficulty.energy_per_hit ?? difficulty.energyPerHit
|
||||||
|
),
|
||||||
|
energyCostPerSec: toNumber(
|
||||||
|
difficulty.energy_cost_per_sec ?? difficulty.energyCostPerSec
|
||||||
|
),
|
||||||
|
energyReqPercent: toNumber(
|
||||||
|
difficulty.energy_req_percent ?? difficulty.energyReqPercent
|
||||||
|
),
|
||||||
practiceId: practice.id || "",
|
practiceId: practice.id || "",
|
||||||
serverAddr: practice.serverAddr || "",
|
serverAddr: practice.serverAddr || "",
|
||||||
createdAt: practice.id ? Date.now() : 0,
|
createdAt: practice.id ? Date.now() : 0,
|
||||||
@@ -803,6 +852,7 @@ onShow(() => {
|
|||||||
:node="node"
|
:node="node"
|
||||||
:active="node.id === selectedDifficultyId"
|
:active="node.id === selectedDifficultyId"
|
||||||
:locked="checkDifficultyLocked(node)"
|
:locked="checkDifficultyLocked(node)"
|
||||||
|
:showUnlockProgress="node.id === unlockedDifficultyId"
|
||||||
:completedProgress="getCompletedDifficultyProgress(node)"
|
:completedProgress="getCompletedDifficultyProgress(node)"
|
||||||
@click="handleSelectDifficulty"
|
@click="handleSelectDifficulty"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -15,19 +15,19 @@ const trainingModeRouteMap = {
|
|||||||
endurance: "endurance",
|
endurance: "endurance",
|
||||||
precision: "precision",
|
precision: "precision",
|
||||||
rhythm: "rhythm",
|
rhythm: "rhythm",
|
||||||
strength: "power",
|
stability: "stability",
|
||||||
};
|
};
|
||||||
const unavailableTrainingIds = new Set(["rhythm", "strength"]);
|
const unavailableTrainingIds = new Set();
|
||||||
// 训练项目卡片右侧主图标。
|
// 训练项目卡片右侧主图标。
|
||||||
const trainingModeIconMap = {
|
const trainingModeIconMap = {
|
||||||
base_bow:
|
base_bow:
|
||||||
"https://static.shelingxingqiu.com/shootmini/static/training-home/img_3.png",
|
"https://static.shelingxingqiu.com/shootmini/static/training-home/img_3.png",
|
||||||
bow: "https://static.shelingxingqiu.com/shootmini/static/training-home/img_4.png",
|
bow: "https://static.shelingxingqiu.com/shootmini/static/training-home/img_5.png",
|
||||||
target:
|
target:
|
||||||
"https://static.shelingxingqiu.com/shootmini/static/training-home/img_5.png",
|
"https://static.shelingxingqiu.com/shootmini/static/training-home/img_4.png",
|
||||||
wave: "https://static.shelingxingqiu.com/shootmini/static/training-home/img_6.png",
|
wave: "https://static.shelingxingqiu.com/shootmini/static/training-home/img_6.png",
|
||||||
muscle:
|
muscle:
|
||||||
"https://static.shelingxingqiu.com/shootmini/static/training-home/img_6.png",
|
"https://static.shelingxingqiu.com/shootmini/static/training-home/img_7.png",
|
||||||
};
|
};
|
||||||
// 训练项目卡片标题图,按接口 id 映射 CDN 资源。
|
// 训练项目卡片标题图,按接口 id 映射 CDN 资源。
|
||||||
const trainingModeTitleImageMap = {
|
const trainingModeTitleImageMap = {
|
||||||
@@ -39,21 +39,22 @@ const trainingModeTitleImageMap = {
|
|||||||
"https://static.shelingxingqiu.com/shootmini/static/training-home/jingzhunxunlian.png",
|
"https://static.shelingxingqiu.com/shootmini/static/training-home/jingzhunxunlian.png",
|
||||||
rhythm:
|
rhythm:
|
||||||
"https://static.shelingxingqiu.com/shootmini/static/training-home/jiezouxunlian.png",
|
"https://static.shelingxingqiu.com/shootmini/static/training-home/jiezouxunlian.png",
|
||||||
strength:
|
stability:
|
||||||
"https://static.shelingxingqiu.com/shootmini/static/training-home/liliangxulian.png",
|
"https://static.shelingxingqiu.com/shootmini/static/training-home/wendingxunlian.png",
|
||||||
};
|
};
|
||||||
const defaultWeekDays = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"];
|
const defaultWeekDays = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"];
|
||||||
const defaultRadarDimensions = [
|
const defaultRadarDimensions = [
|
||||||
{ name: "基础", score: 0 },
|
{ name: "基础", score: 0 },
|
||||||
{ name: "精准", score: 0 },
|
{ name: "精准", score: 0 },
|
||||||
{ name: "力量", score: 0 },
|
{ name: "稳定", score: 0 },
|
||||||
{ name: "节奏", score: 0 },
|
{ name: "节奏", score: 0 },
|
||||||
{ name: "耐力", score: 0 },
|
{ name: "耐力", score: 0 },
|
||||||
];
|
];
|
||||||
const radarDimensionTrainingIdMap = Object.freeze({
|
const radarDimensionTrainingIdMap = Object.freeze({
|
||||||
基础: "base",
|
基础: "base",
|
||||||
精准: "precision",
|
精准: "precision",
|
||||||
力量: "strength",
|
稳定: "stability",
|
||||||
|
力量: "stability",
|
||||||
节奏: "rhythm",
|
节奏: "rhythm",
|
||||||
耐力: "endurance",
|
耐力: "endurance",
|
||||||
});
|
});
|
||||||
@@ -66,7 +67,7 @@ const createDefaultTrainingData = () => ({
|
|||||||
total_arrows: 0,
|
total_arrows: 0,
|
||||||
target_rate: 0,
|
target_rate: 0,
|
||||||
ten_ring_count: 0,
|
ten_ring_count: 0,
|
||||||
total_calories: 0,
|
average_ring: 0,
|
||||||
},
|
},
|
||||||
beat_percent: 0,
|
beat_percent: 0,
|
||||||
radar_max: 0,
|
radar_max: 0,
|
||||||
@@ -124,20 +125,20 @@ const formatValue = (value, digits = 1) => {
|
|||||||
return String(Number(numberValue.toFixed(digits)));
|
return String(Number(numberValue.toFixed(digits)));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const formatCompactCount = (value) => {
|
||||||
|
const numberValue = Number(value);
|
||||||
|
if (!Number.isFinite(numberValue)) return "--";
|
||||||
|
if (numberValue >= 10000) return `${formatValue(numberValue / 1000)}K`;
|
||||||
|
return formatValue(numberValue, 0);
|
||||||
|
};
|
||||||
|
|
||||||
const getLevelText = (item) => {
|
const getLevelText = (item) => {
|
||||||
if (!item) return "";
|
if (!item) return "";
|
||||||
const level = Number(item.current_level) || 0;
|
const level = Number(item.current_level) || 0;
|
||||||
return `当前进度 LV${level} >`;
|
return `当前进度 LV${level} >`;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 卡路里字段按需求做 K / W 缩写展示。
|
const getAverageRingValue = (value) => formatValue(value);
|
||||||
const getCaloriesValue = (value) => {
|
|
||||||
const numberValue = Number(value);
|
|
||||||
if (!Number.isFinite(numberValue)) return "--";
|
|
||||||
if (numberValue >= 10000) return `${formatValue(numberValue / 10000)}W`;
|
|
||||||
if (numberValue >= 1000) return `${formatValue(numberValue / 1000)}K`;
|
|
||||||
return formatValue(numberValue, 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
const getTrainingIcon = (item = {}) =>
|
const getTrainingIcon = (item = {}) =>
|
||||||
trainingModeIconMap[item.icon] || trainingModeIconMap.bow;
|
trainingModeIconMap[item.icon] || trainingModeIconMap.bow;
|
||||||
@@ -288,7 +289,7 @@ const loadPersonalTrainingData = async () => {
|
|||||||
total_arrows: result?.stats?.total_arrows ?? 0,
|
total_arrows: result?.stats?.total_arrows ?? 0,
|
||||||
target_rate: result?.stats?.target_rate ?? 0,
|
target_rate: result?.stats?.target_rate ?? 0,
|
||||||
ten_ring_count: result?.stats?.ten_ring_count ?? 0,
|
ten_ring_count: result?.stats?.ten_ring_count ?? 0,
|
||||||
total_calories: result?.stats?.total_calories ?? 0,
|
average_ring: result?.stats?.average_ring ?? 0,
|
||||||
},
|
},
|
||||||
beat_percent: result?.beat_percent ?? 0,
|
beat_percent: result?.beat_percent ?? 0,
|
||||||
radar_max: result?.radar_max ?? 0,
|
radar_max: result?.radar_max ?? 0,
|
||||||
@@ -418,7 +419,7 @@ onShow(async () => {
|
|||||||
<view class="stats-value-row">
|
<view class="stats-value-row">
|
||||||
<view class="stats-value-group">
|
<view class="stats-value-group">
|
||||||
<text class="stats-value">
|
<text class="stats-value">
|
||||||
{{ formatValue(trainingData.stats.total_arrows, 0) }}
|
{{ formatCompactCount(trainingData.stats.total_arrows) }}
|
||||||
</text>
|
</text>
|
||||||
<text class="stats-unit">支</text>
|
<text class="stats-unit">支</text>
|
||||||
<view class="stats-value-decoration"></view>
|
<view class="stats-value-decoration"></view>
|
||||||
@@ -444,7 +445,7 @@ onShow(async () => {
|
|||||||
<view class="stats-value-row">
|
<view class="stats-value-row">
|
||||||
<view class="stats-value-group">
|
<view class="stats-value-group">
|
||||||
<text class="stats-value">
|
<text class="stats-value">
|
||||||
{{ formatValue(trainingData.stats.ten_ring_count, 0) }}
|
{{ formatCompactCount(trainingData.stats.ten_ring_count) }}
|
||||||
</text>
|
</text>
|
||||||
<text class="stats-unit">支</text>
|
<text class="stats-unit">支</text>
|
||||||
<view class="stats-value-decoration"></view>
|
<view class="stats-value-decoration"></view>
|
||||||
@@ -457,13 +458,13 @@ onShow(async () => {
|
|||||||
<view class="stats-value-row">
|
<view class="stats-value-row">
|
||||||
<view class="stats-value-group">
|
<view class="stats-value-group">
|
||||||
<text class="stats-value">
|
<text class="stats-value">
|
||||||
{{ getCaloriesValue(trainingData.stats.total_calories) }}
|
{{ getAverageRingValue(trainingData.stats.average_ring) }}
|
||||||
</text>
|
</text>
|
||||||
<text class="stats-unit">卡路里</text>
|
<text class="stats-unit">环</text>
|
||||||
<view class="stats-value-decoration"></view>
|
<view class="stats-value-decoration"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<text class="stats-label">共消耗</text>
|
<text class="stats-label">平均环数</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -483,7 +484,7 @@ onShow(async () => {
|
|||||||
<text class="record-sub-text">我的训练记录</text>
|
<text class="record-sub-text">我的训练记录</text>
|
||||||
<image
|
<image
|
||||||
class="record-arrow"
|
class="record-arrow"
|
||||||
src="https://static.shelingxingqiu.com/shootmini/static/training-home/img_7.png"
|
src="https://static.shelingxingqiu.com/shootmini/static/training-home/img_right.png"
|
||||||
mode="widthFix"
|
mode="widthFix"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
@@ -530,19 +531,26 @@ onShow(async () => {
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="featured-card" @click="$clickSound(openRoutineTraining)">
|
|
||||||
<image
|
|
||||||
class="featured-card-bg"
|
|
||||||
src="https://static.shelingxingqiu.com/shootmini/static/training-home/img_22.png"
|
|
||||||
mode="widthFix"
|
|
||||||
/>
|
|
||||||
<view class="featured-card-mask"></view>
|
|
||||||
<view class="featured-card-copy">
|
|
||||||
<text class="featured-card-subtitle">12箭练习</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="mode-grid">
|
<view class="mode-grid">
|
||||||
|
<view
|
||||||
|
class="mode-card"
|
||||||
|
@click="$clickSound(openRoutineTraining)"
|
||||||
|
>
|
||||||
|
<view class="mode-card-copy">
|
||||||
|
<image
|
||||||
|
class="mode-card-title-image"
|
||||||
|
src="https://static.shelingxingqiu.com/shootmini/static/training-home/ziyouxunlian.png"
|
||||||
|
mode="widthFix"
|
||||||
|
/>
|
||||||
|
<text class="mode-card-progress">无级别限制</text>
|
||||||
|
</view>
|
||||||
|
<image
|
||||||
|
class="mode-card-icon"
|
||||||
|
src="https://static.shelingxingqiu.com/shootmini/static/training-home/img_2.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view
|
<view
|
||||||
v-for="item in visibleTrainingItems"
|
v-for="item in visibleTrainingItems"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@@ -743,7 +751,7 @@ onShow(async () => {
|
|||||||
|
|
||||||
.radar-section {
|
.radar-section {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-top: 34rpx;
|
padding-top: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-bubble {
|
.record-bubble {
|
||||||
@@ -860,52 +868,6 @@ onShow(async () => {
|
|||||||
width: 92rpx;
|
width: 92rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.featured-card {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
height: 150rpx;
|
|
||||||
margin-top: 70rpx;
|
|
||||||
border-radius: 16rpx;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.featured-card-bg {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.featured-card-mask {
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
width: 278rpx;
|
|
||||||
height: 150rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.featured-card-copy {
|
|
||||||
position: absolute;
|
|
||||||
left: 174rpx;
|
|
||||||
top: 58rpx;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.featured-card-title {
|
|
||||||
display: block;
|
|
||||||
color: #895409;
|
|
||||||
font-size: 34rpx;
|
|
||||||
font-family: "AlimamaShuHeiTi-Bold", "PingFang SC", sans-serif;
|
|
||||||
font-weight: 700;
|
|
||||||
line-height: 42rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.featured-card-subtitle {
|
|
||||||
display: block;
|
|
||||||
margin-top: 10rpx;
|
|
||||||
color: #895409;
|
|
||||||
font-size: 22rpx;
|
|
||||||
line-height: 32rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mode-grid {
|
.mode-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
@@ -915,11 +877,11 @@ onShow(async () => {
|
|||||||
|
|
||||||
.mode-card {
|
.mode-card {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 150rpx;
|
height: 130rpx;
|
||||||
box-shadow: inset 2rpx 2rpx 6rpx 0rpx rgba(255, 255, 255, 0.27);
|
box-shadow: inset 2rpx 2rpx 6rpx 0rpx rgba(255, 255, 255, 0.27);
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
border: 2rpx solid rgba(235, 184, 123, 0.5);
|
border: 2rpx solid rgba(235, 184, 123, 0.5);
|
||||||
background: rgba(0, 0, 0, 0.5);
|
/* background: rgba(0, 0, 0, 0.5); */
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -928,8 +890,8 @@ onShow(async () => {
|
|||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 72rpx;
|
width: 72rpx;
|
||||||
height: 34rpx;
|
height: 28rpx;
|
||||||
line-height: 34rpx;
|
line-height: 28rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 20rpx;
|
font-size: 20rpx;
|
||||||
color: #000;
|
color: #000;
|
||||||
@@ -940,7 +902,7 @@ onShow(async () => {
|
|||||||
.mode-card-copy {
|
.mode-card-copy {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 30rpx;
|
left: 30rpx;
|
||||||
top: 40rpx;
|
top: 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode-card-title {
|
.mode-card-title {
|
||||||
@@ -968,16 +930,16 @@ onShow(async () => {
|
|||||||
display: block;
|
display: block;
|
||||||
margin-top: 14rpx;
|
margin-top: 14rpx;
|
||||||
color: #fcce96;
|
color: #fcce96;
|
||||||
font-size: 22rpx;
|
font-size: 20rpx;
|
||||||
line-height: 32rpx;
|
line-height: 28rpx;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode-card-icon {
|
.mode-card-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 12rpx;
|
right: 18rpx;
|
||||||
top: 14rpx;
|
top: 8rpx;
|
||||||
width: 124rpx;
|
width: 116rpx;
|
||||||
height: 124rpx;
|
height: 116rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -10,7 +10,15 @@ import Avatar from "@/components/Avatar.vue";
|
|||||||
import BowPower from "@/components/BowPower.vue";
|
import BowPower from "@/components/BowPower.vue";
|
||||||
import TestDistance from "./components/TestDistance.vue";
|
import TestDistance from "./components/TestDistance.vue";
|
||||||
import BubbleTip from "./components/BubbleTip.vue";
|
import BubbleTip from "./components/BubbleTip.vue";
|
||||||
import audioManager from "@/audioManager";
|
import audioManager, {
|
||||||
|
getPrecisionShotAudioKeys,
|
||||||
|
getRhythmShotAudioKeys,
|
||||||
|
getStabilityShotAudioKeys,
|
||||||
|
getTrainingStartAudioKey,
|
||||||
|
RHYTHM_SHOOT_WINDOW_AUDIO_KEY,
|
||||||
|
STABILITY_ENERGY_50_AUDIO_KEY,
|
||||||
|
STABILITY_ENERGY_70_AUDIO_KEY,
|
||||||
|
} from "@/audioManager";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createPractiseV2API,
|
createPractiseV2API,
|
||||||
@@ -23,12 +31,13 @@ import {
|
|||||||
import {
|
import {
|
||||||
connectMatchWebSocket,
|
connectMatchWebSocket,
|
||||||
closeMatchWebSocket,
|
closeMatchWebSocket,
|
||||||
|
requestPracticeInfoSync,
|
||||||
setMatchAppHideResumable,
|
setMatchAppHideResumable,
|
||||||
MATCH_WS_PRACTICE_SYNC_EVENT,
|
MATCH_WS_PRACTICE_SYNC_EVENT,
|
||||||
MATCH_WS_STATE_EVENT,
|
MATCH_WS_STATE_EVENT,
|
||||||
} from "@/matchWebsocket";
|
} from "@/matchWebsocket";
|
||||||
import { sharePractiseData } from "@/canvas";
|
import { sharePractiseData } from "@/canvas";
|
||||||
import { wxShare, debounce, getDirectionText } from "@/util";
|
import { wxShare, debounce, getDirectionText, capsuleHeight } from "@/util";
|
||||||
import { MESSAGETYPESV2, roundsName } from "@/constants";
|
import { MESSAGETYPESV2, roundsName } from "@/constants";
|
||||||
|
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
@@ -38,6 +47,7 @@ const { user } = storeToRefs(store);
|
|||||||
|
|
||||||
const sound = ref(true);
|
const sound = ref(true);
|
||||||
const start = ref(false);
|
const start = ref(false);
|
||||||
|
const practiceStarting = ref(false);
|
||||||
const pageStages = Object.freeze({
|
const pageStages = Object.freeze({
|
||||||
DISTANCE: "distance",
|
DISTANCE: "distance",
|
||||||
SHOOTING: "shooting",
|
SHOOTING: "shooting",
|
||||||
@@ -46,6 +56,25 @@ const pageStages = Object.freeze({
|
|||||||
});
|
});
|
||||||
const pageStage = ref(pageStages.LOADING);
|
const pageStage = ref(pageStages.LOADING);
|
||||||
const scores = ref([]);
|
const scores = ref([]);
|
||||||
|
// 复用金币模块的标题视觉,但保留练习页默认 Header,避免影响返回按钮。
|
||||||
|
const rhythmHeaderTitleStyle = Object.freeze({
|
||||||
|
position: "fixed",
|
||||||
|
top: `${capsuleHeight}px`,
|
||||||
|
left: "50%",
|
||||||
|
width: "430rpx",
|
||||||
|
height: "50px",
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
transform: "translateX(-50%)",
|
||||||
|
color: "#e7ba80",
|
||||||
|
fontSize: "30rpx",
|
||||||
|
lineHeight: "42rpx",
|
||||||
|
fontWeight: 500,
|
||||||
|
textAlign: "center",
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
zIndex: 20,
|
||||||
|
});
|
||||||
// 只在实时 ShootResult 新增一箭时递增,避免同步快照重播飞箭特效。
|
// 只在实时 ShootResult 新增一箭时递增,避免同步快照重播飞箭特效。
|
||||||
const shotEffectToken = ref(0);
|
const shotEffectToken = ref(0);
|
||||||
// 可见区域每次正式提交都递增,同一区域连续刷新也能触发动效。
|
// 可见区域每次正式提交都递增,同一区域连续刷新也能触发动效。
|
||||||
@@ -62,6 +91,17 @@ const tips = ref("");
|
|||||||
const targetType = ref(defaultTargetType);
|
const targetType = ref(defaultTargetType);
|
||||||
const trainingParams = ref({});
|
const trainingParams = ref({});
|
||||||
const practiceInfo = ref({});
|
const practiceInfo = ref({});
|
||||||
|
const simulatorTargetType = computed(() => {
|
||||||
|
const currentTargetType = Number(practiceInfo.value.targetType);
|
||||||
|
if ([20, 40].includes(currentTargetType)) return currentTargetType;
|
||||||
|
return [2, 40].includes(Number(targetType.value)) ? 40 : 20;
|
||||||
|
});
|
||||||
|
const rhythmServerTimestamp = ref(0);
|
||||||
|
const rhythmFallbackWindowStart = ref(0);
|
||||||
|
const rhythmFallbackTimestamp = ref(0);
|
||||||
|
const rhythmHasActiveServerAnchor = ref(false);
|
||||||
|
// 节奏训练目标箭数以服务端 total_arrows 为准;首帧缺失时用 arrows_left 初始化并保持稳定。
|
||||||
|
const rhythmTargetArrows = ref(0);
|
||||||
// 服务端状态立即落到 practiceInfo,精准训练的目标区域单独延迟展示。
|
// 服务端状态立即落到 practiceInfo,精准训练的目标区域单独延迟展示。
|
||||||
const visiblePrecisionTarget = ref({
|
const visiblePrecisionTarget = ref({
|
||||||
randomBlock: 0,
|
randomBlock: 0,
|
||||||
@@ -232,6 +272,96 @@ const loadNextDifficultyState = (result = {}) => {
|
|||||||
// time_limit 缺失或非正数都表示整局不限时。
|
// time_limit 缺失或非正数都表示整局不限时。
|
||||||
const timeLimit = computed(() => getPositiveInteger(practiceInfo.value.timeLimit));
|
const timeLimit = computed(() => getPositiveInteger(practiceInfo.value.timeLimit));
|
||||||
const hasTimeLimit = computed(() => timeLimit.value > 0);
|
const hasTimeLimit = computed(() => timeLimit.value > 0);
|
||||||
|
const isRhythmTraining = computed(() => trainingType.value === "rhythm");
|
||||||
|
const isStabilityTraining = computed(
|
||||||
|
() => trainingType.value === "stability"
|
||||||
|
);
|
||||||
|
const rhythmRoundTime = computed(() =>
|
||||||
|
getPositiveInteger(practiceInfo.value.roundTime) ||
|
||||||
|
getPositiveInteger(trainingParams.value.roundTime)
|
||||||
|
);
|
||||||
|
const rhythmShootTime = computed(() =>
|
||||||
|
getPositiveInteger(practiceInfo.value.shootTime) ||
|
||||||
|
getPositiveInteger(trainingParams.value.shootTime)
|
||||||
|
);
|
||||||
|
const rhythmShootWindowStart = computed(() => {
|
||||||
|
if (rhythmHasActiveServerAnchor.value) {
|
||||||
|
return practiceInfo.value.shootWindowStart || 0;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
rhythmFallbackWindowStart.value ||
|
||||||
|
practiceInfo.value.shootWindowStart ||
|
||||||
|
0
|
||||||
|
);
|
||||||
|
});
|
||||||
|
const rhythmCountdownTimestamp = computed(() =>
|
||||||
|
rhythmHasActiveServerAnchor.value
|
||||||
|
? rhythmServerTimestamp.value
|
||||||
|
: rhythmFallbackTimestamp.value || rhythmServerTimestamp.value
|
||||||
|
);
|
||||||
|
const rhythmInShootWindow = computed(
|
||||||
|
() => practiceInfo.value.inShootWindow === true
|
||||||
|
);
|
||||||
|
const rhythmHitReq = computed(
|
||||||
|
() =>
|
||||||
|
getPositiveInteger(practiceInfo.value.hitReq) ||
|
||||||
|
getPositiveInteger(trainingParams.value.hitReq)
|
||||||
|
);
|
||||||
|
|
||||||
|
const stabilityEnergyReqPercent = computed(() =>
|
||||||
|
Math.max(
|
||||||
|
0,
|
||||||
|
Math.min(
|
||||||
|
100,
|
||||||
|
getPracticeNumber(
|
||||||
|
practiceInfo.value.energyReqPercent,
|
||||||
|
trainingParams.value.energyReqPercent
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const stabilityScoreSlot = computed(() =>
|
||||||
|
Math.max(
|
||||||
|
0,
|
||||||
|
getPracticeNumber(
|
||||||
|
practiceInfo.value.scoreSlot,
|
||||||
|
trainingParams.value.scoreSlot
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const stabilityCurrentEnergy = computed(() => {
|
||||||
|
const currentEnergy = Math.max(
|
||||||
|
0,
|
||||||
|
getPracticeNumber(practiceInfo.value.currentEnergy)
|
||||||
|
);
|
||||||
|
return stabilityScoreSlot.value > 0
|
||||||
|
? Math.min(stabilityScoreSlot.value, currentEnergy)
|
||||||
|
: currentEnergy;
|
||||||
|
});
|
||||||
|
const stabilityEnergyPercent = computed(() => {
|
||||||
|
if (stabilityScoreSlot.value <= 0) return 0;
|
||||||
|
return Math.min(
|
||||||
|
100,
|
||||||
|
(stabilityCurrentEnergy.value / stabilityScoreSlot.value) * 100
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const initializeRhythmFirstRoundCountdown = () => {
|
||||||
|
rhythmHasActiveServerAnchor.value = false;
|
||||||
|
rhythmFallbackWindowStart.value = 0;
|
||||||
|
rhythmFallbackTimestamp.value = 0;
|
||||||
|
if (!isRhythmTraining.value) return;
|
||||||
|
|
||||||
|
const roundTime = rhythmRoundTime.value;
|
||||||
|
const shootTime = rhythmShootTime.value;
|
||||||
|
if (!roundTime || !shootTime || shootTime > roundTime) return;
|
||||||
|
|
||||||
|
const localNow = Date.now();
|
||||||
|
rhythmFallbackTimestamp.value = localNow;
|
||||||
|
// shootWindowStart 位于整轮最后 shootTime 秒的起点。
|
||||||
|
rhythmFallbackWindowStart.value =
|
||||||
|
localNow + (roundTime - shootTime) * 1000;
|
||||||
|
};
|
||||||
|
|
||||||
const precisionBlocks = computed(() => {
|
const precisionBlocks = computed(() => {
|
||||||
if (useHighlightTest.value) {
|
if (useHighlightTest.value) {
|
||||||
@@ -336,6 +466,62 @@ const trainingCopy = computed(() => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (trainingType.value === "rhythm") {
|
||||||
|
const targetArrows = getPositiveInteger(rhythmTargetArrows.value);
|
||||||
|
const arrowsLeft = Math.min(
|
||||||
|
targetArrows,
|
||||||
|
Math.max(
|
||||||
|
0,
|
||||||
|
getPracticeNumber(practiceInfo.value.arrowsLeft, targetArrows)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const completedArrows = targetArrows - arrowsLeft;
|
||||||
|
const hitReq = rhythmHitReq.value;
|
||||||
|
|
||||||
|
return {
|
||||||
|
inline: true,
|
||||||
|
details: [
|
||||||
|
{ text: "在进度条读取到高亮区间时射箭命中" },
|
||||||
|
{
|
||||||
|
text: hitReq > 0 ? `${hitReq}环内` : "指定区域",
|
||||||
|
highlight: true,
|
||||||
|
},
|
||||||
|
{ text: ",需完成" },
|
||||||
|
{ text: `(${completedArrows}/${targetArrows})`, highlight: true },
|
||||||
|
{ text: "箭" },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trainingType.value === "stability") {
|
||||||
|
const hitReq = getPracticeNumber(
|
||||||
|
practiceInfo.value.hitReq,
|
||||||
|
trainingParams.value.hitReq
|
||||||
|
);
|
||||||
|
const stabilityTimeLimit = getPracticeNumber(
|
||||||
|
practiceInfo.value.timeLimit,
|
||||||
|
trainingParams.value.timeLimit
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
inline: true,
|
||||||
|
details: [
|
||||||
|
{ text: stabilityTimeLimit > 0 ? "在" : "" },
|
||||||
|
{
|
||||||
|
text: stabilityTimeLimit > 0 ? `${stabilityTimeLimit}秒` : "不限时",
|
||||||
|
highlight: true,
|
||||||
|
},
|
||||||
|
{ text: stabilityTimeLimit > 0 ? "内射箭,命中" : "射箭,命中" },
|
||||||
|
{ text: `${hitReq}环`, highlight: true },
|
||||||
|
{ text: "可获得能量,计时结束能量需要大于" },
|
||||||
|
{
|
||||||
|
text: `${stabilityEnergyReqPercent.value}%`,
|
||||||
|
highlight: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -369,6 +555,22 @@ const practiceInfoFields = [
|
|||||||
"blocks",
|
"blocks",
|
||||||
"randomBlock",
|
"randomBlock",
|
||||||
"randomRingArea",
|
"randomRingArea",
|
||||||
|
"roundTime",
|
||||||
|
"shootTime",
|
||||||
|
"shootWindowStart",
|
||||||
|
"inShootWindow",
|
||||||
|
"scoreSlot",
|
||||||
|
"currentEnergy",
|
||||||
|
"energyCostPerSec",
|
||||||
|
"energyPerHit",
|
||||||
|
"energyReqPercent",
|
||||||
|
"deltaCurrentEnergy",
|
||||||
|
"maxEnergyPercent",
|
||||||
|
"qualifiedArrows",
|
||||||
|
"qualifiedRate",
|
||||||
|
"deltaMaxEnergyPercent",
|
||||||
|
"deltaQualifiedArrows",
|
||||||
|
"deltaQualifiedRate",
|
||||||
"timeLimit",
|
"timeLimit",
|
||||||
"completed",
|
"completed",
|
||||||
"totalArrows",
|
"totalArrows",
|
||||||
@@ -377,13 +579,17 @@ const practiceInfoFields = [
|
|||||||
"stability",
|
"stability",
|
||||||
"maxCombo",
|
"maxCombo",
|
||||||
"totalHits",
|
"totalHits",
|
||||||
|
"hitRate",
|
||||||
"deltaTotalHits",
|
"deltaTotalHits",
|
||||||
"deltaDuration",
|
"deltaDuration",
|
||||||
|
"deltaHitRate",
|
||||||
"deltaMaxCombo",
|
"deltaMaxCombo",
|
||||||
"deltaTotalRings",
|
"deltaTotalRings",
|
||||||
"deltaTotalArrows",
|
"deltaTotalArrows",
|
||||||
"deltaAverageRing",
|
"deltaAverageRing",
|
||||||
"deltaStability",
|
"deltaStability",
|
||||||
|
"tenRingCount",
|
||||||
|
"deltaTenRingCount",
|
||||||
"beforeExp",
|
"beforeExp",
|
||||||
"beforeLevel",
|
"beforeLevel",
|
||||||
"currentExp",
|
"currentExp",
|
||||||
@@ -404,14 +610,30 @@ const practiceResultFields = [
|
|||||||
"stability",
|
"stability",
|
||||||
"maxCombo",
|
"maxCombo",
|
||||||
"totalHits",
|
"totalHits",
|
||||||
|
"hitRate",
|
||||||
"currentRings",
|
"currentRings",
|
||||||
|
"scoreSlot",
|
||||||
|
"currentEnergy",
|
||||||
|
"energyCostPerSec",
|
||||||
|
"energyPerHit",
|
||||||
|
"energyReqPercent",
|
||||||
|
"deltaCurrentEnergy",
|
||||||
|
"maxEnergyPercent",
|
||||||
|
"qualifiedArrows",
|
||||||
|
"qualifiedRate",
|
||||||
|
"deltaMaxEnergyPercent",
|
||||||
|
"deltaQualifiedArrows",
|
||||||
|
"deltaQualifiedRate",
|
||||||
"deltaTotalHits",
|
"deltaTotalHits",
|
||||||
"deltaDuration",
|
"deltaDuration",
|
||||||
|
"deltaHitRate",
|
||||||
"deltaMaxCombo",
|
"deltaMaxCombo",
|
||||||
"deltaTotalRings",
|
"deltaTotalRings",
|
||||||
"deltaTotalArrows",
|
"deltaTotalArrows",
|
||||||
"deltaAverageRing",
|
"deltaAverageRing",
|
||||||
"deltaStability",
|
"deltaStability",
|
||||||
|
"tenRingCount",
|
||||||
|
"deltaTenRingCount",
|
||||||
"beforeExp",
|
"beforeExp",
|
||||||
"beforeLevel",
|
"beforeLevel",
|
||||||
"currentExp",
|
"currentExp",
|
||||||
@@ -421,7 +643,72 @@ const practiceResultFields = [
|
|||||||
"details",
|
"details",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const cacheRhythmTrainingConfig = (message = {}) => {
|
||||||
|
const messageTrainingType = String(
|
||||||
|
message.trainingType ?? message.training_type ?? trainingType.value
|
||||||
|
).trim();
|
||||||
|
if (messageTrainingType !== "rhythm") return;
|
||||||
|
|
||||||
|
const roundTime = getPositiveInteger(
|
||||||
|
message.roundTime ?? message.round_time
|
||||||
|
);
|
||||||
|
const shootTime = getPositiveInteger(
|
||||||
|
message.shootTime ?? message.shoot_time
|
||||||
|
);
|
||||||
|
const hitReq = getPositiveInteger(message.hitReq ?? message.hit_req);
|
||||||
|
const nextConfig = {};
|
||||||
|
|
||||||
|
// 固定训练配置单独缓存,避免后续部分快照清空 practiceInfo 时丢失。
|
||||||
|
if (roundTime > 0) nextConfig.roundTime = roundTime;
|
||||||
|
if (shootTime > 0) nextConfig.shootTime = shootTime;
|
||||||
|
if (hitReq > 0) nextConfig.hitReq = hitReq;
|
||||||
|
if (Object.keys(nextConfig).length === 0) return;
|
||||||
|
|
||||||
|
trainingParams.value = {
|
||||||
|
...trainingParams.value,
|
||||||
|
...nextConfig,
|
||||||
|
};
|
||||||
|
|
||||||
|
// 开始后配置才到达时补建首轮本地锚点;已有服务端锚点时不重置。
|
||||||
|
if (
|
||||||
|
start.value &&
|
||||||
|
!rhythmHasActiveServerAnchor.value &&
|
||||||
|
!rhythmFallbackWindowStart.value &&
|
||||||
|
rhythmRoundTime.value > 0 &&
|
||||||
|
rhythmShootTime.value > 0
|
||||||
|
) {
|
||||||
|
initializeRhythmFirstRoundCountdown();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const cacheRhythmTargetArrows = (message = {}) => {
|
||||||
|
const messageTrainingType = String(
|
||||||
|
message.trainingType ?? message.training_type ?? trainingType.value
|
||||||
|
).trim();
|
||||||
|
if (messageTrainingType !== "rhythm") return;
|
||||||
|
|
||||||
|
const totalArrows = getPositiveInteger(
|
||||||
|
message.totalArrows ?? message.total_arrows
|
||||||
|
);
|
||||||
|
if (totalArrows > 0) {
|
||||||
|
rhythmTargetArrows.value = totalArrows;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 兼容服务端首帧 total_arrows 暂为 0:只初始化一次,避免剩余数递减时分母跟着变化。
|
||||||
|
if (rhythmTargetArrows.value === 0) {
|
||||||
|
rhythmTargetArrows.value = getPositiveInteger(
|
||||||
|
message.arrowsLeft ?? message.arrows_left
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const syncPracticeInfo = (message = {}) => {
|
const syncPracticeInfo = (message = {}) => {
|
||||||
|
cacheRhythmTrainingConfig(message);
|
||||||
|
cacheRhythmTargetArrows(message);
|
||||||
|
const messageTrainingType = String(
|
||||||
|
message.trainingType ?? message.training_type ?? trainingType.value
|
||||||
|
).trim();
|
||||||
const nextInfo = practiceInfoFields.reduce((result, field) => {
|
const nextInfo = practiceInfoFields.reduce((result, field) => {
|
||||||
if (Object.prototype.hasOwnProperty.call(message, field)) {
|
if (Object.prototype.hasOwnProperty.call(message, field)) {
|
||||||
result[field] = message[field];
|
result[field] = message[field];
|
||||||
@@ -429,6 +716,24 @@ const syncPracticeInfo = (message = {}) => {
|
|||||||
return result;
|
return result;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
|
const isStabilityEnergySnapshot =
|
||||||
|
messageTrainingType === "stability" &&
|
||||||
|
(Object.prototype.hasOwnProperty.call(message, "currentEnergy") ||
|
||||||
|
message.type === undefined ||
|
||||||
|
[
|
||||||
|
MESSAGETYPESV2.BattleStart,
|
||||||
|
MESSAGETYPESV2.ShootResult,
|
||||||
|
MESSAGETYPESV2.BattleEnd,
|
||||||
|
].includes(message.type));
|
||||||
|
|
||||||
|
if (isStabilityEnergySnapshot) {
|
||||||
|
// BattleStart/ShootResult/PracticeEnd/同步消息都是稳定训练完整快照。
|
||||||
|
// current_energy 为 0 时 protobuf 不编码,不能沿用上一份非零能量。
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(nextInfo, "currentEnergy")) {
|
||||||
|
nextInfo.currentEnergy = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const isPrecisionSnapshot =
|
const isPrecisionSnapshot =
|
||||||
(message.type === MESSAGETYPESV2.BattleStart ||
|
(message.type === MESSAGETYPESV2.BattleStart ||
|
||||||
message.type === MESSAGETYPESV2.ShootResult) &&
|
message.type === MESSAGETYPESV2.ShootResult) &&
|
||||||
@@ -466,16 +771,28 @@ const buildShootResultAudioKeys = (message = {}) => {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const keys = [
|
const directionText =
|
||||||
arrow.ring ? `${arrow.ringX ? "X" : arrow.ring}环` : "未上靶",
|
arrow.angle !== null && arrow.angle !== undefined
|
||||||
];
|
? getDirectionText(arrow.angle)
|
||||||
if (arrow.angle !== null && arrow.angle !== undefined) {
|
: "";
|
||||||
keys.push(`向${getDirectionText(arrow.angle)}调整`);
|
return getPrecisionShotAudioKeys(arrow, directionText);
|
||||||
|
};
|
||||||
|
|
||||||
|
const buildRhythmShootResultAudioKeys = (message = {}) => {
|
||||||
|
const latestDetail =
|
||||||
|
Array.isArray(message.details) && message.details.length > 0
|
||||||
|
? message.details[message.details.length - 1]
|
||||||
|
: null;
|
||||||
|
const arrow = message.shootData || latestDetail;
|
||||||
|
if (!arrow) return [];
|
||||||
|
if (
|
||||||
|
arrow.playerId !== undefined &&
|
||||||
|
arrow.playerId !== null &&
|
||||||
|
String(arrow.playerId) !== String(user.value?.id)
|
||||||
|
) {
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
if (arrow.threeConsecutive10Rings === true) {
|
return getRhythmShotAudioKeys(arrow);
|
||||||
keys.push("tententen");
|
|
||||||
}
|
|
||||||
return keys;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const playAudioKeysAndWait = (keys) => {
|
const playAudioKeysAndWait = (keys) => {
|
||||||
@@ -703,6 +1020,16 @@ const onPracticeInfoSync = (payload = {}) => {
|
|||||||
|
|
||||||
const snapshot = payload.practiceInfo;
|
const snapshot = payload.practiceInfo;
|
||||||
if (!snapshot || typeof snapshot !== "object") return;
|
if (!snapshot || typeof snapshot !== "object") return;
|
||||||
|
if (
|
||||||
|
start.value &&
|
||||||
|
(snapshot.trainingType === "rhythm" || isRhythmTraining.value) &&
|
||||||
|
Number(snapshot.shootWindowStart) > 0
|
||||||
|
) {
|
||||||
|
rhythmHasActiveServerAnchor.value = true;
|
||||||
|
}
|
||||||
|
if (payload.timestamp !== undefined && payload.timestamp !== null) {
|
||||||
|
rhythmServerTimestamp.value = payload.timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
const shouldShowDistance =
|
const shouldShowDistance =
|
||||||
waitingPracticeSync && pageStage.value === pageStages.LOADING;
|
waitingPracticeSync && pageStage.value === pageStages.LOADING;
|
||||||
@@ -790,6 +1117,7 @@ const connectPracticeServer = ({
|
|||||||
requestPracticeInfoOnOpen: true,
|
requestPracticeInfoOnOpen: true,
|
||||||
appHideResumable: appHideResumable.value,
|
appHideResumable: appHideResumable.value,
|
||||||
practiceEndAudioKey: "练习结束",
|
practiceEndAudioKey: "练习结束",
|
||||||
|
trainingType: trainingType.value,
|
||||||
});
|
});
|
||||||
connectionClosed.value = false;
|
connectionClosed.value = false;
|
||||||
return true;
|
return true;
|
||||||
@@ -1015,16 +1343,58 @@ onLoad((options = {}) => {
|
|||||||
toRouteNumber(trainingContext.difficultyLevel)
|
toRouteNumber(trainingContext.difficultyLevel)
|
||||||
),
|
),
|
||||||
recordId: options.recordId || "",
|
recordId: options.recordId || "",
|
||||||
hitReq: toRouteNumber(options.hitReq),
|
hitReq: toRouteNumber(
|
||||||
|
options.hitReq,
|
||||||
|
toRouteNumber(trainingContext.hitReq)
|
||||||
|
),
|
||||||
totalReq: toRouteNumber(options.totalReq),
|
totalReq: toRouteNumber(options.totalReq),
|
||||||
blocks: toRouteNumber(options.blocks),
|
blocks: toRouteNumber(options.blocks),
|
||||||
mode: toRouteNumber(options.mode),
|
mode: toRouteNumber(options.mode),
|
||||||
|
roundTime: toRouteNumber(
|
||||||
|
options.roundTime,
|
||||||
|
toRouteNumber(trainingContext.roundTime)
|
||||||
|
),
|
||||||
|
shootTime: toRouteNumber(
|
||||||
|
options.shootTime,
|
||||||
|
toRouteNumber(trainingContext.shootTime)
|
||||||
|
),
|
||||||
|
energyPerHit: toRouteNumber(
|
||||||
|
options.energyPerHit,
|
||||||
|
toRouteNumber(trainingContext.energyPerHit)
|
||||||
|
),
|
||||||
|
energyCostPerSec: toRouteNumber(
|
||||||
|
options.energyCostPerSec,
|
||||||
|
toRouteNumber(trainingContext.energyCostPerSec)
|
||||||
|
),
|
||||||
|
energyReqPercent: toRouteNumber(
|
||||||
|
options.energyReqPercent,
|
||||||
|
toRouteNumber(trainingContext.energyReqPercent)
|
||||||
|
),
|
||||||
|
scoreSlot: toRouteNumber(
|
||||||
|
options.scoreSlot,
|
||||||
|
toRouteNumber(trainingContext.scoreSlot)
|
||||||
|
),
|
||||||
};
|
};
|
||||||
practiseId.value = trainingContext.practiceId || "";
|
practiseId.value = trainingContext.practiceId || "";
|
||||||
serverAddr.value = trainingContext.serverAddr || "";
|
serverAddr.value = trainingContext.serverAddr || "";
|
||||||
|
|
||||||
|
const startAudioKey = getTrainingStartAudioKey(trainingParams.value.type);
|
||||||
|
const warmupKeys = [startAudioKey, "胜利", "失败"];
|
||||||
|
if (trainingParams.value.type === "precision") {
|
||||||
|
warmupKeys.push("Bingo命中目标", "未命中");
|
||||||
|
} else if (trainingParams.value.type === "rhythm") {
|
||||||
|
warmupKeys.push(RHYTHM_SHOOT_WINDOW_AUDIO_KEY, "Perfect", "miss");
|
||||||
|
} else if (trainingParams.value.type === "stability") {
|
||||||
|
warmupKeys.push(
|
||||||
|
STABILITY_ENERGY_50_AUDIO_KEY,
|
||||||
|
STABILITY_ENERGY_70_AUDIO_KEY
|
||||||
|
);
|
||||||
|
}
|
||||||
|
void audioManager.warmKeys(warmupKeys.filter(Boolean));
|
||||||
});
|
});
|
||||||
|
|
||||||
const onReady = async () => {
|
const onReady = async () => {
|
||||||
|
if (practiceStarting.value) return;
|
||||||
if (
|
if (
|
||||||
!practiseId.value ||
|
!practiseId.value ||
|
||||||
practiceEnded.value ||
|
practiceEnded.value ||
|
||||||
@@ -1038,6 +1408,7 @@ const onReady = async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
practiceStarting.value = true;
|
||||||
pageStage.value = pageStages.LOADING;
|
pageStage.value = pageStages.LOADING;
|
||||||
clearHighlightTestTimer();
|
clearHighlightTestTimer();
|
||||||
useHighlightTest.value = false;
|
useHighlightTest.value = false;
|
||||||
@@ -1048,15 +1419,23 @@ const onReady = async () => {
|
|||||||
practiseResult.value = {};
|
practiseResult.value = {};
|
||||||
scores.value = [];
|
scores.value = [];
|
||||||
shotEffectToken.value = 0;
|
shotEffectToken.value = 0;
|
||||||
|
initializeRhythmFirstRoundCountdown();
|
||||||
start.value = true;
|
start.value = true;
|
||||||
pageStage.value = pageStages.SHOOTING;
|
pageStage.value = pageStages.SHOOTING;
|
||||||
setPracticeAppHideResumable(true);
|
setPracticeAppHideResumable(true);
|
||||||
audioManager.play("练习开始");
|
// 先由本地锚点保证首轮立即显示,再用最新服务端快照无感校准。
|
||||||
|
requestPracticeInfoSync();
|
||||||
|
// 开始接口成功即进入正式训练,直接播放对应提示,避免依赖 BattleStart 消息。
|
||||||
|
audioManager.play(
|
||||||
|
getTrainingStartAudioKey(trainingType.value, "练习开始")
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
start.value = false;
|
start.value = false;
|
||||||
pageStage.value = pageStages.DISTANCE;
|
pageStage.value = pageStages.DISTANCE;
|
||||||
setPracticeAppHideResumable(true);
|
setPracticeAppHideResumable(true);
|
||||||
throw error;
|
throw error;
|
||||||
|
} finally {
|
||||||
|
practiceStarting.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1079,6 +1458,7 @@ const enterPracticeResult = (result = {}) => {
|
|||||||
clearPracticeRuntimeContext();
|
clearPracticeRuntimeContext();
|
||||||
closePracticeConnection("training-practice-result");
|
closePracticeConnection("training-practice-result");
|
||||||
pageStage.value = pageStages.RESULT;
|
pageStage.value = pageStages.RESULT;
|
||||||
|
audioManager.play(result.completed === true ? "胜利" : "失败");
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1111,7 +1491,27 @@ const onOver = async () => {
|
|||||||
|
|
||||||
async function onReceiveMessage(msg) {
|
async function onReceiveMessage(msg) {
|
||||||
const previousScoreLength = scores.value.length;
|
const previousScoreLength = scores.value.length;
|
||||||
|
const incomingRhythmWindowStart = Number(msg.shootWindowStart);
|
||||||
|
const currentRhythmWindowStart = Number(rhythmShootWindowStart.value);
|
||||||
|
const shouldSyncRhythmAnchor =
|
||||||
|
start.value &&
|
||||||
|
isRhythmTraining.value &&
|
||||||
|
incomingRhythmWindowStart > 0 &&
|
||||||
|
(!rhythmHasActiveServerAnchor.value ||
|
||||||
|
incomingRhythmWindowStart !== currentRhythmWindowStart);
|
||||||
|
|
||||||
|
// 报靶消息的时间戳包含传输延迟,同一轮内不重复校时,避免秒数回跳。
|
||||||
|
if (
|
||||||
|
shouldSyncRhythmAnchor &&
|
||||||
|
msg.timestamp !== undefined &&
|
||||||
|
msg.timestamp !== null
|
||||||
|
) {
|
||||||
|
rhythmServerTimestamp.value = msg.timestamp;
|
||||||
|
}
|
||||||
syncPracticeInfo(msg);
|
syncPracticeInfo(msg);
|
||||||
|
if (shouldSyncRhythmAnchor) {
|
||||||
|
rhythmHasActiveServerAnchor.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.type === MESSAGETYPESV2.BattleStart) {
|
if (msg.type === MESSAGETYPESV2.BattleStart) {
|
||||||
invalidateShotPresentations();
|
invalidateShotPresentations();
|
||||||
@@ -1150,6 +1550,38 @@ async function onReceiveMessage(msg) {
|
|||||||
audioPromise,
|
audioPromise,
|
||||||
effectPromise,
|
effectPromise,
|
||||||
});
|
});
|
||||||
|
} else if (trainingType.value === "rhythm") {
|
||||||
|
const audioKeys = buildRhythmShootResultAudioKeys(msg);
|
||||||
|
if (audioKeys.length > 0) {
|
||||||
|
audioManager.play(audioKeys, false);
|
||||||
|
}
|
||||||
|
if (hasNewShot) {
|
||||||
|
shotEffectToken.value += 1;
|
||||||
|
}
|
||||||
|
} else if (trainingType.value === "stability") {
|
||||||
|
const hasStabilityShot =
|
||||||
|
msg.stabilityHasNewShot === true || hasNewShot;
|
||||||
|
const latestDetail =
|
||||||
|
Array.isArray(msg.details) && msg.details.length > 0
|
||||||
|
? msg.details[msg.details.length - 1]
|
||||||
|
: null;
|
||||||
|
const arrow = msg.shootData || latestDetail;
|
||||||
|
const audioKeys = hasStabilityShot
|
||||||
|
? getStabilityShotAudioKeys(arrow)
|
||||||
|
: [];
|
||||||
|
const milestoneAudioKey = String(
|
||||||
|
msg.stabilityMilestoneAudioKey || ""
|
||||||
|
).trim();
|
||||||
|
|
||||||
|
// WebSocket 管理器负责阈值判定并把同一语音 key 用于 ACK;这里按
|
||||||
|
// 环数/最高跨越阈值的顺序一次入队。
|
||||||
|
if (milestoneAudioKey) audioKeys.push(milestoneAudioKey);
|
||||||
|
if (audioKeys.length > 0) {
|
||||||
|
audioManager.play(audioKeys, false);
|
||||||
|
}
|
||||||
|
if (hasStabilityShot) {
|
||||||
|
shotEffectToken.value += 1;
|
||||||
|
}
|
||||||
} else if (hasNewShot) {
|
} else if (hasNewShot) {
|
||||||
shotEffectToken.value += 1;
|
shotEffectToken.value += 1;
|
||||||
}
|
}
|
||||||
@@ -1196,6 +1628,11 @@ async function onRetry() {
|
|||||||
practiseResult.value = {};
|
practiseResult.value = {};
|
||||||
practiceEndSnapshot.value = {};
|
practiceEndSnapshot.value = {};
|
||||||
practiceInfo.value = {};
|
practiceInfo.value = {};
|
||||||
|
rhythmServerTimestamp.value = 0;
|
||||||
|
rhythmFallbackWindowStart.value = 0;
|
||||||
|
rhythmFallbackTimestamp.value = 0;
|
||||||
|
rhythmHasActiveServerAnchor.value = false;
|
||||||
|
rhythmTargetArrows.value = 0;
|
||||||
invalidateShotPresentations({ resetVisible: true });
|
invalidateShotPresentations({ resetVisible: true });
|
||||||
start.value = false;
|
start.value = false;
|
||||||
scores.value = [];
|
scores.value = [];
|
||||||
@@ -1318,11 +1755,27 @@ onBeforeUnmount(() => {
|
|||||||
:showBottom="isDistanceStage"
|
:showBottom="isDistanceStage"
|
||||||
:scroll="!isShootingStage"
|
:scroll="!isShootingStage"
|
||||||
:onBack="exitPractice"
|
:onBack="exitPractice"
|
||||||
|
:title="
|
||||||
|
isShootingStage
|
||||||
|
? isRhythmTraining
|
||||||
|
? '节奏训练'
|
||||||
|
: isStabilityTraining
|
||||||
|
? '稳定训练'
|
||||||
|
: ''
|
||||||
|
: ''
|
||||||
|
"
|
||||||
|
:titleStyle="
|
||||||
|
isShootingStage && (isRhythmTraining || isStabilityTraining)
|
||||||
|
? rhythmHeaderTitleStyle
|
||||||
|
: {}
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<view class="practise-content">
|
<view class="practise-content">
|
||||||
<TestDistance
|
<TestDistance
|
||||||
v-if="isDistanceStage"
|
v-if="isDistanceStage"
|
||||||
:targetType="practiceInfo.targetType"
|
:targetType="simulatorTargetType"
|
||||||
|
:autoStart="true"
|
||||||
|
@passed="onReady"
|
||||||
/>
|
/>
|
||||||
<view v-else-if="isShootingStage" class="shooting-layout">
|
<view v-else-if="isShootingStage" class="shooting-layout">
|
||||||
<view class="shooting-fixed">
|
<view class="shooting-fixed">
|
||||||
@@ -1331,9 +1784,21 @@ onBeforeUnmount(() => {
|
|||||||
:total="timeLimit"
|
:total="timeLimit"
|
||||||
:countdownEnabled="hasTimeLimit"
|
:countdownEnabled="hasTimeLimit"
|
||||||
:trainingType="trainingType"
|
:trainingType="trainingType"
|
||||||
|
:roundTime="rhythmRoundTime"
|
||||||
|
:shootTime="rhythmShootTime"
|
||||||
|
:shootWindowStart="rhythmShootWindowStart"
|
||||||
|
:inShootWindow="rhythmInShootWindow"
|
||||||
|
:serverTimestamp="rhythmCountdownTimestamp"
|
||||||
|
:hitReq="rhythmHitReq"
|
||||||
|
:energyPercent="stabilityEnergyPercent"
|
||||||
|
:energyReqPercent="stabilityEnergyReqPercent"
|
||||||
:isVip="isVip"
|
:isVip="isVip"
|
||||||
:isSvip="isSvip"
|
:isSvip="isSvip"
|
||||||
:externalShootResultAudio="trainingType === 'precision'"
|
:externalShootResultAudio="
|
||||||
|
trainingType === 'precision' ||
|
||||||
|
trainingType === 'rhythm' ||
|
||||||
|
trainingType === 'stability'
|
||||||
|
"
|
||||||
:onStop="onTimeLimitReached"
|
:onStop="onTimeLimitReached"
|
||||||
/>
|
/>
|
||||||
<view class="user-row">
|
<view class="user-row">
|
||||||
@@ -1349,6 +1814,7 @@ onBeforeUnmount(() => {
|
|||||||
:currentRound="scores.length % 3"
|
:currentRound="scores.length % 3"
|
||||||
:scores="scores"
|
:scores="scores"
|
||||||
:isSvip="isSvip"
|
:isSvip="isSvip"
|
||||||
|
:targetType="simulatorTargetType"
|
||||||
:shotEffectToken="shotEffectToken"
|
:shotEffectToken="shotEffectToken"
|
||||||
:showCrosshair="false"
|
:showCrosshair="false"
|
||||||
:sectorCount="precisionBlocks"
|
:sectorCount="precisionBlocks"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Container from "@/components/Container.vue";
|
|||||||
import UserHeader from "@/components/UserHeader.vue";
|
import UserHeader from "@/components/UserHeader.vue";
|
||||||
import UserItem from "@/components/UserItem.vue";
|
import UserItem from "@/components/UserItem.vue";
|
||||||
import Avatar from "@/components/Avatar.vue";
|
import Avatar from "@/components/Avatar.vue";
|
||||||
|
import { getMyGoldAPI } from "@/apis";
|
||||||
import { canEenter } from "@/util";
|
import { canEenter } from "@/util";
|
||||||
import useStore from "@/store";
|
import useStore from "@/store";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
@@ -24,6 +25,21 @@ const toFristTryPage = async () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const toCoinPage = () => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/coin/nearby-stores",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const showCoinEntry = ref(false);
|
||||||
|
const loadCoinEntryVisibility = async () => {
|
||||||
|
showCoinEntry.value = false;
|
||||||
|
try {
|
||||||
|
const result = await getMyGoldAPI();
|
||||||
|
showCoinEntry.value = result?.hasTempBind === true;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("加载金币入口状态失败", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
const toBeVipPage = () => {
|
const toBeVipPage = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/member/be-vip",
|
url: "/pages/member/be-vip",
|
||||||
@@ -69,6 +85,7 @@ const logout = () => {
|
|||||||
updateUser();
|
updateUser();
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
loadCoinEntryVisibility();
|
||||||
const accountInfo = uni.getAccountInfoSync();
|
const accountInfo = uni.getAccountInfoSync();
|
||||||
const envVersion = accountInfo.miniProgram.envVersion;
|
const envVersion = accountInfo.miniProgram.envVersion;
|
||||||
if (envVersion !== "release") showLogout.value = true;
|
if (envVersion !== "release") showLogout.value = true;
|
||||||
@@ -108,6 +125,11 @@ const buildVersion = typeof __BUILD_TIME__ !== 'undefined' ? __BUILD_TIME__ : ''
|
|||||||
<text v-if="user.trio > 0" :style="{ color: '#259249' }">已完成</text>
|
<text v-if="user.trio > 0" :style="{ color: '#259249' }">已完成</text>
|
||||||
<text v-else :style="{ color: '#CC311F' }">未完成</text>
|
<text v-else :style="{ color: '#CC311F' }">未完成</text>
|
||||||
</UserItem>
|
</UserItem>
|
||||||
|
<UserItem
|
||||||
|
v-if="showCoinEntry"
|
||||||
|
title="我的金币"
|
||||||
|
:onClick="toCoinPage"
|
||||||
|
/>
|
||||||
<UserItem title="会员" :onClick="toBeVipPage">
|
<UserItem title="会员" :onClick="toBeVipPage">
|
||||||
<view
|
<view
|
||||||
v-if="user.sVip === true"
|
v-if="user.sVip === true"
|
||||||
|
|||||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 332 B |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 172 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 519 B |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 630 KiB |
|
After Width: | Height: | Size: 519 B |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 190 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 813 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 245 B |
|
After Width: | Height: | Size: 13 KiB |