generated from chenhao/template-h5
分享海报 Safari 兼容、昵称超长省略、其他小修
- GoodsDetail: 分享海报连调两次 toDataURL 绕过 Safari html-to-image 首帧空白 - GoodsDetail: 昵称超 10 字省略、"友情推荐"一行不换行 - GoodsDetail: 商品不存在时提示并跳回 Mall - App: 恢复微信分享 init,share 请求走 persist 避免被 abortAll 取消 - http: 403 不再触发登出,仅 401
This commit is contained in:
parent
844b132fe9
commit
51b2de1192
@ -48,7 +48,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// this.init()
|
this.init()
|
||||||
// this.$geo.getWebGeo().then(pos => {
|
// this.$geo.getWebGeo().then(pos => {
|
||||||
// this.geo = pos
|
// this.geo = pos
|
||||||
// })
|
// })
|
||||||
@ -69,7 +69,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
init() {
|
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 || {}
|
this.wechatShareInfo = res.data || {}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -124,7 +124,7 @@ function handleUnauthorized(requestToken) {
|
|||||||
*/
|
*/
|
||||||
function handleError(err, requestToken) {
|
function handleError(err, requestToken) {
|
||||||
// token 失效
|
// token 失效
|
||||||
if (err.status === ERR_CODE.UNAUTHORIZED || err.status === ERR_CODE.FORBIDDEN) {
|
if (err.status === ERR_CODE.UNAUTHORIZED) {
|
||||||
handleUnauthorized(requestToken);
|
handleUnauthorized(requestToken);
|
||||||
}
|
}
|
||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
|
|||||||
@ -140,7 +140,7 @@
|
|||||||
<div class="goods_detail__share_card" id="bsCard">
|
<div class="goods_detail__share_card" id="bsCard">
|
||||||
<div class="goods_detail__share_user">
|
<div class="goods_detail__share_user">
|
||||||
<img :src="$file($userInfo.userimg)" alt="">
|
<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>
|
||||||
|
|
||||||
<div class="goods_detail__share_goods">
|
<div class="goods_detail__share_goods">
|
||||||
@ -249,6 +249,11 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
this.$get(`/v1/client/EProsClient/${this.$route.query.id}`).then(res => {
|
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.data = res.data;
|
||||||
this.specSelect = this.data.specSelect || [];
|
this.specSelect = this.data.specSelect || [];
|
||||||
this.specCombinations = this.data.specCombinations || [];
|
this.specCombinations = this.data.specCombinations || [];
|
||||||
@ -375,11 +380,10 @@ export default {
|
|||||||
// Wait for vue-qr to render
|
// Wait for vue-qr to render
|
||||||
await new Promise(resolve => setTimeout(resolve, 500));
|
await new Promise(resolve => setTimeout(resolve, 500));
|
||||||
|
|
||||||
this.ShareImg = await toDataURL(shareContent, {
|
// ponytail: Safari 下 html-to-image 首帧 foreignObject 内图片未解码完就光栅化,第二次调用图片已缓存 → 正常
|
||||||
pixelRatio: 2,
|
const opts = { pixelRatio: 2, useCORS: true, format: 'png' };
|
||||||
useCORS: true,
|
await toDataURL(shareContent, opts);
|
||||||
format: 'png'
|
this.ShareImg = await toDataURL(shareContent, opts);
|
||||||
});
|
|
||||||
this.hideShareBox();
|
this.hideShareBox();
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user