Commit 83be6c24 authored by Xuguangxing's avatar Xuguangxing

feat: 处理bug

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