perf: 客户端版本更新提示关闭

This commit is contained in:
kuaifan 2022-02-23 22:53:04 +08:00
parent 2c678b5363
commit 88642c2003
6 changed files with 53 additions and 6 deletions

View File

@ -38,11 +38,17 @@ export default {
repoReleases: {}, repoReleases: {},
downloadResult: {}, downloadResult: {},
subscribe: null,
} }
}, },
mounted() { mounted() {
this.getReleases(); this.getReleases();
// //
this.subscribe = Store.subscribe('releasesNotification', () => {
this.releasesNotification();
});
//
if (this.$Electron) { if (this.$Electron) {
this.$Electron.registerMsgListener('downloadDone', ({result}) => { this.$Electron.registerMsgListener('downloadDone', ({result}) => {
if (result.name == this.repoData.name && this.repoStatus !== 2) { 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: { computed: {
...mapState([ ...mapState([
'isDesktop', 'isDesktop',
@ -203,6 +215,7 @@ export default {
releasesNotification() { releasesNotification() {
const {tag_name, body} = this.repoReleases; const {tag_name, body} = this.repoReleases;
this.$store.state.clientNewVersion = tag_name
$A.modalConfirm({ $A.modalConfirm({
okText: this.$L('立即更新'), okText: this.$L('立即更新'),
onOk: () => { onOk: () => {

View File

@ -11,7 +11,8 @@
<UserAvatar :userid="userId" :size="36" tooltipDisabled/> <UserAvatar :userid="userId" :size="36" tooltipDisabled/>
</div> </div>
<span>{{userInfo.nickname}}</span> <span>{{userInfo.nickname}}</span>
<Badge class="manage-box-top-report" :count="reportUnreadNumber"/> <Badge v-if="reportUnreadNumber > 0" class="manage-box-top-report" :count="reportUnreadNumber"/>
<Badge v-else-if="!!clientNewVersion" class="manage-box-top-report" dot/>
<div class="manage-box-arrow"> <div class="manage-box-arrow">
<Icon type="ios-arrow-up" /> <Icon type="ios-arrow-up" />
<Icon type="ios-arrow-down" /> <Icon type="ios-arrow-down" />
@ -20,11 +21,13 @@
<DropdownMenu slot="list"> <DropdownMenu slot="list">
<DropdownItem <DropdownItem
v-for="(item, key) in menu" v-for="(item, key) in menu"
v-if="item.visible !== false"
:key="key" :key="key"
:divided="!!item.divided" :divided="!!item.divided"
:name="item.path"> :name="item.path">
{{$L(item.name)}} {{$L(item.name)}}
<Badge v-if="item.path === 'workReport'" class="manage-menu-report-badge" :count="reportUnreadNumber"/> <Badge v-if="item.path === 'version'" class="manage-menu-report-badge" :text="clientNewVersion"/>
<Badge v-if="item.path === 'workReport'" class="manage-menu-report-badge" :count="reportUnreadNumber"/>
</DropdownItem> </DropdownItem>
<Dropdown placement="right-start" @on-click="setTheme"> <Dropdown placement="right-start" @on-click="setTheme">
<DropdownItem divided> <DropdownItem divided>
@ -238,7 +241,6 @@ import DragBallComponent from "../components/DragBallComponent";
import TaskAdd from "./manage/components/TaskAdd"; import TaskAdd from "./manage/components/TaskAdd";
import Report from "./manage/components/Report"; import Report from "./manage/components/Report";
import {Store} from "le5le-store"; import {Store} from "le5le-store";
import state from "../store/state";
export default { export default {
components: { components: {
@ -342,7 +344,9 @@ export default {
'themeMode', 'themeMode',
'themeList', 'themeList',
'wsMsg' 'wsMsg',
'clientNewVersion'
]), ]),
...mapGetters(['taskData', 'dashboardTask']), ...mapGetters(['taskData', 'dashboardTask']),
@ -377,6 +381,7 @@ export default {
{path: 'password', name: '密码设置'}, {path: 'password', name: '密码设置'},
{path: 'clearCache', name: '清除缓存'}, {path: 'clearCache', name: '清除缓存'},
{path: 'system', name: '系统设置', divided: true}, {path: 'system', name: '系统设置', divided: true},
{path: 'version', name: '更新版本', visible: !!this.clientNewVersion},
{path: 'workReport', name: '工作报告', divided: true}, {path: 'workReport', name: '工作报告', divided: true},
{path: 'allUser', name: '团队管理'}, {path: 'allUser', name: '团队管理'},
{path: 'allProject', name: '所有项目'}, {path: 'allProject', name: '所有项目'},
@ -387,6 +392,7 @@ export default {
{path: 'personal', name: '个人设置'}, {path: 'personal', name: '个人设置'},
{path: 'password', name: '密码设置'}, {path: 'password', name: '密码设置'},
{path: 'clearCache', name: '清除缓存'}, {path: 'clearCache', name: '清除缓存'},
{path: 'version', name: '更新版本', divided: true, visible: !!this.clientNewVersion},
{path: 'workReport', name: '工作报告', divided: true}, {path: 'workReport', name: '工作报告', divided: true},
{path: 'archivedProject', name: '已归档的项目'} {path: 'archivedProject', name: '已归档的项目'}
] ]
@ -546,6 +552,9 @@ export default {
} }
this.workReportShow = true; this.workReportShow = true;
return; return;
case 'version':
Store.set('releasesNotification', null);
return;
case 'clearCache': case 'clearCache':
this.$store.dispatch("handleClearCache", null).then(() => { this.$store.dispatch("handleClearCache", null).then(() => {
$A.setStorage("clearCache", $A.randomString(6)) $A.setStorage("clearCache", $A.randomString(6))

View File

@ -19,7 +19,16 @@
:key="key" :key="key"
:class="classNameRoute(item.path, item.divided)" :class="classNameRoute(item.path, item.divided)"
@click="toggleRoute(item.path)">{{$L(item.name)}}</li> @click="toggleRoute(item.path)">{{$L(item.name)}}</li>
<li class="version divided"><AutoTip>{{$L('版本')}}: {{version}}</AutoTip></li> <li
v-if="!!clientNewVersion"
:class="classNameRoute('version', true)"
@click="toggleRoute('version')">
<AutoTip disabled>{{$L('版本')}}: {{version}}</AutoTip>
<Badge :text="clientNewVersion"/>
</li>
<li v-else class="version divided">
<AutoTip>{{$L('版本')}}: {{version}}</AutoTip>
</li>
</ul> </ul>
</div> </div>
<div class="setting-content"> <div class="setting-content">
@ -32,6 +41,7 @@
<script> <script>
import {mapState} from "vuex"; import {mapState} from "vuex";
import {Store} from "le5le-store";
export default { export default {
data() { data() {
@ -46,7 +56,7 @@ export default {
}, },
computed: { computed: {
...mapState(['userInfo', 'userIsAdmin']), ...mapState(['userInfo', 'userIsAdmin', 'clientNewVersion']),
menu() { menu() {
let menu = [ let menu = [
@ -80,6 +90,10 @@ export default {
}, },
methods: { methods: {
toggleRoute(path) { toggleRoute(path) {
if (path == 'version') {
Store.set('releasesNotification', null);
return;
}
this.show768Menu = false; this.show768Menu = false;
this.goForward({path: '/manage/setting/' + path}); this.goForward({path: '/manage/setting/' + path});
}, },

View File

@ -118,6 +118,9 @@ const stateData = {
{name: '暗黑', value: 'dark'}, {name: '暗黑', value: 'dark'},
], ],
themeIsDark: false, themeIsDark: false,
// 客户端新版本号
clientNewVersion: null
}; };
// 会员信息 // 会员信息

View File

@ -70,6 +70,7 @@
} }
} }
.manage-box-top-report { .manage-box-top-report {
overflow: unset;
margin-right: -6px; margin-right: -6px;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;

View File

@ -44,6 +44,13 @@
padding: 0 20px; padding: 0 20px;
margin: 5px 0; margin: 5px 0;
position: relative; position: relative;
display: flex;
align-items: center;
.ivu-badge {
transform: scale(0.8);
transform-origin: right center;
}
&.active, &.active,
&:hover { &:hover {