diff --git a/src/apis.js b/src/apis.js index 7e105fd..e47e3d0 100644 --- a/src/apis.js +++ b/src/apis.js @@ -510,3 +510,11 @@ export const laserCloseAPI = async () => { export const getDeviceBatteryAPI = async () => { return request("GET", "/user/device/battery"); }; + +export const addNoteAPI = async (id, remark) => { + return request("POST", "/user/score/sheet/remark", { id, remark }); +}; + +export const removePointRecord = async (id) => { + return request("DELETE", `/user/score/sheet/delete?id=${id}`); +}; diff --git a/src/audioManager.js b/src/audioManager.js index ca72ac2..1d3d051 100644 --- a/src/audioManager.js +++ b/src/audioManager.js @@ -215,6 +215,8 @@ class AudioManager { // 播放指定音频 play(key) { + const pages = getCurrentPages(); + if (pages.length <= 1) return; // 如果有正在播放的音频,先停止 if (this.currentPlayingKey) { this.stop(this.currentPlayingKey); @@ -222,6 +224,7 @@ class AudioManager { const audio = this.audioMap.get(key); if (audio) { + console.log("播放音频:", key); audio.play(); this.currentPlayingKey = key; } else { diff --git a/src/components/EditOption.vue b/src/components/EditOption.vue index 58aabaa..e21f9bf 100644 --- a/src/components/EditOption.vue +++ b/src/components/EditOption.vue @@ -63,6 +63,30 @@ const onMeterChange = (e) => { meter.value = e.detail.value; props.onSelect(props.itemIndex, e.detail.value); }; +const sets = ref(null); +const onSetsChange = (e) => { + sets.value = e.detail.value; + if (!sets.value) return; + if (arrowAmount.value || groupArrows[secondSelectIndex.value]) { + props.onSelect( + props.itemIndex, + `${e.detail.value}/${ + arrowAmount.value || groupArrows[secondSelectIndex.value] + }` + ); + } +}; +const arrowAmount = ref(""); +const onArrowAmountChange = (e) => { + arrowAmount.value = e.detail.value; + if (!arrowAmount.value) return; + if (sets.value || selectedIndex.value !== -1) { + props.onSelect( + props.itemIndex, + `${sets.value || selectedIndex.value}/${e.detail.value}` + ); + } +}; watch( () => props.value, (newValue) => { @@ -219,7 +243,7 @@ onMounted(async () => { + + + { {{ item }} + + + + @@ -352,4 +406,12 @@ onMounted(async () => { width: 100%; text-align: center; } +.amount-items > view:last-child { + grid-column: 1 / -1; + width: 100%; +} +.amount-items > view:last-child > input { + width: 85%; + text-align: center; +} diff --git a/src/components/PointRecord.vue b/src/components/PointRecord.vue index 0df8e8d..3f4bb37 100644 --- a/src/components/PointRecord.vue +++ b/src/components/PointRecord.vue @@ -6,6 +6,10 @@ const props = defineProps({ type: Object, default: () => {}, }, + longPress: { + type: Function, + default: () => {}, + }, }); const bowOptions = ref({}); const targetOptions = ref({}); @@ -28,7 +32,7 @@ onMounted(() => { @@ -70,9 +71,18 @@ const ringText = (ring) => { display: flex; flex-direction: column; justify-content: flex-end; + position: relative; +} +.container > text { + position: absolute; + bottom: 2rpx; + left: 0; + font-size: 18rpx; + color: #999999; } .container > view { - padding: 0 10rpx; + padding-left: 40rpx; + padding-right: 10rpx; } .container > view:first-child { display: flex; @@ -93,14 +103,15 @@ const ringText = (ring) => { transition: all 0.3s ease; height: 0; } -.container > view:last-child { +.container > view:nth-child(2) { display: grid; grid-template-columns: repeat(12, 1fr); border-top: 1rpx solid #333; font-size: 22rpx; color: #333333; + padding-top: 2rpx; } -.container > view:last-child > text { +.container > view:nth-child(2) > text { text-align: center; } diff --git a/src/pages/point-book-detail.vue b/src/pages/point-book-detail.vue index 6dfecc3..26620a2 100644 --- a/src/pages/point-book-detail.vue +++ b/src/pages/point-book-detail.vue @@ -7,25 +7,40 @@ import ScreenHint2 from "@/components/ScreenHint2.vue"; import SButton from "@/components/SButton.vue"; import RingBarChart from "@/components/RingBarChart.vue"; -import { getPointBookDetailAPI } from "@/apis"; +import { getPointBookDetailAPI, addNoteAPI } from "@/apis"; const selectedIndex = ref(0); const showTip = ref(false); const showTip2 = ref(false); +const showTip3 = ref(false); const groups = ref([]); const data = ref({}); const targetId = ref(0); const targetSrc = ref(""); const arrows = ref([]); +const notes = ref(""); +const draftNotes = ref(""); +const recordId = ref(""); const openTip = (index) => { if (index === 1) showTip.value = true; else if (index === 2) showTip2.value = true; + else if (index === 3) showTip3.value = true; }; const closeTip = () => { showTip.value = false; showTip2.value = false; + showTip3.value = false; +}; + +const saveNote = async () => { + notes.value = draftNotes.value; + draftNotes.value = ""; + showTip3.value = false; + if (recordId.value) { + await addNoteAPI(recordId.value, notes.value); + } }; const onSelect = (index) => { @@ -54,6 +69,8 @@ const ringRates = computed(() => { onLoad(async (options) => { if (options.id) { const result = await getPointBookDetailAPI(options.id || 164); + recordId.value = result.id; + notes.value = result.remark || ""; const config = uni.getStorageSync("point-book-config"); config.targetOption.some((item) => { if (item.id === result.targetType) { @@ -132,6 +149,10 @@ onLoad(async (options) => { 总环数 {{ data.userTotalRing }}/{{ data.totalRing }} + @@ -168,14 +189,21 @@ onLoad(async (options) => { - {{ - `第${index}组` - }} + + {{ index }}: + {{ + item.list.reduce((acc, cur) => acc + cur.ring, 0) + }} + + { }" > {{ - arrow.ring === 0 - ? "X" - : arrow.ring === -1 - ? "M" - : arrow.ring + "环" + arrow.ring === 0 ? "X" : arrow.ring === -1 ? "M" : arrow.ring }} @@ -200,7 +224,10 @@ onLoad(async (options) => { 关闭 - + 落点稳定性说明 @@ -212,6 +239,22 @@ onLoad(async (options) => { 落点分布说明 展示用户某次练习中射箭的点位 + + 笔记 + {{ notes }} +