Commit 4ab6516e authored by beisir's avatar beisir

Merge branch 'feat/group-buy' of git.quantgroup.cn:ui/group-buy-ui into feat/group-buy

parents f96e4f7c ef4cb324
......@@ -17,8 +17,12 @@ export default {
const appData = json.data || {};
if (appData && appData.token) {
localStorage.set('vccToken', appData.token);
const location = window.location;
window.location.href = location.href;
this.nativeBridge.openNewUrl({
event: 'openNewUrl',
data: {
newUrl: window.location.href //需要打开的新链接
}
});
}
}
};
......
......@@ -195,7 +195,10 @@ import groupDescInfo from './components/groupDescInfo';
import { mapState } from 'vuex';
import sharePic from '@/components/sharePic';
import localStorage from '@/service/localStorage.service';
import goodsCheckMixin from '@/mixins/goodsCheck.mixin';
// import goodsCheckMixin from '@/mixins/goodsCheck.mixin';
import Bridge from '@qg/js-bridge';
import MpBridge from '@/service/mp';
import { isWxMp, isApp } from '@/service/validation.service';
export default {
// eslint-disable-next-line vue/name-property-casing
name: 'goodDetail',
......@@ -213,7 +216,7 @@ export default {
filters: {
Img2Thumb
},
mixins: [goodsCheckMixin],
// mixins: [goodsCheckMixin],
data() {
return {
timestemp: '', // 大活动结束时间
......@@ -284,6 +287,48 @@ export default {
}, 5000);
},
methods: {
getToken() {
window.xyqbNativeEvent = function(res) {
const json = typeof res === 'string' ? JSON.parse(res) : res;
if (json.event === 'getTokenSuccess') {
const appData = json.data || {};
if (appData && appData.token) {
localStorage.set('vccToken', appData.token);
window.location.reload();
}
}
};
this.nativeBridge.getToken();
},
checkLogin() {
const vccToken = localStorage.get('vccToken');
const needLogin = vccToken ? false : true;
if (needLogin) {
if (isApp) this.nativeBridge = new Bridge();
else if (isWxMp) this.nativeBridge = new MpBridge();
this.$dialog({
message: '参与拼团活动需要您先进行登录哦~',
title: '',
showCancelButton: false,
confirmButtonText: '登录',
onConfirm: () => {
if (isWxMp) {
this.nativeBridge.getToken();
} else if (isApp) {
// native调用getToken
this.getToken();
} else {
this.$dialog({
message: '请在App或小程序中参与活动~',
title: '',
showCancelButton: false,
confirmButtonText: '我知道了'
});
}
}
});
}
},
onChange(index) {
this.swiperCurrent = index;
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment