diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFileUploadController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFileUploadController.java index 2745957c1..ece6a3285 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFileUploadController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFileUploadController.java @@ -42,6 +42,7 @@ public class SysFileUploadController extends BaseController { if (StringUtils.isNotEmpty(fileUrl)) { ajax = AjaxResult.success(); ajax.put("fileUrl", fileUrl); + ajax.put("previewUrl", AliyunOSSUtils.generatePresignedUrl(fileUrl)); ajax.put("fileName", file.getOriginalFilename()); } else { ajax = AjaxResult.error("文件上传失败"); diff --git a/stdiet-common/src/main/java/com/stdiet/common/utils/oss/AliyunOSSUtils.java b/stdiet-common/src/main/java/com/stdiet/common/utils/oss/AliyunOSSUtils.java index 0b77da830..0a5b163b1 100644 --- a/stdiet-common/src/main/java/com/stdiet/common/utils/oss/AliyunOSSUtils.java +++ b/stdiet-common/src/main/java/com/stdiet/common/utils/oss/AliyunOSSUtils.java @@ -3,6 +3,7 @@ package com.stdiet.common.utils.oss; import com.aliyun.oss.model.GetObjectRequest; import com.aliyun.oss.model.OSSObject; import com.stdiet.common.config.AliyunOSSConfig; +import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.file.FileUtils; import org.springframework.web.multipart.MultipartFile; @@ -233,6 +234,9 @@ public class AliyunOSSUtils { * @return */ public static String generatePresignedUrl(String fileUrl){ + if(StringUtils.isEmpty(fileUrl)) { + return null; + } // 创建OSSClient实例。 OSS ossClient = getOssClient(); diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml index 4e4c7bab9..89ef8a168 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml @@ -35,8 +35,15 @@ diff --git a/stdiet-ui/src/components/TextInfo/index.vue b/stdiet-ui/src/components/TextInfo/index.vue index 09654e7c6..5707918c5 100644 --- a/stdiet-ui/src/components/TextInfo/index.vue +++ b/stdiet-ui/src/components/TextInfo/index.vue @@ -21,10 +21,15 @@ export default { if ( this.value && typeof this.value === "string" && - this.value.includes("
") + (this.value.includes("
") || this.value.includes("\n")) ) { this.newLine = true; - return this.value.split("
"); + if (this.value.includes("
")) { + return this.value.split("
"); + } else if (this.value.includes("\n")) { + return this.value.split("\n"); + } + return this.value; } return this.value; }, diff --git a/stdiet-ui/src/views/custom/customer/index.vue b/stdiet-ui/src/views/custom/customer/index.vue index e2484bd46..127446616 100644 --- a/stdiet-ui/src/views/custom/customer/index.vue +++ b/stdiet-ui/src/views/custom/customer/index.vue @@ -7,24 +7,16 @@ v-show="showSearch" label-width="86px" > - + - - - + - + + + + + + + + + - 搜索
将文件拖到此处,或点击上传 -
最多可上传5个文件,且每个文件不超过10M
+
+ 最多可上传5个文件,且每个文件不超过10M +
@@ -598,8 +600,18 @@ export default { submitForm() { this.$refs["form"].validate((valid) => { if (valid) { - if (this.form.id != null) { - updateIngredient(this.form).then((response) => { + const params = JSON.parse(JSON.stringify(this.form)); + params.imgList = params.imgList.reduce((arr, cur) => { + if (cur.url) { + arr.push({ + url: cur.url.substring(0, cur.url.indexOf("?")), + name: cur.name, + }); + } + return arr; + }, []); + if (params.id != null) { + updateIngredient(params).then((response) => { if (response.code === 200) { this.msgSuccess("修改成功"); this.open = false; @@ -607,7 +619,7 @@ export default { } }); } else { - addIngredient(this.form).then((response) => { + addIngredient(params).then((response) => { if (response.code === 200) { this.msgSuccess("新增成功"); this.open = false; @@ -658,7 +670,7 @@ export default { this.form.imgList = fileList.map((data) => { const { name, url, response } = data; if (response) { - return { url: response.fileUrl, name: response.fileName }; + return { url: response.previewUrl, name: response.fileName }; } return { url, name }; }); diff --git a/stdiet-ui/src/views/custom/recipesBuild/InfoView/PieChart/index.vue b/stdiet-ui/src/views/custom/recipesBuild/InfoView/PieChart/index.vue index a9fc668c6..1da5ce55c 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/InfoView/PieChart/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/InfoView/PieChart/index.vue @@ -266,7 +266,7 @@ export default { }, ], }; - console.log(option); + // console.log(option); this.chart.setOption(option); }, handleOnViewChange(view) {