diff --git a/vue/gold-system/src/util/index.js b/vue/gold-system/src/util/index.js
deleted file mode 100644
index 17d9080..0000000
--- a/vue/gold-system/src/util/index.js
+++ /dev/null
@@ -1,37 +0,0 @@
-// 防抖
-function _debounce(fn, delay = 500) {
- var timer = null;
- return function () {
- var _this = this;
- var args = arguments;
- if (timer) clearTimeout(timer);
- timer = setTimeout(function () {
- fn.apply(_this, args);
- }, delay);
- };
-}
-
-// 节流
-function _throttle(fn, delay = 1000) {
- var lastTime, timer, delay;
- return function () {
- var _this = this;
- var args = arguments;
- var nowTime = Date.now();
- if (lastTime && nowTime - lastTime < delay) {
- if (timer) clearTimeout(timer);
- timer = setTimeout(function () {
- lastTime = nowTime;
- fn.apply(_this, args);
- }, delay)
- } else {
- lastTime = nowTime;
- fn.apply(_this, args);
- }
- }
-}
-
-export {
- _debounce,
- _throttle,
-}
\ No newline at end of file
diff --git a/vue/gold-system/src/views/consume/addConsume.vue b/vue/gold-system/src/views/consume/addConsume.vue
index e3efd6a..a74c252 100644
--- a/vue/gold-system/src/views/consume/addConsume.vue
+++ b/vue/gold-system/src/views/consume/addConsume.vue
@@ -7,6 +7,7 @@ import axios from "axios";
import { ElMessageBox } from "element-plus";
import API from "../../api/index.js";
import moment from "moment";
+import _ from 'lodash';
//这是获取用户信息的接口
const adminData = ref({});
diff --git a/vue/gold-system/src/views/managerecharge/rate.vue b/vue/gold-system/src/views/managerecharge/rate.vue
index b774fc1..fcbdd10 100644
--- a/vue/gold-system/src/views/managerecharge/rate.vue
+++ b/vue/gold-system/src/views/managerecharge/rate.vue
@@ -5,6 +5,7 @@ import axios from "axios";
import { createApp } from "vue";
import moment from "moment";
import API from "../../api/index.js";
+import _ from "lodash";
// 查询用户接口
const adminData = ref({
@@ -159,7 +160,8 @@ const add = () => {
}
});
};
-
+// 使用 _.throttle 并设置 trailing 为 false 实现严格节流,只执行一次
+const throttledAdd = _.throttle(add, 5000, { trailing: false });
// 编辑方法
const rateEdit = ref({});
//查询已有的数据
@@ -663,7 +665,7 @@ function handleInput(value) {
个
`;
+ }
+ if (
batchData.value[i].activityId == "" ||
- batchData.value[i].activityId == null ||
+ batchData.value[i].activityId == null) {
+ msg += `活动不能为空!
`;
+ }
+ if (
batchData.value[i].paidGold == "" ||
- batchData.value[i].paidGold == null ||
+ batchData.value[i].paidGold == null) {
+ msg += `充值金币不能为空!
`;
+ }
+ if (
batchData.value[i].rechargeGold == "" ||
- batchData.value[i].rechargeGold == null ||
+ batchData.value[i].rechargeGold == null) {
+ msg += `充值金额不能为空!
`;
+ }
+ if (
batchData.value[i].payWay == "" ||
- batchData.value[i].payWay == null ||
+ batchData.value[i].payWay == null) {
+ msg += `收款方式不能为空!
`;
+ }
+ if (
batchData.value[i].rechargeTime == "" ||
- batchData.value[i].rechargeTime == null
- ) {
- ElMessage({
- type: "error",
- message: "信息不能为空!请检查输入内容!",
- });
- return;
+ batchData.value[i].rechargeTime == null) {
+ msg += `交款时间不能为空!
`;
}
+ ElMessage({
+ dangerouslyUseHTMLString: true,
+ type: "error",
+ message: msg,
+ });
+ return;
}
console.log("batchData===", batchData.value);
@@ -723,7 +714,8 @@ const batchAdd = async function () {
closeBatchRechargeVisible();
};
-
+// 使用 _.throttle 并设置 trailing 为 false 实现严格节流,只执行一次
+const throttledBatchAdd = _.throttle(batchAdd, 5000, { trailing: false });
// 批量设置的对象
const batchSettingObj = ref({});
// 批量充值弹窗
@@ -839,36 +831,14 @@ onMounted(async function () {
-
+