Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
bns_han 2023-12-21 10:39:45 +08:00
commit d8430e9dc4
3 changed files with 32 additions and 4 deletions

View File

@ -200,7 +200,8 @@ export default {
},
data() {
return {
actionUrl: process.env.VUE_APP_BASE_API + '/sgzb-system/sys/file/upload',
// actionUrl: process.env.VUE_APP_BASE_API + '/sgzb-system/sys/file/upload',
actionUrl: process.env.VUE_APP_BASE_API + '/system/sys/file/upload',
// uploadTip: 'jpg/png500kb',
fileIds: [],
fileList: [],
@ -239,7 +240,7 @@ export default {
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
// return this.$confirm(` ${file.name}`);
},
handleSuccess(response, fileList) {
this.fileList = fileList

View File

@ -77,8 +77,14 @@ export default {
}
},
watch: {
clearable(val) {
console.log('val', val);
// clearable(val) {
// console.log('val-----', val);
// },
clearable: {
handler: function(val,old) {
},
// obj.name
immediate: true
},
filterText(val) {
this.$refs.selectTree.filter(val)
@ -187,18 +193,22 @@ export default {
color: #666666;
pointer-events: none;
}
.el-input.is-focus {
.el-icon- {
transform: rotate(0deg);
}
}
.el-input__inner {
height: 36px;
line-height: 36px;
}
.el-input__icon {
line-height: 36px;
}
.el-tree-node__content {
height: 32px;
}

View File

@ -11,6 +11,8 @@
:file-list="fileList"
:headers="headers"
:on-success="handleSuccess"
:data="uploadData"
:before-upload="beforeUpload"
>
<slot name="default">
<el-button size="small" type="primary">点击上传</el-button>
@ -51,6 +53,9 @@ export default {
headers: {
Authorization: "Bearer " + getToken(),
},
uploadData: {
type: "sx"
},
}
},
methods: {
@ -71,6 +76,18 @@ export default {
return this.$confirm(`确定移除 ${file.name} `).then(() => {
this.$emit('before-remove', file, fileList);
}).catch(() => { });
},
beforeUpload(file) {
console.log('file', file);
const isJPGorPNG = file.type == 'image/png' || file.type == 'image/jpg' || file.type == 'image/jpeg';
const isLt5M = file.size / 1024 / 1024 < 2; // 2MB
if (!isJPGorPNG) {
this.$message.error('只能上传 JPG/PNG/jpeg 格式的图片');
}
if (!isLt5M) {
this.$message.error('上传图片大小不能超过 2MB');
}
return isJPGorPNG && isLt5M;
}
}
};