From 451458eb1e98aa42f8b6bcf7b2e1f7fbb974c0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=AE=E6=A2=A6?= Date: Wed, 23 Aug 2023 10:23:22 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BC=9A=E5=91=98=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E8=B7=B3=E8=BD=AC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/member/user/index.vue | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/views/member/user/index.vue b/src/views/member/user/index.vue index 18e4f370..777fa8d5 100644 --- a/src/views/member/user/index.vue +++ b/src/views/member/user/index.vue @@ -114,10 +114,10 @@ - 编辑 + 详情 @@ -130,14 +130,10 @@ @pagination="getList" /> - - - + + + + diff --git a/src/views/member/user/detail/index.vue b/src/views/member/user/detail/index.vue index 38c8712c..569277d4 100644 --- a/src/views/member/user/detail/index.vue +++ b/src/views/member/user/detail/index.vue @@ -142,28 +142,25 @@ - - + + + diff --git a/src/views/member/user/components/PointList.vue b/src/views/member/user/components/PointList.vue index 2b2b98e4..a98a622f 100644 --- a/src/views/member/user/components/PointList.vue +++ b/src/views/member/user/components/PointList.vue @@ -17,7 +17,7 @@ > @@ -112,7 +112,7 @@ const queryParams = reactive({ bizType: undefined, title: null, createDate: [], - userId: null + userId: NaN }) const queryFormRef = ref() // 搜索的表单 @@ -140,9 +140,8 @@ const resetQuery = () => { handleQuery() } -// TODO @梦:改成 userId 哈 -const { memberId } = defineProps({ - memberId: { +const { userId } = defineProps({ + userId: { type: Number, required: true } @@ -150,7 +149,7 @@ const { memberId } = defineProps({ /** 初始化 **/ onMounted(() => { - queryParams.userId = memberId + queryParams.userId = userId getList() }) diff --git a/src/views/member/user/components/SignList.vue b/src/views/member/user/components/SignList.vue index 479e18a7..47fbd155 100644 --- a/src/views/member/user/components/SignList.vue +++ b/src/views/member/user/components/SignList.vue @@ -92,6 +92,7 @@ const list = ref([]) // 列表的数据 const queryParams = reactive({ pageNo: 1, pageSize: 10, + userId: NaN, nickname: null, day: null, createTime: [] @@ -122,9 +123,8 @@ const resetQuery = () => { handleQuery() } -// TODO @梦:改成 userId 哈 -const { memberId } = defineProps({ - memberId: { +const { userId } = defineProps({ + userId: { type: Number, required: true } @@ -132,7 +132,7 @@ const { memberId } = defineProps({ /** 初始化 **/ onMounted(() => { - queryParams.userId = memberId + queryParams.userId = userId getList() }) diff --git a/src/views/member/user/components/UserBasicInfo.vue b/src/views/member/user/components/UserBasicInfo.vue index c6449d3a..50d16413 100644 --- a/src/views/member/user/components/UserBasicInfo.vue +++ b/src/views/member/user/components/UserBasicInfo.vue @@ -1,7 +1,90 @@ - - + + diff --git a/src/views/member/user/components/address-list.vue b/src/views/member/user/components/address-list.vue deleted file mode 100644 index 6d47bda5..00000000 --- a/src/views/member/user/components/address-list.vue +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - diff --git a/src/views/member/user/components/descriptions/DescriptionsItemLabel.vue b/src/views/member/user/components/descriptions/DescriptionsItemLabel.vue new file mode 100644 index 00000000..35783351 --- /dev/null +++ b/src/views/member/user/components/descriptions/DescriptionsItemLabel.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/views/member/user/detail/index.vue b/src/views/member/user/detail/index.vue index 569277d4..967a4110 100644 --- a/src/views/member/user/detail/index.vue +++ b/src/views/member/user/detail/index.vue @@ -1,12 +1,11 @@ - + - + 成长值(WIP) 余额(WIP) + + + + 订单管理(WIP) + 售后管理(WIP) + 收藏记录(WIP) + 优惠劵(WIP) @@ -150,34 +63,37 @@ import PointList from '@/views/member/user/components/PointList.vue' import SignList from '@/views/member/user/components/SignList.vue' import CardTitle from '@/views/member/user/components/CardTitle.vue' import * as UserApi from '@/api/member/user' -import { formatDate } from '@/utils/formatTime' -import { DICT_TYPE } from '@/utils/dict' import UserForm from '@/views/member/user/UserForm.vue' -// TODO @梦:把用户信息,也抽成一个组件,类似 AccountInfo import AccountInfo from '@/views/member/user/components/AccountInfo.vue' +import UserBasicInfo from '@/views/member/user/components/UserBasicInfo.vue' +import AddressList from '@/views/member/user/components/AddressList.vue' defineOptions({ name: 'MemberDetail' }) const activeName = ref('point') // 账户明细 选中的 tabs const loading = ref(true) // 加载中 -let user = ref({ +let user = ref({ areaId: undefined, avatar: undefined, birthday: undefined, createTime: undefined, - id: undefined, + id: NaN, loginDate: undefined, loginIp: '', mark: '', mobile: '', name: '', nickname: '', - password: null, - registerIp: undefined, + registerIp: '', sex: 0, - status: 0 + status: 0, + areaName: '' }) - +/** 添加/修改操作 */ +const formRef = ref() +const openForm = (type: string, id?: number) => { + formRef.value.open(type, id) +} /** 获得用户 */ const getUserData = async (id: number) => { loading.value = true @@ -188,16 +104,10 @@ const getUserData = async (id: number) => { } } -/** 添加/修改操作 */ -const formRef = ref() -const openForm = (type: string, id?: number) => { - formRef.value.open(type, id) -} - /** 初始化 */ const route = useRoute() const router = useRouter() -const member_id = route.params.member_id as number +const member_id = Number(route.params.userId as string) onMounted(() => { if (!member_id) { // TODO @@ -222,11 +132,4 @@ onMounted(() => { justify-content: space-between; align-items: center; } -.cell-item { - display: inline; -} -/** TODO 下面 css 貌似没啥用? */ -.cell-item::after { - content: ':'; -} From 1b6c9b2e2939a853e59843d5b9f321652bb38da8 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 26 Aug 2023 01:59:36 +0800 Subject: [PATCH 5/5] =?UTF-8?q?code=20review=EF=BC=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/member/address/index.ts | 29 +------- src/api/member/user/index.ts | 26 +------ src/components/Card/index.ts | 3 + .../Card/src}/CardTitle.vue | 0 src/components/Descriptions/index.ts | 3 +- .../src}/DescriptionsItemLabel.vue | 0 src/router/modules/remaining.ts | 2 +- .../UserAccountInfo.vue} | 5 -- .../UserAddressList.vue} | 30 +------- .../{components => detail}/UserBasicInfo.vue | 2 +- .../UserPointList.vue} | 5 +- .../SignList.vue => detail/UserSignList.vue} | 3 - src/views/member/user/detail/index.vue | 69 +++++++------------ src/views/member/user/index.vue | 15 ++-- 14 files changed, 45 insertions(+), 147 deletions(-) create mode 100644 src/components/Card/index.ts rename src/{views/member/user/components => components/Card/src}/CardTitle.vue (100%) rename src/{views/member/user/components/descriptions => components/Descriptions/src}/DescriptionsItemLabel.vue (100%) rename src/views/member/user/{components/AccountInfo.vue => detail/UserAccountInfo.vue} (94%) rename src/views/member/user/{components/AddressList.vue => detail/UserAddressList.vue} (69%) rename src/views/member/user/{components => detail}/UserBasicInfo.vue (96%) rename src/views/member/user/{components/PointList.vue => detail/UserPointList.vue} (96%) rename src/views/member/user/{components/SignList.vue => detail/UserSignList.vue} (96%) diff --git a/src/api/member/address/index.ts b/src/api/member/address/index.ts index cc16980d..a914f979 100644 --- a/src/api/member/address/index.ts +++ b/src/api/member/address/index.ts @@ -10,31 +10,6 @@ export interface AddressVO { } // 查询用户收件地址列表 -export const getAddressPage = async (params) => { - return await request.get({ url: `/member/address/page`, params }) -} - -// 查询用户收件地址详情 -export const getAddress = async (id: number) => { - return await request.get({ url: `/member/address/get?id=` + id }) -} - -// 新增用户收件地址 -export const createAddress = async (data: AddressVO) => { - return await request.post({ url: `/member/address/create`, data }) -} - -// 修改用户收件地址 -export const updateAddress = async (data: AddressVO) => { - return await request.put({ url: `/member/address/update`, data }) -} - -// 删除用户收件地址 -export const deleteAddress = async (id: number) => { - return await request.delete({ url: `/member/address/delete?id=` + id }) -} - -// 导出用户收件地址 Excel -export const exportAddress = async (params) => { - return await request.download({ url: `/member/address/export-excel`, params }) +export const getAddressList = async (params) => { + return await request.get({ url: `/member/address/list`, params }) } diff --git a/src/api/member/user/index.ts b/src/api/member/user/index.ts index dd417f68..82d8d159 100644 --- a/src/api/member/user/index.ts +++ b/src/api/member/user/index.ts @@ -1,12 +1,10 @@ import request from '@/config/axios' export interface UserVO { - areaId: number | undefined - areaName: string | undefined + id: number avatar: string | undefined birthday: number | undefined createTime: number | undefined - id: number loginDate: number | undefined loginIp: string mark: string @@ -16,26 +14,8 @@ export interface UserVO { registerIp: string sex: number status: number -} - -// TODO @梦:和 UserVO 搞成一个把。 -export interface UserBaseInfoVO { - id: number | undefined | null - mobile: string - password: string | null | undefined - status: number - registerIp: string | null | undefined - loginIp: string | null | undefined - loginDate: Date | null | undefined - nickname: string | null | undefined - avatar: string | null | undefined - name: string | null | undefined - sex: number - areaId: number | null | undefined - areaName: string | null | undefined - birthday: Date | null | undefined - mark: string | null | undefined - createTime: Date | null | undefined + areaId: number | undefined + areaName: string | undefined } // 查询会员用户列表 diff --git a/src/components/Card/index.ts b/src/components/Card/index.ts new file mode 100644 index 00000000..f4c0d86c --- /dev/null +++ b/src/components/Card/index.ts @@ -0,0 +1,3 @@ +import CardTitle from './src/CardTitle.vue' + +export { CardTitle } diff --git a/src/views/member/user/components/CardTitle.vue b/src/components/Card/src/CardTitle.vue similarity index 100% rename from src/views/member/user/components/CardTitle.vue rename to src/components/Card/src/CardTitle.vue diff --git a/src/components/Descriptions/index.ts b/src/components/Descriptions/index.ts index 91b0eb41..243bc397 100644 --- a/src/components/Descriptions/index.ts +++ b/src/components/Descriptions/index.ts @@ -1,3 +1,4 @@ import Descriptions from './src/Descriptions.vue' +import DescriptionsItemLabel from './src/DescriptionsItemLabel.vue' -export { Descriptions } +export { Descriptions, DescriptionsItemLabel } diff --git a/src/views/member/user/components/descriptions/DescriptionsItemLabel.vue b/src/components/Descriptions/src/DescriptionsItemLabel.vue similarity index 100% rename from src/views/member/user/components/descriptions/DescriptionsItemLabel.vue rename to src/components/Descriptions/src/DescriptionsItemLabel.vue diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index 8bd56119..40909f4a 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -434,7 +434,7 @@ const remainingRouter: AppRouteRecordRaw[] = [ meta: { hidden: true }, children: [ { - path: 'user/detail/:userId', + path: 'user/detail/:id', name: 'MemberUserDetail', meta: { title: '会员详情', diff --git a/src/views/member/user/components/AccountInfo.vue b/src/views/member/user/detail/UserAccountInfo.vue similarity index 94% rename from src/views/member/user/components/AccountInfo.vue rename to src/views/member/user/detail/UserAccountInfo.vue index 252f3f10..4eaa2bab 100644 --- a/src/views/member/user/components/AccountInfo.vue +++ b/src/views/member/user/detail/UserAccountInfo.vue @@ -46,11 +46,6 @@ -