添加四个按钮控制牌位-使用优化

This commit is contained in:
WindowBird 2025-10-14 16:06:43 +08:00
parent 83cf936b9c
commit 0827eb2da7

View File

@ -96,6 +96,7 @@ export default {
methods: {
//
async handleForceOpen() {
uni.showLoading({ title: "处理中...", mask: true });
try {
const res = await this.$request.put(
`/bst/memorial/open/${this.selectedUnitId}`,
@ -111,11 +112,14 @@ export default {
} catch (error) {
uni.showToast({ title: "请求失败", icon: "none" });
console.error("handleForceOpen error", error);
} finally {
uni.hideLoading();
}
},
//
async handleForceClose() {
uni.showLoading({ title: "处理中...", mask: true });
try {
const res = await this.$request.put(
`/bst/memorial/close/${this.selectedUnitId}`,
@ -131,14 +135,17 @@ export default {
} catch (error) {
uni.showToast({ title: "请求失败", icon: "none" });
console.error("handleForceClose error", error);
} finally {
uni.hideLoading();
}
},
//
async handleResetDuration() {
uni.showLoading({ title: "处理中...", mask: true });
try {
const res = await this.$request.put(
`/bst/memorial/duration/reset/${this.selectedUnitId}`,
`/bst/memorial/reset/${this.selectedUnitId}`,
);
if (res && (res.code === 200 || res.status === 200)) {
uni.showToast({ title: res.msg || "操作成功", icon: "success" });
@ -151,17 +158,22 @@ export default {
} catch (error) {
uni.showToast({ title: "请求失败", icon: "none" });
console.error("handleResetDuration error", error);
} finally {
uni.hideLoading();
}
},
//
async handleIncreaseDuration() {
uni.showLoading({ title: "处理中...", mask: true });
try {
// 1
const res = await this.$request.put(
`/bst/memorial/duration/increase/${this.selectedUnitId}`,
{ value: 1 },
);
// 20 unit: 4
const payload = {
memorialId: String(this.selectedUnitId),
seconds: "20",
unit: "1",
};
const res = await this.$request.put(`/bst/memorial/addTime`, payload);
if (res && (res.code === 200 || res.status === 200)) {
uni.showToast({ title: res.msg || "操作成功", icon: "success" });
} else {
@ -173,6 +185,8 @@ export default {
} catch (error) {
uni.showToast({ title: "请求失败", icon: "none" });
console.error("handleIncreaseDuration error", error);
} finally {
uni.hideLoading();
}
},