chore:点击交换名片中的同意按钮,进去到对方名片,左上角返回按钮,返回到名片首页
This commit is contained in:
@@ -299,7 +299,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.copyText2(row.value);
|
this.copyText2(row.value);
|
||||||
},
|
},
|
||||||
loadDetail() {
|
loadDetail(retry) {
|
||||||
if (!this.cardId) {
|
if (!this.cardId) {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.errorMsg = '缺少名片编号';
|
this.errorMsg = '缺少名片编号';
|
||||||
@@ -318,6 +318,12 @@ export default {
|
|||||||
// 公开页/二维码地址由后端统一拼装返回(含 site_id/域名), 前端不自行拼接
|
// 公开页/二维码地址由后端统一拼装返回(含 site_id/域名), 前端不自行拼接
|
||||||
this.shareUrl = data.wap_url || '';
|
this.shareUrl = data.wap_url || '';
|
||||||
this.qrUrl = data.qr_url || '';
|
this.qrUrl = data.qr_url || '';
|
||||||
|
} else if (res.code == -1 && !retry) {
|
||||||
|
// -1 = 尚未登录: 冷启动进入本页时(含从对方名片页点返回回到本页)
|
||||||
|
// store 里的 token 可能还没恢复完成, 与 loadExchange 的瞬时态同源。
|
||||||
|
// 若不重试就会走下面的 fallbackToPublicPage → 本页刚显示又被弹去公开页,
|
||||||
|
// 表现为「点返回后中间又跳走了」, 故先静默重试一次再决定是否兜底。
|
||||||
|
setTimeout(() => this.loadDetail(true), 800);
|
||||||
} else {
|
} else {
|
||||||
// 未登录 / 非本人名下 / 卡片不存在: 后端报错信封同样返回 wap_url,
|
// 未登录 / 非本人名下 / 卡片不存在: 后端报错信封同样返回 wap_url,
|
||||||
// 据此匿名落地到公开页(可看、可提交交换请求), 不出现死路
|
// 据此匿名落地到公开页(可看、可提交交换请求), 不出现死路
|
||||||
@@ -376,7 +382,8 @@ export default {
|
|||||||
data: { card_id: cardId },
|
data: { card_id: cardId },
|
||||||
success: res => {
|
success: res => {
|
||||||
const data = res.data || {};
|
const data = res.data || {};
|
||||||
this.gotoPublic(data.wap_url || '');
|
// 同样带 back_url: 对方名片页左上角返回键据此回到本页(提醒条点对方名片 → 返回详情页)
|
||||||
|
this.gotoPublic(this.withBackUrl(data.wap_url || ''));
|
||||||
},
|
},
|
||||||
fail: () => {
|
fail: () => {
|
||||||
uni.showToast({ title: '打开名片失败,请稍后重试', icon: 'none' });
|
uni.showToast({ title: '打开名片失败,请稍后重试', icon: 'none' });
|
||||||
@@ -409,12 +416,18 @@ export default {
|
|||||||
*/
|
*/
|
||||||
jumpToOtherPublic(wapUrl) {
|
jumpToOtherPublic(wapUrl) {
|
||||||
if (!wapUrl) return;
|
if (!wapUrl) return;
|
||||||
let url = wapUrl;
|
this.gotoPublic(this.withBackUrl(wapUrl));
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 给公开页地址追加 back_url=本页完整地址(契约 §4 前端唯一允许的改动)。
|
||||||
|
* 对方名片页(PHP wap 模板)左上角返回键据此跳回本页; 已带 back_url 的原样返回, 不重复追加。
|
||||||
|
*/
|
||||||
|
withBackUrl(wapUrl) {
|
||||||
|
if (!wapUrl) return '';
|
||||||
|
if (wapUrl.indexOf('back_url=') >= 0) return wapUrl;
|
||||||
const back = this.myPageFullUrl();
|
const back = this.myPageFullUrl();
|
||||||
if (back) {
|
if (!back) return wapUrl;
|
||||||
url += (wapUrl.indexOf('?') >= 0 ? '&' : '?') + 'back_url=' + encodeURIComponent(back);
|
return wapUrl + (wapUrl.indexOf('?') >= 0 ? '&' : '?') + 'back_url=' + encodeURIComponent(back);
|
||||||
}
|
|
||||||
this.gotoPublic(url);
|
|
||||||
},
|
},
|
||||||
// 我方名片页完整地址: H5 运行时取 window.location.href(禁止写死域名, 部署/测试环境不同);
|
// 我方名片页完整地址: H5 运行时取 window.location.href(禁止写死域名, 部署/测试环境不同);
|
||||||
// 非 H5(小程序/App) 无等价 H5 地址, 返回 '' 由 share.vue 中转页原生返回。
|
// 非 H5(小程序/App) 无等价 H5 地址, 返回 '' 由 share.vue 中转页原生返回。
|
||||||
|
|||||||
@@ -124,11 +124,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
jumpToOtherPublic(wapUrl) {
|
jumpToOtherPublic(wapUrl) {
|
||||||
if (!wapUrl) return;
|
if (!wapUrl) return;
|
||||||
let url = wapUrl;
|
const url = this.withBackUrl(wapUrl);
|
||||||
const back = this.myPageFullUrl();
|
|
||||||
if (back) {
|
|
||||||
url += (wapUrl.indexOf('?') >= 0 ? '&' : '?') + 'back_url=' + encodeURIComponent(back);
|
|
||||||
}
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
// #endif
|
// #endif
|
||||||
@@ -138,6 +134,17 @@ export default {
|
|||||||
});
|
});
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 给公开页地址追加 back_url=本页完整地址(契约 §4 前端唯一允许的改动)。
|
||||||
|
* 对方名片页(PHP wap 模板)左上角返回键据此跳回本页; 已带 back_url 的原样返回, 不重复追加。
|
||||||
|
*/
|
||||||
|
withBackUrl(wapUrl) {
|
||||||
|
if (!wapUrl) return '';
|
||||||
|
if (wapUrl.indexOf('back_url=') >= 0) return wapUrl;
|
||||||
|
const back = this.myPageFullUrl();
|
||||||
|
if (!back) return wapUrl;
|
||||||
|
return wapUrl + (wapUrl.indexOf('?') >= 0 ? '&' : '?') + 'back_url=' + encodeURIComponent(back);
|
||||||
|
},
|
||||||
// H5: 当前页面完整地址(禁止写死域名); 非 H5 无等价 H5 地址返回 '' 由 share.vue 中转页原生返回
|
// H5: 当前页面完整地址(禁止写死域名); 非 H5 无等价 H5 地址返回 '' 由 share.vue 中转页原生返回
|
||||||
myPageFullUrl() {
|
myPageFullUrl() {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
|
|||||||
Reference in New Issue
Block a user