import configService from "@/common/config.service"; // 处理选择器 const selectDealFunction = (vm,model,params,success) => { switch(model){ case 0 : case 1 : case 2 : case 3 : diagramOfTheSketch(vm,params,success); break; }; return; } // 图生图 const diagramOfTheSketch = async (vm,params,success) => { commonUpload(vm,params,success); } // 通用上传方法 const commonUpload = (vm,params,success) =>{ const image = params.filePath; delete params.filePath; uni.uploadFile({ url: configService.apiUrl+'/AiPicture/GenerateImages', filePath: image, name: 'image', formData: params, header:{'token':vm.$store.state.vuex_token}, success: (res) => { if(res.data){ success(encodeURI(JSON.parse(res.data).data.path)); } else { vm.$refs.uToast.show({type: 'error',title: "余额不足,请充值!"}); vm.dotLoading = false; return; } }, fail: function (res) { vm.$refs.uToast.show({type: 'error',title: "处理失败!"}); vm.dotLoading = false; } }); } export { selectDealFunction };