fix: image URLs incorrectly using API base URL instead of image base URL
Images are served from MinIO directly, not through /prod-api proxy. Add imageBaseUrl to config and use it in fixImageUrl() and WXML templates. This fixes images not loading on order list and detail pages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,7 @@ App({
|
|||||||
url: config.baseUrl,
|
url: config.baseUrl,
|
||||||
domain: config.baseUrl,
|
domain: config.baseUrl,
|
||||||
domaintwo: config.baseUrl,
|
domaintwo: config.baseUrl,
|
||||||
|
imageBaseUrl: config.imageBaseUrl,
|
||||||
|
|
||||||
phone: '',
|
phone: '',
|
||||||
uid: '',
|
uid: '',
|
||||||
@@ -106,11 +107,11 @@ App({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
// 修复图片路径:相对路径补全 baseUrl,绝对 URL 或空值原样返回
|
// 修复图片路径:相对路径补全图片基地址,绝对 URL 或空值原样返回
|
||||||
fixImageUrl: function (path) {
|
fixImageUrl: function (path) {
|
||||||
if (!path) return '';
|
if (!path) return '';
|
||||||
if (path.indexOf('http') === 0) return path;
|
if (path.indexOf('http') === 0) return path;
|
||||||
return this.globalData.url + path;
|
return this.globalData.imageBaseUrl + path;
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取订单状态文案
|
// 获取订单状态文案
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Page({
|
|||||||
nav_type: 1,
|
nav_type: 1,
|
||||||
all: true,
|
all: true,
|
||||||
height: '',
|
height: '',
|
||||||
url: app.globalData.url,
|
url: app.globalData.imageBaseUrl,
|
||||||
statusType: ["全部", "待接单", "已接单", "服务中", "待支付", "已完成","已取消"],
|
statusType: ["全部", "待接单", "已接单", "服务中", "待支付", "已完成","已取消"],
|
||||||
status: ["", "0", "1", "2", "3","4","-2"],
|
status: ["", "0", "1", "2", "3","4","-2"],
|
||||||
currentType: 0,
|
currentType: 0,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Page({
|
|||||||
qrcode: '',
|
qrcode: '',
|
||||||
id: '',
|
id: '',
|
||||||
item: {},
|
item: {},
|
||||||
url: app.globalData.url,
|
url: app.globalData.imageBaseUrl,
|
||||||
refund: '',
|
refund: '',
|
||||||
charge_phone: '',
|
charge_phone: '',
|
||||||
refund_box: false,
|
refund_box: false,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Page({
|
|||||||
|
|
||||||
data: {
|
data: {
|
||||||
height: '',
|
height: '',
|
||||||
url: app.globalData.url,
|
url: app.globalData.imageBaseUrl,
|
||||||
seckill_start: '请输入开始日期',
|
seckill_start: '请输入开始日期',
|
||||||
seckill_endx: '请输入结束日期',
|
seckill_endx: '请输入结束日期',
|
||||||
time: 30 * 60 * 60 * 1000,
|
time: 30 * 60 * 60 * 1000,
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ const config = {
|
|||||||
// baseUrl: 'http://192.168.1.100:8039',
|
// baseUrl: 'http://192.168.1.100:8039',
|
||||||
// 生产环境(通过 nginx 代理,HTTPS + 域名)
|
// 生产环境(通过 nginx 代理,HTTPS + 域名)
|
||||||
baseUrl: 'https://ruilaizipj.com/prod-api',
|
baseUrl: 'https://ruilaizipj.com/prod-api',
|
||||||
|
// 图片/文件访问基地址(不走 /prod-api 代理,MinIO 直接访问)
|
||||||
|
imageBaseUrl: 'https://ruilaizipj.com',
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = config
|
module.exports = config
|
||||||
|
|||||||
Reference in New Issue
Block a user