mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	fix(前端 ImageUpload 组件):
- 前端 ImageUpload 组件, 上传路径以及地址拼接 - 基础设施-文件上传, 新增简单上传接口
This commit is contained in:
		| @@ -43,7 +43,7 @@ | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import { getToken } from "@/utils/auth"; | ||||
| import {getToken} from "@/utils/auth"; | ||||
|  | ||||
| export default { | ||||
|   props: { | ||||
| @@ -77,7 +77,7 @@ export default { | ||||
|       dialogVisible: false, | ||||
|       hideUpload: false, | ||||
|       baseUrl: process.env.VUE_APP_BASE_API, | ||||
|       uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址 | ||||
|       uploadImgUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/simple-upload", // 上传的图片服务器地址 | ||||
|       headers: { | ||||
|         Authorization: "Bearer " + getToken(), | ||||
|       }, | ||||
| @@ -93,10 +93,11 @@ export default { | ||||
|           // 然后将数组转为对象数组 | ||||
|           this.fileList = list.map(item => { | ||||
|             if (typeof item === "string") { | ||||
|               if (item.indexOf(this.baseUrl) === -1) { | ||||
|                 item = { name: this.baseUrl + item, url: this.baseUrl + item }; | ||||
|               // 不带有 http 的路径, 才拼接 baseUrl. | ||||
|               if (item.indexOf("http") === -1) { | ||||
|                 item = {name: this.baseUrl + item, url: this.baseUrl + item}; | ||||
|               } else { | ||||
|                 item = { name: item, url: item }; | ||||
|                 item = {name: item, url: item}; | ||||
|               } | ||||
|             } | ||||
|             return item; | ||||
| @@ -127,7 +128,7 @@ export default { | ||||
|     }, | ||||
|     // 上传成功回调 | ||||
|     handleUploadSuccess(res) { | ||||
|       this.uploadList.push({ name: res.fileName, url: res.fileName }); | ||||
|       this.uploadList.push({name: res.data.fileName, url: res.data.fileUrl}); | ||||
|       if (this.uploadList.length === this.number) { | ||||
|         this.fileList = this.fileList.concat(this.uploadList); | ||||
|         this.uploadList = []; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 jeromesoar
					jeromesoar