diff --git a/vue/gold-system/src/router/index.js b/vue/gold-system/src/router/index.js index e951857..0c8fc72 100644 --- a/vue/gold-system/src/router/index.js +++ b/vue/gold-system/src/router/index.js @@ -4,7 +4,7 @@ const router=createRouter({ history:createWebHashHistory(), routes:[ {path:'/login', name:"login", component:()=>import("../views/login.vue")}, - {path:'/',redirect:"/workspace"}, + {path:'/',redirect:"/login"}, {path:'/test',component:()=>import("../views/z.vue")}, { meta:{requireAuth:true}, diff --git a/vue/gold-system/src/views/login.vue b/vue/gold-system/src/views/login.vue index bc409fd..73cf936 100644 --- a/vue/gold-system/src/views/login.vue +++ b/vue/gold-system/src/views/login.vue @@ -21,7 +21,7 @@ const login = async function () { ); if (result.data.code == 200) { localStorage.setItem("token", result.data.msg); - router.push("/"); + router.push("/workspace"); ElMessage.success("登录成功"); console.log("请求成功", result); } else { diff --git a/vue/gold-system/src/views/recharge/addRecharge.vue b/vue/gold-system/src/views/recharge/addRecharge.vue index eefe256..e45a225 100644 --- a/vue/gold-system/src/views/recharge/addRecharge.vue +++ b/vue/gold-system/src/views/recharge/addRecharge.vue @@ -373,48 +373,68 @@ const addLine = function () { }; const loading = ref(false); // 添加多行 -// const addLines = async function () { -// try { -// for (let j = 0; j < addLineObj.value; j++) { -// batchData.value.unshift({ -// line: ++i.value, -// showInput: true, -// }); -// } -// ElMessage.success("添加成功"); -// } catch (error) { -// console.log("添加失败", error); -// ElMessage.error("添加失败"); -// } -// } - -// 添加多行点击按钮 const addLines = async function () { try { - // loading.value = true; // 操作开始前,将loading设为true,显示加载动画 - // console.log(loading.value, "loading.value"); + loading.value = true; // 操作开始前,将loading设为true,显示加载动画 + console.log(loading.value, "loading.value") - const newItems = Array.from({ length: addLineObj.value }, (_, index) => reactive({ - line: ++i.value, - showInput: true, - isInputInvalid: false, - inputErrorMessage: '', - freeGold: "0", - rechargeGold: "0", - paidGold: "0", - })); - batchData.value = [...newItems, ...batchData.value]; + await new Promise(resolve => setTimeout(resolve, 100)); // 人为创建一个小延迟 + for (let j = 0; j < addLineObj.value; j++) { + batchData.value.unshift({ + line: ++i.value, + showInput: true, + isInputInvalid: false, + inputErrorMessage: '', + freeGold: "0", + rechargeGold: "0", + paidGold: "0", + }); + } ElMessage.success("添加成功"); - // loading.value = false; // 将loading设为false,关闭加载动画 + console.log(batchData.value, "batchData.value"); } catch (error) { console.log("添加失败", error); ElMessage.error("添加失败"); - // 如果出现异常,也要确保关闭加载动画 - // loading.value = false; + } finally { + loading.value = false; + console.log(loading.value, "loading.value") } -}; +} +// 添加多行点击按钮 +// const addLines = async function () { +// try { + +// loading.value = true; // 操作开始前,将loading设为true,显示加载动画 +// console.log(loading.value, "loading.value") + +// await new Promise(resolve => setTimeout(resolve, 100)); // 人为创建一个小延迟 + +// const newItems = Array.from({ length: addLineObj.value }, (_, index) => reactive({ +// line: ++i.value, +// showInput: true, +// isInputInvalid: false, +// inputErrorMessage: '', +// freeGold: "0", +// rechargeGold: "0", +// paidGold: "0", +// })); +// batchData.value = [...newItems, ...batchData.value]; +// ElMessage.success("添加成功"); +// console.log(batchData.value, "batchData.value"); + +// loading.value = false; +// console.log(loading.value, "loading.value") +// } catch (error) { +// console.log("添加失败", error); +// ElMessage.error("添加失败"); +// // 如果出现异常,也要确保关闭加载动画 +// loading.value = false; +// } +// }; +// 使用 _.throttle 并设置 trailing 为 false 实现严格节流,只执行一次 +const throttledAddLines = _.throttle(addLines, 500, { trailing: false }); // 导入excel按钮的ref const uploadRefMap = ref({}); // 获取excel数据 @@ -967,7 +987,7 @@ onMounted(async function () { 添加 - 添加 + 添加 批量设置 +
+
+ +
+
+
+ + + + + + + + + + + + + + + +
-
\ No newline at end of file