diff --git a/src/components/dashboard/WorkPlace.vue b/src/components/dashboard/WorkPlace.vue index 369b4e3..8d645d2 100644 --- a/src/components/dashboard/WorkPlace.vue +++ b/src/components/dashboard/WorkPlace.vue @@ -39,14 +39,12 @@ - + - + - -
- 曲丽丽 在 高逼格设计天团 新建项目 六月迭代 -
+ +
9小时前
@@ -70,15 +68,17 @@
- - - - - - 程序员日常 - - - + + @@ -126,12 +126,16 @@ export default { return { currUser: {}, projects: [], - loading: true + loading: true, + activities: [], + teams: [] } }, mounted () { this.currentUser() this.getProjectList() + this.getActivites() + this.getTeams() }, methods: { currentUser () { @@ -150,6 +154,22 @@ export default { this.projects = res.data this.loading = false }) + }, + getActivites () { + this.$axios({ + method: 'get', + url: '/work/activity' + }).then(res => { + this.activities = res.data + }) + }, + getTeams () { + this.$axios({ + method: 'get', + url: '/work/team' + }).then(res => { + this.teams = res.data + }) } } } @@ -217,14 +237,27 @@ export default { width: 25%; } } - .member{ - display: block; - margin: 12px 0; - line-height: 24px; - height: 24px; - overflow: hidden; - text-overflow: ellipsis; - word-break: break-all; - white-space: nowrap; + .members { + a { + display: block; + margin: 12px 0; + line-height: 24px; + height: 24px; + .member { + font-size: 14px; + color: rgba(0,0,0,.65); + line-height: 24px; + max-width: 100px; + vertical-align: top; + margin-left: 12px; + transition: all 0.3s; + display: inline-block; + } + &:hover { + span { + color: #1890ff; + } + } + } } diff --git a/src/mock/common/activityData.js b/src/mock/common/activityData.js new file mode 100644 index 0000000..477008f --- /dev/null +++ b/src/mock/common/activityData.js @@ -0,0 +1,32 @@ +import {users, groups} from './index' + +const events = [ + { + type: 0, + event: '八月迭代' + }, + { + type: 1, + event: '留言' + }, + { + type: 2, + event: '项目进展' + } +] + +const activities = users.map((user, index) => { + return { + user: Object.assign({}, user, {group: groups[user.groupId]}), + activity: events[index % events.length], + template: '' + } +}) + +const templates = [ + (user, activity) => { return `${user.name} 在 ${user.group} 新建项目 ${activity.event}` }, + (user, activity) => { return `${user.name} 在 ${user.group} 发布了 ${activity.event}` }, + (user, activity) => { return `${user.name} 将 ${activity.event} 更新至已发布状态` } +] + +export {activities, templates} diff --git a/src/mock/common/index.js b/src/mock/common/index.js index 037d4ce..1d622d5 100644 --- a/src/mock/common/index.js +++ b/src/mock/common/index.js @@ -31,4 +31,46 @@ const logos = [ const admins = ['ICZER', 'JACK', 'LUIS', 'DAVID'] -export {logos, sayings, positions, avatars, admins} +const groups = ['高逼格设计天团', '中二少女团', '科学搬砖组', '骗你学计算机', '程序员日常'] + +const users = [ + { + name: '曲丽丽', + avatar: avatars[0], + groupId: 0 + }, + { + name: '付晓晓', + avatar: avatars[1], + groupId: 0 + }, + { + name: '林东东', + avatar: avatars[2], + groupId: 1 + }, + { + name: '周星星', + avatar: avatars[3], + groupId: 2 + }, + { + name: '朱偏右', + avatar: avatars[4], + groupId: 3 + }, + { + name: '勒个', + avatar: avatars[5], + groupId: 4 + } +] + +const teams = groups.map((item, index) => { + return { + name: item, + avatar: avatars[index] + } +}) + +export {logos, sayings, positions, avatars, admins, groups, users, teams} diff --git a/src/mock/index.js b/src/mock/index.js index c37380d..33ee2ec 100644 --- a/src/mock/index.js +++ b/src/mock/index.js @@ -2,6 +2,7 @@ import Mock from 'mockjs' import '@/mock/user/current' import '@/mock/project' import '@/mock/user/login' +import '@/mock/workplace' // 设置全局延时 Mock.setup({ diff --git a/src/mock/workplace/index.js b/src/mock/workplace/index.js new file mode 100644 index 0000000..a8c1f1c --- /dev/null +++ b/src/mock/workplace/index.js @@ -0,0 +1,15 @@ +import Mock from 'mockjs' +import {activities, templates} from '../common/activityData' +import {teams} from '../../mock/common' + +activities.forEach(item => { + item.template = templates[item.activity.type](item.user, item.activity) +}) + +Mock.mock('/work/activity', 'get', () => { + return activities +}) + +Mock.mock('/work/team', 'get', () => { + return teams +})