修复:进度条超过100%的问题

This commit is contained in:
jmal 2021-03-04 17:05:03 +08:00
parent 9a084f4f2f
commit 2e77870ab1
5 changed files with 17 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"name": "jmal-cloud-view",
"version": "2.1.6",
"version": "2.1.7",
"description": "jmal cloud",
"author": "Jmal <zhushilun084@163.com>",
"license": "MIT",

View File

@ -47,6 +47,7 @@ export default {
return {
percentage: 0,
customColors: [
{color: '#f56c6c', percentage: 150},
{color: '#f56c6c', percentage: 100},
{color: '#e6a23c', percentage: 80},
{color: '#5cb87a', percentage: 60},
@ -115,7 +116,8 @@ export default {
if (takeUpSpace) {
this.takeUpSpace = takeUpSpace
const space = takeUpSpace/1024/1024/1024
this.percentage = Number((space/this.userInfo.quota * 100).toFixed(1))
const percentage = Number((space/this.userInfo.quota * 100).toFixed(1))
this.percentage = percentage > 100 ? 100 : percentage
}
},
copyWebDAVLink(className) {
@ -142,7 +144,8 @@ export default {
const quota = this.userInfo.quota
const space = this.takeUpSpace/1024/1024/1024
if(space && quota > 0){
this.percentage = Number((space/quota * 100).toFixed(1))
const percentage = Number((space/quota * 100).toFixed(1))
this.percentage = percentage > 100 ? 100 : percentage
if(this.isCollapse){
return `${formatSize(this.takeUpSpace)}`
} else {

View File

@ -40,6 +40,9 @@ router.beforeEach(async(to, from, next) => {
} catch {
// 删除token,然后转到登录页面重新登录
await store.dispatch('user/resetToken')
if (to.path === '/404') {
to.path = '/'
}
next(`/login?redirect=${to.path}`)
NProgress.done()
}
@ -52,6 +55,9 @@ router.beforeEach(async(to, from, next) => {
next()
} else {
// 其他没有token重定向到登录页面。
if (window.location.pathname === '/404') {
window.location.pathname = '/'
}
next(`/login?redirect=${window.location.pathname}`)
NProgress.done()
}

View File

@ -247,9 +247,9 @@
const space = this.userInfo.takeUpSpace/1024/1024/1024
const quota = this.userInfo.quota
if(space && quota > 0){
this.percentage = Number((space/quota * 100).toFixed(1))
const percentage = Number((space/quota * 100).toFixed(1))
this.percentage = percentage > 100 ? 100 : percentage
return `${this.percentage}% (${formatSize(this.userInfo.takeUpSpace)}/${quota}GB)`;
// return `${this.percentage}%`;
}
},
// 设置formData

View File

@ -28,8 +28,8 @@
<el-form-item v-if="editMove===1" label="确认密码:" prop="checkPass">
<el-input type="password" v-model="form.checkPass"/>
</el-form-item>
<el-form-item label="配额:">
<el-input v-model="form.quota"/>
<el-form-item label="配额(GB):">
<el-input-number v-model="form.quota" controls-position="right" :min="1" :max="100"></el-input-number>
</el-form-item>
</el-col>
</el-row>
@ -151,7 +151,7 @@ export default {
}
}
},
{prop: 'quota',label: '配额(G)',sortable: 'custom'},
{prop: 'quota',label: '配额(GB)',sortable: 'custom'},
{prop: 'createTime',label: '创建时间',sortable: 'custom'},
{label: '操作', minWidth: 130, active: [
{name: '修改', icon: 'el-icon-edit', handle: (row) => this.handleEdit(row.id,row.username)},