diff --git a/src/App.vue b/src/App.vue index 211ad15..9e1fb48 100644 --- a/src/App.vue +++ b/src/App.vue @@ -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 || {} }) }, diff --git a/src/api/http.js b/src/api/http.js index de90c0f..a0134aa 100644 --- a/src/api/http.js +++ b/src/api/http.js @@ -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); diff --git a/src/views/Goods/GoodsDetail.vue b/src/views/Goods/GoodsDetail.vue index 1666b0b..8ac557f 100644 --- a/src/views/Goods/GoodsDetail.vue +++ b/src/views/Goods/GoodsDetail.vue @@ -140,7 +140,7 @@
- +
@@ -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) {