fix: 增加失败报告的提示、根据s3是否启用设置不同的下载逻辑
This commit is contained in:
@@ -44,6 +44,7 @@ import { useRouter } from 'vue-router'
|
|||||||
import { storageKey } from '@/utils/constants'
|
import { storageKey } from '@/utils/constants'
|
||||||
import { api } from '@/utils/api'
|
import { api } from '@/utils/api'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
import _ from 'lodash'
|
||||||
import utc from 'dayjs/plugin/utc'
|
import utc from 'dayjs/plugin/utc'
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
|
|
||||||
@@ -71,15 +72,19 @@ export default {
|
|||||||
post(api.login, { username: this.username, pin: this.pin }).then(
|
post(api.login, { username: this.username, pin: this.pin }).then(
|
||||||
res => {
|
res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
if (!this.$_.isEmpty(res.data.lang)) {
|
if (!_.isEmpty(res.data.lang)) {
|
||||||
localStorage.setItem(storageKey.language, res.data.lang)
|
localStorage.setItem(storageKey.language, res.data.lang)
|
||||||
}
|
}
|
||||||
if (!this.$_.isEmpty(res.data.theme)) {
|
if (!_.isEmpty(res.data.theme)) {
|
||||||
localStorage.setItem(storageKey.theme, res.data.theme)
|
localStorage.setItem(storageKey.theme, res.data.theme)
|
||||||
}
|
}
|
||||||
|
if (!_.isEmpty(res.data.s3_upload)) {
|
||||||
|
localStorage.setItem(storageKey.s3Enable, res.data.s3_upload)
|
||||||
|
}
|
||||||
res.loginSuccessPath = this.$route.query.redirect
|
res.loginSuccessPath = this.$route.query.redirect
|
||||||
this.loginSuccess(res)
|
this.loginSuccess(res)
|
||||||
localStorage.setItem(storageKey.username, this.username)
|
localStorage.setItem(storageKey.username, this.username)
|
||||||
|
localStorage.setItem(storageKey.token, res.data.token)
|
||||||
} else if (res.code === 518005) {
|
} else if (res.code === 518005) {
|
||||||
this.$message.error(this.$t('Incorrect username or password'))
|
this.$message.error(this.$t('Incorrect username or password'))
|
||||||
this.loading = false
|
this.loading = false
|
||||||
@@ -105,10 +110,10 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
appearanceOut (data) {
|
appearanceOut (data) {
|
||||||
if (this.$_.isEmpty(localStorage.getItem(storageKey.language))) {
|
if (_.isEmpty(localStorage.getItem(storageKey.language))) {
|
||||||
localStorage.setItem(storageKey.language, data.lang || 'zh')
|
localStorage.setItem(storageKey.language, data.lang || 'zh')
|
||||||
}
|
}
|
||||||
if (this.$_.isEmpty(localStorage.getItem(storageKey.theme))) {
|
if (_.isEmpty(localStorage.getItem(storageKey.theme))) {
|
||||||
localStorage.setItem(storageKey.theme, data.theme || 'light')
|
localStorage.setItem(storageKey.theme, data.theme || 'light')
|
||||||
}
|
}
|
||||||
localStorage.setItem(storageKey.sysTimezone, data.timezone)
|
localStorage.setItem(storageKey.sysTimezone, data.timezone)
|
||||||
|
|||||||
@@ -36,9 +36,10 @@
|
|||||||
<div class="expand-cell" v-for="(item, index) in downDataList" :key="index">
|
<div class="expand-cell" v-for="(item, index) in downDataList" :key="index">
|
||||||
<div class="expand-right">
|
<div class="expand-right">
|
||||||
<div class="demo-progress">
|
<div class="demo-progress">
|
||||||
<el-progress type="circle" :percentage="computePercent(item)" :color="computePercent(item) === 100 ? '#21bf9a' : '#50b3ef'">
|
<el-progress :stroke-width="10" type="circle" :percentage="computePercent(item)" :color="computePercent(item) === 'Failed' ? '#D8A6A6' : (computePercent(item) === 100 ? '#21bf9a' : '#50b3ef')">
|
||||||
<template #default="{ percentage }">
|
<template #default="{ percentage }">
|
||||||
<span style="font-size: 0.875rem;">{{ percentage }}%</span>
|
<span style="font-size: 0.875rem;" v-if="percentage !== 'Failed'">{{ percentage + '%' }}</span>
|
||||||
|
<span style="font-size: 0.875rem;color: #C14843" v-else>{{percentage}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-progress>
|
</el-progress>
|
||||||
</div>
|
</div>
|
||||||
@@ -50,13 +51,13 @@
|
|||||||
<div>{{dateFormatByAppearance(item.ctime)}}</div>
|
<div>{{dateFormatByAppearance(item.ctime)}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="expand-icon">
|
<div class="expand-icon">
|
||||||
<div class="table-operation-item--no-border" :class="{'table-operation-item--disabled': computePercent(item) < 100}" @click="reportOperation(['download', item])">
|
<div class="table-operation-item--no-border" :class="{'table-operation-item--disabled': computePercent(item) === 'Failed' || computePercent(item) < 100}" @click="reportOperation(['download', item])">
|
||||||
<loading :loading="loadingTableId === item.id"></loading>
|
<loading :loading="loadingTableId === item.id"></loading>
|
||||||
<svg class="icon" aria-hidden="true" :class="{'table-operation-all-loading': loadingTableId}">
|
<svg class="icon" aria-hidden="true" :class="{'table-operation-all-loading': loadingTableId}">
|
||||||
<use xlink:href="#cn-icon-download2"></use>
|
<use xlink:href="#cn-icon-download2"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-operation-item--no-border" :class="{'table-operation-item--disabled': computePercent(item) < 100}" @click="reportOperation(['preview', item])">
|
<div class="table-operation-item--no-border" :class="{'table-operation-item--disabled': computePercent(item) === 'Failed' || computePercent(item) < 100}" @click="reportOperation(['preview', item])">
|
||||||
<loading :loading="loadingPreviewId === item.id"></loading>
|
<loading :loading="loadingPreviewId === item.id"></loading>
|
||||||
<svg class="icon" aria-hidden="true" :class="{'table-operation-all-loading': loadingPreviewId}">
|
<svg class="icon" aria-hidden="true" :class="{'table-operation-all-loading': loadingPreviewId}">
|
||||||
<use xlink:href="#cn-icon-preview"></use>
|
<use xlink:href="#cn-icon-preview"></use>
|
||||||
@@ -329,12 +330,23 @@ export default {
|
|||||||
},
|
},
|
||||||
computePercent () {
|
computePercent () {
|
||||||
return function (item) {
|
return function (item) {
|
||||||
|
if (item.state === 2) {
|
||||||
|
return 'Failed'
|
||||||
|
}
|
||||||
if (item.percent === 1) {
|
if (item.percent === 1) {
|
||||||
|
if (localStorage.getItem(storageKey.s3Enable) == 1) {
|
||||||
|
if (item.state === 1 && item.upload === 1) {
|
||||||
|
return 100
|
||||||
|
} else {
|
||||||
|
return 99.99
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (item.state === 1) {
|
if (item.state === 1) {
|
||||||
return 100
|
return 100
|
||||||
} else {
|
} else {
|
||||||
return 99.99
|
return 99.99
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return parseFloat(item.percent * 100).toFixed(2)
|
return parseFloat(item.percent * 100).toFixed(2)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ const user = {
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
loginSuccess (store, res) {
|
loginSuccess (store, res) {
|
||||||
localStorage.setItem(storageKey.token, res.data.token)
|
|
||||||
post(api.permissions, { token: res.data.token }).then(res2 => {
|
post(api.permissions, { token: res.data.token }).then(res2 => {
|
||||||
const menuList = sortByOrderNum(res2.data.menus)
|
const menuList = sortByOrderNum(res2.data.menus)
|
||||||
store.commit('setMenuList', menuList)
|
store.commit('setMenuList', menuList)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ export const storageKey = {
|
|||||||
iso36112Capital: 'cn-iso3611-2-capital',
|
iso36112Capital: 'cn-iso3611-2-capital',
|
||||||
iso36112WorldLow: 'cn-iso3611-2-world-low',
|
iso36112WorldLow: 'cn-iso3611-2-world-low',
|
||||||
i18n: 'cn-i18n',
|
i18n: 'cn-i18n',
|
||||||
|
s3Enable: 'cn-s3-enable',
|
||||||
languages: 'cn-languages',
|
languages: 'cn-languages',
|
||||||
language: 'cn-language',
|
language: 'cn-language',
|
||||||
theme: 'cn-theme',
|
theme: 'cn-theme',
|
||||||
|
|||||||
Reference in New Issue
Block a user