|
@@ -594,7 +594,10 @@
|
|
<div class="file-dialog">
|
|
<div class="file-dialog">
|
|
<el-form ref="form" label-width="80px">
|
|
<el-form ref="form" label-width="80px">
|
|
<el-form-item label="图片名称">
|
|
<el-form-item label="图片名称">
|
|
- <el-input v-model="imageName" />
|
|
|
|
|
|
+ <el-col :span="20">
|
|
|
|
+ <el-input v-model="imageName" />
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="4">.png</el-col>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<img :src="imageUrl" class="image-url">
|
|
<img :src="imageUrl" class="image-url">
|
|
@@ -1197,6 +1200,15 @@ export default {
|
|
return res
|
|
return res
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ generateMixed(len) {
|
|
|
|
+ const chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
|
|
|
|
+ let res = ''
|
|
|
|
+ for (let i = 0; i < len; i++) {
|
|
|
|
+ const id = Math.ceil(Math.random() * 35)
|
|
|
|
+ res += chars[id]
|
|
|
|
+ }
|
|
|
|
+ return res
|
|
|
|
+ },
|
|
pasteUpload() {
|
|
pasteUpload() {
|
|
if (!this.uploadButton) {
|
|
if (!this.uploadButton) {
|
|
return false
|
|
return false
|
|
@@ -1209,11 +1221,31 @@ export default {
|
|
this.imageUrl = reader.result
|
|
this.imageUrl = reader.result
|
|
if (this.imageUrl.match(reg)) { // 判断是否是图片
|
|
if (this.imageUrl.match(reg)) { // 判断是否是图片
|
|
this.showCopyFile = true
|
|
this.showCopyFile = true
|
|
|
|
+ this.imageName = this.generateMixed(10)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async confirmUpload() {
|
|
async confirmUpload() {
|
|
|
|
+ if (this.imageName === null || this.imageName.replace(/\s+/g, '') === '') {
|
|
|
|
+ this.$message({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: '请输入图片名称',
|
|
|
|
+ type: 'error'
|
|
|
|
+ })
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ const isExist = this.fileList.some(item => {
|
|
|
|
+ return this.imageName === item.name
|
|
|
|
+ })
|
|
|
|
+ if (isExist) {
|
|
|
|
+ this.$message({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: '图片名称重复',
|
|
|
|
+ type: 'error'
|
|
|
|
+ })
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
this.showCopyFile = false
|
|
this.showCopyFile = false
|
|
const res = await this.updateFile(window.uploadFiles[0])
|
|
const res = await this.updateFile(window.uploadFiles[0])
|
|
const data = res.data
|
|
const data = res.data
|
|
@@ -1413,7 +1445,7 @@ export default {
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|
|
|
|
|
|
-<style scoped>
|
|
|
|
|
|
+<style scoped lang="scss">
|
|
.module_title{
|
|
.module_title{
|
|
display:flex;
|
|
display:flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
@@ -1448,9 +1480,13 @@ export default {
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
align-items: center;
|
|
|
|
+ .el-form {
|
|
|
|
+ width: 80%;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
.image-url {
|
|
.image-url {
|
|
- width: 80%;
|
|
|
|
|
|
+ width: 90%;
|
|
max-height: 60vh;
|
|
max-height: 60vh;
|
|
|
|
+ border:1px solid #EBEEF5;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|