From e03799d723ba8a20b3489352d99911edb9817c72 Mon Sep 17 00:00:00 2001 From: zhaowenkang Date: Fri, 6 Feb 2026 14:04:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E4=BA=8C=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/eventManagement.js | 48 +- src/layout/Layout.vue | 3 + src/router/index.js | 6 + src/views/EventManagement/ContentConfiguration.vue | 220 ++++++++- src/views/EventManagement/ExchangeRecords.vue | 524 +++++++++++++++++++++ src/views/EventManagement/WinningRecords.vue | 3 +- 6 files changed, 775 insertions(+), 29 deletions(-) create mode 100644 src/views/EventManagement/ExchangeRecords.vue diff --git a/src/api/eventManagement.js b/src/api/eventManagement.js index 88ca225..a8ea372 100644 --- a/src/api/eventManagement.js +++ b/src/api/eventManagement.js @@ -1,7 +1,7 @@ import request from '../utils/myAxios'; var base_url = import.meta.env.VITE_API_BASE_URL -// 获取用户抽奖记录 +// 历史记录--获取用户抽奖记录 export function userLuckyDrawListApi(params) { return request({ url: base_url + "/admin/luckyDraw/list", @@ -10,7 +10,7 @@ export function userLuckyDrawListApi(params) { }); } -// 导出用户抽奖记录 +// 历史记录--导出用户抽奖记录 export function exportUserLuckyDrawListApi(params) { return request({ url: base_url + "/admin/luckyDraw/export/create", @@ -19,7 +19,7 @@ export function exportUserLuckyDrawListApi(params) { }); } -// 获取配置列表 +// 内容配置--获取配置列表 export function getContentListApi(params) { return request({ url: base_url + "/admin/luckyDraw/getContentList", @@ -28,7 +28,7 @@ export function getContentListApi(params) { }); } -// 添加奖品 +// 内容配置--添加奖品 export function addDrawConfigApi(params) { return request({ url: base_url + "/admin/luckyDraw/addDrawConfig", @@ -37,7 +37,7 @@ export function addDrawConfigApi(params) { }); } -// 删除奖品 +// 内容配置--删除奖品 export function deleteDrawApi(params) { return request({ url: base_url + "/admin/luckyDraw/deleteDraw", @@ -46,11 +46,47 @@ export function deleteDrawApi(params) { }); } -// 修改奖品状态 +// 内容配置--修改奖品状态 export function changeStatusApi(params) { return request({ url: base_url + "/admin/luckyDraw/changeStatus", method: "post", data: params, }); +} + +// 内容配置--获取模板名称 +export function getTemplateApi(params) { + return request({ + url: base_url + "/admin/indicator/list", + method: "post", + data: params, + }); +} + +// Token兑换记录--获取token兑换记录 +export function getTokenExchangeRecordApi(params) { + return request({ + url: base_url + "/admin/luckyDraw/tokenExchangeRecord", + method: "post", + data: params, + }); +} + +// Token兑换记录--导出token兑换记录 +export function exportTokenExchangeRecordApi(params) { + return request({ + url: base_url + "/admin/luckyDraw/tokenExport/create", + method: "post", + data: params, + }); +} + +// Token兑换记录--获取token兑换方式下拉框 +export function getDropDownListApi(params) { + return request({ + url: base_url + "/admin/luckyDraw/token/dropDownList", + method: "post", + data: params, + }); } \ No newline at end of file diff --git a/src/layout/Layout.vue b/src/layout/Layout.vue index 063146f..870c61b 100644 --- a/src/layout/Layout.vue +++ b/src/layout/Layout.vue @@ -312,6 +312,9 @@ onMounted(async () => { margin-top: 169px; width: calc(100% - 20px); border-right: none; + height: 70%; + overflow-y: auto; + overflow-x: hidden; } /* 主内容区样式 */ diff --git a/src/router/index.js b/src/router/index.js index 1df3731..a921376 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -123,6 +123,12 @@ const routes = [ component: () => import('../views/EventManagement/ContentConfiguration.vue'), meta: { title: '内容配置', showSidebar: true } }, + { + path: 'exchangeRecords', + name: 'exchangeRecords', + component: () => import('../views/EventManagement/ExchangeRecords.vue'), + meta: { title: 'Token兑换记录', showSidebar: true } + }, ] }, ] diff --git a/src/views/EventManagement/ContentConfiguration.vue b/src/views/EventManagement/ContentConfiguration.vue index 4e82126..b79db73 100644 --- a/src/views/EventManagement/ContentConfiguration.vue +++ b/src/views/EventManagement/ContentConfiguration.vue @@ -30,7 +30,11 @@ label="类型" align="center" header-align="center" - /> + > + + + > + + - + > + + + + + \ No newline at end of file diff --git a/src/views/EventManagement/WinningRecords.vue b/src/views/EventManagement/WinningRecords.vue index 3eb712f..8afd40f 100644 --- a/src/views/EventManagement/WinningRecords.vue +++ b/src/views/EventManagement/WinningRecords.vue @@ -101,7 +101,7 @@ header-align="center" /> Date: Fri, 6 Feb 2026 14:56:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BD=BF=E7=94=A8setTimeout=E4=BB=A3?= =?UTF-8?q?=E6=9B=BFnextTick?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/EventManagement/ContentConfiguration.vue | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/views/EventManagement/ContentConfiguration.vue b/src/views/EventManagement/ContentConfiguration.vue index b79db73..c95d1d8 100644 --- a/src/views/EventManagement/ContentConfiguration.vue +++ b/src/views/EventManagement/ContentConfiguration.vue @@ -446,10 +446,6 @@ const resetForm = () => { form.probability = null; form.img = ""; fileList.value = []; - // 清除校验红字 - nextTick(() => { - formRef.value?.resetFields(); - }); }; // 添加按钮 @@ -457,6 +453,21 @@ const add = () => { isEdit.value = false; resetForm(); dialogFormVisible.value = true; + // 清除校验红字 + /* nextTick虽然是异步的,但它执行的时机非常“快”(微任务队列)。设置 dialogFormVisible = true 时, 开始渲染。 + 但由于弹窗可能有动画,或者内部组件是懒加载的,在 nextTick 执行的那一瞬间, 可能还没有真正渲染到 DOM 上。 + 此时 formRef.value 是 undefined,所以 clearValidate() 其实根本没有执行成功。*/ + + // nextTick(() => { + // formRef.value?.clearValidate(); + // }); + + //setTimeout 会将任务推到宏任务队列,确保在 DOM 渲染、弹窗打开动画开始之后再执行,保证 formRef 一定存在。 + setTimeout(() => { + if (formRef.value) { + formRef.value.clearValidate(); + } + }, 0); }; const submitForm = async () => { @@ -517,20 +528,9 @@ const deleteDraw = async (row) => { }; const handleEdit = (row) => { - console.log(row); isEdit.value = true; - form.id = undefined; - form.stick_type = ""; - form.prize_type = ""; - form.item_name = ""; - form.templateName = ""; - form.term_value = null; - form.time_unit = 3; - form.num = null; - form.probability = null; - form.img = ""; - fileList.value = []; + resetForm(); form.id = row.id; form.stick_type = row.stick_type; @@ -561,7 +561,7 @@ const handleEdit = (row) => { // 6. 在 DOM 更新后,解除锁并清除校验 nextTick(() => { - isEditMode.value = false; // 解除锁 + isEdit.value = false; // 解除锁 if (formRef.value) { formRef.value.clearValidate(); // 去掉一打开就红一片的校验信息 }