From 1cf23d99fe4d61e848cbb8805ab51d8638fc1564 Mon Sep 17 00:00:00 2001
From: yziiy <15979918+mayday-yziiy@user.noreply.gitee.com>
Date: Fri, 12 Dec 2025 17:30:45 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/Decorate/decorateList/hook.tsx | 19 ++-
src/views/Decorate/decorateList/index.vue | 4 +-
src/views/Decorate/decorateUser/hook.tsx | 20 ++-
src/views/Decorate/decorateUser/index.vue | 2 +
src/views/room/roomTag/form.vue | 17 +-
src/views/room/roomTag/hook.tsx | 15 +-
src/views/system/Tasks/Reward/form.vue | 71 +++++++++
src/views/system/Tasks/Reward/hook.tsx | 185 ++++++++++++++++++++++
src/views/system/Tasks/Reward/index.vue | 79 +++++++++
src/views/system/Tasks/form.vue | 18 +--
src/views/system/Tasks/hook.tsx | 24 ++-
src/views/system/Tasks/index.vue | 3 +-
12 files changed, 436 insertions(+), 21 deletions(-)
create mode 100644 src/views/system/Tasks/Reward/form.vue
create mode 100644 src/views/system/Tasks/Reward/hook.tsx
create mode 100644 src/views/system/Tasks/Reward/index.vue
diff --git a/src/views/Decorate/decorateList/hook.tsx b/src/views/Decorate/decorateList/hook.tsx
index ef7e966..e50bbae 100644
--- a/src/views/Decorate/decorateList/hook.tsx
+++ b/src/views/Decorate/decorateList/hook.tsx
@@ -6,7 +6,8 @@ import {
addDataProp,
editDataProp,
deleteDataProp,
- giveDecorate
+ giveDecorate,
+ queryClassifyList
} from "@/api/modules/decorate";
import { addDialog } from "@/components/ReDialog";
import priceList from './priceList.vue'
@@ -22,7 +23,7 @@ export function useData() {
});
const searchLabel = ref([
{ label: "道具名称", prop: "name", type: "input" },
- { label: "道具类型", prop: "type", type: "input" }
+ { label: "道具类型", prop: "type", type: "select", optionList: [] }
]);
const pagination = ref({
total: 0,
@@ -239,6 +240,17 @@ export function useData() {
}
});
}
+ const getType = async () => {
+ const { data, code } = await queryClassifyList();
+ if (code) {
+ searchLabel.value[searchLabel.value.length - 1].optionList = data.map(ele => {
+ return {
+ value: ele.id,
+ label: ele.name
+ }
+ })
+ }
+ }
return {
searchForm,
searchLabel,
@@ -253,7 +265,8 @@ export function useData() {
openDialog,
handleDelete,
settingPrice,
- sendGift
+ sendGift,
+ getType
};
}
diff --git a/src/views/Decorate/decorateList/index.vue b/src/views/Decorate/decorateList/index.vue
index ebeff40..41f5e51 100644
--- a/src/views/Decorate/decorateList/index.vue
+++ b/src/views/Decorate/decorateList/index.vue
@@ -20,12 +20,14 @@ const {
openDialog,
handleDelete,
settingPrice,
- sendGift
+ sendGift,
+ getType
} = useData();
defineOptions({
name: "decorateList"
});
onMounted(() => {
+ getType()
onSearch(searchForm.value);
});
diff --git a/src/views/Decorate/decorateUser/hook.tsx b/src/views/Decorate/decorateUser/hook.tsx
index a0ce327..eef0cbc 100644
--- a/src/views/Decorate/decorateUser/hook.tsx
+++ b/src/views/Decorate/decorateUser/hook.tsx
@@ -1,7 +1,8 @@
import { ref, h } from "vue";
import { message } from "@/utils/message";
import {
- queryDecorateList
+ queryDecorateList,
+ queryClassifyList
} from "@/api/modules/decorate";
export function useData() {
const formRef = ref();
@@ -16,7 +17,10 @@ export function useData() {
const searchLabel = ref([
{ label: "用户ID", prop: "user_id", type: "input" },
{ label: "道具ID", prop: "did", type: "input" },
- { label: "道具分类", prop: "type", type: "input" }
+ {
+ label: "道具分类", prop: "type", type: "select",
+ optionList: []
+ }
]);
const pagination = ref({
total: 0,
@@ -94,6 +98,17 @@ export function useData() {
pagination.value.currentPage = val;
onSearch(searchForm.value);
};
+ const getType = async () => {
+ const { data, code } = await queryClassifyList();
+ if (code) {
+ searchLabel.value[searchLabel.value.length - 1].optionList = data.map(ele => {
+ return {
+ value: ele.id,
+ label: ele.name
+ }
+ })
+ }
+ }
return {
searchForm,
searchLabel,
@@ -104,6 +119,7 @@ export function useData() {
pagination,
handleSizeChange,
handleCurrentChange,
+ getType,
loading
};
}
diff --git a/src/views/Decorate/decorateUser/index.vue b/src/views/Decorate/decorateUser/index.vue
index e412adc..d66028b 100644
--- a/src/views/Decorate/decorateUser/index.vue
+++ b/src/views/Decorate/decorateUser/index.vue
@@ -15,12 +15,14 @@ const {
handleSizeChange,
handleCurrentChange,
loading,
+ getType,
openDialog
} = useData();
defineOptions({
name: "decorateUser"
});
onMounted(() => {
+ getType()
onSearch(searchForm.value);
});
diff --git a/src/views/room/roomTag/form.vue b/src/views/room/roomTag/form.vue
index d01f30f..495ab9b 100644
--- a/src/views/room/roomTag/form.vue
+++ b/src/views/room/roomTag/form.vue
@@ -4,6 +4,8 @@ import uploadImage from '@/components/UploadImage/index.vue';
const ruleFormRef = ref();
const formRules = ref({
status: [{ required: true, message: "请选择状态", trigger: "change" }],
+ default_index: [{ required: true, message: "请选择状态", trigger: "change" }],
+ sort: [{ required: true, message: "请选择状态", trigger: "blur" }],
label_icon: [{ required: true, message: "请上传图标", trigger: "change" }],
label_icon_room: [{ required: true, message: "请上传房间内展示图标", trigger: "change" }],
label_name: [{ required: true, message: "请输入标签名称", trigger: "blur" }, { min: 1, max: 10, message: '长度在 1 到 10 个字符', trigger: 'blur' }]
@@ -14,7 +16,9 @@ const newFormInline = ref(
? props.formInline
: {
label_name: "",
- status: ""
+ status: "",
+ default_index: "",
+ sort: ""
}
);
function getRef() {
@@ -42,6 +46,17 @@ defineExpose({ getRef });
隐藏
+
+
+ 是
+ 否
+
+
+
+
+
+
+
diff --git a/src/views/room/roomTag/hook.tsx b/src/views/room/roomTag/hook.tsx
index e6e8d4f..1e400c9 100644
--- a/src/views/room/roomTag/hook.tsx
+++ b/src/views/room/roomTag/hook.tsx
@@ -68,6 +68,17 @@ export function useData() {
// />
// ),
// },
+ {
+ label: "首页默认选中",
+ prop: "default_index",
+ cellRenderer: ({ row }) => (
+ {row.default_index == 1 ? '默认选中' : '未选中'}
+ ),
+ },
+ {
+ label: "排序",
+ prop: "sort"
+ },
{
label: "创建时间",
prop: "createtime"
@@ -120,7 +131,9 @@ export function useData() {
label_name: rowData?.label_name ?? "",
label_icon: rowData?.label_icon ?? "",
label_icon_room: rowData?.label_icon_room ?? "",
- status: rowData?.status ?? ""
+ status: rowData?.status ?? "",
+ default_index: rowData?.default_index ?? "",
+ sort: rowData?.sort ?? ""
}
},
width: "40%",
diff --git a/src/views/system/Tasks/Reward/form.vue b/src/views/system/Tasks/Reward/form.vue
new file mode 100644
index 0000000..58f459c
--- /dev/null
+++ b/src/views/system/Tasks/Reward/form.vue
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/Tasks/Reward/hook.tsx b/src/views/system/Tasks/Reward/hook.tsx
new file mode 100644
index 0000000..9049dc9
--- /dev/null
+++ b/src/views/system/Tasks/Reward/hook.tsx
@@ -0,0 +1,185 @@
+import { ref, h } from "vue";
+import {
+ queryList,
+ addActivitiesBox,
+ editActivitiesBox,
+ deletectivitiesBox
+} from "@/api/modules/activities";
+import editForm from "./form.vue";
+import { addDialog } from "@/components/ReDialog";
+import { message } from "@/utils/message";
+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 activeName = ref(0)
+ // const typeList = ref([])
+ const tableLabel = ref([
+ {
+ label: "礼盒ID",
+ prop: "id"
+ },
+ {
+ label: "礼物类型",
+ prop: "gift_type_str"
+ },
+ {
+ label: "礼物ID",
+ prop: "gift_id"
+ },
+ {
+ label: "礼物名称",
+ prop: "gift_name"
+ },
+ {
+ label: "封面图",
+ prop: "base_image",
+ cellRenderer: ({ row }) => (
+
+ )
+ },
+ {
+ label: "数量",
+ prop: "quantity_str"
+ },
+ {
+ label: "金币价格",
+ prop: "gift_price"
+ },
+ {
+ label: "添加时间",
+ prop: "createtime"
+ },
+ {
+ label: "操作",
+ fixed: "right",
+ width: 210,
+ slot: "operation"
+ }
+ ]);
+ const BagId = ref(0)
+ const onSearch = async (id) => {
+ loading.value = true;
+ BagId.value = id ? id : BagId.value
+ const { data, code } = await queryList({
+ gift_bag_id: BagId.value,
+ page: pagination.value.currentPage,
+ page_limit: pagination.value.pageSize,
+ });
+ if (code) {
+ // console.log(data)
+ tableList.value = data.lists.map(ele => {
+ return {
+ ...ele, ...data.total
+ }
+ });
+ pagination.value.total = data.count;
+ pagination.value.currentPage = data.page;
+ }
+ loading.value = false;
+ };
+ const handleSizeChange = (val: number) => {
+ pagination.value.pageSize = val;
+ onSearch(BagId.value);
+ };
+ const handleCurrentChange = (val: number) => {
+ pagination.value.currentPage = val;
+ onSearch(BagId.value);
+ };
+ const handleDelete = async rowData => {
+ const { code } = await deletectivitiesBox({ id: rowData.id });
+ if (code) {
+ message(`您删除了这条数据`, {
+ type: "success"
+ });
+ onSearch(BagId.value);
+ }
+ };
+ const openDialog = async (title = "新增", rowData: any) => {
+ addDialog({
+ title: `${title}礼盒`,
+ props: {
+ formInline: {
+ type: rowData?.gift_type ?? "",
+ num: rowData?.quantity ?? "",
+ gift_id: rowData?.gift_id ?? "",
+ gift_bag_id: rowData?.gift_bag_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 addActivitiesBox({
+ ...form,
+ gift_bag_id: BagId.value,
+ });
+ if (code) {
+ message("新增成功", { type: "success" });
+ onSearch(BagId.value);
+ done();
+ } else {
+ message("新增失败", { type: "error" });
+ }
+ };
+ const updateData = async form => {
+ const { code, msg } = await editActivitiesBox({
+ ...form,
+ gift_bag_id: BagId.value,
+ id: rowData.id
+ });
+ if (code) {
+ message("修改成功", { type: "success" });
+ onSearch(BagId.value);
+ done();
+ } else {
+ message(msg, { type: "error" });
+ }
+ };
+ FormRef.validate(valid => {
+ if (valid) {
+ console.log("curData", curData);
+ // 表单规则校验通过
+ if (title === "新增") {
+ // 实际开发先调用新增接口,再进行下面操作
+ saveData(curData);
+ } else {
+ // 实际开发先调用修改接口,再进行下面操作
+ updateData(curData);
+ }
+ }
+ });
+ }
+ });
+ };
+ return {
+ onSearch,
+ isShow,
+ tableList,
+ tableLabel,
+ pagination,
+ handleSizeChange,
+ handleCurrentChange,
+ loading,
+ BagId,
+ openDialog,
+ handleDelete,
+ };
+}
\ No newline at end of file
diff --git a/src/views/system/Tasks/Reward/index.vue b/src/views/system/Tasks/Reward/index.vue
new file mode 100644
index 0000000..f81ac2a
--- /dev/null
+++ b/src/views/system/Tasks/Reward/index.vue
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+ 添加
+
+
+
+
+
+
+ 编辑
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/Tasks/form.vue b/src/views/system/Tasks/form.vue
index 963fc21..93c7ea2 100644
--- a/src/views/system/Tasks/form.vue
+++ b/src/views/system/Tasks/form.vue
@@ -9,7 +9,7 @@ const formRules = ref({
target_quantity: [{ required: true, message: "请输入获得目标完成数量", trigger: "blur" }],
sort: [{ required: true, message: "请输入排序", trigger: "blur" }]
});
-const props = defineProps(["formInline"]);
+const props = defineProps(["formInline", "typeOptions"]);
const newFormInline = ref(
props.formInline
? props.formInline
@@ -39,29 +39,27 @@ defineExpose({ getRef });
-
+
-
+
+
-
+
diff --git a/src/views/system/Tasks/hook.tsx b/src/views/system/Tasks/hook.tsx
index 23b204c..13bcd74 100644
--- a/src/views/system/Tasks/hook.tsx
+++ b/src/views/system/Tasks/hook.tsx
@@ -7,9 +7,11 @@ import {
editTaskData,
upadteTaskData
} from "@/api/modules/system";
+import detailView from './Reward/index.vue'
import { addDialog } from "@/components/ReDialog";
export function useData() {
const formRef = ref();
+ const typeList = ref([]);
const loading = ref(true);
const tableList = ref([]);
const isShow = ref(false);
@@ -112,6 +114,9 @@ export function useData() {
});
pagination.value.total = data.count;
pagination.value.currentPage = data.page;
+ Object.keys(data.task_type).forEach(ele => {
+ typeList.value.push({ id: +ele, value: data.task_type[ele] })
+ })
}
loading.value = false;
};
@@ -123,6 +128,19 @@ export function useData() {
pagination.value.currentPage = val;
onSearch(searchForm.value);
};
+ // 查看任务奖励
+ const setTaskReward = (title, rowData) => {
+ addDialog({
+ title: title,
+ props: {
+ tableData: rowData
+ },
+ width: "60%",
+ hideFooter: true,
+ closeOnClickModal: false,
+ contentRenderer: () => h(detailView)
+ });
+ }
// 新增
const openDialog = (title = "新增", rowData: any) => {
addDialog({
@@ -130,7 +148,8 @@ export function useData() {
props: {
formInline: {
...rowData
- }
+ },
+ typeOptions: typeList.value
},
width: "40%",
closeOnClickModal: false,
@@ -171,6 +190,7 @@ export function useData() {
handleSizeChange,
handleCurrentChange,
loading,
- openDialog
+ openDialog,
+ setTaskReward
};
}
diff --git a/src/views/system/Tasks/index.vue b/src/views/system/Tasks/index.vue
index 5e25502..5f78d00 100644
--- a/src/views/system/Tasks/index.vue
+++ b/src/views/system/Tasks/index.vue
@@ -14,7 +14,7 @@ const {
tableLabel,
handleSizeChange,
handleCurrentChange,
- handleDelete,
+ setTaskReward,
loading,
openDialog
} = useData();
@@ -44,6 +44,7 @@ onMounted(() => {
编辑
+ 任务奖励