From 6131759745a810e825f1845f995b7d915aa30aad Mon Sep 17 00:00:00 2001 From: yziiy <15979918+mayday-yziiy@user.noreply.gitee.com> Date: Fri, 10 Oct 2025 17:21:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=A7=98=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/admin.ts | 7 +- src/utils/http/config.ts | 2 +- src/views/Activities/giftPack/hook.tsx | 2 +- src/views/Activities/giftPack/index.vue | 1 + src/views/Activities/goodGift/form.vue | 4 + .../Activities/goodGift/giftPack/form.vue | 74 +++++++ .../Activities/goodGift/giftPack/hook.tsx | 175 ++++++++++++++++ .../Activities/goodGift/giftPack/index.vue | 64 ++++++ src/views/Activities/goodGift/hook.tsx | 24 ++- src/views/Activities/goodGift/index.vue | 6 + src/views/Activities/newcomer/form.vue | 54 +++++ src/views/Activities/newcomer/hook.tsx | 188 ++++++++++++++++++ src/views/Activities/newcomer/index.vue | 72 +++++++ src/views/Activities/newcomer/record.vue | 79 ++++++++ src/views/Admin/userList/hook.tsx | 41 +++- src/views/Admin/userList/index.vue | 4 + src/views/Admin/userList/password.vue | 30 +++ src/views/system/private/index.vue | 4 +- vite.config.ts | 2 +- 19 files changed, 824 insertions(+), 9 deletions(-) create mode 100644 src/views/Activities/goodGift/giftPack/form.vue create mode 100644 src/views/Activities/goodGift/giftPack/hook.tsx create mode 100644 src/views/Activities/goodGift/giftPack/index.vue create mode 100644 src/views/Activities/newcomer/form.vue create mode 100644 src/views/Activities/newcomer/hook.tsx create mode 100644 src/views/Activities/newcomer/index.vue create mode 100644 src/views/Activities/newcomer/record.vue create mode 100644 src/views/Admin/userList/password.vue diff --git a/src/api/modules/admin.ts b/src/api/modules/admin.ts index 70639a0..52ab34f 100644 --- a/src/api/modules/admin.ts +++ b/src/api/modules/admin.ts @@ -46,4 +46,9 @@ export const getLogInfo = params => { "/adminapi/Adminlog/detail", { params } ); -}; \ No newline at end of file +}; +export const apiPassWord = data => { + return http.request("post", "/adminapi/User/changePwd", { + data + }); +} \ No newline at end of file diff --git a/src/utils/http/config.ts b/src/utils/http/config.ts index cb30703..185382f 100644 --- a/src/utils/http/config.ts +++ b/src/utils/http/config.ts @@ -1,4 +1,4 @@ -export const URL = "https://md.xscmmidi.site"; +export const URL = "https://tmd.xscmmidi.site"; // https://md.xscmmidi.site 正式 // https://tmd.xscmmidi.site 测试 // 声网appId 在这里换 diff --git a/src/views/Activities/giftPack/hook.tsx b/src/views/Activities/giftPack/hook.tsx index a291876..23e137e 100644 --- a/src/views/Activities/giftPack/hook.tsx +++ b/src/views/Activities/giftPack/hook.tsx @@ -102,7 +102,7 @@ export function useData() { type: rowData?.type ?? "", num: rowData?.num ?? "", gift_id: rowData?.gift_id ?? "", - gift_bag_id: rowData?.gift_bag_id ?? "", + gift_bag_id: propRowData.value.id ?? "", } }, diff --git a/src/views/Activities/giftPack/index.vue b/src/views/Activities/giftPack/index.vue index 5acfe86..82b88f0 100644 --- a/src/views/Activities/giftPack/index.vue +++ b/src/views/Activities/giftPack/index.vue @@ -26,6 +26,7 @@ onMounted(() => { diff --git a/src/views/Activities/goodGift/giftPack/form.vue b/src/views/Activities/goodGift/giftPack/form.vue new file mode 100644 index 0000000..d9a4c8f --- /dev/null +++ b/src/views/Activities/goodGift/giftPack/form.vue @@ -0,0 +1,74 @@ + + + diff --git a/src/views/Activities/goodGift/giftPack/hook.tsx b/src/views/Activities/goodGift/giftPack/hook.tsx new file mode 100644 index 0000000..c059815 --- /dev/null +++ b/src/views/Activities/goodGift/giftPack/hook.tsx @@ -0,0 +1,175 @@ +import { ref, h, nextTick } from "vue"; +import editForm from "./form.vue"; +import { message } from "@/utils/message"; +import { + queryGiftPack, + addGiftPackData, + editGiftPackData, + deteleGiftPackData +} from "@/api/modules/activities"; +import { addDialog } from "@/components/ReDialog"; +export function useData() { + const formRef = ref(); + const propRowData = ref(null) + const loading = ref(true); + const tableList = ref([]); + const isShow = ref(false); + const pagination = ref({ + total: 0, + pageSize: 10, + currentPage: 1, + pageSizes: [10, 20, 50, 100], + background: true + }); + const tableLabel = ref([ + { + label: "ID", + prop: "id" + }, + { + label: "礼物名称", + prop: "name" + }, + { + label: "封面图", + prop: "icon", + cellRenderer: ({ row }) => ( + + ) + }, + { + label: "数量", + prop: "num" + }, + { + label: "价格", + prop: "gold" + }, + { + label: "类型", + prop: "type_str" + }, + { + label: "添加时间", + prop: "createtime" + }, + { + label: "操作", + fixed: "right", + width: 210, + slot: "operation" + } + ]); + const onSearch = async (rowData) => { + propRowData.value = { ...rowData } + loading.value = true; + const { data, code } = await queryGiftPack({ + gift_bag_id: propRowData.value.id, + page: pagination.value.currentPage, + page_limit: pagination.value.pageSize + }); + if (code) { + tableList.value = data.lists.map(ele => { + return { + ...ele + } + }); + pagination.value.total = data.count; + pagination.value.currentPage = data.page; + } + loading.value = false; + }; + const handleSizeChange = (val: number) => { + pagination.value.pageSize = val; + onSearch(propRowData.value); + }; + const handleCurrentChange = (val: number) => { + pagination.value.currentPage = val; + onSearch(propRowData.value); + }; + // 新增 + const openDialog = (title = "新增", rowData: any) => { + addDialog({ + title: `${title}礼物`, + props: { + formInline: { + type: rowData?.type ?? "", + num: rowData?.num ?? "", + gift_id: rowData?.gift_id ?? "", + gift_bag_id: propRowData.value.id, + + } + }, + width: "40%", + closeOnClickModal: false, + contentRenderer: () => h(editForm, { ref: formRef, formInline: null }), + beforeSure: (done, { options }) => { + const FormRef = formRef.value.getRef(); + const curData = options.props.formInline; + const saveData = async form => { + const { code } = await addGiftPackData(form); + if (code) { + message("新增成功", { type: "success" }); + onSearch(propRowData.value); + done(); + } else { + message("新增失败", { type: "error" }); + } + }; + const updateData = async form => { + const { code } = await editGiftPackData({ + ...form, + id: rowData.id + }); + if (code) { + message("修改成功", { type: "success" }); + onSearch(propRowData.value); + done(); + } else { + message("修改失败", { type: "error" }); + } + }; + FormRef.validate(valid => { + if (valid) { + console.log("curData", curData); + // 表单规则校验通过 + if (title === "新增") { + // 实际开发先调用新增接口,再进行下面操作 + saveData(curData); + } else { + // 实际开发先调用修改接口,再进行下面操作 + updateData(curData); + } + } + }); + } + }); + }; + const handleDelete = async rowData => { + const { code } = await deteleGiftPackData({ id: rowData.id }); + if (code) { + message(`您删除了名称为${rowData.name}的这条数据`, { + type: "success" + }); + onSearch(propRowData.value); + } + }; + return { + onSearch, + isShow, + tableList, + tableLabel, + pagination, + handleSizeChange, + handleCurrentChange, + handleDelete, + loading, + openDialog + }; +} diff --git a/src/views/Activities/goodGift/giftPack/index.vue b/src/views/Activities/goodGift/giftPack/index.vue new file mode 100644 index 0000000..a174130 --- /dev/null +++ b/src/views/Activities/goodGift/giftPack/index.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/src/views/Activities/goodGift/hook.tsx b/src/views/Activities/goodGift/hook.tsx index 693e1bb..41c8c8f 100644 --- a/src/views/Activities/goodGift/hook.tsx +++ b/src/views/Activities/goodGift/hook.tsx @@ -2,6 +2,7 @@ import { ref, h, nextTick } from "vue"; import editForm from "./form.vue"; import { message } from "@/utils/message"; import recordList from "./record.vue" +import giftPackView from './giftPack/index.vue'; import { getGoodGiftInfo, setGoodGiftConfig @@ -55,6 +56,11 @@ export function useData() { label: "所得金币文字", prop: "diamond" }, + { + label: "操作", + fixed: "right", + slot: "operation" + } ]); const onSearch = async () => { loading.value = true; @@ -92,7 +98,8 @@ export function useData() { counter: rowData?.counter ?? "", money: rowData?.money ?? "", money_str: rowData?.money_str ?? "", - diamond: rowData?.diamond ?? "" + diamond: rowData?.diamond ?? "", + activity_end_time: rowData?.activity_end_time ?? "", } }, width: "40%", @@ -131,6 +138,18 @@ export function useData() { contentRenderer: () => h(recordList, { ref: formRef, formInline: null }), }); }; + const openGiftPark = (rowData) => { + addDialog({ + title: `礼包列表`, + width: "60%", + closeOnClickModal: false, + hideFooter: true, + props: { + rowData + }, + contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null }), + }); + } return { onSearch, isShow, @@ -141,6 +160,7 @@ export function useData() { handleCurrentChange, loading, setConfig, - DistributionRecord + DistributionRecord, + openGiftPark }; } diff --git a/src/views/Activities/goodGift/index.vue b/src/views/Activities/goodGift/index.vue index 5ea5858..1a68ab0 100644 --- a/src/views/Activities/goodGift/index.vue +++ b/src/views/Activities/goodGift/index.vue @@ -13,6 +13,7 @@ const { handleSizeChange, handleCurrentChange, DistributionRecord, + openGiftPark, loading, } = useData(); defineOptions({ @@ -44,6 +45,11 @@ onMounted(() => { background: 'var(--el-fill-color-light)', color: 'var(--el-text-color-primary)' }" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange"> + diff --git a/src/views/Activities/newcomer/form.vue b/src/views/Activities/newcomer/form.vue new file mode 100644 index 0000000..ea5832e --- /dev/null +++ b/src/views/Activities/newcomer/form.vue @@ -0,0 +1,54 @@ + + + diff --git a/src/views/Activities/newcomer/hook.tsx b/src/views/Activities/newcomer/hook.tsx new file mode 100644 index 0000000..f298802 --- /dev/null +++ b/src/views/Activities/newcomer/hook.tsx @@ -0,0 +1,188 @@ +import { ref, h } from "vue"; +import editForm from "./form.vue"; +import { message } from "@/utils/message"; +import recordList from "./record.vue"; +import giftPackView from '../giftPack/index.vue'; +import { + queryFirstCharge, + addChargeTypeData, + editChargeTypeData, + deteleChargeTypeData +} from "@/api/modules/activities"; +import { addDialog } from "@/components/ReDialog"; +export function useData() { + const formRef = ref(); + const loading = ref(true); + const tableList = ref([]); + const isShow = ref(false); + const pagination = ref({ + total: 0, + pageSize: 10, + pageSizes: [10, 20, 50, 100], + currentPage: 1, + background: true + }); + const tableLabel = ref([ + { + label: "ID", + prop: "id" + }, + { + label: "新人礼包名称", + prop: "name" + }, + { + label: "新人礼包标题", + prop: "title" + }, + { + label: "副标题1", + prop: "title1" + }, + { + label: "副标题2", + prop: "title2" + }, + { + label: "价值(元)", + prop: "money" + }, + { + label: "状态", + prop: "status_str" + }, + { + label: "操作", + fixed: "right", + width: 210, + slot: "operation" + } + ]); + const onSearch = async () => { + loading.value = true; + const { data, code } = await queryFirstCharge({ + page: pagination.value.currentPage, + page_limit: pagination.value.pageSize, + activities_id: 7 + }); + if (code) { + tableList.value = data.lists; + pagination.value.total = data.count; + pagination.value.currentPage = data.page; + } + loading.value = false; + }; + const handleSizeChange = (val: number) => { + pagination.value.pageSize = val; + onSearch(); + }; + const handleCurrentChange = (val: number) => { + pagination.value.currentPage = val; + onSearch(); + }; + const handleDelete = async rowData => { + const { code } = await deteleChargeTypeData({ id: rowData.id }); + if (code) { + message(`您删除了名称为${rowData.name}的这条数据`, { + type: "success" + }); + onSearch(); + } + }; + const DistributionRecord = () => { + addDialog({ + title: `发放记录`, + width: "60%", + closeOnClickModal: false, + hideFooter: true, + contentRenderer: () => h(recordList, { ref: formRef, formInline: null }), + }); + }; + // 新增 + const openDialog = (title = "新增", rowData: any) => { + addDialog({ + title: `${title}首充分类`, + props: { + formInline: { + title: rowData?.title ?? "", + name: rowData?.name ?? "", + status: rowData?.status ?? "", + title1: rowData?.title1 ?? "", + title2: rowData?.title2 ?? "", + money: rowData?.money ?? "" + } + }, + width: "40%", + closeOnClickModal: false, + contentRenderer: () => h(editForm, { ref: formRef, formInline: null }), + beforeSure: (done, { options }) => { + const FormRef = formRef.value.getRef(); + const curData = options.props.formInline; + const saveData = async form => { + const { code } = await addChargeTypeData({ ...form, activities_id: 7 }); + if (code) { + message("新增成功", { type: "success" }); + onSearch(); + done(); + } else { + message("新增失败", { type: "error" }); + } + }; + const updateData = async form => { + const { code } = await editChargeTypeData({ + ...form, + id: rowData.id, + activities_id: 7 + }); + if (code) { + message("修改成功", { type: "success" }); + onSearch(); + done(); + } else { + message("修改失败", { type: "error" }); + } + }; + FormRef.validate(valid => { + if (valid) { + console.log("curData", curData); + // 表单规则校验通过 + if (title === "新增") { + // 实际开发先调用新增接口,再进行下面操作 + saveData(curData); + } else { + // 实际开发先调用修改接口,再进行下面操作 + updateData(curData); + } + } + }); + } + }); + }; + // 打开礼物列表 + const openGiftPark = (rowData: any) => { + addDialog({ + title: `礼包列表`, + width: "60%", + closeOnClickModal: false, + hideFooter: true, + props: { + rowData + }, + contentRenderer: () => h(giftPackView, { ref: formRef, formInline: null }), + }); + } + return { + onSearch, + isShow, + tableList, + tableLabel, + pagination, + handleSizeChange, + handleCurrentChange, + loading, + handleDelete, + openDialog, + openGiftPark, + DistributionRecord + }; +} diff --git a/src/views/Activities/newcomer/index.vue b/src/views/Activities/newcomer/index.vue new file mode 100644 index 0000000..52a2216 --- /dev/null +++ b/src/views/Activities/newcomer/index.vue @@ -0,0 +1,72 @@ + + + + + diff --git a/src/views/Activities/newcomer/record.vue b/src/views/Activities/newcomer/record.vue new file mode 100644 index 0000000..eb54cb9 --- /dev/null +++ b/src/views/Activities/newcomer/record.vue @@ -0,0 +1,79 @@ + + + diff --git a/src/views/Admin/userList/hook.tsx b/src/views/Admin/userList/hook.tsx index e444ca5..b4b2dd7 100644 --- a/src/views/Admin/userList/hook.tsx +++ b/src/views/Admin/userList/hook.tsx @@ -6,8 +6,10 @@ import { addData, editData, deleteData, - getDataInfo + getDataInfo, + apiPassWord } from "@/api/modules/admin"; +import passwordForm from './password.vue'; import { addDialog } from "@/components/ReDialog"; export function useData() { const formRef = ref(); @@ -143,6 +145,40 @@ export function useData() { onSearch(); } }; + const settingPassWord = (title, rowData) => { + addDialog({ + title: title, + width: "40%", + props: { + formInline: { + new_pwd: "" + } + }, + closeOnClickModal: false, + contentRenderer: () => h(passwordForm, { ref: formRef, formInline: null }), + beforeSure: (done, { options }) => { + const FormRef = formRef.value.getRef(); + const curData = options.props.formInline; + const updatePassWord = async form => { + console.log(form) + const { code } = await apiPassWord(form); + if (code) { + message("设置成功", { type: "success" }); + onSearch(); + done(); + } else { + message("设置失败", { type: "error" }); + } + }; + FormRef.validate(valid => { + if (valid) { + console.log("curData", curData.new_pwd); + updatePassWord({ new_pwd: curData.new_pwd, user_id: rowData.id }) + } + }); + } + }); + } return { onSearch, isShow, @@ -153,6 +189,7 @@ export function useData() { handleCurrentChange, loading, openDialog, - handleDelete + handleDelete, + settingPassWord }; } diff --git a/src/views/Admin/userList/index.vue b/src/views/Admin/userList/index.vue index 4e44d5c..46c5b2a 100644 --- a/src/views/Admin/userList/index.vue +++ b/src/views/Admin/userList/index.vue @@ -15,6 +15,7 @@ const { handleCurrentChange, openDialog, loading, + settingPassWord, handleDelete } = useData(); defineOptions({ @@ -44,6 +45,9 @@ onMounted(() => { color: 'var(--el-text-color-primary)' }" @page-size-change="handleSizeChange" @page-current-change="handleCurrentChange">