新功能
This commit is contained in:
@ -60,7 +60,7 @@
|
||||
>
|
||||
<img
|
||||
v-if="this.form.logo"
|
||||
:src="imagePath + this.form.logo"
|
||||
:src="getImageUrl(this.form.logo)"
|
||||
class="list-img"
|
||||
/>
|
||||
<i v-if="!this.form.logo" class="el-icon-plus"></i>
|
||||
@ -108,6 +108,7 @@
|
||||
<script>
|
||||
import { saveBookCate } from '@/api/book'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { getUploadFileName } from '@/utils/upload'
|
||||
export default {
|
||||
name: 'bookCateForm',
|
||||
props: {
|
||||
@ -179,6 +180,11 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getImageUrl(path) {
|
||||
if (!path) return ''
|
||||
if (/^https?:\/\//i.test(path)) return path
|
||||
return (this.imagePath || '') + path
|
||||
},
|
||||
// 提交
|
||||
doSubmit() {
|
||||
const app = this
|
||||
@ -195,8 +201,10 @@ export default {
|
||||
this.$emit('closeDialog', 'bookCateDialog')
|
||||
},
|
||||
// 上传成功回调
|
||||
handleUploadSuccess(file) {
|
||||
this.form.logo = file.data.fileName
|
||||
handleUploadSuccess(res) {
|
||||
const fileName = getUploadFileName(res)
|
||||
if (!fileName) return
|
||||
this.form.logo = fileName
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user