|
@@ -57,6 +57,7 @@
|
|
|
<div class="delImg el-icon-delete" @click="delGoodsImg(index,item.id)" v-if="imgActive !== index"></div>
|
|
<div class="delImg el-icon-delete" @click="delGoodsImg(index,item.id)" v-if="imgActive !== index"></div>
|
|
|
</div>
|
|
</div>
|
|
|
<el-upload
|
|
<el-upload
|
|
|
|
|
+ v-if="this.imgList.length<18"
|
|
|
ref="upload"
|
|
ref="upload"
|
|
|
class="avatar-uploader"
|
|
class="avatar-uploader"
|
|
|
:action="baseURL + '/cms/goods/upload'"
|
|
:action="baseURL + '/cms/goods/upload'"
|
|
@@ -72,7 +73,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
<p class="upHint upHint1">格式要求:</p>
|
|
<p class="upHint upHint1">格式要求:</p>
|
|
|
<p class="upHint">
|
|
<p class="upHint">
|
|
|
- 1、支持png、jpg、gif和jpeg的图片格式;最大支持20M。
|
|
|
|
|
|
|
+ 1、支持png、jpg、gif和jpeg的图片格式;单张最大支持20M。
|
|
|
</p>
|
|
</p>
|
|
|
<p class="upHint">2、最多可上传18张图片。</p>
|
|
<p class="upHint">2、最多可上传18张图片。</p>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -120,7 +121,7 @@ export default {
|
|
|
async goodsSave () {
|
|
async goodsSave () {
|
|
|
if (this.ruleForm.name.trim() === '') { return this.$message.warning('标题不能为空') }
|
|
if (this.ruleForm.name.trim() === '') { return this.$message.warning('标题不能为空') }
|
|
|
if (this.imgList.length === 0) { return this.$message.warning('图片不能为空') }
|
|
if (this.imgList.length === 0) { return this.$message.warning('图片不能为空') }
|
|
|
- if (this.imgList.length > 18) { return this.$message.warning('图片不能超过18张') }
|
|
|
|
|
|
|
+ // if (this.imgList.length > 18) { return this.$message.warning('图片不能超过18张') }
|
|
|
const temp = []
|
|
const temp = []
|
|
|
this.imgList.forEach(v => {
|
|
this.imgList.forEach(v => {
|
|
|
temp.push(v.id)
|
|
temp.push(v.id)
|
|
@@ -179,12 +180,11 @@ export default {
|
|
|
},
|
|
},
|
|
|
// 上传图片
|
|
// 上传图片
|
|
|
beforethumbUpload (file) {
|
|
beforethumbUpload (file) {
|
|
|
- // console.log(998, file)
|
|
|
|
|
// 限制图片大小和格式
|
|
// 限制图片大小和格式
|
|
|
const sizeOk = file.size / 1024 / 1024 < 20
|
|
const sizeOk = file.size / 1024 / 1024 < 20
|
|
|
const typeOk =
|
|
const typeOk =
|
|
|
file.type === 'image/png' ||
|
|
file.type === 'image/png' ||
|
|
|
- file.type === 'image/jpeg' ||
|
|
|
|
|
|
|
+ (file.type === 'image/jpeg' && !file.name.includes('.jfif')) ||
|
|
|
file.type === 'image/gif'
|
|
file.type === 'image/gif'
|
|
|
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|