From cb8602535efdd7e963941aa3a47abea6bf72952d Mon Sep 17 00:00:00 2001 From: xingyu Date: Tue, 22 Aug 2023 17:46:05 +0800 Subject: [PATCH] feat: add member user --- src/views/member/user/UserModal.vue | 58 ++++++++ src/views/member/user/index.vue | 49 ++++++- src/views/member/user/user.data.ts | 196 ++++++++++++++++++++++++++++ 3 files changed, 302 insertions(+), 1 deletion(-) create mode 100644 src/views/member/user/UserModal.vue create mode 100644 src/views/member/user/user.data.ts diff --git a/src/views/member/user/UserModal.vue b/src/views/member/user/UserModal.vue new file mode 100644 index 00000000..5b5c5a60 --- /dev/null +++ b/src/views/member/user/UserModal.vue @@ -0,0 +1,58 @@ + + + diff --git a/src/views/member/user/index.vue b/src/views/member/user/index.vue index ef9fd593..28e7a86b 100644 --- a/src/views/member/user/index.vue +++ b/src/views/member/user/index.vue @@ -1,3 +1,50 @@ + + diff --git a/src/views/member/user/user.data.ts b/src/views/member/user/user.data.ts new file mode 100644 index 00000000..3cb91d63 --- /dev/null +++ b/src/views/member/user/user.data.ts @@ -0,0 +1,196 @@ +import { getMemberTagPage } from '@/api/member/tag' +import { getAreaTree } from '@/api/system/area' +import type { BasicColumn, FormSchema } from '@/components/Table' +import { useRender } from '@/components/Table' +import { DICT_TYPE, getDictOptions } from '@/utils/dict' + +export const columns: BasicColumn[] = [ + { + title: '用户编号', + dataIndex: 'id', + width: 100, + }, + { + title: '头像', + dataIndex: 'avatar', + width: 180, + customRender: ({ text }) => { + return useRender.renderImg(text) + }, + }, + { + title: '手机号', + dataIndex: 'mobile', + width: 100, + }, + { + title: '昵称', + dataIndex: 'nickname', + width: 100, + }, + // { + // title: '分组', + // dataIndex: 'id', + // width: 100, + // }, + { + title: '用户标签', + dataIndex: 'tagNames', + width: 100, + customRender: ({ text }) => { + return useRender.renderTags(text) + }, + }, + // { + // title: '积分', + // dataIndex: 'nickname', + // width: 100, + // }, + { + title: '状态', + dataIndex: 'status', + width: 180, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.COMMON_STATUS) + }, + }, + { + title: '登录时间', + dataIndex: 'loginDate', + customRender: ({ text }) => { + return useRender.renderDate(text) + }, + }, + { + title: '注册时间', + dataIndex: 'createTime', + customRender: ({ text }) => { + return useRender.renderDate(text) + }, + }, +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '用户昵称', + field: 'nickname', + component: 'Input', + colProps: { span: 8 }, + }, + { + label: '手机号', + field: 'mobile', + component: 'Input', + colProps: { span: 8 }, + }, + { + label: '注册时间', + field: 'createTime', + component: 'RangePicker', + colProps: { span: 8 }, + }, + { + label: '登录时间', + field: 'loginDate', + component: 'RangePicker', + colProps: { span: 8 }, + }, + { + label: '用户标签', + field: 'tagIds', + component: 'ApiSelect', + componentProps: { + api: () => getMemberTagPage({}), + labelField: 'name', + valueField: 'id', + }, + colProps: { span: 8 }, + }, +] + +export const formSchema: FormSchema[] = [ + { + label: '编号', + field: 'id', + show: false, + component: 'Input', + }, + { + label: '手机号', + field: 'mobile', + required: true, + component: 'Input', + }, + { + label: '状态', + field: 'status', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS), + }, + }, + { + label: '用户昵称', + field: 'nickname', + component: 'Input', + }, + { + label: '用户头像', + field: 'avatar', + component: 'FileUpload', + componentProps: { + maxCount: 1, + fileType: 'image', + }, + }, + { + label: '真实名字', + field: 'name', + component: 'Input', + }, + { + label: '用户性别', + field: 'sex', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.SYSTEM_USER_SEX), + }, + }, + { + label: '出生日期', + field: 'birthday', + component: 'DatePicker', + componentProps: { + valueFormat: 'x', + }, + }, + { + label: '所在地', + field: 'areaId', + component: 'ApiTreeSelect', + componentProps: { + api: () => getAreaTree(), + fieldNames: { + label: 'name', + key: 'id', + value: 'id', + }, + handleTree: 'id', + }, + }, + { + label: '用户标签', + field: 'tagIds', + component: 'ApiSelect', + componentProps: { + api: () => getMemberTagPage({}), + labelField: 'name', + valueField: 'id', + }, + }, + { + label: '会员备注', + field: 'mark', + component: 'InputTextArea', + }, +]