From 1b6c9b2e2939a853e59843d5b9f321652bb38da8 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 26 Aug 2023 01:59:36 +0800 Subject: [PATCH] =?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 @@ -