From 7ad4cee79ade617a13358f7417ce3e1182c1027f Mon Sep 17 00:00:00 2001 From: chen-xt <1250548605@qq.com> Date: Sat, 14 Nov 2020 20:34:46 +0800 Subject: [PATCH] feat: add accountSetting page (#85) --- mock/demo/account.ts | 62 ++++++++ src/api/demo/account.ts | 16 ++ src/api/demo/model/accountModel.ts | 7 + src/router/menus/modules/demo/page.ts | 13 ++ src/router/routes/modules/demo/page.ts | 21 +++ .../demo/page/account/setting/AccountBind.vue | 59 +++++++ .../demo/page/account/setting/BaseSetting.vue | 42 +++++ .../demo/page/account/setting/MsgNotify.vue | 53 +++++++ .../page/account/setting/SecureSetting.vue | 45 ++++++ src/views/demo/page/account/setting/data.ts | 149 ++++++++++++++++++ src/views/demo/page/account/setting/index.vue | 58 +++++++ 11 files changed, 525 insertions(+) create mode 100644 mock/demo/account.ts create mode 100644 src/api/demo/account.ts create mode 100644 src/api/demo/model/accountModel.ts create mode 100644 src/views/demo/page/account/setting/AccountBind.vue create mode 100644 src/views/demo/page/account/setting/BaseSetting.vue create mode 100644 src/views/demo/page/account/setting/MsgNotify.vue create mode 100644 src/views/demo/page/account/setting/SecureSetting.vue create mode 100644 src/views/demo/page/account/setting/data.ts create mode 100644 src/views/demo/page/account/setting/index.vue diff --git a/mock/demo/account.ts b/mock/demo/account.ts new file mode 100644 index 00000000..40dc7af0 --- /dev/null +++ b/mock/demo/account.ts @@ -0,0 +1,62 @@ +import { MockMethod } from 'vite-plugin-mock'; +import { resultSuccess } from '../_util'; + +const userInfo = { + name: 'Serati Ma', + userid: '00000001', + email: 'antdesign@alipay.com', + signature: '海纳百川,有容乃大', + introduction: '微笑着,努力着,欣赏着', + title: '交互专家', + group: '蚂蚁集团-某某某事业群-某某平台部-某某技术部-UED', + tags: [ + { + key: '0', + label: '很有想法的', + }, + { + key: '1', + label: '专注设计', + }, + { + key: '2', + label: '辣~', + }, + { + key: '3', + label: '大长腿', + }, + { + key: '4', + label: '川妹子', + }, + { + key: '5', + label: '海纳百川', + }, + ], + notifyCount: 12, + unreadCount: 11, + country: 'China', + province: { + label: '浙江省', + value: '330000', + }, + city: { + label: '杭州市', + value: '330100', + }, + address: '西湖区工专路 77 号', + phone: '0752-268888888', +}; + +export default [ + { + url: '/api/account/getAccountInfo', + timeout: 1000, + method: 'get', + response: () => { + return resultSuccess(userInfo); + }, + }, +] as MockMethod[]; diff --git a/src/api/demo/account.ts b/src/api/demo/account.ts new file mode 100644 index 00000000..89979aa9 --- /dev/null +++ b/src/api/demo/account.ts @@ -0,0 +1,16 @@ +import { defHttp } from '/@/utils/http/axios'; +import { GetAccountInfoModel } from './model/accountModel'; + +enum Api { + ACCOUNT_INFO = '/account/getAccountInfo', + SECURE_LIST = '/account/getSecureList', +} + +// 获取个人中心--基础设置内容 +export function accountInfoApi(params: any) { + return defHttp.request({ + url: Api.ACCOUNT_INFO, + method: 'GET', + params, + }); +} diff --git a/src/api/demo/model/accountModel.ts b/src/api/demo/model/accountModel.ts new file mode 100644 index 00000000..4594393e --- /dev/null +++ b/src/api/demo/model/accountModel.ts @@ -0,0 +1,7 @@ +export interface GetAccountInfoModel { + email: string; + name: string; + introduction: string; + phone: string; + address: string; +} diff --git a/src/router/menus/modules/demo/page.ts b/src/router/menus/modules/demo/page.ts index ebbc1569..11b5af20 100644 --- a/src/router/menus/modules/demo/page.ts +++ b/src/router/menus/modules/demo/page.ts @@ -51,6 +51,19 @@ const menu: MenuModule = { }, ], }, + { + path: 'account', + name: '个人页', + tag: { + content: 'new', + }, + children: [ + { + path: 'setting', + name: '个人设置', + }, + ], + }, ], }, }; diff --git a/src/router/routes/modules/demo/page.ts b/src/router/routes/modules/demo/page.ts index 10766c66..0318c65e 100644 --- a/src/router/routes/modules/demo/page.ts +++ b/src/router/routes/modules/demo/page.ts @@ -116,6 +116,27 @@ const page: AppRouteModule = { ], }, // =============================exception end============================= + + // =============================account start============================= + { + path: '/account', + name: 'AccountPage', + redirect: '/page-demo/account/setting', + meta: { + title: '个人页', + }, + children: [ + { + path: 'setting', + name: 'AccountSettingPage', + component: () => import('/@/views/demo/page/account/setting/index.vue'), + meta: { + title: '个人设置', + }, + }, + ], + }, + // =============================account end============================= ], }; diff --git a/src/views/demo/page/account/setting/AccountBind.vue b/src/views/demo/page/account/setting/AccountBind.vue new file mode 100644 index 00000000..61441012 --- /dev/null +++ b/src/views/demo/page/account/setting/AccountBind.vue @@ -0,0 +1,59 @@ + + + diff --git a/src/views/demo/page/account/setting/BaseSetting.vue b/src/views/demo/page/account/setting/BaseSetting.vue new file mode 100644 index 00000000..1b87c6f4 --- /dev/null +++ b/src/views/demo/page/account/setting/BaseSetting.vue @@ -0,0 +1,42 @@ + + diff --git a/src/views/demo/page/account/setting/MsgNotify.vue b/src/views/demo/page/account/setting/MsgNotify.vue new file mode 100644 index 00000000..dbd935f4 --- /dev/null +++ b/src/views/demo/page/account/setting/MsgNotify.vue @@ -0,0 +1,53 @@ + + + diff --git a/src/views/demo/page/account/setting/SecureSetting.vue b/src/views/demo/page/account/setting/SecureSetting.vue new file mode 100644 index 00000000..e3847572 --- /dev/null +++ b/src/views/demo/page/account/setting/SecureSetting.vue @@ -0,0 +1,45 @@ + + + diff --git a/src/views/demo/page/account/setting/data.ts b/src/views/demo/page/account/setting/data.ts new file mode 100644 index 00000000..6c725e1a --- /dev/null +++ b/src/views/demo/page/account/setting/data.ts @@ -0,0 +1,149 @@ +import { FormSchema } from '/@/components/Form/index'; + +export interface ListItem { + key: string; + title: string; + description: string; + extra?: string; + avatar?: string; + color?: string; +} + +// tab的list +export const settingList = [ + { + key: '1', + name: '基本设置', + component: 'BaseSetting', + }, + { + key: '2', + name: '安全设置', + component: 'SecureSetting', + }, + { + key: '3', + name: '账号绑定', + component: 'AccountBind', + }, + { + key: '4', + name: '新消息通知', + component: 'MsgNotify', + }, +]; + +// 基础设置 form +export const baseSetschemas: FormSchema[] = [ + { + field: 'email', + component: 'Input', + label: '邮箱', + colProps: { span: 18 }, + }, + { + field: 'name', + component: 'Input', + label: '昵称', + colProps: { span: 18 }, + }, + { + field: 'introduction', + component: 'InputTextArea', + label: '个人简介', + colProps: { span: 18 }, + }, + { + field: 'phone', + component: 'Input', + label: '联系电话', + colProps: { span: 18 }, + }, + { + field: 'address', + component: 'Input', + label: '所在地区', + colProps: { span: 18 }, + }, +]; + +// 安全设置 list +export const secureSettingList: ListItem[] = [ + { + key: '1', + title: '账户密码', + description: '当前密码强度::强', + extra: '修改', + }, + { + key: '2', + title: '密保手机', + description: '已绑定手机::138****8293', + extra: '修改', + }, + { + key: '3', + title: '密保问题', + description: '未设置密保问题,密保问题可有效保护账户安全', + extra: '修改', + }, + { + key: '4', + title: '备用邮箱', + description: '已绑定邮箱::ant***sign.com', + extra: '修改', + }, + { + key: '5', + title: 'MFA 设备', + description: '未绑定 MFA 设备,绑定后,可以进行二次确认', + extra: '修改', + }, +]; + +// 账号绑定 list +export const accountBindList: ListItem[] = [ + { + key: '1', + title: '绑定淘宝', + description: '当前未绑定淘宝账号', + extra: '绑定', + avatar: 'ant-design:taobao-outlined', + color: '#ff4000', + }, + { + key: '2', + title: '绑定支付宝', + description: '当前未绑定支付宝账号', + extra: '绑定', + avatar: 'ant-design:alipay-outlined', + color: '#2eabff', + }, + { + key: '3', + title: '绑定钉钉', + description: '当前未绑定钉钉账号', + extra: '绑定', + avatar: 'ri:dingding-fill', + color: '#2eabff', + }, +]; + +// 新消息通知 list +export const msgNotifyList: ListItem[] = [ + { + key: '1', + title: '账户密码', + description: '其他用户的消息将以站内信的形式通知', + }, + { + key: '2', + title: '系统消息', + description: '系统消息将以站内信的形式通知', + }, + { + key: '3', + title: '待办任务', + description: '待办任务将以站内信的形式通知', + }, +]; diff --git a/src/views/demo/page/account/setting/index.vue b/src/views/demo/page/account/setting/index.vue new file mode 100644 index 00000000..48388788 --- /dev/null +++ b/src/views/demo/page/account/setting/index.vue @@ -0,0 +1,58 @@ + + + +