diff --git a/src/views/expression/TypeList/index.vue b/src/views/expression/TypeList/index.vue new file mode 100644 index 0000000..e69de29 diff --git a/src/views/expression/form.vue b/src/views/expression/form.vue index feb0768..59cdad7 100644 --- a/src/views/expression/form.vue +++ b/src/views/expression/form.vue @@ -1,135 +1,77 @@ diff --git a/src/views/expression/hook.tsx b/src/views/expression/hook.tsx index ac2f923..dfc2020 100644 --- a/src/views/expression/hook.tsx +++ b/src/views/expression/hook.tsx @@ -36,26 +36,30 @@ export function useData() { }, { label: "表情名称", - prop: "gift_name" + prop: "name" }, { label: "图片", - prop: "base_image", + prop: "image", cellRenderer: ({ row }) => ( ) }, + { + label: "表情分类", + prop: "type_str" + }, { label: "状态", - prop: "is_can_buy", + prop: "status", cellRenderer: ({ row }) => ( - {row.is_can_buy === 1 ? '可购买' : '禁止购买'} + {row.status_str} ) }, { @@ -82,7 +86,7 @@ export function useData() { page_limit: pagination.value.pageSize }); if (code) { - tableList.value = data.lists; + tableList.value = data.list; pagination.value.total = data.count; pagination.value.currentPage = data.page; } @@ -97,9 +101,9 @@ export function useData() { onSearch(searchForm.value); }; const handleDelete = async rowData => { - const { code } = await removeGiftData({ gid: rowData.gid }); + const { code } = await removeData({ id: rowData.id }); if (code) { - message(`您删除了礼物名称为【${rowData.gift_name}】的这条数据`, { + message(`您删除了表情名称为【${rowData.name}】的这条数据`, { type: "success" }); onSearch(searchForm.value); @@ -107,24 +111,17 @@ export function useData() { }; // 新增 const openDialog = async (title = "新增", rowData: any) => { - const { data, code } = await getGiftInfo({ gid: rowData.gid }) addDialog({ title: `${title}礼物`, props: { formInline: { - gift_name: rowData?.gift_name ?? "", - type: data?.type ?? "", - label: data?.label ?? "", - base_image: rowData?.base_image ?? "", - gift_price: rowData?.gift_price ?? "", - file_type: data?.file_type ?? "", - play_image: data?.play_image ?? "", - gift_type: data?.gift_type ?? "", - is_public_screen: rowData?.is_public_screen ?? "", - is_public_server: rowData?.is_public_server ?? "", - is_show: rowData?.is_show ?? "", - is_can_buy: rowData?.is_can_buy ?? "", - sort: rowData?.sort ?? "" + pid: rowData?.pid ?? "", + name: rowData?.name ?? "", + image: rowData?.image ?? "", + animate_image: rowData?.animate_image ?? "", + sort: rowData?.sort ?? "", + type_id: rowData?.type_id ?? "", + status: rowData?.status ?? "" } }, width: "40%", @@ -134,7 +131,8 @@ export function useData() { const FormRef = formRef.value.getRef(); const curData = options.props.formInline; const saveData = async form => { - const { code, msg } = await addGiftData(form); + console.log(form) + const { code, msg } = await addData(form); if (code) { message("新增成功", { type: "success" }); onSearch(searchForm.value); @@ -144,9 +142,9 @@ export function useData() { } }; const updateData = async form => { - const { code, msg } = await editGiftData({ + const { code, msg } = await editData({ ...form, - gid: rowData.gid + id: rowData.id }); if (code) { message("修改成功", { type: "success" }); @@ -172,6 +170,16 @@ export function useData() { } }); }; + // 查看表情分类 + const openTypeDialog = () => { + addDialog({ + title: `表情包分类列表`, + width: "60%", + closeOnClickModal: false, + hideFooter: true, + // contentRenderer: () => h(, { ref: formRef, formInline: null }) + }); + } return { searchForm, searchLabel, @@ -184,6 +192,7 @@ export function useData() { handleCurrentChange, loading, handleDelete, - openDialog + openDialog, + openTypeDialog }; } diff --git a/src/views/expression/index.vue b/src/views/expression/index.vue index 5b4df43..32f5208 100644 --- a/src/views/expression/index.vue +++ b/src/views/expression/index.vue @@ -17,6 +17,8 @@ const { handleSizeChange, handleCurrentChange, loading, + handleDelete, + openTypeDialog, openDialog } = useData(); defineOptions({ @@ -35,6 +37,7 @@ onMounted(() => {