添加计分本草稿功能

This commit is contained in:
kron
2025-11-27 12:02:57 +08:00
parent c697a7edd0
commit 82a0ee83b2
7 changed files with 165 additions and 49 deletions

View File

@@ -58,29 +58,33 @@ const onSignin = () => {
const startScoring = () => {
if (user.value.id) {
uni.navigateTo({
url: "/pages/point-book-create",
});
const draft = uni.getStorageSync("last-point-record");
if (draft) {
showTip2.value = true;
return;
}
toScorePage();
} else {
showModal.value = true;
}
};
const onRemoveRecord = (item) => {
removeId.value = item.id;
showTip2.value = true;
const toScorePage = (withDraft) => {
showTip2.value = false;
if (withDraft) {
return uni.navigateTo({
url: "/pages/point-book-edit?withDraft=true",
});
}
uni.removeStorageSync("last-point-record");
return uni.navigateTo({
url: "/pages/point-book-create",
});
};
const confirmRemove = async () => {
try {
showTip2.value = false;
await removePointRecord(removeId.value);
const result = await getPointBookListAPI(1);
list.value = result.slice(0, 3);
uni.showToast({ title: "已删除", icon: "none" });
} catch (e) {
uni.showToast({ title: "删除失败,请重试", icon: "none" });
}
const closeHint = () => {
showTip.value = false;
showTip2.value = false;
};
const loadData = async () => {
@@ -352,20 +356,21 @@ onShareTimeline(() => {
<SModal :show="showModal" :onClose="() => (showModal = false)" :noBg="true">
<Signin :onClose="() => (showModal = false)" :noBg="true" />
</SModal>
<ScreenHint2
:show="showTip || showTip2"
:onClose="showTip ? () => (showTip = false) : null"
>
<ScreenHint2 :show="showTip || showTip2" :onClose="closeHint">
<RewardUs
v-if="showTip"
:show="showTip"
:onClose="() => (showTip = false)"
/>
<view class="tip-content" v-if="showTip2">
<text>确认删除该记录吗</text>
<text>发现未完成的记分是否继续编辑</text>
<view>
<button hover-class="none" @click="showTip2 = false">取消</button>
<button hover-class="none" @click="confirmRemove">确认</button>
<button hover-class="none" @click="toScorePage(false)">
重新计分
</button>
<button hover-class="none" @click="toScorePage(true)">
继续编辑
</button>
</view>
</view>
</ScreenHint2>