Commit f4028313 authored by beisir's avatar beisir

feat:更改小程序路径

parent f40adb24
......@@ -153,7 +153,7 @@ export default {
},
weixinHandleLink(linkPath) {
if (isWxMp) {
return `/pages/webview/webview?url=${encodeURIComponent(JSON.stringify(linkPath))}`;
return `/pages/groupbuy/webview?url=${encodeURIComponent(JSON.stringify(linkPath))}`;
}
return linkPath;
},
......@@ -190,7 +190,7 @@ export default {
const { posterUrl } = this.shareInfo;
console.log(posterUrl);
this.nativeBridge.openNewUrl({
newUrl: `/pages/goodshare/index?url=${encodeURIComponent(JSON.stringify(posterUrl))}`
newUrl: `/pages/groupbuy/goodshare?url=${encodeURIComponent(JSON.stringify(posterUrl))}`
});
},
shareDialogConfirm() {
......
export default {
MP_URL_MAP: {
home: '/pages/index/index',
webview: '/pages/webview/webview',
webview: '/pages/groupbuy/webview',
middleWay: '/pages/webview/middleWay',
goodDetail: '/pages/product/goodDetail',
landPage: '/pages/landing/goods',
......
......@@ -365,36 +365,17 @@ export function setAppTitleColor(bgcolor = '#fff') {
});
}
export function getQueryParams(key) {
var search = window.location.search;
var regExp = new RegExp('[\\?\\&]([^\\?\\&]+)=([^\\?\\&]+)', 'ig');
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();
export function paramsParentheses(pointer) {
const params = pointer.$route.query;
const path = pointer.$route.path;
let tempString = '';
// !h=0$activityId=39"
for (let key in paramsObj) {
let option = `${key}=${paramsObj[key]}`;
for (let key in params) {
let option = `${key}=${params[key]}`;
tempString += `$${option}`;
}
if (tempString.length) {
tempString = `${config.localHost}!` + tempString.slice(1);
tempString = `${config.localHost}${path}!` + tempString.slice(1);
}
console.log(tempString);
return tempString;
}
......@@ -104,9 +104,9 @@ const mutations = {
// todo 跳转到小程序
let getScheme = async function() {
const [res] = await groupBuy.getScheme({
miniUrl: 'pages/product/goodDetail',
miniUrl: 'pages/groupbuy/webview',
// params: `url=${window.location.href}`
params: `from=groupBuy&url=${paramsParentheses()}`
params: `from=groupBuy&url=${paramsParentheses(pointer)}`
});
const url = res;
window.location.href = url; // todo 需要验证
......
<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">
<cr-image :src="goodsItem.thumbImageUrl" />
<span class="group-item-tag">{{ goodsItem.groupBuyLimitUserCount }}人团</span>
......@@ -141,6 +141,7 @@ export default {
align-items: center;
padding: 12px 0;
border-bottom: #ededed solid 1px;
cursor: pointer;
position: relative;
&:last-of-type {
border-bottom: none;
......
......@@ -135,6 +135,18 @@ export default {
mounted() {
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) {
const { activityId } = to.query;
if (!activityId || isNaN(activityId)) {
......@@ -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: {
animationEventStart() {
this.showSwipe = false;
......@@ -187,11 +187,6 @@ export default {
shareInfo,
type: 0
});
// const activity_id = this.activityId;
// this.$store.dispatch('goods_share_open', shareInfo);
// registeredEvents('H5_GroupZeroYuanPurchaseActivityPageSharePopupBtnClick', {
// activity_id
// });
},
async getShareData() {
const {
......@@ -201,18 +196,6 @@ export default {
shareIconUrl,
img
} = 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;
return Promise.resolve({
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