4 changed files with 221 additions and 3 deletions
@ -0,0 +1,88 @@ |
|||
<!-- |
|||
@ 时间: 2026-01-12 |
|||
@ 备注: 云盘info 是用于设置用户的云盘大小 |
|||
--> |
|||
<script setup lang="ts"> |
|||
import { onMounted } from 'vue' |
|||
import {doGetUserInfo,doSetUserInfo} from "@/api/doc/space" |
|||
import { useUserStore } from "@/store/modules/user"; |
|||
|
|||
const userStore = useUserStore(); |
|||
const uid=btoa("p0"+userStore.userInfoCont.userId); |
|||
const props = withDefaults(defineProps<{ |
|||
title:string; |
|||
userid:string; |
|||
confirmFunc:(urlstr:string)=>void, //保存数据的回调, data是当前勾选的数据库id |
|||
closeFunc:()=>void, //父级只需销毁组件 |
|||
}>(),{}) |
|||
|
|||
const userInfo=ref({totalSizeLimit:10*1024*1024*1024,totalSize:1}) |
|||
const newsize=ref(15) |
|||
const reset=ref(false) |
|||
|
|||
const onSaveChange = () => { |
|||
if(newsize.value<1 || newsize.value>=1000){ |
|||
alert("请输入1~1000内的数字") |
|||
return |
|||
} |
|||
doSetUserInfo(uid,{ |
|||
uuid:props.userid, |
|||
totalSizeLimit:newsize.value*1024*1024*1024 |
|||
}).then(resp=>{ |
|||
if(resp.code==200){ |
|||
userInfo.value=resp.data |
|||
ElMessage({ |
|||
message: '设置成功', |
|||
type: 'success', |
|||
plain: true, |
|||
}) |
|||
}else{ |
|||
console.log(resp) |
|||
alert("设置出错!") |
|||
} |
|||
}) |
|||
} |
|||
|
|||
onMounted(() => { |
|||
doGetUserInfo(uid,{uuid:props.userid}).then((resp)=>{ |
|||
userInfo.value=resp.data |
|||
}) |
|||
}) |
|||
</script> |
|||
|
|||
<template> |
|||
<el-dialog :model-value="true" :style="{'max-height': '880px','--el-dialog-width': '43%'}" @close="props.closeFunc"> |
|||
<template #header> |
|||
<span style="font-weight: bold;">{{props.title}}</span> |
|||
</template> |
|||
<div class="tablelist"> |
|||
<p><strong>空间总大小:</strong> {{ userInfo.totalSizeLimit/1024/1024 }}M </p> |
|||
<el-progress style="width: 80%;margin: 10px 0;" :text-inside="true" :stroke-width="14" :percentage="((userInfo.totalSize/userInfo.totalSizeLimit)*100).toFixed(2)" /> |
|||
<br> |
|||
<el-switch style="width:max-content;" v-model="reset" inactive-text="调整"/> |
|||
<div v-if="reset" > |
|||
<strong>分配空间大小: {{ newsize}}GB !! </strong><br> |
|||
<el-input v-model="newsize" style="width: 40%;" placeholder="请输入新空间数值" type="number" maxlength="3"/> |
|||
</div> |
|||
</div> |
|||
|
|||
<template #footer> |
|||
<div class="dialog-footer"> |
|||
<el-button @click="props.closeFunc()">取消</el-button> |
|||
<el-button type="primary" @click="onSaveChange">保存</el-button> |
|||
</div> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<style lang="scss" scoped> |
|||
|
|||
.tablelist{ |
|||
margin-bottom:20px; |
|||
display:flex; |
|||
flex-direction:column; |
|||
width: 90%; |
|||
} |
|||
|
|||
|
|||
</style> |
|||
Loading…
Reference in new issue