From fa3fa22f3c51ee2ded09460f34697d7914b7f702 Mon Sep 17 00:00:00 2001 From: iczer <1126263215@qq.com> Date: Wed, 24 Jun 2020 18:53:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20international=20language=20suppor?= =?UTF-8?q?t=20for=20workplace=20page;=20:star2:=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=EF=BC=9A=E5=B7=A5=E4=BD=9C=E5=8F=B0=E9=A1=B5=E9=9D=A2=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=9B=BD=E9=99=85=E5=8C=96=E8=AF=AD=E8=A8=80=E6=94=AF?= =?UTF-8?q?=E6=8C=81=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mock/common/index.js | 21 ++++++-- src/mock/extend/index.js | 49 +++++++++++++++++-- src/mock/user/current.js | 2 +- src/mock/user/login.js | 2 +- .../dashboard/{ => workplace}/WorkPlace.vue | 47 +++++++++++------- src/pages/dashboard/workplace/i18n.js | 40 +++++++++++++++ src/router/index.js | 2 +- src/router/lazy.js | 2 +- 8 files changed, 136 insertions(+), 29 deletions(-) rename src/pages/dashboard/{ => workplace}/WorkPlace.vue (77%) create mode 100644 src/pages/dashboard/workplace/i18n.js diff --git a/src/mock/common/index.js b/src/mock/common/index.js index 1d622d5..14b576f 100644 --- a/src/mock/common/index.js +++ b/src/mock/common/index.js @@ -8,10 +8,23 @@ const avatars = [ ] const positions = [ - 'JAVA工程师 | 蚂蚁金服-计算服务事业群-微信平台部', - '前端工程师 | 蚂蚁金服-计算服务事业群-VUE平台', - '前端工程师 | 蚂蚁金服-计算服务事业群-REACT平台', - '产品分析师 | 蚂蚁金服-计算服务事业群-IOS平台部' + { + CN: 'Java工程师 | 蚂蚁金服-计算服务事业群-微信平台部', + HK: 'Java工程師 | 螞蟻金服-計算服務事業群-微信平台部', + US: 'Java engineer | Ant financial - Computing services business group - WeChat platform division' + },{ + CN: '前端工程师 | 蚂蚁金服-计算服务事业群-VUE平台', + HK: '前端工程師 | 螞蟻金服-計算服務事業群-VUE平台', + US: 'Front-end engineer | Ant Financial - Computing services business group - VUE platform' + },{ + CN: '前端工程师 | 蚂蚁金服-计算服务事业群-REACT平台', + HK: '前端工程師 | 螞蟻金服-計算服務事業群-REACT平台', + US: 'Front-end engineer | Ant Financial - Computing services business group - REACT platform' + },{ + CN: '产品分析师 | 蚂蚁金服-计算服务事业群-IOS平台部', + HK: '產品分析師 | 螞蟻金服-計算服務事業群-IOS平台部', + US: 'Product analyst | Ant Financial - Computing services business group - IOS platform division' + } ] const sayings = [ diff --git a/src/mock/extend/index.js b/src/mock/extend/index.js index 0e27c3a..cdeb9ab 100644 --- a/src/mock/extend/index.js +++ b/src/mock/extend/index.js @@ -3,17 +3,60 @@ import {logos, sayings, positions, avatars, admins} from '../common' const Random = Mock.Random +const timeList = [ + { + CN: '早上好', + HK: '早晨啊', + US: 'Good morning', + },{ + CN: '上午好', + HK: '上午好', + US: 'Good morning', + },{ + CN: '中午好', + HK: '中午好', + US: 'Good afternoon', + },{ + CN: '晚上好', + HK: '晚上好', + US: 'Good evening', + }, +] + +const welcomeMessages = [ + { + CN: '休息一会儿吧', + HK: '休息一會兒吧', + US: 'you may need a break', + }, + { + CN: '准备吃什么呢', + HK: '準備吃什麼呢', + US: 'what are you going to eat', + }, + { + CN: '要不要打一把 DOTA', + HK: '要不要打一把 DOTA', + US: 'how about a game of DOTA', + }, + { + CN: '我猜你可能累了', + HK: '我猜你可能累了', + US: 'i guess you might be tired', + } +] + Random.extend({ admin () { return this.pick(admins) }, welcome () { - return this.pick(['休息一会儿吧', '准备吃什么呢', '要不要打一把DOTA', '我猜你可能累了']) + return this.pick(welcomeMessages) }, - timefix () { + timeFix () { const time = new Date() const hour = time.getHours() - return hour < 9 ? '早上好' : (hour <= 11 ? '上午好' : (hour <= 13 ? '中午好' : (hour <= 20 ? '下午好' : '晚上好'))) + return hour < 9 ? timeList[0] : (hour <= 11 ? timeList[1] : (hour <= 13 ? timeList[2] : (hour <= 20 ? timeList[3] : timeList[4]))) }, avatar () { return this.pick(avatars) diff --git a/src/mock/user/current.js b/src/mock/user/current.js index 5f222a0..db0aeaf 100644 --- a/src/mock/user/current.js +++ b/src/mock/user/current.js @@ -8,7 +8,7 @@ const userDB = Mock.mock({ avatar: '@AVATAR', address: '@CITY', welcome: '@WELCOME', - timefix: '@TIMEFIX', + timeFix: '@TIMEFIX', position: '@position' } ] diff --git a/src/mock/user/login.js b/src/mock/user/login.js index 014287d..6f01b6e 100644 --- a/src/mock/user/login.js +++ b/src/mock/user/login.js @@ -6,7 +6,7 @@ const user = Mock.mock({ avatar: '@AVATAR', address: '@CITY', welcome: '@WELCOME', - timefix: '@TIMEFIX', + timeFix: '@TIMEFIX', position: '@POSITION' }) diff --git a/src/pages/dashboard/WorkPlace.vue b/src/pages/dashboard/workplace/WorkPlace.vue similarity index 77% rename from src/pages/dashboard/WorkPlace.vue rename to src/pages/dashboard/workplace/WorkPlace.vue index ee43ba3..2f503bd 100644 --- a/src/pages/dashboard/WorkPlace.vue +++ b/src/pages/dashboard/workplace/WorkPlace.vue @@ -1,19 +1,19 @@