图片上传逻辑优化
This commit is contained in:
parent
ff182165ae
commit
1ae811604f
|
|
@ -191,7 +191,7 @@
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm" :disabled="isUpload">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -279,6 +279,7 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
isUpload:false,
|
||||||
fileList: [],//食堂图片
|
fileList: [],//食堂图片
|
||||||
checkUrlList: [],//食堂图片
|
checkUrlList: [],//食堂图片
|
||||||
checkUrlNameList: [],//食堂图片
|
checkUrlNameList: [],//食堂图片
|
||||||
|
|
@ -391,7 +392,6 @@
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.baseForm.bizStartTime=this.rangeTime[0]
|
this.baseForm.bizStartTime=this.rangeTime[0]
|
||||||
this.baseForm.bizEndTime=this.rangeTime[1]
|
this.baseForm.bizEndTime=this.rangeTime[1]
|
||||||
// this.$set(this.baseForm,"imgUrl",this.checkUrlList[0])
|
|
||||||
if (this.canteenId != "") {
|
if (this.canteenId != "") {
|
||||||
updateCanteenApi(this.baseForm).then(response => {
|
updateCanteenApi(this.baseForm).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
|
@ -422,8 +422,8 @@
|
||||||
},
|
},
|
||||||
// 图片上传
|
// 图片上传
|
||||||
imgUpLoad(param, name, index) {
|
imgUpLoad(param, name, index) {
|
||||||
// console.log(param,'image')
|
param.type = 'canteen';
|
||||||
param.type = 'canteen'
|
this.isUpload=true
|
||||||
imgUpLoadTwo(param).then((res) => {
|
imgUpLoadTwo(param).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.checkUrlList.push(res.data.url)
|
this.checkUrlList.push(res.data.url)
|
||||||
|
|
@ -433,14 +433,16 @@
|
||||||
this.$modal.msgError(res.msg)
|
this.$modal.msgError(res.msg)
|
||||||
this.$set(this.baseForm,"imgUrl","")
|
this.$set(this.baseForm,"imgUrl","")
|
||||||
}
|
}
|
||||||
|
this.isUpload=false
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$modal.msgError(error)
|
this.$modal.msgError(error)
|
||||||
|
this.isUpload=false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 上传之前
|
// 上传之前
|
||||||
handleBeforeUpload(file) {
|
handleBeforeUpload(file) {
|
||||||
const isLt = file.size / 1024 / 1024 < 10
|
const isLt = file.size / 1024 / 1024 < 5
|
||||||
if (!isLt) {
|
if (!isLt) {
|
||||||
this.$modal.msgError(`图片大小不能超过 5 MB`)
|
this.$modal.msgError(`图片大小不能超过 5 MB`)
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,7 @@
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm" :disabled="isUpload">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -453,6 +453,7 @@ export default {
|
||||||
checkUrlNameList: [],//档口图片
|
checkUrlNameList: [],//档口图片
|
||||||
dialogVisible:false,//图片弹窗
|
dialogVisible:false,//图片弹窗
|
||||||
dialogImageUrl:"",//图片弹窗
|
dialogImageUrl:"",//图片弹窗
|
||||||
|
isUpload:false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
@ -705,6 +706,7 @@ export default {
|
||||||
imgUpLoad(param, name, index) {
|
imgUpLoad(param, name, index) {
|
||||||
// console.log(param,'image')
|
// console.log(param,'image')
|
||||||
param.type = 'stall'
|
param.type = 'stall'
|
||||||
|
this.isUpload=true
|
||||||
imgUpLoadTwo(param).then((res) => {
|
imgUpLoadTwo(param).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.checkUrlList.push(res.data.url)
|
this.checkUrlList.push(res.data.url)
|
||||||
|
|
@ -714,9 +716,11 @@ export default {
|
||||||
this.$modal.msgError(res.msg)
|
this.$modal.msgError(res.msg)
|
||||||
this.$set(this.baseForm,"imgUrl","")
|
this.$set(this.baseForm,"imgUrl","")
|
||||||
}
|
}
|
||||||
|
this.isUpload=false
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$modal.msgError(error)
|
this.$modal.msgError(error)
|
||||||
|
this.isUpload=false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleAvatarSuccess(res, file) {
|
handleAvatarSuccess(res, file) {
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm" :disabled="isUpload">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -207,6 +207,7 @@ export default {
|
||||||
checkUrlNameList: [],//食堂图片
|
checkUrlNameList: [],//食堂图片
|
||||||
dialogVisible:false,//图片弹窗
|
dialogVisible:false,//图片弹窗
|
||||||
dialogImageUrl:"",//图片弹窗
|
dialogImageUrl:"",//图片弹窗
|
||||||
|
isUpload:false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
@ -328,8 +329,8 @@ export default {
|
||||||
},
|
},
|
||||||
// 图片上传
|
// 图片上传
|
||||||
imgUpLoad(param, name, index) {
|
imgUpLoad(param, name, index) {
|
||||||
// console.log(param,'image')
|
|
||||||
param.type = 'canteen'
|
param.type = 'canteen'
|
||||||
|
this.isUpload=true
|
||||||
imgUpLoadTwo(param).then((res) => {
|
imgUpLoadTwo(param).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.checkUrlList.push(res.data.url)
|
this.checkUrlList.push(res.data.url)
|
||||||
|
|
@ -339,9 +340,11 @@ export default {
|
||||||
this.$modal.msgError(res.msg)
|
this.$modal.msgError(res.msg)
|
||||||
this.$set(this.form,"imgUrl","")
|
this.$set(this.form,"imgUrl","")
|
||||||
}
|
}
|
||||||
|
this.isUpload=false
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$modal.msgError(error)
|
this.$modal.msgError(error)
|
||||||
|
this.isUpload=false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
checkImageSize(file, fileType) {
|
checkImageSize(file, fileType) {
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,6 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getSettingListApi,addSettingApi,updateSettingApi,removeSettingApi } from "@/api/base/mobile.js";
|
import { getSettingListApi,addSettingApi,updateSettingApi,removeSettingApi } from "@/api/base/mobile.js";
|
||||||
import { imgUpLoadTwo } from '@/api/system/upload'
|
|
||||||
export default {
|
export default {
|
||||||
name: "",
|
name: "",
|
||||||
dicts: [],
|
dicts: [],
|
||||||
|
|
|
||||||
|
|
@ -1397,6 +1397,7 @@
|
||||||
// 图片上传
|
// 图片上传
|
||||||
imgUpLoad(param, name, index) {
|
imgUpLoad(param, name, index) {
|
||||||
param.type = 'dishes'
|
param.type = 'dishes'
|
||||||
|
this.btnLoading=true;
|
||||||
imgUpLoadTwo(param).then((res) => {
|
imgUpLoadTwo(param).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.checkUrlList.push(res.data.url)
|
this.checkUrlList.push(res.data.url)
|
||||||
|
|
@ -1409,10 +1410,12 @@
|
||||||
this.$set(this.baseForm,"imageUrl",'')
|
this.$set(this.baseForm,"imageUrl",'')
|
||||||
this.$modal.msgError(res.msg)
|
this.$modal.msgError(res.msg)
|
||||||
}
|
}
|
||||||
|
this.btnLoading=false;
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
this.fileList=[]
|
this.fileList=[]
|
||||||
this.checkUrlList=[]
|
this.checkUrlList=[]
|
||||||
this.checkUrlNameList=[]
|
this.checkUrlNameList=[]
|
||||||
|
this.btnLoading=false;
|
||||||
this.$modal.msgError(error)
|
this.$modal.msgError(error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -403,6 +403,7 @@ export default {
|
||||||
imgUpLoad(param, name, index) {
|
imgUpLoad(param, name, index) {
|
||||||
// console.log(param,'image')
|
// console.log(param,'image')
|
||||||
param.type = 'stall'
|
param.type = 'stall'
|
||||||
|
this.loading=true
|
||||||
imgUpLoadTwo(param).then((res) => {
|
imgUpLoadTwo(param).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.checkUrlList.push(res.data.url)
|
this.checkUrlList.push(res.data.url)
|
||||||
|
|
@ -412,9 +413,11 @@ export default {
|
||||||
this.$modal.msgError(res.msg)
|
this.$modal.msgError(res.msg)
|
||||||
this.$set(this.form,"imgUrl","")
|
this.$set(this.form,"imgUrl","")
|
||||||
}
|
}
|
||||||
|
this.loading=false
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$modal.msgError(error)
|
this.$modal.msgError(error)
|
||||||
|
this.loading=false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 上传之前
|
// 上传之前
|
||||||
|
|
|
||||||
|
|
@ -1074,6 +1074,7 @@
|
||||||
imgUpLoad(param, name, index) {
|
imgUpLoad(param, name, index) {
|
||||||
// console.log(param,'image')
|
// console.log(param,'image')
|
||||||
param.type = 'canteen'
|
param.type = 'canteen'
|
||||||
|
this.loadingBtn=true
|
||||||
imgUpLoadTwo(param).then((res) => {
|
imgUpLoadTwo(param).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.checkUrlList.push(res.data.url)
|
this.checkUrlList.push(res.data.url)
|
||||||
|
|
@ -1081,9 +1082,11 @@
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError(res.msg)
|
this.$modal.msgError(res.msg)
|
||||||
}
|
}
|
||||||
|
this.loadingBtn=false
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$modal.msgError(error)
|
this.$modal.msgError(error)
|
||||||
|
this.loadingBtn=false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleAvatarSuccess(res, file) {
|
handleAvatarSuccess(res, file) {
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm" :disabled="loadingBtn">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -482,6 +482,7 @@ export default {
|
||||||
checkUrlList2: [],//图片
|
checkUrlList2: [],//图片
|
||||||
dialogVisible:false,//图片弹窗
|
dialogVisible:false,//图片弹窗
|
||||||
dialogImageUrl:"",//图片弹窗
|
dialogImageUrl:"",//图片弹窗
|
||||||
|
loadingBtn:false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
@ -718,6 +719,7 @@ export default {
|
||||||
// 图片上传
|
// 图片上传
|
||||||
imgUpLoad0(param, name, index) {
|
imgUpLoad0(param, name, index) {
|
||||||
param.type = 'canteen'
|
param.type = 'canteen'
|
||||||
|
this.loadingBtn=true
|
||||||
imgUpLoadTwo(param).then((res) => {
|
imgUpLoadTwo(param).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.checkUrlList0.push(res.data.url)
|
this.checkUrlList0.push(res.data.url)
|
||||||
|
|
@ -725,13 +727,16 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError(res.msg)
|
this.$modal.msgError(res.msg)
|
||||||
}
|
}
|
||||||
|
this.loadingBtn=false
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$modal.msgError(error)
|
this.$modal.msgError(error)
|
||||||
|
this.loadingBtn=false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
imgUpLoad1(param, name, index) {
|
imgUpLoad1(param, name, index) {
|
||||||
param.type = 'canteen'
|
param.type = 'canteen'
|
||||||
|
this.loadingBtn=true
|
||||||
imgUpLoadTwo(param).then((res) => {
|
imgUpLoadTwo(param).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.checkUrlList1.push(res.data.url)
|
this.checkUrlList1.push(res.data.url)
|
||||||
|
|
@ -739,13 +744,16 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError(res.msg)
|
this.$modal.msgError(res.msg)
|
||||||
}
|
}
|
||||||
|
this.loadingBtn=false
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$modal.msgError(error)
|
this.$modal.msgError(error)
|
||||||
|
this.loadingBtn=false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
imgUpLoad2(param, name, index) {
|
imgUpLoad2(param, name, index) {
|
||||||
param.type = 'canteen'
|
param.type = 'canteen'
|
||||||
|
this.loadingBtn=true
|
||||||
imgUpLoadTwo(param).then((res) => {
|
imgUpLoadTwo(param).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.checkUrlList2.push(res.data.url)
|
this.checkUrlList2.push(res.data.url)
|
||||||
|
|
@ -753,9 +761,11 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError(res.msg)
|
this.$modal.msgError(res.msg)
|
||||||
}
|
}
|
||||||
|
this.loadingBtn=false
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$modal.msgError(error)
|
this.$modal.msgError(error)
|
||||||
|
this.loadingBtn=false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 上传之前
|
// 上传之前
|
||||||
|
|
|
||||||
|
|
@ -646,7 +646,7 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm" :disabled="loadingBtn">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -932,6 +932,7 @@ export default {
|
||||||
checkUrlNameList: [],//图片
|
checkUrlNameList: [],//图片
|
||||||
dialogVisible:false,//图片弹窗
|
dialogVisible:false,//图片弹窗
|
||||||
dialogImageUrl:"",//图片弹窗
|
dialogImageUrl:"",//图片弹窗
|
||||||
|
loadingBtn:false,
|
||||||
// 是否显示cropper
|
// 是否显示cropper
|
||||||
visible: false,
|
visible: false,
|
||||||
options: {
|
options: {
|
||||||
|
|
@ -1407,7 +1408,7 @@ export default {
|
||||||
imgUpLoad(param, name, index) {
|
imgUpLoad(param, name, index) {
|
||||||
// console.log(param,'image')
|
// console.log(param,'image')
|
||||||
param.type = 'face'
|
param.type = 'face'
|
||||||
console.log(param.file)
|
this.loadingBtn=true
|
||||||
imgUpLoadTwo(param).then((res) => {
|
imgUpLoadTwo(param).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.checkUrlList.push(res.data.url)
|
this.checkUrlList.push(res.data.url)
|
||||||
|
|
@ -1415,9 +1416,11 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.$modal.msgError(res.msg)
|
this.$modal.msgError(res.msg)
|
||||||
}
|
}
|
||||||
|
this.loadingBtn=false
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$modal.msgError(error)
|
this.$modal.msgError(error)
|
||||||
|
this.loadingBtn=false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleAvatarSuccess(res, file) {
|
handleAvatarSuccess(res, file) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue