增加赠送爵位功能

This commit is contained in:
yziiy
2026-01-20 15:39:58 +08:00
parent f8e4acda08
commit 2232b18968
6 changed files with 88 additions and 6 deletions

View File

@@ -51,4 +51,8 @@ export const deleteDecData = data => {
};
export const addDecData = data => {
return http.request<Result>("post", "/adminapi/Nobility/add_nobility_decorate", { data });
};
export const editgiveasGiftData = data => {
return http.request<Result>("post", "/adminapi/Nobility/give_nobility", { data });
};

View File

@@ -1,7 +1,7 @@
export const URL = "https://yushengapi.qxyushen.top";
// export const URL = "https://yushengapi.qxyushen.top";
// 预测版
// export const URL = "https://vsyusheng.qxhs.xyz";
// 测试
// export const URL = "https://test.vespa.qxyushen.top";
export const URL = "https://test.vespa.qxyushen.top";
// 声网appId 在这里换
export const appIdBySw = "02f7339ec98947deaeab173599891932";

View File

@@ -0,0 +1,35 @@
<script setup lang="ts">
import { ref } from "vue";
const ruleFormRef = ref();
const formRules = ref({
user_code: [{ required: true, message: "请输入用户code", trigger: "blur" }],
lid: [{ required: true, message: "请选择爵位", trigger: "change" }]
});
const props = defineProps(["formInline", "typeList"]);
const newFormInline = ref(
props.formInline
? props.formInline
: {
lid: "",
user_code: ""
}
);
function getRef() {
return ruleFormRef.value;
}
defineExpose({ getRef });
</script>
<template>
<el-form ref="ruleFormRef" :model="newFormInline" :rules="formRules" label-width="120px">
<el-form-item label="用户code" prop="user_code">
<el-input v-model="newFormInline.user_code" clearable placeholder="请输入用户code" />
</el-form-item>
<el-form-item label="爵位Id" prop="lid">
<el-select v-model="newFormInline.lid" placeholder="请选择爵位">
<el-option v-for="item in typeList" :key="item.lid" :label="item.name" :value="item.lid">
</el-option>
</el-select>
</el-form-item>
</el-form>
</template>

View File

@@ -1,5 +1,6 @@
import { ref, h } from "vue";
import editForm from "./form.vue";
import giveForm from "./giveForm.vue";
import attireList from "./List/index.vue";
import { message } from "@/utils/message";
import { verifyPassword } from "@/utils/passwordVerify";
@@ -7,7 +8,8 @@ import {
queryList,
addNobilityData,
deleteRobotData,
editNobilityData
editNobilityData,
editgiveasGiftData
} from "@/api/modules/nobility";
import { addDialog } from "@/components/ReDialog";
export function useData() {
@@ -115,6 +117,41 @@ export function useData() {
contentRenderer: () => h(attireList)
});
};
const giveasGift = (title = "赠送爵位", rowData: any) => {
addDialog({
title: `${title}`,
props: {
formInline: {
user_code: rowData?.user_code ?? "",
lid: rowData?.lid ?? ""
},
typeList: tableList.value
},
width: "40%",
closeOnClickModal: false,
contentRenderer: () => h(giveForm, { ref: formRef, formInline: null }),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline;
FormRef.validate(async valid => {
if (valid) {
// 编辑操作,需要二级密码验证
verifyPassword(async () => {
const { code } = await editgiveasGiftData({
...curData
});
if (code) {
message("赠送成功", { type: "success" });
onSearch();
done();
}
});
}
});
}
});
};
// 新增
const openDialog = (title = "新增", rowData: any) => {
addDialog({
@@ -183,6 +220,7 @@ export function useData() {
loading,
handleDelete,
openDialog,
openList
openList,
giveasGift
};
}

View File

@@ -14,6 +14,7 @@ const {
handleSizeChange,
handleCurrentChange,
handleDelete,
giveasGift,
loading,
openDialog,
openList
@@ -33,6 +34,9 @@ onMounted(() => {
<PureTableBar title="爵位等级列表" :class="[isShow && !deviceDetection() ? '!w-[60vw]' : 'w-full']"
:columns="tableLabel" @refresh="onSearch">
<template #buttons>
<el-button type="primary" @click="giveasGift('赠送爵位', {})">
赠送爵位
</el-button>
<!-- <el-button type="primary" :icon="useRenderIcon(AddFill)" @click="openDialog('新增', {})">
新增爵位
</el-button> -->
@@ -45,6 +49,7 @@ onMounted(() => {
color: 'var(--el-text-color-primary)'
}" @page-current-change="handleCurrentChange" @page-size-change="handleSizeChange">
<template #operation="{ row }">
<el-button link type="primary" :size="size" @click="openList('爵位装扮', row)">
爵位装扮
</el-button>

View File

@@ -39,8 +39,8 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
// "Access-Control-Allow-Origin",
// "http://adminvs.qxhs.xyz"
// );
res.setHeader('Access-Control-Allow-Origin', 'http://yushenggliht.qxyushen.top');
// res.setHeader('Access-Control-Allow-Origin', 'https://test.vespa.qxyushen.top');
// res.setHeader('Access-Control-Allow-Origin', 'http://yushenggliht.qxyushen.top');
res.setHeader('Access-Control-Allow-Origin', 'https://test.vespa.qxyushen.top');
res.setHeader(
"Access-Control-Allow-Methods",
"GET, POST, PUT, DELETE, OPTIONS"