Commit f4028313 authored by beisir's avatar beisir

feat:更改小程序路径

parent f40adb24
...@@ -153,7 +153,7 @@ export default { ...@@ -153,7 +153,7 @@ export default {
}, },
weixinHandleLink(linkPath) { weixinHandleLink(linkPath) {
if (isWxMp) { if (isWxMp) {
return `/pages/webview/webview?url=${encodeURIComponent(JSON.stringify(linkPath))}`; return `/pages/groupbuy/webview?url=${encodeURIComponent(JSON.stringify(linkPath))}`;
} }
return linkPath; return linkPath;
}, },
...@@ -190,7 +190,7 @@ export default { ...@@ -190,7 +190,7 @@ export default {
const { posterUrl } = this.shareInfo; const { posterUrl } = this.shareInfo;
console.log(posterUrl); console.log(posterUrl);
this.nativeBridge.openNewUrl({ this.nativeBridge.openNewUrl({
newUrl: `/pages/goodshare/index?url=${encodeURIComponent(JSON.stringify(posterUrl))}` newUrl: `/pages/groupbuy/goodshare?url=${encodeURIComponent(JSON.stringify(posterUrl))}`
}); });
}, },
shareDialogConfirm() { shareDialogConfirm() {
......
export default { export default {
MP_URL_MAP: { MP_URL_MAP: {
home: '/pages/index/index', home: '/pages/index/index',
webview: '/pages/webview/webview', webview: '/pages/groupbuy/webview',
middleWay: '/pages/webview/middleWay', middleWay: '/pages/webview/middleWay',
goodDetail: '/pages/product/goodDetail', goodDetail: '/pages/product/goodDetail',
landPage: '/pages/landing/goods', landPage: '/pages/landing/goods',
......
...@@ -365,36 +365,17 @@ export function setAppTitleColor(bgcolor = '#fff') { ...@@ -365,36 +365,17 @@ export function setAppTitleColor(bgcolor = '#fff') {
}); });
} }
export function getQueryParams(key) { export function paramsParentheses(pointer) {
var search = window.location.search; const params = pointer.$route.query;
var regExp = new RegExp('[\\?\\&]([^\\?\\&]+)=([^\\?\\&]+)', 'ig'); const path = pointer.$route.path;
var queryStringList = {};
var parttern;
while ((parttern = regExp.exec(search))) {
if (!queryStringList[parttern[1].toLowerCase()]) {
queryStringList[parttern[1].toLowerCase()] = parttern[2];
}
}
//返回指定键的值
if (key) {
return queryStringList[key.toLowerCase()] || '';
}
//返回所有查询参数
return queryStringList;
}
export function paramsParentheses() {
let paramsObj = getQueryParams();
let tempString = ''; let tempString = '';
// !h=0$activityId=39" for (let key in params) {
for (let key in paramsObj) { let option = `${key}=${params[key]}`;
let option = `${key}=${paramsObj[key]}`;
tempString += `$${option}`; tempString += `$${option}`;
} }
if (tempString.length) { if (tempString.length) {
tempString = `${config.localHost}!` + tempString.slice(1); tempString = `${config.localHost}${path}!` + tempString.slice(1);
} }
console.log(tempString);
return tempString; return tempString;
} }
...@@ -104,9 +104,9 @@ const mutations = { ...@@ -104,9 +104,9 @@ const mutations = {
// todo 跳转到小程序 // todo 跳转到小程序
let getScheme = async function() { let getScheme = async function() {
const [res] = await groupBuy.getScheme({ const [res] = await groupBuy.getScheme({
miniUrl: 'pages/product/goodDetail', miniUrl: 'pages/groupbuy/webview',
// params: `url=${window.location.href}` // params: `url=${window.location.href}`
params: `from=groupBuy&url=${paramsParentheses()}` params: `from=groupBuy&url=${paramsParentheses(pointer)}`
}); });
const url = res; const url = res;
window.location.href = url; // todo 需要验证 window.location.href = url; // todo 需要验证
......
<template> <template>
<dl class="group-item" :class="{ disabled: groupStop }" @click="onButtonClick"> <dl class="group-item" :class="{ disabled: groupStop }" @click.stop="onButtonClick">
<dt class="group-item-thumb"> <dt class="group-item-thumb">
<cr-image :src="goodsItem.thumbImageUrl" /> <cr-image :src="goodsItem.thumbImageUrl" />
<span class="group-item-tag">{{ goodsItem.groupBuyLimitUserCount }}人团</span> <span class="group-item-tag">{{ goodsItem.groupBuyLimitUserCount }}人团</span>
...@@ -141,6 +141,7 @@ export default { ...@@ -141,6 +141,7 @@ export default {
align-items: center; align-items: center;
padding: 12px 0; padding: 12px 0;
border-bottom: #ededed solid 1px; border-bottom: #ededed solid 1px;
cursor: pointer;
position: relative; position: relative;
&:last-of-type { &:last-of-type {
border-bottom: none; border-bottom: none;
......
...@@ -135,6 +135,18 @@ export default { ...@@ -135,6 +135,18 @@ export default {
mounted() { mounted() {
this.showLoops = true; this.showLoops = true;
}, },
deactivated() {
clearTimeout((this.$refs.swipeRota && this.$refs.swipeRota.timer) || null);
this.showLoops = false;
this.setTitleColor();
},
activated() {
this.showLoops = true;
this.$nextTick(() => {
this.$refs.swipeRota && this.$refs.swipeRota.onSlidePrevChange();
});
},
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
const { activityId } = to.query; const { activityId } = to.query;
if (!activityId || isNaN(activityId)) { if (!activityId || isNaN(activityId)) {
...@@ -151,18 +163,6 @@ export default { ...@@ -151,18 +163,6 @@ export default {
} }
} }
}, },
// beforeDestroy() {
// },
deactivated() {
clearTimeout((this.$refs.swipeRota && this.$refs.swipeRota.timer) || null);
this.showLoops = false;
},
activated() {
this.showLoops = true;
this.$nextTick(() => {
this.$refs.swipeRota && this.$refs.swipeRota.onSlidePrevChange();
});
},
methods: { methods: {
animationEventStart() { animationEventStart() {
this.showSwipe = false; this.showSwipe = false;
...@@ -187,11 +187,6 @@ export default { ...@@ -187,11 +187,6 @@ export default {
shareInfo, shareInfo,
type: 0 type: 0
}); });
// const activity_id = this.activityId;
// this.$store.dispatch('goods_share_open', shareInfo);
// registeredEvents('H5_GroupZeroYuanPurchaseActivityPageSharePopupBtnClick', {
// activity_id
// });
}, },
async getShareData() { async getShareData() {
const { const {
...@@ -201,18 +196,6 @@ export default { ...@@ -201,18 +196,6 @@ export default {
shareIconUrl, shareIconUrl,
img img
} = this.goodsTemp; } = this.goodsTemp;
// let link = `${config.localHost}/groupBuy/list?h=0&activityId=${this.activityId}`;
// if (isWxMp) {
// link = `/pages/webview/webview?url=${encodeURIComponent(JSON.stringify(link))}`;
// }
// console.log(link);
// return Promise.resolve({
// title: shareTitle,
// desc: shareSubTitle,
// link, // 页面地址
// imgUrl: shareIconUrl || img, // 图片地
// posterUrl: sharePosterTemplateUrl
// });
const { activityId } = this; const { activityId } = this;
return Promise.resolve({ return Promise.resolve({
skuName: shareTitle, skuName: shareTitle,
......
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