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: {},
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: () => {

View File

@ -11,7 +11,8 @@
<UserAvatar :userid="userId" :size="36" tooltipDisabled/>
</div>
<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">
<Icon type="ios-arrow-up" />
<Icon type="ios-arrow-down" />
@ -20,11 +21,13 @@
<DropdownMenu slot="list">
<DropdownItem
v-for="(item, key) in menu"
v-if="item.visible !== false"
:key="key"
:divided="!!item.divided"
:name="item.path">
{{$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>
<Dropdown placement="right-start" @on-click="setTheme">
<DropdownItem divided>
@ -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))

View File

@ -19,7 +19,16 @@
:key="key"
:class="classNameRoute(item.path, item.divided)"
@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>
</div>
<div class="setting-content">
@ -32,6 +41,7 @@
<script>
import {mapState} from "vuex";
import {Store} from "le5le-store";
export default {
data() {
@ -46,7 +56,7 @@ export default {
},
computed: {
...mapState(['userInfo', 'userIsAdmin']),
...mapState(['userInfo', 'userIsAdmin', 'clientNewVersion']),
menu() {
let menu = [
@ -80,6 +90,10 @@ export default {
},
methods: {
toggleRoute(path) {
if (path == 'version') {
Store.set('releasesNotification', null);
return;
}
this.show768Menu = false;
this.goForward({path: '/manage/setting/' + path});
},

View File

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

View File

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

View File

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