mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 20:06:44 +08:00
提问题框图片加载失败问题
This commit is contained in:
@@ -16,8 +16,8 @@
|
|||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:headers="headers"
|
:headers="headers"
|
||||||
style="display: inline-block;">
|
style="display: inline-block;">
|
||||||
<el-image v-if="!value" :src="value" style="width:100%;height:100%;">
|
<el-image v-if="!value" :src="value" :style="`width:${width};height:${height};`">
|
||||||
<div slot="error" class="image-slot" >
|
<div slot="error" class="image-slot">
|
||||||
<i class="el-icon-upload"></i>
|
<i class="el-icon-upload"></i>
|
||||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
<div class="el-upload__tip" slot="tip">只能上传jpg/png/bmp/jpeg文件,且不超过500kb</div>
|
<div class="el-upload__tip" slot="tip">只能上传jpg/png/bmp/jpeg文件,且不超过500kb</div>
|
||||||
@@ -169,7 +169,14 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
::v-deep .el-upload-dragger{
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
.image-upload{
|
||||||
|
width: 410px;
|
||||||
|
height: 168px;
|
||||||
|
}
|
||||||
.image-card .el-upload--picture-card,.image-card .el-upload-list--picture-card .el-upload-list__item{
|
.image-card .el-upload--picture-card,.image-card .el-upload-list--picture-card .el-upload-list__item{
|
||||||
background-color: #fbfdff;
|
background-color: #fbfdff;
|
||||||
border: 1px dashed #c0ccda;
|
border: 1px dashed #c0ccda;
|
||||||
@@ -183,6 +190,7 @@ export default {
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
|
line-height: 100%;
|
||||||
}
|
}
|
||||||
.image-uploader .el-upload {
|
.image-uploader .el-upload {
|
||||||
border: 1px dashed #d9d9d9;
|
border: 1px dashed #d9d9d9;
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
<el-input class="title-input" v-model="askForm.title" show-word-limit placeholder="请输入问题标题,字符长度不能高于100" maxlength="100"></el-input>
|
<el-input class="title-input" v-model="askForm.title" show-word-limit placeholder="请输入问题标题,字符长度不能高于100" maxlength="100"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="封面">
|
<el-form-item label="封面">
|
||||||
<imageUpload dir="qa" width="410px" height="168px" :value="imageShowUrl" @success="handleUploadSuccess" @remove="handleRemoveSuccess"></imageUpload>
|
<imageUpload :value="imageShowUrl" dir="qa" width="410px" height="168px" @success="handleUploadSuccess" @remove="handleRemoveSuccess"></imageUpload>
|
||||||
<!-- <el-upload
|
<!-- <el-upload
|
||||||
:action="uploadFileUrl"
|
:action="uploadFileUrl"
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:headers="headers"
|
:headers="headers"
|
||||||
list-type="picture-card"
|
list-type="picture-card"
|
||||||
:on-success="handleAvatarSuccess"
|
:on-success="handleAvatarSuccess"
|
||||||
@@ -67,6 +67,7 @@
|
|||||||
export default{
|
export default{
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
|
fileBaseUrl:process.env.VUE_APP_FILE_BASE_URL,
|
||||||
askFormCheckedShow:false,
|
askFormCheckedShow:false,
|
||||||
askFormRules: {
|
askFormRules: {
|
||||||
title: [{ required: true, message: '请输入问题标题', trigger: 'blur' }, { max: 100, message: '字符长度不能高于100', trigger: 'blur' }],
|
title: [{ required: true, message: '请输入问题标题', trigger: 'blur' }, { max: 100, message: '字符长度不能高于100', trigger: 'blur' }],
|
||||||
@@ -91,8 +92,10 @@
|
|||||||
},
|
},
|
||||||
handleUploadSuccess(file) {
|
handleUploadSuccess(file) {
|
||||||
// console.log(file.result.httpPath,'是否会fig以后关于和',file.result.filePath)
|
// console.log(file.result.httpPath,'是否会fig以后关于和',file.result.filePath)
|
||||||
this.imageShowUrl=file.result.httpPath;
|
|
||||||
this.askForm.images=file.result.filePath
|
this.askForm.images=file.result.filePath
|
||||||
|
this.imageShowUrl= this.fileBaseUrl + file.result.filePath;
|
||||||
|
// console.log(this.fileBaseUrl)
|
||||||
|
console.log(file)
|
||||||
},
|
},
|
||||||
handleRemoveSuccess(file) {
|
handleRemoveSuccess(file) {
|
||||||
this.imageShowUrl=''
|
this.imageShowUrl=''
|
||||||
|
|||||||
Reference in New Issue
Block a user