mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-21 08:28:12 +00:00
refactor(ui): 优化客户端下载入口位置
- 将仪表盘页面的客户端下载链接移至右上角用户菜单 - 登录页保留右下角客户端下载链接 - 新增 clientDownloadUrl 全局状态,统一管理下载地址 - AI 浮动按钮在登录页不显示
This commit is contained in:
parent
07360a8d2c
commit
b794ba7a6b
@ -2,7 +2,7 @@
|
||||
<div
|
||||
v-show="visible"
|
||||
ref="floatBtn"
|
||||
class="ai-float-button"
|
||||
class="ai-float-button no-dark-content"
|
||||
:style="btnStyle"
|
||||
@mousedown.stop.prevent="onMouseDown">
|
||||
<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
||||
@ -36,7 +36,10 @@ export default {
|
||||
|
||||
computed: {
|
||||
visible() {
|
||||
return this.userId > 0 && this.positionLoaded && !this.windowPortrait;
|
||||
return this.userId > 0 &&
|
||||
this.positionLoaded &&
|
||||
!this.windowPortrait &&
|
||||
this.routeName !== 'login';
|
||||
},
|
||||
|
||||
// 计算实际的 left 值
|
||||
|
||||
@ -3,16 +3,10 @@
|
||||
<div v-if="showSSO" class="common-right-bottom-link" @click="useSSOLogin">
|
||||
{{ $L('使用 SSO 登录') }}
|
||||
</div>
|
||||
<template v-if="showDown">
|
||||
<a v-if="downloadUrl" class="common-right-bottom-link" :href="downloadUrl" target="_blank">
|
||||
<Icon type="md-download"/>
|
||||
{{ $L('客户端下载') }}
|
||||
</a>
|
||||
<div v-else-if="updateVersion && updateBottomShow && $Electron" class="common-right-bottom-link" @click="updateShow=true">
|
||||
<Icon type="md-download"/>
|
||||
{{ $L('更新客户端') }}
|
||||
</div>
|
||||
</template>
|
||||
<a v-if="showDown && clientDownloadUrl" class="common-right-bottom-link" :href="clientDownloadUrl" target="_blank">
|
||||
<Icon type="md-download"/>
|
||||
{{ $L('客户端下载') }}
|
||||
</a>
|
||||
<a v-if="showPrivacy" class="common-right-bottom-link" target="_blank" :href="$A.apiUrl('privacy')">
|
||||
《{{ $L('隐私政策') }}》
|
||||
</a>
|
||||
@ -43,6 +37,7 @@
|
||||
const VMPreview = () => import('./VMEditor/preview');
|
||||
import axios from "axios";
|
||||
import emitter from "../store/events";
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
name: 'RightBottom',
|
||||
@ -59,8 +54,6 @@ export default {
|
||||
updateShow: false,
|
||||
updateBottomShow: false,
|
||||
updateIng: false,
|
||||
|
||||
downloadUrl: '',
|
||||
}
|
||||
},
|
||||
|
||||
@ -77,10 +70,12 @@ export default {
|
||||
this.updateShow = !$A.strExists(this.updateNote, `[${this.updateVersion}-Silence]`);
|
||||
})
|
||||
}
|
||||
emitter.on('openDownloadClient', this.openDownloadClient);
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
emitter.off('updateNotification', this.onUpdateShow);
|
||||
emitter.off('openDownloadClient', this.openDownloadClient);
|
||||
},
|
||||
|
||||
watch: {
|
||||
@ -92,20 +87,17 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['clientDownloadUrl']),
|
||||
|
||||
showSSO() {
|
||||
return this.$isSoftware && ['login'].includes(this.routeName)
|
||||
},
|
||||
|
||||
showDown() {
|
||||
if (this.$isEEUIApp || this.windowTouch) {
|
||||
// app或者触摸屏不显示下载链接
|
||||
return false;
|
||||
if (this.$Electron || this.$isEEUIApp || this.windowTouch) {
|
||||
return false
|
||||
}
|
||||
if (this.routeName == 'manage-dashboard' && this.windowPortrait) {
|
||||
// 在仪表盘页面且竖屏不显示下载链接
|
||||
return false;
|
||||
}
|
||||
return ['login', 'index', 'manage-dashboard'].includes(this.routeName)
|
||||
return this.routeName === 'login'
|
||||
},
|
||||
|
||||
showPrivacy() {
|
||||
@ -118,6 +110,12 @@ export default {
|
||||
this.updateShow = true
|
||||
},
|
||||
|
||||
openDownloadClient() {
|
||||
if (this.clientDownloadUrl) {
|
||||
window.open(this.clientDownloadUrl, '_blank');
|
||||
}
|
||||
},
|
||||
|
||||
isNotServer() {
|
||||
let apiHome = $A.getDomain(window.systemInfo.apiUrl)
|
||||
return this.$isSoftware && (apiHome == "" || apiHome == "public")
|
||||
@ -187,7 +185,7 @@ export default {
|
||||
//
|
||||
switch (publish.provider) {
|
||||
case 'generic':
|
||||
this.downloadUrl = `${publish.url}/latest`
|
||||
this.$store.state.clientDownloadUrl = `${publish.url}/latest`
|
||||
break;
|
||||
|
||||
case 'github':
|
||||
@ -196,7 +194,7 @@ export default {
|
||||
let cache = await $A.IDBJson(key);
|
||||
let timeout = 600;
|
||||
if (cache.time && cache.time + timeout > $A.dayjs().unix()) {
|
||||
this.downloadUrl = cache.data.html_url;
|
||||
this.$store.state.clientDownloadUrl = cache.data.html_url;
|
||||
return;
|
||||
}
|
||||
//
|
||||
@ -210,7 +208,7 @@ export default {
|
||||
cache.time = $A.dayjs().unix()
|
||||
cache.data = data.find(({tag_name}) => this.compareVersion(this.tagVersion(tag_name), this.apiVersion) === 0) || {}
|
||||
$A.IDBSave(key, cache);
|
||||
this.downloadUrl = cache.data.html_url;
|
||||
this.$store.state.clientDownloadUrl = cache.data.html_url;
|
||||
}
|
||||
}).catch(() => {
|
||||
this.loadIng--;
|
||||
|
||||
@ -605,6 +605,7 @@ export default {
|
||||
'columnTemplate',
|
||||
|
||||
'clientNewVersion',
|
||||
'clientDownloadUrl',
|
||||
|
||||
'reportUnreadNumber',
|
||||
'approveUnreadNumber',
|
||||
@ -712,6 +713,18 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 是否显示客户端下载
|
||||
* @returns {boolean}
|
||||
*/
|
||||
showDownloadClient() {
|
||||
return !this.$Electron && !this.$isEEUIApp && !!this.clientDownloadUrl
|
||||
},
|
||||
|
||||
/**
|
||||
* 右上角菜单
|
||||
* @returns {Array}
|
||||
*/
|
||||
menu() {
|
||||
const {userIsAdmin} = this;
|
||||
const array = [
|
||||
@ -726,6 +739,7 @@ export default {
|
||||
{path: 'system', name: '系统设置'},
|
||||
{path: 'license', name: 'License Key'},
|
||||
|
||||
{path: 'downloadClient', name: '客户端下载', divided: true, visible: this.showDownloadClient},
|
||||
{path: 'version', name: '更新版本', divided: true, visible: !!this.clientNewVersion},
|
||||
|
||||
{path: 'allProject', name: '所有项目', divided: true},
|
||||
@ -736,6 +750,7 @@ export default {
|
||||
} else {
|
||||
array.push(...[
|
||||
{path: 'personal', name: '个人设置', divided: true},
|
||||
{path: 'downloadClient', name: '客户端下载', divided: true, visible: this.showDownloadClient},
|
||||
{path: 'version', name: '更新版本', divided: true, visible: !!this.clientNewVersion},
|
||||
|
||||
{path: 'workReport', name: '工作报告', divided: true},
|
||||
@ -749,6 +764,10 @@ export default {
|
||||
return array
|
||||
},
|
||||
|
||||
/**
|
||||
* 项目模板列表
|
||||
* @returns {Array}
|
||||
*/
|
||||
columns() {
|
||||
const array = $A.cloneJSON(this.columnTemplate);
|
||||
array.unshift({
|
||||
@ -758,6 +777,10 @@ export default {
|
||||
return array
|
||||
},
|
||||
|
||||
/**
|
||||
* 项目列表
|
||||
* @returns {Array}
|
||||
*/
|
||||
projectLists() {
|
||||
const {projectKeyValue, cacheProjects} = this;
|
||||
const data = $A.cloneJSON(cacheProjects).sort((a, b) => {
|
||||
@ -778,6 +801,10 @@ export default {
|
||||
return data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 最近打开的任务列表
|
||||
* @returns {Array}
|
||||
*/
|
||||
taskBrowseLists() {
|
||||
// 直接使用组件内的响应式数据
|
||||
return this.taskBrowseHistory.slice(0, 10); // 只显示前10个
|
||||
@ -933,6 +960,9 @@ export default {
|
||||
case 'version':
|
||||
emitter.emit('updateNotification', null);
|
||||
return;
|
||||
case 'downloadClient':
|
||||
emitter.emit('openDownloadClient');
|
||||
return;
|
||||
case 'clearCache':
|
||||
$A.IDBSet("clearCache", "handle").then(_ => {
|
||||
$A.reloadUrl()
|
||||
|
||||
3
resources/assets/js/store/state.js
vendored
3
resources/assets/js/store/state.js
vendored
@ -234,6 +234,9 @@ export default {
|
||||
// 客户端新版本号
|
||||
clientNewVersion: null,
|
||||
|
||||
// 客户端下载地址(网页版)
|
||||
clientDownloadUrl: '',
|
||||
|
||||
// 预览图片
|
||||
previewImageIndex: 0,
|
||||
previewImageList: [],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user