Commit 78d4d41c85f5341bb5dfd2a1cbb6e60d6858b084
Committed by
GitHub
1 parent
7ad4cee7
feat: add account center page (#86)
Showing
12 changed files
with
557 additions
and
4 deletions
mock/demo/account.ts
src/assets/images/demo.png
0 → 100644
17 KB
src/router/menus/modules/demo/page.ts
1 | +/* | |
2 | + * @description: Do not edit | |
3 | + * @author: cxiaoting | |
4 | + * @Date: 2020-11-13 14:00:37 | |
5 | + * @LastEditors: cxiaoting | |
6 | + * @LastEditTime: 2020-11-13 18:07:11 | |
7 | + */ | |
1 | 8 | import type { MenuModule } from '/@/router/types.d'; |
2 | 9 | const menu: MenuModule = { |
3 | 10 | orderNo: 20, |
... | ... | @@ -59,6 +66,10 @@ const menu: MenuModule = { |
59 | 66 | }, |
60 | 67 | children: [ |
61 | 68 | { |
69 | + path: 'center', | |
70 | + name: '个人中心', | |
71 | + }, | |
72 | + { | |
62 | 73 | path: 'setting', |
63 | 74 | name: '个人设置', |
64 | 75 | }, | ... | ... |
src/router/routes/modules/demo/page.ts
... | ... | @@ -127,6 +127,14 @@ const page: AppRouteModule = { |
127 | 127 | }, |
128 | 128 | children: [ |
129 | 129 | { |
130 | + path: 'center', | |
131 | + name: 'AccountCenterPage', | |
132 | + component: () => import('/@/views/demo/page/account/center/index.vue'), | |
133 | + meta: { | |
134 | + title: '个人中心', | |
135 | + }, | |
136 | + }, | |
137 | + { | |
130 | 138 | path: 'setting', |
131 | 139 | name: 'AccountSettingPage', |
132 | 140 | component: () => import('/@/views/demo/page/account/setting/index.vue'), | ... | ... |
src/views/demo/page/account/center/Application.vue
0 → 100644
1 | +<template> | |
2 | + <List :class="prefixCls"> | |
3 | + <Row :gutter="16"> | |
4 | + <template v-for="(item, index) in list" :key="index"> | |
5 | + <Col :span="6"> | |
6 | + <ListItem> | |
7 | + <Card :hoverable="true" :class="`${prefixCls}__card`"> | |
8 | + <div :class="`${prefixCls}__card-title`"> | |
9 | + <Icon class="icon" v-if="item.icon" :icon="item.icon" :color="item.color" /> | |
10 | + {{ item.title }} | |
11 | + </div> | |
12 | + <div :class="`${prefixCls}__card-num`"> | |
13 | + 活跃用户:<span>{{ item.active }}</span> 万 | |
14 | + </div> | |
15 | + <div :class="`${prefixCls}__card-num`"> | |
16 | + 新增用户:<span>{{ item.new }}</span> | |
17 | + </div> | |
18 | + <Icon | |
19 | + :class="`${prefixCls}__card-download`" | |
20 | + v-if="item.download" | |
21 | + :icon="item.download" | |
22 | + /> | |
23 | + </Card> | |
24 | + </ListItem> | |
25 | + </Col> | |
26 | + </template> | |
27 | + </Row> | |
28 | + </List> | |
29 | +</template> | |
30 | +<script lang="ts"> | |
31 | + import { defineComponent } from 'vue'; | |
32 | + import { List, Card, Row, Col } from 'ant-design-vue'; | |
33 | + import Icon from '/@/components/Icon/index'; | |
34 | + import { applicationList } from './data'; | |
35 | + | |
36 | + export default defineComponent({ | |
37 | + components: { | |
38 | + List, | |
39 | + ListItem: List.Item, | |
40 | + Card, | |
41 | + Row, | |
42 | + Col, | |
43 | + Icon, | |
44 | + }, | |
45 | + setup() { | |
46 | + return { | |
47 | + prefixCls: 'account-center-application', | |
48 | + list: applicationList, | |
49 | + }; | |
50 | + }, | |
51 | + }); | |
52 | +</script> | |
53 | +<style lang="less" scoped> | |
54 | + .account-center-application { | |
55 | + &__card { | |
56 | + width: 100%; | |
57 | + | |
58 | + /deep/ .ant-card-body { | |
59 | + padding: 16px; | |
60 | + } | |
61 | + | |
62 | + &-title { | |
63 | + margin-bottom: 5px; | |
64 | + font-size: 16px; | |
65 | + font-weight: 500; | |
66 | + color: rgba(0, 0, 0, 0.85); | |
67 | + | |
68 | + .icon { | |
69 | + margin-top: -5px; | |
70 | + font-size: 22px; | |
71 | + } | |
72 | + } | |
73 | + | |
74 | + &-num { | |
75 | + margin-left: 24px; | |
76 | + line-height: 36px; | |
77 | + color: #7d7a7a; | |
78 | + | |
79 | + span { | |
80 | + margin-left: 5px; | |
81 | + font-size: 18px; | |
82 | + color: #000; | |
83 | + } | |
84 | + } | |
85 | + | |
86 | + &-download { | |
87 | + float: right; | |
88 | + font-size: 20px !important; | |
89 | + color: #1890ff; | |
90 | + } | |
91 | + } | |
92 | + } | |
93 | +</style> | ... | ... |
src/views/demo/page/account/center/Article.vue
0 → 100644
1 | +<template> | |
2 | + <List item-layout="vertical" :class="prefixCls"> | |
3 | + <template v-for="(item, index) in list" :key="index"> | |
4 | + <ListItem> | |
5 | + <ListItemMeta> | |
6 | + <template #description> | |
7 | + <div :class="`${prefixCls}__content`">{{ item.content }}</div> | |
8 | + </template> | |
9 | + <template #title> | |
10 | + <p :class="`${prefixCls}__title`"> {{ item.title }}</p> | |
11 | + <div> | |
12 | + <template v-for="(tag, index) in item.description" :key="index"> | |
13 | + <Tag class="mb-2">{{ tag }}</Tag> | |
14 | + </template> | |
15 | + </div> | |
16 | + </template> | |
17 | + </ListItemMeta> | |
18 | + <div> | |
19 | + <template v-for="(action, index) in actions" :key="index"> | |
20 | + <div :class="`${prefixCls}__action`"> | |
21 | + <Icon | |
22 | + v-if="action.icon" | |
23 | + :class="`${prefixCls}__action-icon`" | |
24 | + :icon="action.icon" | |
25 | + :color="action.color" | |
26 | + /> | |
27 | + {{ action.text }} | |
28 | + </div> | |
29 | + </template> | |
30 | + <span :class="`${prefixCls}__time`">{{ item.time }}</span> | |
31 | + </div> | |
32 | + </ListItem> | |
33 | + </template> | |
34 | + </List> | |
35 | +</template> | |
36 | +<script lang="ts"> | |
37 | + import { defineComponent } from 'vue'; | |
38 | + import { List, Tag } from 'ant-design-vue'; | |
39 | + import Icon from '/@/components/Icon/index'; | |
40 | + import { actions, articleList } from './data'; | |
41 | + | |
42 | + export default defineComponent({ | |
43 | + components: { | |
44 | + List, | |
45 | + ListItem: List.Item, | |
46 | + ListItemMeta: List.Item.Meta, | |
47 | + Tag, | |
48 | + Icon, | |
49 | + }, | |
50 | + setup() { | |
51 | + return { | |
52 | + prefixCls: 'account-center-article', | |
53 | + list: articleList, | |
54 | + actions, | |
55 | + }; | |
56 | + }, | |
57 | + }); | |
58 | +</script> | |
59 | +<style lang="less" scoped> | |
60 | + .account-center-article { | |
61 | + &__title { | |
62 | + margin-bottom: 12px; | |
63 | + font-size: 18px; | |
64 | + } | |
65 | + | |
66 | + &__content { | |
67 | + color: rgba(0, 0, 0, 0.65); | |
68 | + } | |
69 | + | |
70 | + &__action { | |
71 | + display: inline-block; | |
72 | + padding: 0 16px; | |
73 | + color: rgba(0, 0, 0, 0.45); | |
74 | + | |
75 | + &:not(:last-child) { | |
76 | + border-right: 1px solid rgba(206, 206, 206, 0.4); | |
77 | + } | |
78 | + | |
79 | + &-icon { | |
80 | + margin-right: 3px; | |
81 | + } | |
82 | + } | |
83 | + | |
84 | + &__time { | |
85 | + position: absolute; | |
86 | + right: 20px; | |
87 | + color: rgba(0, 0, 0, 0.45); | |
88 | + } | |
89 | + } | |
90 | +</style> | ... | ... |
src/views/demo/page/account/center/Project.vue
0 → 100644
1 | +<template> | |
2 | + <List :class="prefixCls"> | |
3 | + <Row :gutter="16"> | |
4 | + <template v-for="(item, index) in list" :key="index"> | |
5 | + <Col :span="6"> | |
6 | + <ListItem> | |
7 | + <Card :hoverable="true" :class="`${prefixCls}__card`"> | |
8 | + <img :src="demoImg" /> | |
9 | + <div :class="`${prefixCls}__card-title`"> | |
10 | + {{ item.title }} | |
11 | + </div> | |
12 | + <div :class="`${prefixCls}__card-content`"> {{ item.content }}</div> | |
13 | + </Card> | |
14 | + </ListItem> | |
15 | + </Col> | |
16 | + </template> | |
17 | + </Row> | |
18 | + </List> | |
19 | +</template> | |
20 | +<script lang="ts"> | |
21 | + import { defineComponent } from 'vue'; | |
22 | + import { List, Card, Row, Col } from 'ant-design-vue'; | |
23 | + import demoImg from '/@/assets/images/demo.png'; | |
24 | + import { projectList } from './data'; | |
25 | + | |
26 | + export default defineComponent({ | |
27 | + components: { | |
28 | + List, | |
29 | + ListItem: List.Item, | |
30 | + Card, | |
31 | + Row, | |
32 | + Col, | |
33 | + }, | |
34 | + setup() { | |
35 | + return { | |
36 | + prefixCls: 'account-center-project', | |
37 | + list: projectList, | |
38 | + demoImg, | |
39 | + }; | |
40 | + }, | |
41 | + }); | |
42 | +</script> | |
43 | +<style lang="less" scoped> | |
44 | + .account-center-project { | |
45 | + &__card { | |
46 | + width: 100%; | |
47 | + | |
48 | + /deep/ .ant-card-body { | |
49 | + padding: 0 0 24px 0; | |
50 | + } | |
51 | + | |
52 | + img { | |
53 | + width: 100%; | |
54 | + height: 100px; | |
55 | + } | |
56 | + | |
57 | + &-title { | |
58 | + margin: 5px 10px; | |
59 | + font-size: 16px; | |
60 | + font-weight: 500; | |
61 | + color: rgba(0, 0, 0, 0.85); | |
62 | + } | |
63 | + | |
64 | + &-content { | |
65 | + margin: 5px 10px; | |
66 | + } | |
67 | + } | |
68 | + } | |
69 | +</style> | ... | ... |
src/views/demo/page/account/center/data.tsx
0 → 100644
1 | +export interface ListItem { | |
2 | + title: string; | |
3 | + icon: string; | |
4 | + color?: string; | |
5 | +} | |
6 | + | |
7 | +export interface TabItem { | |
8 | + key: string; | |
9 | + name: string; | |
10 | + component: string; | |
11 | +} | |
12 | + | |
13 | +export const tags: string[] = [ | |
14 | + '很有想法的', | |
15 | + '专注设计', | |
16 | + '川妹子', | |
17 | + '大长腿', | |
18 | + '海纳百川', | |
19 | + '前端开发', | |
20 | + 'vue3', | |
21 | +]; | |
22 | + | |
23 | +export const teams: ListItem[] = [ | |
24 | + { | |
25 | + icon: 'ant-design:alipay-circle-outlined', | |
26 | + title: '科学搬砖组', | |
27 | + color: '#ff4000', | |
28 | + }, | |
29 | + { | |
30 | + icon: 'emojione-monotone:letter-a', | |
31 | + title: '中二少年团', | |
32 | + color: '#7c51b8', | |
33 | + }, | |
34 | + { | |
35 | + icon: 'ant-design:alipay-circle-outlined', | |
36 | + title: '高逼格设计', | |
37 | + color: '#00adf7', | |
38 | + }, | |
39 | + { | |
40 | + icon: 'ant-design:codepen-circle-filled', | |
41 | + title: '程序员日常', | |
42 | + color: '#00adf7', | |
43 | + }, | |
44 | + { | |
45 | + icon: 'ant-design:dribbble-circle-filled', | |
46 | + title: '科学搬砖组', | |
47 | + color: '#ff4000', | |
48 | + }, | |
49 | + { | |
50 | + icon: 'ant-design:behance-square-filled', | |
51 | + title: '程序员日常', | |
52 | + color: '#7c51b8', | |
53 | + }, | |
54 | +]; | |
55 | + | |
56 | +export const details: ListItem[] = [ | |
57 | + { | |
58 | + icon: 'ant-design:contacts-outlined', | |
59 | + title: '交互专家', | |
60 | + }, | |
61 | + { | |
62 | + icon: 'ant-design:cluster-outlined', | |
63 | + title: '蚂蚁金服-某某某事业群', | |
64 | + }, | |
65 | + { | |
66 | + icon: 'ant-design:home-outlined', | |
67 | + title: '福建省厦门市', | |
68 | + }, | |
69 | +]; | |
70 | + | |
71 | +export const achieveList: TabItem[] = [ | |
72 | + { | |
73 | + key: '1', | |
74 | + name: '文章', | |
75 | + component: 'Article', | |
76 | + }, | |
77 | + { | |
78 | + key: '2', | |
79 | + name: '应用', | |
80 | + component: 'Application', | |
81 | + }, | |
82 | + { | |
83 | + key: '3', | |
84 | + name: '项目', | |
85 | + component: 'Project', | |
86 | + }, | |
87 | +]; | |
88 | + | |
89 | +export const actions: any[] = [ | |
90 | + { icon: 'ant-design:star-outlined', text: '156', color: '#018ffb' }, | |
91 | + { icon: 'ant-design:like-filled', text: '156', color: '#459ae8' }, | |
92 | + { icon: 'ant-design:message-filled', text: '2', color: '#42d27d' }, | |
93 | +]; | |
94 | + | |
95 | +export const articleList = (() => { | |
96 | + const result: any[] = []; | |
97 | + for (let i = 0; i < 4; i++) { | |
98 | + result.push({ | |
99 | + title: 'Ant Design', | |
100 | + description: ['Ant Design', '设计语言', '蚂蚁金服'], | |
101 | + content: | |
102 | + '段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案', | |
103 | + time: '2020-11-14 11:20', | |
104 | + }); | |
105 | + } | |
106 | + return result; | |
107 | +})(); | |
108 | + | |
109 | +export const applicationList = (() => { | |
110 | + const result: any[] = []; | |
111 | + for (let i = 0; i < 8; i++) { | |
112 | + result.push({ | |
113 | + title: 'Ant Design', | |
114 | + icon: 'emojione-monotone:letter-a', | |
115 | + color: '#7c51b8', | |
116 | + active: '100', | |
117 | + new: '1,799', | |
118 | + download: 'bx:bx-download', | |
119 | + }); | |
120 | + } | |
121 | + return result; | |
122 | +})(); | |
123 | + | |
124 | +export const projectList = (() => { | |
125 | + const result: any[] = []; | |
126 | + for (let i = 0; i < 8; i++) { | |
127 | + result.push({ | |
128 | + title: 'Angular', | |
129 | + content: '那是一种内在的东西, 他们到达不了,', | |
130 | + }); | |
131 | + } | |
132 | + return result; | |
133 | +})(); | ... | ... |
src/views/demo/page/account/center/index.vue
0 → 100644
1 | +<template> | |
2 | + <div :class="prefixCls"> | |
3 | + <Row :class="`${prefixCls}-top`"> | |
4 | + <Col :span="9" :class="`${prefixCls}-col`"> | |
5 | + <Row> | |
6 | + <Col :span="8"> | |
7 | + <div :class="`${prefixCls}-top__avatar`"> | |
8 | + <img width="70" :src="headerImg" /> | |
9 | + <span>Serati Ma</span> | |
10 | + <div>海纳百川,有容乃大</div> | |
11 | + </div> | |
12 | + </Col> | |
13 | + <Col :span="16"> | |
14 | + <div :class="`${prefixCls}-top__detail`"> | |
15 | + <template v-for="(detail, index) in details" :key="index"> | |
16 | + <p> | |
17 | + <Icon :icon="detail.icon" /> | |
18 | + {{ detail.title }} | |
19 | + </p> | |
20 | + </template> | |
21 | + </div> | |
22 | + </Col> | |
23 | + </Row> | |
24 | + </Col> | |
25 | + <Col :span="7" :class="`${prefixCls}-col`"> | |
26 | + <CollapseContainer title="标签" :canExpan="false"> | |
27 | + <template v-for="(tag, index) in tags" :key="index"> | |
28 | + <Tag class="mb-2">{{ tag }}</Tag> | |
29 | + </template> | |
30 | + </CollapseContainer> | |
31 | + </Col> | |
32 | + <Col :span="8" :class="`${prefixCls}-col`"> | |
33 | + <CollapseContainer :class="`${prefixCls}-top__team`" title="团队" :canExpan="false"> | |
34 | + <div v-for="(team, index) in teams" :key="index" :class="`${prefixCls}-top__team-item`"> | |
35 | + <Icon :icon="team.icon" :color="team.color" /> | |
36 | + <span>{{ team.title }}</span> | |
37 | + </div> | |
38 | + </CollapseContainer> | |
39 | + </Col> | |
40 | + </Row> | |
41 | + <div :class="`${prefixCls}-bottom`"> | |
42 | + <Tabs> | |
43 | + <template v-for="item in achieveList" :key="item.key"> | |
44 | + <TabPane :tab="item.name"> | |
45 | + <component :is="item.component" /> | |
46 | + </TabPane> | |
47 | + </template> | |
48 | + </Tabs> | |
49 | + </div> | |
50 | + </div> | |
51 | +</template> | |
52 | + | |
53 | +<script lang="ts"> | |
54 | + import { Row, Col, Tag, Tabs } from 'ant-design-vue'; | |
55 | + import { defineComponent } from 'vue'; | |
56 | + import { CollapseContainer } from '/@/components/Container/index'; | |
57 | + import Icon from '/@/components/Icon/index'; | |
58 | + import Article from './Article.vue'; | |
59 | + import Application from './Application.vue'; | |
60 | + import Project from './Project.vue'; | |
61 | + | |
62 | + import headerImg from '/@/assets/images/header.jpg'; | |
63 | + import { tags, teams, details, achieveList } from './data'; | |
64 | + | |
65 | + export default defineComponent({ | |
66 | + components: { | |
67 | + CollapseContainer, | |
68 | + Icon, | |
69 | + Row, | |
70 | + Col, | |
71 | + Tag, | |
72 | + Tabs, | |
73 | + TabPane: Tabs.TabPane, | |
74 | + Article, | |
75 | + Application, | |
76 | + Project, | |
77 | + }, | |
78 | + setup() { | |
79 | + return { | |
80 | + prefixCls: 'account-center', | |
81 | + headerImg, | |
82 | + tags, | |
83 | + teams, | |
84 | + details, | |
85 | + achieveList, | |
86 | + }; | |
87 | + }, | |
88 | + }); | |
89 | +</script> | |
90 | +<style lang="less" scoped> | |
91 | + .account-center { | |
92 | + &-col:not(:last-child) { | |
93 | + padding: 0 10px; | |
94 | + | |
95 | + &:not(:last-child) { | |
96 | + border-right: 1px dashed rgb(206, 206, 206, 0.5); | |
97 | + } | |
98 | + } | |
99 | + | |
100 | + &-top { | |
101 | + padding: 10px; | |
102 | + margin: 16px 16px 12px 16px; | |
103 | + background: #fff; | |
104 | + border-radius: 3px; | |
105 | + | |
106 | + &__avatar { | |
107 | + text-align: center; | |
108 | + | |
109 | + img { | |
110 | + border-radius: 50%; | |
111 | + } | |
112 | + | |
113 | + span { | |
114 | + display: block; | |
115 | + font-size: 20px; | |
116 | + font-weight: 500; | |
117 | + } | |
118 | + | |
119 | + div { | |
120 | + margin-top: 3px; | |
121 | + font-size: 12px; | |
122 | + } | |
123 | + } | |
124 | + | |
125 | + &__detail { | |
126 | + padding-left: 20px; | |
127 | + margin-top: 15px; | |
128 | + } | |
129 | + | |
130 | + &__team { | |
131 | + &-item { | |
132 | + display: inline-block; | |
133 | + padding: 4px 18px; | |
134 | + } | |
135 | + | |
136 | + span { | |
137 | + margin-left: 3px; | |
138 | + } | |
139 | + } | |
140 | + } | |
141 | + | |
142 | + &-bottom { | |
143 | + padding: 10px; | |
144 | + margin: 0 16px 16px 16px; | |
145 | + background: #fff; | |
146 | + border-radius: 3px; | |
147 | + } | |
148 | + } | |
149 | +</style> | ... | ... |
src/views/demo/page/account/setting/AccountBind.vue
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | </template> |
23 | 23 | <script lang="ts"> |
24 | 24 | import { List } from 'ant-design-vue'; |
25 | - import { defineComponent, onMounted } from 'vue'; | |
25 | + import { defineComponent } from 'vue'; | |
26 | 26 | import { CollapseContainer } from '/@/components/Container/index'; |
27 | 27 | import Icon from '/@/components/Icon/index'; |
28 | 28 | ... | ... |
src/views/demo/page/account/setting/MsgNotify.vue
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | </template> |
25 | 25 | <script lang="ts"> |
26 | 26 | import { List, Switch } from 'ant-design-vue'; |
27 | - import { defineComponent, onMounted } from 'vue'; | |
27 | + import { defineComponent } from 'vue'; | |
28 | 28 | import { CollapseContainer } from '/@/components/Container/index'; |
29 | 29 | |
30 | 30 | import { msgNotifyList } from './data'; | ... | ... |
src/views/demo/page/account/setting/SecureSetting.vue
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | </template> |
20 | 20 | <script lang="ts"> |
21 | 21 | import { List } from 'ant-design-vue'; |
22 | - import { defineComponent, onMounted } from 'vue'; | |
22 | + import { defineComponent } from 'vue'; | |
23 | 23 | import { CollapseContainer } from '/@/components/Container/index'; |
24 | 24 | |
25 | 25 | import { secureSettingList } from './data'; | ... | ... |