提交 7ffee40f 编写于 作者: guangjun.yang's avatar guangjun.yang

Merge branch 'dev-phase1-0111' of...

Merge branch 'dev-phase1-0111' of 192.168.110.53:com.pica.cloud.education.frontend/pica-admin-IM into dev-phase1-0111

* 'dev-phase1-0111' of 192.168.110.53:com.pica.cloud.education.frontend/pica-admin-IM:
  文件大小限制
  文件大小
...@@ -787,21 +787,15 @@ export const setOptionLabel = (self,selfModel,selfEId,selfEName,list,listEId,lis ...@@ -787,21 +787,15 @@ export const setOptionLabel = (self,selfModel,selfEId,selfEName,list,listEId,lis
// 将文件大小B转为MB // 将文件大小B转为MB
export const betaHandle = (limit) => { export const betaHandle = (limit) => {
var size = ""; var size = "";
if(limit < 1 * 1024){ //小于0.1KB,则转化成B if(limit < 1024){ //小于0.1KB,则转化成B
size = limit.toFixed(1) + "B" size = limit + "B"
}else if(limit < 1 * 1024 * 1024){ //小于0.1MB,则转化成KB }else if(limit < (1024 * 1024)){ //小于0.1MB,则转化成KB
size = (limit/1024).toFixed(1) + "KB" size = (limit/1024).toFixed(1) + "KB"
}else if(limit < 1 * 1024 * 1024 * 1024){ //小于0.1GB,则转化成MB }else if(limit < (1024 * 1024 * 1024)){ //小于0.1GB,则转化成MB
size = (limit/(1024 * 1024)).toFixed(1) + "MB" size = (limit/(1024 * 1024)).toFixed(1) + "MB"
}else{ //其他转化成GB }else{ //其他转化成GB
size = (limit/(1024 * 1024 * 1024)).toFixed(1) + "GB" size = (limit/(1024 * 1024 * 1024)).toFixed(1) + "GB"
} }
var sizeStr = size + ""; //转成字符串
var index = sizeStr.indexOf("."); //获取小数点处的索引
var dou = sizeStr.substr(index + 1 ,1) //获取小数点后两位的值
if(dou == "0"){ //判断后两位是否为00,如果是则删除00
return sizeStr.substring(0, index) + sizeStr.substr(index + 3, 2)
}
return size; return size;
} }
......
...@@ -189,7 +189,7 @@ export default { ...@@ -189,7 +189,7 @@ export default {
}, },
uploadImportFile(file) { uploadImportFile(file) {
let _this = this; let _this = this;
const isLt5M = file.size / 1024 / 1024 < 6; const isLt5M = file.size / 1024 / 1024 < 5;
if (!isLt5M) { if (!isLt5M) {
this.$message.error('上传文件不能超过5MB!'); this.$message.error('上传文件不能超过5MB!');
return isLt5M return isLt5M
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册