From 8431994810ea29e07e4b38d03bc3f889306730ac Mon Sep 17 00:00:00 2001 From: yziiy <15979918+mayday-yziiy@user.noreply.gitee.com> Date: Fri, 7 Nov 2025 18:30:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/nobility.ts | 12 ++ src/utils/http/config.ts | 5 +- src/views/Nobility/nobilityList/List/form.vue | 39 +++++ src/views/Nobility/nobilityList/List/hook.tsx | 143 ++++++++++++++++++ .../Nobility/nobilityList/List/index.vue | 63 ++++++++ src/views/Nobility/nobilityList/form.vue | 10 +- src/views/Nobility/nobilityList/hook.tsx | 16 +- src/views/Nobility/nobilityList/index.vue | 6 +- vite.config.ts | 3 +- 9 files changed, 290 insertions(+), 7 deletions(-) create mode 100644 src/views/Nobility/nobilityList/List/form.vue create mode 100644 src/views/Nobility/nobilityList/List/hook.tsx create mode 100644 src/views/Nobility/nobilityList/List/index.vue diff --git a/src/api/modules/nobility.ts b/src/api/modules/nobility.ts index a73080c..f70dd5b 100644 --- a/src/api/modules/nobility.ts +++ b/src/api/modules/nobility.ts @@ -39,4 +39,16 @@ export const queryUserNobility = params => { return http.request("get", "/adminapi/Nobility/get_user_nobility_list", { params }); +}; +// 获取爵位装扮列表 +export const queryDecList = params => { + return http.request("get", "/adminapi/Nobility/get_nobility_decorate_list", { + params + }); +}; +export const deleteDecData = data => { + return http.request("post", "/adminapi/Nobility/del_nobility_decorate", { data }); +}; +export const addDecData = data => { + return http.request("post", "/adminapi/Nobility/add_nobility_decorate", { data }); }; \ No newline at end of file diff --git a/src/utils/http/config.ts b/src/utils/http/config.ts index 4a26d80..c072cbd 100644 --- a/src/utils/http/config.ts +++ b/src/utils/http/config.ts @@ -1,5 +1,6 @@ -export const URL = "https://1.13.101.98"; +export const URL = "http://test.vespa.xscmmidi.site"; // https://vespa.qxyushen.top 正式 -// https://test.vespa.qxyushen.top +// http://1.13.101.98 +// https://test.vespa.xscmmidi.site // 声网appId 在这里换 export const appIdBySw = '02f7339ec98947deaeab173599891932'; \ No newline at end of file diff --git a/src/views/Nobility/nobilityList/List/form.vue b/src/views/Nobility/nobilityList/List/form.vue new file mode 100644 index 0000000..a677b62 --- /dev/null +++ b/src/views/Nobility/nobilityList/List/form.vue @@ -0,0 +1,39 @@ + + + diff --git a/src/views/Nobility/nobilityList/List/hook.tsx b/src/views/Nobility/nobilityList/List/hook.tsx new file mode 100644 index 0000000..355d390 --- /dev/null +++ b/src/views/Nobility/nobilityList/List/hook.tsx @@ -0,0 +1,143 @@ +import { ref, h } from "vue"; +import editForm from "./form.vue"; +import { message } from "@/utils/message"; +import { + queryDecList, + deleteDecData, + addDecData +} from "@/api/modules/nobility"; +import { addDialog } from "@/components/ReDialog"; +export function useData() { + const formRef = ref(); + const detailData = 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: "decorate_name" + }, + { + label: "装扮类型", + prop: "decorate_type_name" + }, + { + label: "图标", + prop: "decorate_image", + cellRenderer: ({ row }) => ( + + ), + }, + { + label: "时长(天数)", + prop: "decorate_day" + }, + { + label: "操作", + fixed: "right", + width: 210, + slot: "operation" + } + ]); + const onSearch = async () => { + loading.value = true; + const { data, code } = await queryDecList + ({ + lid: detailData.value.lid, + page: pagination.value.currentPage, + page_limit: pagination.value.pageSize + }); + 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 deleteDecData({ id: rowData.id }); + if (code) { + message(`您删除了名称为${rowData.decorate_name}的这条数据`, { + type: "success" + }); + onSearch(); + } + }; + // 新增 + const openDialog = (title = "新增", rowData: any) => { + addDialog({ + title: `${title}赠送装扮`, + props: { + formInline: { + lid: detailData.value.lid, + dpid: rowData?.dpid ?? "" + } + }, + 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, msg } = await addDecData({ + lid: detailData.value.lid, + dpid: form.dpid + }); + if (code) { + message("新增成功", { type: "success" }); + onSearch(); + done(); + } else { + message(msg, { type: "error" }); + } + }; + FormRef.validate(valid => { + if (valid) { + console.log("curData", curData); + saveData(curData); + } + }); + } + }); + }; + return { + onSearch, + isShow, + tableList, + tableLabel, + pagination, + handleSizeChange, + handleCurrentChange, + loading, + handleDelete, + openDialog, + detailData + }; +} diff --git a/src/views/Nobility/nobilityList/List/index.vue b/src/views/Nobility/nobilityList/List/index.vue new file mode 100644 index 0000000..b85ec28 --- /dev/null +++ b/src/views/Nobility/nobilityList/List/index.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/src/views/Nobility/nobilityList/form.vue b/src/views/Nobility/nobilityList/form.vue index 9d28e26..240abd9 100644 --- a/src/views/Nobility/nobilityList/form.vue +++ b/src/views/Nobility/nobilityList/form.vue @@ -13,6 +13,7 @@ const formRules = ref({ day: [{ required: true, message: "请输入购买时长(天)", trigger: "blur" }], image: [{ required: true, message: "请上传图标", trigger: "change" }], images: [{ required: true, message: "请上传灰色图标", trigger: "change" }], + nick_name_color_name: [{ required: true, message: "请选择昵称颜色", trigger: "change" }], name: [{ required: true, message: "请输入爵位名称", trigger: "blur" }, { min: 1, max: 10, message: '长度在 1 到 10 个字符', trigger: 'blur' }] }); const props = defineProps(["formInline"]); @@ -120,8 +121,13 @@ defineExpose({ getRef }); {{ ele.name }} - - + +
+
+
+ +
+
diff --git a/src/views/Nobility/nobilityList/hook.tsx b/src/views/Nobility/nobilityList/hook.tsx index 52e989b..1671d4c 100644 --- a/src/views/Nobility/nobilityList/hook.tsx +++ b/src/views/Nobility/nobilityList/hook.tsx @@ -1,5 +1,6 @@ import { ref, h } from "vue"; import editForm from "./form.vue"; +import attireList from './List/index.vue' import { message } from "@/utils/message"; import { queryList, @@ -99,6 +100,18 @@ export function useData() { onSearch(); } }; + const openList = (title = "爵位装扮", rowData: any) => { + addDialog({ + title: `查看爵位装扮列表`, + props: { + formInline: rowData + }, + width: "60%", + hideFooter: true, + closeOnClickModal: false, + contentRenderer: () => h(attireList) + }); + } // 新增 const openDialog = (title = "新增", rowData: any) => { addDialog({ @@ -172,6 +185,7 @@ export function useData() { handleCurrentChange, loading, handleDelete, - openDialog + openDialog, + openList }; } diff --git a/src/views/Nobility/nobilityList/index.vue b/src/views/Nobility/nobilityList/index.vue index f5deedd..0816369 100644 --- a/src/views/Nobility/nobilityList/index.vue +++ b/src/views/Nobility/nobilityList/index.vue @@ -15,7 +15,8 @@ const { handleCurrentChange, handleDelete, loading, - openDialog + openDialog, + openList } = useData(); defineOptions({ name: "charmGrade" @@ -44,6 +45,9 @@ onMounted(() => { color: 'var(--el-text-color-primary)' }" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange">