|
@@ -591,23 +591,25 @@
|
|
|
<normal-dialog
|
|
|
:show-dialog="showCopyFile"
|
|
|
:title="'上传截图'"
|
|
|
- :width="'50%'"
|
|
|
+ :width="'40%'"
|
|
|
:submit-button="'上传'"
|
|
|
:top="'5vh'"
|
|
|
@confirm="confirmUpload()"
|
|
|
@cancel="showCopyFile=false"
|
|
|
>
|
|
|
<div class="file-dialog">
|
|
|
- <el-form ref="form" label-width="20%">
|
|
|
- <el-form-item label="图片命名">
|
|
|
+ <el-form ref="imageForm" label-width="20%" :rules="imageRules" :model="imageName">
|
|
|
+ <el-form-item label="图片命名" prop="name">
|
|
|
<el-col style="width: 75%">
|
|
|
- <el-input v-model="imageName" />
|
|
|
+ <el-input v-model="imageName.name" placeholder="请输入图片名称" />
|
|
|
</el-col>
|
|
|
<el-col style="width: 10%">.png</el-col>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div class="image">
|
|
|
- <img :src="imageUrl" class="image-url">
|
|
|
+ <div class="image-center">
|
|
|
+ <img :src="imageUrl" class="image-url">
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</normal-dialog>
|
|
@@ -750,9 +752,15 @@ export default {
|
|
|
]
|
|
|
},
|
|
|
showCopyFile: false, // 复制文件对话框
|
|
|
- imageName: null,
|
|
|
+ imageName: { name: null },
|
|
|
imageUrl: null,
|
|
|
- uploadButton: this.drawerShow
|
|
|
+ uploadButton: this.drawerShow,
|
|
|
+ imageRules: {
|
|
|
+ name: [
|
|
|
+ { required: true, message: '请输入图片名称', trigger: 'blur' },
|
|
|
+ { min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur' }
|
|
|
+ ]
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -1267,13 +1275,13 @@ export default {
|
|
|
this.imageUrl = reader.result
|
|
|
if (this.imageUrl.match(reg)) { // 判断是否是图片
|
|
|
this.showCopyFile = true
|
|
|
- this.imageName = this.generateMixed(10)
|
|
|
+ this.imageName.name = this.generateMixed(10)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
async confirmUpload() {
|
|
|
- if (this.imageName === null || this.imageName.replace(/\s+/g, '') === '') {
|
|
|
+ if (this.imageName.name === null || this.imageName.name.replace(/\s+/g, '') === '') {
|
|
|
this.$message({
|
|
|
showClose: true,
|
|
|
message: '请输入图片名称',
|
|
@@ -1282,7 +1290,7 @@ export default {
|
|
|
return false
|
|
|
}
|
|
|
const isExist = this.fileList.some(item => {
|
|
|
- return this.imageName === item.name
|
|
|
+ return this.imageName.name === item.name
|
|
|
})
|
|
|
if (isExist) {
|
|
|
this.$message({
|
|
@@ -1296,7 +1304,7 @@ export default {
|
|
|
const res = await this.updateFile(window.uploadFiles[0])
|
|
|
const data = res.data
|
|
|
const item = {
|
|
|
- name: this.imageName || '',
|
|
|
+ name: this.imageName.name || '',
|
|
|
status: 'success',
|
|
|
url: 'http:' + data.url
|
|
|
}
|
|
@@ -1309,7 +1317,7 @@ export default {
|
|
|
type: 'success'
|
|
|
})
|
|
|
this.bugUpdate(this.bug, 'accessory')
|
|
|
- this.imageName = null
|
|
|
+ this.imageName.name = null
|
|
|
this.imageUrl = null
|
|
|
window.uploadFiles = null
|
|
|
},
|
|
@@ -1538,13 +1546,19 @@ export default {
|
|
|
width: 61%;
|
|
|
padding-top: 60%;
|
|
|
border:1px solid #409EFF;
|
|
|
- .image-url {
|
|
|
+ border-radius: 4px;
|
|
|
+ .image-center {
|
|
|
position: absolute;
|
|
|
- top: 50%;
|
|
|
- left: 50%;
|
|
|
- transform: translate(-50%,-50%);
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
width: 100%;
|
|
|
- max-height: 100%;
|
|
|
+ height: 100%;
|
|
|
+ overflow-x: hidden;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ }
|
|
|
+ .image-url {
|
|
|
+ height: 100%;
|
|
|
}
|
|
|
}
|
|
|
}
|