From 6ea8ca9ac65b227990e0decfcf3afea02e21cce3 Mon Sep 17 00:00:00 2001 From: song Date: Tue, 26 Oct 2021 14:39:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0PC=E7=AB=AF=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +- public/index.html | 9 ++++ src/App.vue | 9 +++- src/apis/wbs.js | 3 +- .../change-password/change-password.vue | 6 ++- src/config/message.js | 23 ++++++++++ src/pages/index/index.vue | 3 +- src/pages/project-webview/project-webview.vue | 45 +++++++++++++++++-- src/pages/right-window/right-window.vue | 23 ++++++---- src/store/project/mutations.js | 9 ++++ src/store/project/state.js | 1 + src/store/user/mutations.js | 9 ++++ src/store/user/state.js | 1 + src/utils/tall.js | 2 + 14 files changed, 128 insertions(+), 18 deletions(-) create mode 100644 src/config/message.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 10672a4..64fd1d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 0.1.0 (2021-10-20) +# 0.1.0 (2021-10-26) ### 🌟 新功能 范围|描述|commitId @@ -51,6 +51,7 @@ - | 添加 环境变量,动态控制webview project的path | 8a40481 - | 添加子任务插件 子项目插件 | 7bda7e2 - | 添加时间轴上下滚动 | 2b81bbc + - | 添加登录,修改密码页面 | 8d53e63 - | 添加顶部导航栏和详情页 | 2a63485 - | 添加项目排序 | a0b491b - | 点击日历日期查询项目列表 | c458385 diff --git a/public/index.html b/public/index.html index 37ae61b..4899304 100644 --- a/public/index.html +++ b/public/index.html @@ -25,4 +25,13 @@ + + diff --git a/src/App.vue b/src/App.vue index ac9da08..276d75f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -26,6 +26,13 @@ export default { } /* #endif */ this.initSocket(); + + // 判断是在pc端还是移动端 + if (navigator.userAgent.match(/(iPhone|Android)/i)) { + this.setIsPC(false); + } else { + this.setIsPC(true); + } }, computed: { @@ -37,7 +44,7 @@ export default { ...mapActions('user', ['getToken']), ...mapActions('socket', ['initSocket']), ...mapMutations(['setNetworkConnected', 'setSystemInfo']), - ...mapMutations('user', ['setToken', 'setUser']), + ...mapMutations('user', ['setToken', 'setUser', 'setIsPC']), // 检查网络状态 设置store里的网络状态变量 // 网络连接 且 不是2g 不是3g 才算是网络连接; 否则不是 将启用本地存储 diff --git a/src/apis/wbs.js b/src/apis/wbs.js index e9a13a5..9773e20 100644 --- a/src/apis/wbs.js +++ b/src/apis/wbs.js @@ -1,7 +1,8 @@ const install = (Vue, vm) => { vm.$u.api = { ...vm.$u.api } || {}; // 导入wbs - vm.$u.api.import = formData => vm.$t.chooseAndUpload(`${uni.$t.domain}/wbs`, formData); + // vm.$u.api.import = formData => vm.$t.chooseAndUpload(`${uni.$t.domain}/wbs`, formData); + vm.$u.api.import = formData => vm.$t.chooseAndUpload(`https://test.tall.wiki/gateway/sports/wbs`, formData); }; export default { install }; diff --git a/src/components/change-password/change-password.vue b/src/components/change-password/change-password.vue index 6743748..de3b94b 100644 --- a/src/components/change-password/change-password.vue +++ b/src/components/change-password/change-password.vue @@ -20,11 +20,11 @@ {{ passwordNewTips }} - + 返回登录 - 确认修改 + 确认修改 @@ -33,6 +33,8 @@ import { mapMutations } from 'vuex'; export default { + props: { showBack: { type: Boolean, default: true } }, + data() { return { border: true, diff --git a/src/config/message.js b/src/config/message.js new file mode 100644 index 0000000..d492f0d --- /dev/null +++ b/src/config/message.js @@ -0,0 +1,23 @@ +export default { + // 收到PC端打开详情页需要的消息 + onMessage() { + console.log('收到消息'); + let result = null; + window.addEventListener( + 'message', + function (e) { + console.log('父-接受:', e.data); + // if (e.source !== frame.src) return; // 来源 + const { event } = e.data; + console.log('event: ', event); + result = event; + + // if (event === 'openDetail') { + // location.reload(); + // } + }, + false, + ); + return result; + }, +}; diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index e7d40a0..0d1da0e 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -46,6 +46,7 @@ export default { if (!this.token) return; this.getProjects(); this.handleFindPoint(); + this.setTaskDetailUrl(''); }, onReady() { @@ -53,7 +54,7 @@ export default { }, methods: { - ...mapMutations('project', ['setProjects', 'setDotList']), + ...mapMutations('project', ['setProjects', 'setDotList', 'setTaskDetailUrl']), // 获取项目列表 getProjects(start = this.$moment().startOf('day').valueOf(), end = this.$moment().endOf('day').valueOf()) { diff --git a/src/pages/project-webview/project-webview.vue b/src/pages/project-webview/project-webview.vue index 90baa21..a8ba011 100644 --- a/src/pages/project-webview/project-webview.vue +++ b/src/pages/project-webview/project-webview.vue @@ -3,16 +3,32 @@ diff --git a/src/pages/right-window/right-window.vue b/src/pages/right-window/right-window.vue index 72246a2..be4a431 100644 --- a/src/pages/right-window/right-window.vue +++ b/src/pages/right-window/right-window.vue @@ -2,11 +2,11 @@ - + - - {{ project.name }} - 详情页 + + + @@ -16,16 +16,23 @@ import { mapState } from 'vuex'; export default { data() { - return { show: false }; + return { show: false, src: '' }; }, computed: { - ...mapState('project', ['project']), + ...mapState('project', ['project', 'taskDetailUrl']), ...mapState('user', ['user', 'token']), }, - onLoad(options) { - console.log('options: ', options); + watch: { + taskDetailUrl(val) { + if (val && val.split('?')[0] === 'change-password') { + this.show = true; + } else { + this.src = val; + this.show = false; + } + }, }, }; diff --git a/src/store/project/mutations.js b/src/store/project/mutations.js index fc5baf3..f9f69c8 100644 --- a/src/store/project/mutations.js +++ b/src/store/project/mutations.js @@ -57,6 +57,15 @@ const mutations = { setDotList(state, data) { state.dotList = data; }, + + /** + * 设置任务详情页路径 + * @param { object } state + * @param { string } data + */ + setTaskDetailUrl(state, data) { + state.taskDetailUrl = data; + }, }; export default mutations; diff --git a/src/store/project/state.js b/src/store/project/state.js index d33be86..7289091 100644 --- a/src/store/project/state.js +++ b/src/store/project/state.js @@ -3,6 +3,7 @@ const state = { project: { name: '加载中...' }, // 当前项目信息 projects: [], // 项目列表 dotList: [], // 小红点 + taskDetailUrl: '', // 任务详情页路径 }; export default state; diff --git a/src/store/user/mutations.js b/src/store/user/mutations.js index 61bb4b1..16b3909 100644 --- a/src/store/user/mutations.js +++ b/src/store/user/mutations.js @@ -28,6 +28,15 @@ const mutations = { setFirstInter(state, show) { state.firstInter = show; }, + + /** + * 设置是不是PC端 + * @param {object} state + * @param {boolean} show 项目列表 + */ + setIsPC(state, show) { + state.isPC = show; + }, }; export default mutations; diff --git a/src/store/user/state.js b/src/store/user/state.js index d79b8cd..c837da2 100644 --- a/src/store/user/state.js +++ b/src/store/user/state.js @@ -2,5 +2,6 @@ const state = { token: '', user: null, firstInter: false, + isPC: false, // 是不是PC端 }; export default state; diff --git a/src/utils/tall.js b/src/utils/tall.js index 39c0ca5..27d11a8 100644 --- a/src/utils/tall.js +++ b/src/utils/tall.js @@ -7,6 +7,7 @@ import ui from '@/utils/ui.js'; import upload from '@/utils/upload.js'; import user from '@/config/user.js'; import zIndex from '@/config/zIndex.js'; +import message from '@/config/message.js'; const gateway = process.env.VUE_APP_API_URL; @@ -21,6 +22,7 @@ const $t = { cache, // 本地存储相关 $q: cacheAndRequest, user, // 用户相关配置 + message, // 跨源通信 }; uni.$t = $t;