From 88642c20037d2d0b242e35da10d84d7f83f884fb Mon Sep 17 00:00:00 2001 From: kuaifan Date: Wed, 23 Feb 2022 22:53:04 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=AE=A2=E6=88=B7=E7=AB=AF=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=9B=B4=E6=96=B0=E6=8F=90=E7=A4=BA=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/components/RightBottom.vue | 13 +++++++++++++ resources/assets/js/pages/manage.vue | 17 +++++++++++++---- .../assets/js/pages/manage/setting/index.vue | 18 ++++++++++++++++-- resources/assets/js/store/state.js | 3 +++ resources/assets/sass/pages/page-manage.scss | 1 + resources/assets/sass/pages/page-setting.scss | 7 +++++++ 6 files changed, 53 insertions(+), 6 deletions(-) diff --git a/resources/assets/js/components/RightBottom.vue b/resources/assets/js/components/RightBottom.vue index 165ac52d..dcc9e945 100644 --- a/resources/assets/js/components/RightBottom.vue +++ b/resources/assets/js/components/RightBottom.vue @@ -38,11 +38,17 @@ export default { repoReleases: {}, downloadResult: {}, + + subscribe: null, } }, mounted() { this.getReleases(); // + this.subscribe = Store.subscribe('releasesNotification', () => { + this.releasesNotification(); + }); + // if (this.$Electron) { this.$Electron.registerMsgListener('downloadDone', ({result}) => { if (result.name == this.repoData.name && this.repoStatus !== 2) { @@ -52,6 +58,12 @@ export default { }) } }, + beforeDestroy() { + if (this.subscribe) { + this.subscribe.unsubscribe(); + this.subscribe = null; + } + }, computed: { ...mapState([ 'isDesktop', @@ -203,6 +215,7 @@ export default { releasesNotification() { const {tag_name, body} = this.repoReleases; + this.$store.state.clientNewVersion = tag_name $A.modalConfirm({ okText: this.$L('立即更新'), onOk: () => { diff --git a/resources/assets/js/pages/manage.vue b/resources/assets/js/pages/manage.vue index 9e4a2b71..9016c03b 100644 --- a/resources/assets/js/pages/manage.vue +++ b/resources/assets/js/pages/manage.vue @@ -11,7 +11,8 @@ {{userInfo.nickname}} - + +
@@ -20,11 +21,13 @@ {{$L(item.name)}} - + + @@ -238,7 +241,6 @@ import DragBallComponent from "../components/DragBallComponent"; import TaskAdd from "./manage/components/TaskAdd"; import Report from "./manage/components/Report"; import {Store} from "le5le-store"; -import state from "../store/state"; export default { components: { @@ -342,7 +344,9 @@ export default { 'themeMode', 'themeList', - 'wsMsg' + 'wsMsg', + + 'clientNewVersion' ]), ...mapGetters(['taskData', 'dashboardTask']), @@ -377,6 +381,7 @@ export default { {path: 'password', name: '密码设置'}, {path: 'clearCache', name: '清除缓存'}, {path: 'system', name: '系统设置', divided: true}, + {path: 'version', name: '更新版本', visible: !!this.clientNewVersion}, {path: 'workReport', name: '工作报告', divided: true}, {path: 'allUser', name: '团队管理'}, {path: 'allProject', name: '所有项目'}, @@ -387,6 +392,7 @@ export default { {path: 'personal', name: '个人设置'}, {path: 'password', name: '密码设置'}, {path: 'clearCache', name: '清除缓存'}, + {path: 'version', name: '更新版本', divided: true, visible: !!this.clientNewVersion}, {path: 'workReport', name: '工作报告', divided: true}, {path: 'archivedProject', name: '已归档的项目'} ] @@ -546,6 +552,9 @@ export default { } this.workReportShow = true; return; + case 'version': + Store.set('releasesNotification', null); + return; case 'clearCache': this.$store.dispatch("handleClearCache", null).then(() => { $A.setStorage("clearCache", $A.randomString(6)) diff --git a/resources/assets/js/pages/manage/setting/index.vue b/resources/assets/js/pages/manage/setting/index.vue index 0d804e46..19e2458a 100644 --- a/resources/assets/js/pages/manage/setting/index.vue +++ b/resources/assets/js/pages/manage/setting/index.vue @@ -19,7 +19,16 @@ :key="key" :class="classNameRoute(item.path, item.divided)" @click="toggleRoute(item.path)">{{$L(item.name)}} -
  • {{$L('版本')}}: {{version}}
  • +
  • + {{$L('版本')}}: {{version}} + +
  • +
  • + {{$L('版本')}}: {{version}} +
  • @@ -32,6 +41,7 @@