分享海报 Safari 兼容、昵称超长省略、其他小修

- GoodsDetail: 分享海报连调两次 toDataURL 绕过 Safari html-to-image 首帧空白
- GoodsDetail: 昵称超 10 字省略、"友情推荐"一行不换行
- GoodsDetail: 商品不存在时提示并跳回 Mall
- App: 恢复微信分享 init,share 请求走 persist 避免被 abortAll 取消
- http: 403 不再触发登出,仅 401
This commit is contained in:
chenhao 2026-07-14 13:15:26 +08:00
parent 844b132fe9
commit 51b2de1192
3 changed files with 14 additions and 9 deletions

View File

@ -48,7 +48,7 @@ export default {
}
},
mounted() {
// this.init()
this.init()
// this.$geo.getWebGeo().then(pos => {
// this.geo = pos
// })
@ -69,7 +69,8 @@ export default {
}
},
init() {
this.$get('/v1/client/HWxinfoClient/share').then(res => {
// abortAll()
this.$get('/v1/client/HWxinfoClient/share', undefined, undefined, undefined, true).then(res => {
this.wechatShareInfo = res.data || {}
})
},

View File

@ -124,7 +124,7 @@ function handleUnauthorized(requestToken) {
*/
function handleError(err, requestToken) {
// token 失效
if (err.status === ERR_CODE.UNAUTHORIZED || err.status === ERR_CODE.FORBIDDEN) {
if (err.status === ERR_CODE.UNAUTHORIZED) {
handleUnauthorized(requestToken);
}
return Promise.reject(err);

View File

@ -140,7 +140,7 @@
<div class="goods_detail__share_card" id="bsCard">
<div class="goods_detail__share_user">
<img :src="$file($userInfo.userimg)" alt="">
<div class="goods_detail__share_user_name"><span>{{ $userInfo.nickname }}友情推荐</span></div>
<div class="goods_detail__share_user_name"><span style="white-space:nowrap">{{ ($userInfo.nickname?.length > 10 ? $userInfo.nickname.slice(0, 10) + '…' : $userInfo.nickname) }}友情推荐</span></div>
</div>
<div class="goods_detail__share_goods">
@ -249,6 +249,11 @@ export default {
methods: {
init() {
this.$get(`/v1/client/EProsClient/${this.$route.query.id}`).then(res => {
if (!res.data || !res.data.id) {
this.$showFailToast('该商品不存在或已下架');
this.$navigate('Mall');
return;
}
this.data = res.data;
this.specSelect = this.data.specSelect || [];
this.specCombinations = this.data.specCombinations || [];
@ -375,11 +380,10 @@ export default {
// Wait for vue-qr to render
await new Promise(resolve => setTimeout(resolve, 500));
this.ShareImg = await toDataURL(shareContent, {
pixelRatio: 2,
useCORS: true,
format: 'png'
});
// ponytail: Safari html-to-image foreignObject
const opts = { pixelRatio: 2, useCORS: true, format: 'png' };
await toDataURL(shareContent, opts);
this.ShareImg = await toDataURL(shareContent, opts);
this.hideShareBox();
this.loading = false;
} catch (e) {