inleft
2022-02-09 9bcb19959eeb9da9bde2561e7278f6d0a55eb151
commit | author | age
9bcb19 1 <template>
I 2   <page-view :avatar="avatar" :title="false">
3     <div slot="headerContent">
4       <div class="title">{{ timeFix }},{{ user.name }}<span class="welcome-text">,{{ welcome }}</span></div>
5       <div style="margin-bottom:10px">前端工程师 | 蚂蚁金服 - 某某某事业群 - VUE平台</div>
6     </div>
7     <div slot="extra">
8       <a-row class="more-info">
9         <a-col :span="8">
10           <head-info title="项目" content="56" :center="false" :bordered="false"/>
11         </a-col>
12         <a-col :span="8">
13           <head-info title="团队排名" content="8/24" :center="false" :bordered="false"/>
14         </a-col>
15         <a-col :span="8">
16           <head-info title="项目数" content="2,223" :center="false" />
17         </a-col>
18       </a-row>
19     </div>
20
21     <div>
22       <a-row :gutter="24">
23         <a-col :xl="16" :lg="24" :md="24" :sm="24" :xs="24">
24           <a-card
25             class="project-list"
26             :loading="loading"
27             style="margin-bottom: 24px;"
28             :bordered="false"
29             title="进行中的项目"
30             :body-style="{ padding: 0 }">
31             <a slot="extra">全部项目</a>
32             <div>
33               <a-card-grid class="project-card-grid" :key="i" v-for="(item, i) in projects">
34                 <a-card :bordered="false" :body-style="{ padding: 0 }">
35                   <a-card-meta>
36                     <div slot="title" class="card-title">
37                       <a-avatar size="small" :src="item.cover"/>
38                       <a>{{ item.title }}</a>
39                     </div>
40                     <div slot="description" class="card-description">
41                       {{ item.description }}
42                     </div>
43                   </a-card-meta>
44                   <div class="project-item">
45                     <a href="/#/">科学搬砖组</a>
46                     <span class="datetime">9小时前</span>
47                   </div>
48                 </a-card>
49               </a-card-grid>
50             </div>
51           </a-card>
52
53           <a-card :loading="loading" title="动态" :bordered="false">
54             <a-list>
55               <a-list-item :key="index" v-for="(item, index) in activities">
56                 <a-list-item-meta>
57                   <a-avatar slot="avatar" :src="item.user.avatar" />
58                   <div slot="title">
59                     <span>{{ item.user.nickname }}</span>&nbsp;
60                     在&nbsp;<a href="#">{{ item.project.name }}</a>&nbsp;
61                     <span>{{ item.project.action }}</span>&nbsp;
62                     <a href="#">{{ item.project.event }}</a>
63                   </div>
64                   <div slot="description">{{ item.time }}</div>
65                 </a-list-item-meta>
66               </a-list-item>
67             </a-list>
68           </a-card>
69         </a-col>
70         <a-col
71           style="padding: 0 12px"
72           :xl="8"
73           :lg="24"
74           :md="24"
75           :sm="24"
76           :xs="24">
77           <a-card title="快速开始 / 便捷导航" style="margin-bottom: 24px" :bordered="false" :body-style="{padding: 0}">
78             <div class="item-group">
79               <a>操作一</a>
80               <a>操作二</a>
81               <a>操作三</a>
82               <a>操作四</a>
83               <a>操作五</a>
84               <a>操作六</a>
85               <a-button size="small" type="primary" ghost icon="plus">添加</a-button>
86             </div>
87           </a-card>
88           <a-card title="XX 指数" style="margin-bottom: 24px" :loading="radarLoading" :bordered="false" :body-style="{ padding: 0 }">
89             <div style="min-height: 400px;">
90               <!-- :scale="scale" :axis1Opts="axis1Opts" :axis2Opts="axis2Opts"  -->
91               <radar :data="radarData" />
92             </div>
93           </a-card>
94           <a-card :loading="loading" title="团队" :bordered="false">
95             <div class="members">
96               <a-row>
97                 <a-col :span="12" v-for="(item, index) in teams" :key="index">
98                   <a>
99                     <a-avatar size="small" :src="item.avatar" />
100                     <span class="member">{{ item.name }}</span>
101                   </a>
102                 </a-col>
103               </a-row>
104             </div>
105           </a-card>
106         </a-col>
107       </a-row>
108     </div>
109   </page-view>
110 </template>
111
112 <script>
113   import { timeFix } from '@/utils/util'
114   import { mapState } from 'vuex'
115   import { PageView } from '@/layouts'
116   import HeadInfo from '@/components/tools/HeadInfo'
117   import { Radar } from '@/components'
118   const DataSet = require('@antv/data-set')
119
120   export default {
121     name: 'Workplace',
122     components: {
123       PageView,
124       HeadInfo,
125       Radar
126     },
127     data () {
128       return {
129         timeFix: timeFix(),
130         avatar: '',
131         user: {},
132
133         projects: [],
134         loading: true,
135         radarLoading: true,
136         activities: [],
137         teams: [],
138
139         // data
140         axis1Opts: {
141           dataKey: 'item',
142           line: null,
143           tickLine: null,
144           grid: {
145             lineStyle: {
146               lineDash: null
147             },
148             hideFirstLine: false
149           }
150         },
151         axis2Opts: {
152           dataKey: 'score',
153           line: null,
154           tickLine: null,
155           grid: {
156             type: 'polygon',
157             lineStyle: {
158               lineDash: null
159             }
160           }
161         },
162         scale: [{
163           dataKey: 'score',
164           min: 0,
165           max: 80
166         }],
167         axisData: [
168           { item: '引用', a: 70, b: 30, c: 40 },
169           { item: '口碑', a: 60, b: 70, c: 40 },
170           { item: '产量', a: 50, b: 60, c: 40 },
171           { item: '贡献', a: 40, b: 50, c: 40 },
172           { item: '热度', a: 60, b: 70, c: 40 },
173           { item: '引用', a: 70, b: 50, c: 40 }
174         ],
175         radarData: []
176       }
177     },
178     computed: {
179       ...mapState({
180         nickname: (state) => state.user.nickname,
181         welcome: (state) => state.user.welcome
182       }),
183       userInfo () {
184         return this.$store.getters.userInfo
185       }
186     },
187     created () {
188       this.user = this.userInfo
189       this.avatar = process.env.VUE_APP_API_BASE_URL + '/sysFileInfo/preview?id=' + this.userInfo.avatar
190     },
191     mounted () {
192       this.getProjects()
193       this.getActivity()
194       this.getTeams()
195       this.initRadar()
196     },
197     methods: {
198       getProjects () {
199         this.projects = [{
200           id: 1,
201           cover: 'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png',
202           title: 'Alipay',
203           description: '那是一种内在的东西, 他们到达不了,也无法触及的',
204           status: 1,
205           updatedAt: '2018-07-26 00:00:00'
206         },
207           {
208             id: 2,
209             cover: 'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png',
210             title: 'Angular',
211             description: '希望是一个好东西,也许是最好的,好东西是不会消亡的',
212             status: 1,
213             updatedAt: '2018-07-26 00:00:00'
214           },
215           {
216             id: 3,
217             cover: 'https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png',
218             title: 'Ant Design',
219             description: '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆',
220             status: 1,
221             updatedAt: '2018-07-26 00:00:00'
222           },
223           {
224             id: 4,
225             cover: 'https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png',
226             title: 'Snowy',
227             description: '那时候我只会想自己想要什么,从不想自己拥有什么',
228             status: 1,
229             updatedAt: '2018-07-26 00:00:00'
230           },
231           {
232             id: 5,
233             cover: 'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png',
234             title: 'Bootstrap',
235             description: '凛冬将至',
236             status: 1,
237             updatedAt: '2018-07-26 00:00:00'
238           },
239           {
240             id: 6,
241             cover: 'https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png',
242             title: 'Vue',
243             description: '生命就像一盒巧克力,结果往往出人意料',
244             status: 1,
245             updatedAt: '2018-07-26 00:00:00'
246           }
247         ]
248         this.loading = false
249       },
250       getActivity () {
251         this.activities = [{
252           id: 1,
253           user: {
254             nickname: '@name',
255             avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'
256           },
257           project: {
258             name: '白鹭酱油开发组',
259             action: '更新',
260             event: '番组计划'
261           },
262           time: '2018-08-23 14:47:00'
263         },
264           {
265             id: 1,
266             user: {
267               nickname: '蓝莓酱',
268               avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png'
269             },
270             project: {
271               name: '白鹭酱油开发组',
272               action: '更新',
273               event: '番组计划'
274             },
275             time: '2018-08-23 09:35:37'
276           },
277           {
278             id: 1,
279             user: {
280               nickname: '@name',
281               avatar: '@image(64x64)'
282             },
283             project: {
284               name: '白鹭酱油开发组',
285               action: '创建',
286               event: '番组计划'
287             },
288             time: '2017-05-27 00:00:00'
289           },
290           {
291             id: 1,
292             user: {
293               nickname: '曲丽丽',
294               avatar: '@image(64x64)'
295             },
296             project: {
297               name: '高逼格设计天团',
298               action: '更新',
299               event: '六月迭代'
300             },
301             time: '2018-08-23 14:47:00'
302           },
303           {
304             id: 1,
305             user: {
306               nickname: '@name',
307               avatar: '@image(64x64)'
308             },
309             project: {
310               name: '高逼格设计天团',
311               action: 'created',
312               event: '六月迭代'
313             },
314             time: '2018-08-23 14:47:00'
315           },
316           {
317             id: 1,
318             user: {
319               nickname: '曲丽丽',
320               avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'
321             },
322             project: {
323               name: '高逼格设计天团',
324               action: 'created',
325               event: '六月迭代'
326             },
327             time: '2018-08-23 14:47:00'
328           }
329         ]
330       },
331       getTeams () {
332         this.teams = [{
333           id: 1,
334           name: '科学搬砖组',
335           avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'
336         },
337           {
338             id: 2,
339             name: '程序员日常',
340             avatar: 'https://gw.alipayobjects.com/zos/rmsportal/cnrhVkzwxjPwAaCfPbdc.png'
341           },
342           {
343             id: 1,
344             name: '设计天团',
345             avatar: 'https://gw.alipayobjects.com/zos/rmsportal/gaOngJwsRYRaVAuXXcmB.png'
346           },
347           {
348             id: 1,
349             name: '中二少女团',
350             avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ubnKSIfAJTxIgXOKlciN.png'
351           },
352           {
353             id: 1,
354             name: '骗你学计算机',
355             avatar: 'https://gw.alipayobjects.com/zos/rmsportal/WhxKECPNujWoWEFNdnJE.png'
356           }
357         ]
358       },
359       initRadar () {
360         this.radarLoading = true
361         const dv = new DataSet.View().source(
362           [{
363             item: '引用',
364             '个人': 70,
365             '团队': 30,
366             '部门': 40
367           },
368             {
369               item: '口碑',
370               '个人': 60,
371               '团队': 70,
372               '部门': 40
373             },
374             {
375               item: '产量',
376               '个人': 50,
377               '团队': 60,
378               '部门': 40
379             },
380             {
381               item: '贡献',
382               '个人': 40,
383               '团队': 50,
384               '部门': 40
385             },
386             {
387               item: '热度',
388               '个人': 60,
389               '团队': 70,
390               '部门': 40
391             },
392             {
393               item: '引用',
394               '个人': 70,
395               '团队': 50,
396               '部门': 40
397             }
398           ]
399         )
400         dv.transform({
401           type: 'fold',
402           fields: ['个人', '团队', '部门'],
403           key: 'user',
404           value: 'score'
405         })
406
407         this.radarData = dv.rows
408         this.radarLoading = false
409       }
410     }
411   }
412 </script>
413
414 <style lang="less" scoped>
415   .project-list {
416
417     .card-title {
418       font-size: 0;
419
420       a {
421         color: rgba(0, 0, 0, 0.85);
422         margin-left: 12px;
423         line-height: 24px;
424         height: 24px;
425         display: inline-block;
426         vertical-align: top;
427         font-size: 14px;
428
429         &:hover {
430           color: #1890ff;
431         }
432       }
433     }
434     .card-description {
435       color: rgba(0, 0, 0, 0.45);
436       height: 44px;
437       line-height: 22px;
438       overflow: hidden;
439     }
440     .project-item {
441       display: flex;
442       margin-top: 8px;
443       overflow: hidden;
444       font-size: 12px;
445       height: 20px;
446       line-height: 20px;
447       a {
448         color: rgba(0, 0, 0, 0.45);
449         display: inline-block;
450         flex: 1 1 0;
451
452         &:hover {
453           color: #1890ff;
454         }
455       }
456       .datetime {
457         color: rgba(0, 0, 0, 0.25);
458         flex: 0 0 auto;
459         float: right;
460       }
461     }
462     .ant-card-meta-description {
463       color: rgba(0, 0, 0, 0.45);
464       height: 44px;
465       line-height: 22px;
466       overflow: hidden;
467     }
468   }
469
470   .item-group {
471     padding: 20px 0 8px 24px;
472     font-size: 0;
473     a {
474       color: rgba(0, 0, 0, 0.65);
475       display: inline-block;
476       font-size: 14px;
477       margin-bottom: 13px;
478       width: 25%;
479     }
480   }
481
482   .members {
483     a {
484       display: block;
485       margin: 12px 0;
486       line-height: 24px;
487       height: 24px;
488       .member {
489         font-size: 14px;
490         color: rgba(0, 0, 0, .65);
491         line-height: 24px;
492         max-width: 100px;
493         vertical-align: top;
494         margin-left: 12px;
495         transition: all 0.3s;
496         display: inline-block;
497       }
498       &:hover {
499         span {
500           color: #1890ff;
501         }
502       }
503     }
504   }
505
506   .mobile {
507
508     .project-list {
509
510       .project-card-grid {
511         width: 100%;
512       }
513     }
514
515     .more-info {
516       border: 0;
517       padding-top: 16px;
518       margin: 16px 0 16px;
519     }
520
521     .headerContent .title .welcome-text {
522       display: none;
523     }
524   }
525
526 </style>