图片上传

This commit is contained in:
13713575202 2025-04-16 17:12:17 +08:00
parent c10f87fe22
commit ae1dcedd9b
7 changed files with 13 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
public/favicon_old.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -147,7 +147,8 @@ export default {
handleUploadSuccess(res) {
this.fileList.push({
name: res.fileName,
url: process.env.VUE_APP_BASE_API + res.fileName,
// url: process.env.VUE_APP_BASE_API + res.fileName,
url: res.url,
});
this.$emit('input', this.listToString(this.fileList));
this.$emit('change', this.listToString(this.fileList));
@ -185,7 +186,9 @@ export default {
const isValidSize = await this.checkImageSize(file, this.fileWidth, this.fileHeight);
if (!isValidSize) {
this.$message.error(
`上传图片不符合要求,尺寸要小于:宽${this.fileWidth ? this.fileWidth + 'px' : '不限制'},高${this.fileHeight ? this.fileHeight + 'px' : '不限制'}`
`上传图片不符合要求,尺寸要小于:宽${this.fileWidth ? this.fileWidth + 'px' : '不限制'},高${
this.fileHeight ? this.fileHeight + 'px' : '不限制'
}`
);
return Promise.reject();
}

View File

@ -53,10 +53,10 @@
<data-tag :options="userList" :value="scope.row.batchHead" labelName="userName" valueName="userId" type="notag" />
</template>
</el-table-column>
<el-table-column label="种图片" align="center" prop="introImg" width="180">
<el-table-column label="种图片" align="center" prop="introImg" width="180">
<template v-slot:default="{ row }">
<div class="image" @click="previewImage(`${image.baseUrl + row.germplasmImg}`, row)">
<img style="width: 50px; height: 50px" :src="`${image.baseUrl + row.germplasmImg}`" />
<div class="image" @click="previewImage(`${row.germplasmImg}`, row)">
<img style="width: 50px; height: 50px" :src="`${row.germplasmImg}`" />
</div>
</template>
</el-table-column>

View File

@ -32,10 +32,10 @@
</el-card>
<el-card class="card-padding-bottom">
<el-table v-loading="loading" :data="germplasmList">
<el-table-column label="种图片" align="center" prop="germplasmImg" width="180">
<el-table-column label="种图片" align="center" prop="germplasmImg" width="180">
<template v-slot:default="{ row }">
<div class="image" @click="previewImage(`${image.baseUrl + row.germplasmImg}`, row)">
<img style="width: 50px; height: 50px" :src="`${image.baseUrl + row.germplasmImg}`" />
<div class="image" @click="previewImage(`${row.germplasmImg}`, row)">
<img style="width: 50px; height: 50px" :src="`${row.germplasmImg}`" />
</div>
</template>
</el-table-column>
@ -101,7 +101,7 @@
<el-form-item label="种质英文名称" prop="germplasmEnName">
<el-input v-model="form.germplasmEnName" placeholder="请输入种质英文名称" />
</el-form-item>
<el-form-item label="种图片" prop="germplasmImg">
<el-form-item label="种图片" prop="germplasmImg">
<imageUpload v-model="form.germplasmImg" :limit="1" />
</el-form-item>
<el-form-item label="宣传语" prop="germplasmDes">
@ -185,7 +185,7 @@ export default {
cropEnName: [{ required: true, message: '作物英文名称不能为空', trigger: 'blur' }],
germplasmName: [{ required: true, message: '种质名称不能为空', trigger: 'blur' }],
germplasmEnName: [{ required: true, message: '种质英文名称不能为空', trigger: 'blur' }],
germplasmImg: [{ required: true, message: '种图片不能为空', trigger: 'blur' }],
germplasmImg: [{ required: true, message: '种图片不能为空', trigger: 'blur' }],
germplasmDes: [{ required: true, message: '宣传语不能为空', trigger: 'blur' }],
},
};