Commit 83be6c24 authored by Xuguangxing's avatar Xuguangxing

feat: 处理bug

parent e4f57835
......@@ -2,7 +2,6 @@
<div id="app">
<cr-nav-bar v-if="header" :title="title" left-text="" @click-left="backFun" />
<div class="app">
<Weapp v-if="isWeixinBrowser" jump-url="/pages/user/login" />
<keep-alive>
<router-view v-if="$route.meta.keepLive" />
</keep-alive>
......@@ -20,13 +19,13 @@ import { mapState } from 'vuex';
import NetError from '@/components/NetError';
import { isApp, isWxMp, isWechat } from '@/service/validation.service';
import store from '@/store';
import Weapp from '@/components/weapp';
import goodsShare from '@/components/groupShare';
import qs from 'qs';
export default {
name: 'App',
components: {
NetError,
Weapp,
// Weapp,
goodsShare
},
data() {
......@@ -58,6 +57,19 @@ export default {
store.dispatch('change_is_weixin_browser', !isApp && !isWxMp && isWechat ? true : false);
}
},
created() {
if (isWechat && !isWxMp) {
const params = {
jumpUrl: 'pages/groupbuy/webview',
terminal: 1,
extraInfo: JSON.stringify({
url: window.location.href
})
};
const url = qs.stringify(params);
window.location.href = `https://mall.q-gp.com/common/launch?${url}`;
}
},
methods: {
backFun() {
this.$router.go(-1);
......
......@@ -137,7 +137,7 @@ export default {
};
switch (type) {
case 0:
linkPath = `${config.localHost}/groupBuy/list?h=0&activityId=${shareInfo.activityId}`;
linkPath = `${config.localHost}/groupBuy/list?activityId=${shareInfo.activityId}`;
break;
case 1:
case 2:
......@@ -146,7 +146,7 @@ export default {
detailData.groupBuyGroupId = shareInfo.groupBuyGroupId;
}
linkPath = qs.stringify(detailData);
linkPath = `${config.localHost}/groupBuy/skuInfo?h=0&${linkPath}`;
linkPath = `${config.localHost}/groupBuy/skuInfo?${linkPath}`;
break;
}
shareInfo.linkPath = this.weixinHandleLink(linkPath);
......
......@@ -10,7 +10,7 @@ const shenceHost = 'https://bn.xyqb.com/sa?project=default'; // 测试地址
const talosHost = 'https://talos-test1.liangkebang.net';
const faceHost = 'https://auth-test1.liangkebang.net';
const kdspHost = 'https://kdsp-api-test1.liangkebang.net';
const localHost = 'https://group-buy-test1.liangkebang.net/group-buying'; // 测试环境页面地址
const localHost = 'https://group-buy-test1.liangkebang.net'; // 测试环境页面地址
// const talosHost = 'http://192.168.29.89:8098'; // 唐峰
// const talosHost = 'http://192.168.25.210:8080'; // 张超
// const talosHost = 'http://192.168.28.83:80'; // 董彪
......
......@@ -9,7 +9,7 @@ const VERSION = '7.9.00';
const kdspHost = 'https://kdsp-api.q-gp.com';
const opapiHost = `${protocol}//opapi.xyqb.com`;
// const localHost = 'https://mall.q-gp.com/group-buying'; // 正式环境页面地址
const localHost = 'https://group-buy-test1.liangkebang.net/group-buying'; // 正式环境页面地址
const localHost = 'https://group-buy-test1.liangkebang.net'; // 正式环境页面地址
const shenceUrl = protocol + '//bn.xyqb.com/sa?project=production';
export default {
localHost,
......
......@@ -10,18 +10,15 @@ export default {
},
methods: {
getToken() {
// const that = this;
const _this = this;
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);
this.nativeBridge.openNewUrl({
event: 'openNewUrl',
data: {
newUrl: window.location.href //需要打开的新链接
}
_this.$nextTick(() => {
window.location.reload();
});
}
}
......@@ -56,7 +53,6 @@ export default {
}
});
}
return needLogin;
}
}
};
......@@ -28,7 +28,6 @@ const scrollBehavior = (to, from, savedPosition) => {
const router = new VueRouter({
mode: 'history',
base: '/group-buying',
routes,
scrollBehavior
});
......
......@@ -10,6 +10,11 @@ export default {
// token校验,整个流程都是登陆后的
init: router => {
router.beforeEach((to, from, next) => {
if (to.name == 'groupBuyList' && from.name == 'groupBuySkuInfo') {
// 这是为了详情页登录,把登录信息带回列表页所做的处理
to.query.vccToken = '{token}';
}
Cookies.set('h', 0);
// 所有自定义路由字段在此处理
const { meta } = to;
isWechat && localStorage.set('vccChannel', '159913');
......
......@@ -202,10 +202,7 @@ import rules from '@/components/rules';
import groupDescInfo from './components/groupDescInfo';
import { mapState } from 'vuex';
import localStorage from '@/service/localStorage.service';
// import goodsCheckMixin from '@/mixins/goodsCheck.mixin';
import Bridge from '@qg/js-bridge';
import MpBridge from '@/service/mp';
import { isWxMp, isApp } from '@/service/validation.service';
import goodsCheckMixin from '@/mixins/goodsCheck.mixin';
import { EventBus } from '@/service/utils.service';
import { saTrackEvent } from '@/service/sa.service';
export default {
......@@ -224,7 +221,7 @@ export default {
filters: {
Img2Thumb
},
// mixins: [goodsCheckMixin],
mixins: [goodsCheckMixin],
data() {
return {
timestemp: '', // 大活动结束时间
......@@ -324,48 +321,6 @@ export default {
type: 2
});
},
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;
},
......
......@@ -111,7 +111,6 @@ export default {
this.$router.push({
path: '/groupBuy/skuInfo',
query: {
h: 0,
skuNo,
goodsSpecialId,
activityId: activityInfoId,
......
......@@ -188,10 +188,12 @@ export default {
this.goodsTemp = await computedTemplate(info);
},
async goToMyorder() {
const isLogin = this.checkLogin();
if (!isLogin) {
this.$router.push('/orderList/0');
const hasLogin = localStorage.get('vccToken') ? true : false;
if (!hasLogin) {
this.checkLogin();
return;
}
this.$router.push('/orderList/0');
},
async openShareEvent() {
const shareInfo = await this.getShareData();
......
......@@ -171,7 +171,6 @@ export default {
this.$router.replace({
path: '/groupBuy/list',
query: {
h: 0,
activityId: itemInfo.activityInfoId
}
});
......@@ -230,7 +229,6 @@ export default {
this.$router.push({
path: '/groupBuy/skuInfoSmallPic',
query: {
h: 0,
skuNo: skuList[0].skuNo,
groupBuyGroupId: activityHundredGroupId,
goodsSpecialId: skuList[0].goodsSpecialId,
......
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