diff --git a/components-diy/diy-recommend-code.vue b/components-diy/diy-recommend-code.vue index b6b8142..48c7017 100644 --- a/components-diy/diy-recommend-code.vue +++ b/components-diy/diy-recommend-code.vue @@ -414,14 +414,10 @@ export default { return 'https://api.qrserver.com/v1/create-qr-code/?size=300x300&margin=0&data=' + url; }, formatShareLink() { - // 读取后台装修配置的链接前缀模板 - const baseTemplate = this.nc.customShareLink || ''; - // 后台未配置时兜底默认地址 - const defaultBase = "http://192.168.8.118/hwappx/common/pages_tool/form/formdata?id=13&uniacid=1&recommend_code="; - // 取最终基础链接 - const linkPrefix = baseTemplate ? baseTemplate : defaultBase; - // 直接拼接推荐码,不需要{code}占位 - return linkPrefix + (this.code || ''); + // 读取后台配置完整带{code}的模板 + const template = this.nc.customShareLink || "http://192.168.8.118/hwappx/common/pages_tool/form/formdata?id=13&uniacid=1&recommend_code={code}"; + // 把模板里 {code} 整体替换成 {推荐码} + return template.replace(/\{code\}/g, this.code); }, }, watch: {