添加四个按钮控制牌位-使用优化
This commit is contained in:
parent
83cf936b9c
commit
0827eb2da7
|
|
@ -96,6 +96,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
// 底部按钮:强制开启
|
// 底部按钮:强制开启
|
||||||
async handleForceOpen() {
|
async handleForceOpen() {
|
||||||
|
uni.showLoading({ title: "处理中...", mask: true });
|
||||||
try {
|
try {
|
||||||
const res = await this.$request.put(
|
const res = await this.$request.put(
|
||||||
`/bst/memorial/open/${this.selectedUnitId}`,
|
`/bst/memorial/open/${this.selectedUnitId}`,
|
||||||
|
|
@ -111,11 +112,14 @@ export default {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.showToast({ title: "请求失败", icon: "none" });
|
uni.showToast({ title: "请求失败", icon: "none" });
|
||||||
console.error("handleForceOpen error", error);
|
console.error("handleForceOpen error", error);
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 底部按钮:强制关闭
|
// 底部按钮:强制关闭
|
||||||
async handleForceClose() {
|
async handleForceClose() {
|
||||||
|
uni.showLoading({ title: "处理中...", mask: true });
|
||||||
try {
|
try {
|
||||||
const res = await this.$request.put(
|
const res = await this.$request.put(
|
||||||
`/bst/memorial/close/${this.selectedUnitId}`,
|
`/bst/memorial/close/${this.selectedUnitId}`,
|
||||||
|
|
@ -131,14 +135,17 @@ export default {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.showToast({ title: "请求失败", icon: "none" });
|
uni.showToast({ title: "请求失败", icon: "none" });
|
||||||
console.error("handleForceClose error", error);
|
console.error("handleForceClose error", error);
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 底部按钮:时长归零
|
// 底部按钮:时长归零
|
||||||
async handleResetDuration() {
|
async handleResetDuration() {
|
||||||
|
uni.showLoading({ title: "处理中...", mask: true });
|
||||||
try {
|
try {
|
||||||
const res = await this.$request.put(
|
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)) {
|
if (res && (res.code === 200 || res.status === 200)) {
|
||||||
uni.showToast({ title: res.msg || "操作成功", icon: "success" });
|
uni.showToast({ title: res.msg || "操作成功", icon: "success" });
|
||||||
|
|
@ -151,17 +158,22 @@ export default {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.showToast({ title: "请求失败", icon: "none" });
|
uni.showToast({ title: "请求失败", icon: "none" });
|
||||||
console.error("handleResetDuration error", error);
|
console.error("handleResetDuration error", error);
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 底部按钮:增加时长
|
// 底部按钮:增加时长
|
||||||
async handleIncreaseDuration() {
|
async handleIncreaseDuration() {
|
||||||
|
uni.showLoading({ title: "处理中...", mask: true });
|
||||||
try {
|
try {
|
||||||
// 默认增加 1(单位由后端定义)
|
// 默认增加 20 秒;unit: 4 表示“秒”
|
||||||
const res = await this.$request.put(
|
const payload = {
|
||||||
`/bst/memorial/duration/increase/${this.selectedUnitId}`,
|
memorialId: String(this.selectedUnitId),
|
||||||
{ value: 1 },
|
seconds: "20",
|
||||||
);
|
unit: "1",
|
||||||
|
};
|
||||||
|
const res = await this.$request.put(`/bst/memorial/addTime`, payload);
|
||||||
if (res && (res.code === 200 || res.status === 200)) {
|
if (res && (res.code === 200 || res.status === 200)) {
|
||||||
uni.showToast({ title: res.msg || "操作成功", icon: "success" });
|
uni.showToast({ title: res.msg || "操作成功", icon: "success" });
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -173,6 +185,8 @@ export default {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.showToast({ title: "请求失败", icon: "none" });
|
uni.showToast({ title: "请求失败", icon: "none" });
|
||||||
console.error("handleIncreaseDuration error", error);
|
console.error("handleIncreaseDuration error", error);
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user