feat:topology 限制图片大小 ,点击 overview topo图跳转对应project
This commit is contained in:
@@ -345,19 +345,41 @@
|
||||
this.esc();
|
||||
},
|
||||
beforeAvatarUpload(file){
|
||||
let this_=this
|
||||
let isJPG = (file.type === 'image/jpeg' || file.type === 'image/png');
|
||||
|
||||
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||
|
||||
if (!isJPG) {
|
||||
this.$message.error('上传图片只能是 JPG/png 格式!');
|
||||
this.$message.error( this_.$t('project.topology.imgFormat'));
|
||||
return false;
|
||||
}
|
||||
if (!isLt2M) {
|
||||
this.$message.error('上传图片大小不能超过 2MB!');
|
||||
}
|
||||
this.file=file;
|
||||
this.upload();
|
||||
return false;
|
||||
// if (!isLt2M) {
|
||||
// this.$message.error( this_.$t('project.topology.imgSize'));
|
||||
// return false;
|
||||
// }
|
||||
const isSize = new Promise(function(resolve, reject) {
|
||||
let width = 100;
|
||||
let height = 100;
|
||||
let _URL = window.URL || window.webkitURL;
|
||||
let img = new Image();
|
||||
img.onload = function() {
|
||||
console.log(img.width);
|
||||
let valid = img.width > width && img.height > height;
|
||||
valid ? resolve() : reject();
|
||||
}
|
||||
img.src = _URL.createObjectURL(file);
|
||||
}).then(() => {
|
||||
if(isJPG){
|
||||
this.file=file;
|
||||
this.upload();
|
||||
}
|
||||
return file;
|
||||
}, () => {
|
||||
this.$message.error( this_.$t('project.topology.imgMeasure'));
|
||||
return Promise.reject();
|
||||
});
|
||||
return false;
|
||||
},
|
||||
handleAvatarSuccess(file,res){
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
<div style="width: 100%;height: 100%;position: relative" v-if="allProject.length>0">
|
||||
<el-carousel :interval="5000" arrow="hover" :trigger="'click'">
|
||||
<el-carousel-item v-for="(item,index) in allProject" :key="index">
|
||||
<div class="maskLayer"></div>
|
||||
<div class="maskLayer" @click="toProject(item)"></div>
|
||||
<span class="project-name">{{item.name}}</span>
|
||||
<topology
|
||||
:nodesArray="item.nodesArray"
|
||||
@@ -462,6 +462,9 @@
|
||||
})
|
||||
}
|
||||
},
|
||||
toProject(projectInfo){//跳转对应project页面
|
||||
this.$store.commit("setOverViewProject", projectInfo);
|
||||
},
|
||||
queryAssetData() {
|
||||
return new Promise(resolve => {
|
||||
this.assetLoading = true;
|
||||
@@ -1662,6 +1665,7 @@
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
cursor: pointer;
|
||||
}
|
||||
/deep/ .el-carousel__indicator--horizontal .el-carousel__button{
|
||||
background-color: #C0C4CC;
|
||||
|
||||
Reference in New Issue
Block a user