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