跟新
This commit is contained in:
		
							parent
							
								
									743c73044e
								
							
						
					
					
						commit
						7447661a21
					
				| @ -424,9 +424,16 @@ | |||||||
|             console.error('上传出错', file, err, res) |             console.error('上传出错', file, err, res) | ||||||
|         }, |         }, | ||||||
|         customInsert(res, insertFn) { |         customInsert(res, insertFn) { | ||||||
|             // 只使用返回的url字段
 |             // 只使用返回的url字段,并确保使用完整的URL
 | ||||||
|             if (res.code === 0 && res.url) { |             if (res.code === 0 && res.url) { | ||||||
|                 insertFn(res.url); |                 // 如果URL不是以http开头,添加https://
 | ||||||
|  |                 let imageUrl = res.url; | ||||||
|  |                 if (!imageUrl.startsWith('http')) { | ||||||
|  |                     imageUrl = 'https://' + imageUrl; | ||||||
|  |                 } | ||||||
|  |                 // 移除可能存在的重复域名和路径
 | ||||||
|  |                 imageUrl = imageUrl.replace(/^https?:\/\/[^\/]+\/admin\/resources\//, 'https://www.yunzer.cn/');
 | ||||||
|  |                 insertFn(imageUrl); | ||||||
|             } else { |             } else { | ||||||
|                 layer.msg('图片上传失败:' + (res.msg || '未知错误'), { icon: 2 }); |                 layer.msg('图片上传失败:' + (res.msg || '未知错误'), { icon: 2 }); | ||||||
|             } |             } | ||||||
|  | |||||||
| @ -442,9 +442,16 @@ | |||||||
|             console.error('上传出错', file, err, res) |             console.error('上传出错', file, err, res) | ||||||
|         }, |         }, | ||||||
|         customInsert(res, insertFn) { |         customInsert(res, insertFn) { | ||||||
|             // 只使用返回的url字段
 |             // 只使用返回的url字段,并确保使用完整的URL
 | ||||||
|             if (res.code === 0 && res.url) { |             if (res.code === 0 && res.url) { | ||||||
|                 insertFn(res.url); |                 // 如果URL不是以http开头,添加https://
 | ||||||
|  |                 let imageUrl = res.url; | ||||||
|  |                 if (!imageUrl.startsWith('http')) { | ||||||
|  |                     imageUrl = 'https://' + imageUrl; | ||||||
|  |                 } | ||||||
|  |                 // 移除可能存在的重复域名和路径
 | ||||||
|  |                 imageUrl = imageUrl.replace(/^https?:\/\/[^\/]+\/admin\/resources\//, 'https://www.yunzer.cn/');
 | ||||||
|  |                 insertFn(imageUrl); | ||||||
|             } else { |             } else { | ||||||
|                 layer.msg('图片上传失败:' + (res.msg || '未知错误'), { icon: 2 }); |                 layer.msg('图片上传失败:' + (res.msg || '未知错误'), { icon: 2 }); | ||||||
|             } |             } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 云泽网
						云泽网