修改海报监测逻辑

This commit is contained in:
Gaoxs
2020-09-16 18:04:03 +08:00
parent 1e625a90fa
commit 4d9486b484
5 changed files with 126 additions and 216 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -4433,7 +4433,7 @@ page {
.bargain .header .pictxt {
margin: 2.6*100rpx auto 0 auto;
font-size: 0.26*100rpx;
color: #fff;
color: #000;
}
.bargain .header .pictxt .pictrue {
@ -4484,14 +4484,16 @@ page {
background-color: #fff;
border-radius: 0.2*100rpx;
margin: -1.62*100rpx auto 0 auto;
padding: 0 0.24*100rpx 0.47*100rpx 0.24*100rpx;
padding: 24rpx;
position: relative;
}
.bargain .wrapper .pictxt {
margin: 0.26*100rpx 0 0.37*100rpx 0;
padding: 26rpx 0;
}
.bargain .bargain-box{
margin-bottom: 20rpx !important;
}
.bargain .wrapper .pictxt .pictrue {
width: 1.8*100rpx;
height: 1.8*100rpx;
@ -4509,7 +4511,6 @@ page {
width: 3.95*100rpx;
font-size: 0.28*100rpx;
color: #282828;
height: 1.8*100rpx;
}
.bargain .wrapper .pictxt .text .money {

View File

@ -1,10 +1,11 @@
<template>
<view class="bargain on">
<!-- 在header上加 on 为请求支援 -->
<view :class="[bargainPartake != userInfo.uid ? 'header bargain-box on' : 'header bargain-box']">
<view :class="[bargainPartake != userInfo.uid ? 'wrapper bargain-box on' : 'wrapper bargain-box']">
<!-- <view class="people">{{ lookCount }}人查看 {{ shareCount }}人分享 {{ userCount }}人参与</view> -->
<!-- 帮助砍价帮砍成功-->
<view class="pictxt acea-row row-center-wrapper" v-if="bargainPartake != userInfo.uid">
<view class="pictxt acea-row row-center-wrapper " v-if="bargainPartake != userInfo.uid">
<div class="bargain-header">
<view class="pictrue">
<image :src="bargainUserInfo.avatar" />
</view>
@ -12,9 +13,14 @@
{{ bargainUserInfo.nickname }}
<text>邀请您帮忙砍价</text>
</view>
</div>
</view>
<count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '"
:secondText="' 秒'" :datatime="datatime"></count-down>
</view>
<view class="wrapper bargain-box">
<div class="pictxt">
<count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '"
:secondText="' 秒'" :datatime="datatime"></count-down>
</div>
</view>
<view class="wrapper bargain-box">
<view class="pictxt acea-row row-between-wrapper" @click="openAlone">
@ -279,6 +285,7 @@
console.log(this)
let url = handleQrCode();
console.log(url)
debugger;
if (url) {
that.bargainId = url.bargainId;
that.partake = url.uid;
@ -378,7 +385,7 @@
'<img style="max-width:100%;height:auto;"'
);
that.datatime = that.bargain.stopTime / 1000;
that.getBargainHelpCount();
that.getBargainHelpCount();
// that.setOpenShare();
that.getBargainHelpList();
})
@ -456,7 +463,7 @@
getBargainHelpPrice: function () {
var that = this;
that.helpListLoading = true;
getBargainHelpPrice({
bargainId: that.bargainId,
bargainUserUid: that.bargainPartake
@ -518,6 +525,7 @@
})
.catch(() => {
debugger
this.$yrouter.push({
path: "/pages/activity/DargainDetails/index",
query: {
@ -525,13 +533,6 @@
partake: that.userInfo.uid
}
});
// that.$router.push({
// path:
// "/activity/dargain_detail/" +
// that.bargainId +
// "/" +
// that.userInfo.uid
// });
});
},
getBargainHelpCount: function () {
@ -652,4 +653,17 @@
.iconfonts {
font-size: 0.22 * 100rpx;
}
</style>
.bargain .wrapper .pictxt {
.bargain-header {
image {
width: 100rpx;
height: 100rpx;
border-radius: 100rpx;
}
.text{
}
}
}
</style>

View File

@ -89,11 +89,9 @@ export function isWeixin() {
}
export function parseQuery() {
// #ifdef H5
let res = {};
// #ifdef H5
const query = (location.href.split("?")[1] || "")
.trim()
.replace(/^(\?|#|&)/, "");
@ -687,38 +685,33 @@ export const _router = {
export function handleQrCode() {
try {
var urlSpread = parseQuery()["q"];
if (urlSpread) {
if (urlSpread.indexOf('%3F') != -1) {
// 通过海报二维码进来
urlSpread = urlSpread
.split("%3F")[1]
.replace(/%3D/g, ":")
.replace(/%26/g, ",")
.split(",")
.map((item, index) => {
item = item.split(":");
return `"${item[0]}":"${item[1]}"`;
})
.join(",");
urlSpread = JSON.parse("{" + urlSpread + "}");
return urlSpread
} else {
return handleUrlParam(urlSpread)
}
var urlSpread = parseQuery()["q"];
if (urlSpread) {
if (urlSpread.indexOf('%3F') != -1) {
// 通过海报二维码进来
urlSpread = urlSpread
.split("%3F")[1]
.replace(/%3D/g, ":")
.replace(/%26/g, ",")
.split(",")
.map((item, index) => {
item = item.split(":");
return `"${item[0]}":"${item[1]}"`;
})
.join(",");
urlSpread = JSON.parse("{" + urlSpread + "}");
return urlSpread
} else {
return handleUrlParam(urlSpread)
}
return null
} catch {
return null
}
return null
}
export function handleUrlParam(path) {
var url = path.split("?")[1]; //获取url中"?"符后的字串
var theRequest = new Object();
if(path.includes("?")){
if (path.includes("?")) {
var url = path.split("?")[1]; //获取url中"?"符后的字串
let strs = url.split("&");
for (var i = 0; i < strs.length; i++) {
@ -834,7 +827,6 @@ export const PosterCanvas = (store, successCallBack) => {
export const handleLoginFailure = () => {
console.log('————————')
console.log('退出登录,标记当前页面为授权页面,防止多次跳转')
console.log('————————')
@ -842,10 +834,11 @@ export const handleLoginFailure = () => {
store.commit("logout");
store.commit("updateAuthorization", false);
let currentPageUrl = getCurrentPageUrl()
// token 失效
// 判断当前是不是已经在登录页面或者授权页,防止二次跳转
if (store.getters.isAuthorizationPage || getCurrentPageUrl() == '/pages/user/Login/index') {
console.log(store.getters.isAuthorizationPage, getCurrentPageUrl(), '已经是登录页面或者授权页面,跳出方法')
if (store.getters.isAuthorizationPage || currentPageUrl == '/pages/user/Login/index') {
console.log(store.getters.isAuthorizationPage, currentPageUrl, '已经是登录页面或者授权页面,跳出方法')
return
}
@ -854,177 +847,79 @@ export const handleLoginFailure = () => {
console.log(store.getters)
console.log('————————')
store.commit("updateAuthorizationPage", true);
let path = '/' + getCurrentPageUrlWithArgs()
//判断小程序转发分享商品详情进来的
if (getCurrentPageUrl() == 'pages/shop/GoodsCon/index' && handleUrlParam(path) && !handleQrCode()) {
console.log('————————')
console.log('判断小程序转发分享商品详情进来的')
console.log(' handleUrlParam()', handleUrlParam(path))
let qrCode = handleQrCode()
let url = handleUrlParam(path);
console.log(url)
if (url) {
path = parseUrl({
path: `/${getCurrentPageUrl()}`,
query: {
id: url.id,
}
})
cookie.set("spread", url.spread || 0);
} else {
handleNoParameters()
if (qrCode) {
// 当前是通过海报扫描进入的
// 判断是不是拼团进来的
if (currentPageUrl == 'pages/activity/GroupRule/index') {
console.log('————————')
console.log('是扫描的商品详情进来的,但是没有获取到参数')
console.log('是拼团进来的')
console.log('————————')
if (qrCode.pinkId) {
path = parseUrl({
path: `/${currentPageUrl}`,
query: {
id: qrCode.pinkId,
}
})
cookie.set("spread", qrCode.spread || 0);
} else {
console.log('————————')
console.log('是拼团进来的,但是没有获取到参数')
console.log('————————')
handleNoParameters()
}
}
// 判断是不是扫描的砍价海报进来的
if (currentPageUrl == 'pages/activity/DargainDetails/index') {
console.log('————————')
console.log('是扫描的砍价海报进来的')
console.log('————————')
if (qrCode.bargainId) {
path = parseUrl({
path: `/${currentPageUrl}`,
query: {
id: qrCode.bargainId,
partake: qrCode.uid
}
})
cookie.set("spread", qrCode.spread || 0);
} else {
handleNoParameters()
console.log('————————')
console.log('是扫描的砍价海报进来的,但是没有获取到参数')
console.log('————————')
}
}
if (currentPageUrl == 'pages/shop/GoodsCon/index') {
console.log('————————')
console.log('是扫描的商品详情')
console.log('————————')
if (qrCode.productId) {
path = parseUrl({
path: `/${currentPageUrl}`,
query: {
id: qrCode.productId,
}
})
cookie.set("spread", qrCode.spread || 0);
} else {
handleNoParameters()
console.log('————————')
console.log('是扫描的商品详情进来的,但是没有获取到参数')
console.log('————————')
}
}
}
// 是分享转发拼团进来的
if (getCurrentPageUrl() == 'pages/activity/GroupDetails/index' && handleUrlParam(path)) {
console.log('————————')
console.log('是分享转发拼团进来的')
console.log('————————')
let url = handleUrlParam(path);
console.log(url)
if (url) {
path = parseUrl({
path: `/${getCurrentPageUrl()}`,
query: {
id: url.id,
}
})
cookie.set("spread", url.spread || 0);
} else {
console.log('————————')
console.log('是拼团进来的,但是没有获取到参数')
console.log('————————')
handleNoParameters()
}
}
// 是分享转发秒杀进来的
if (getCurrentPageUrl() == 'pages/activity/SeckillDetails/index' && handleUrlParam(path)) {
console.log('————————')
console.log('是分享转发秒杀进来的')
console.log('————————')
let url = handleUrlParam(path);
console.log(url)
if (url) {
path = parseUrl({
path: `/${getCurrentPageUrl()}`,
query: {
id: url.id,
}
})
cookie.set("spread", url.spread || 0);
} else {
console.log('————————')
console.log('是秒杀进来的,但是没有获取到参数')
console.log('————————')
handleNoParameters()
}
}
// 判断是不是转发分享的砍价海报进来的
if (getCurrentPageUrl() == 'pages/activity/DargainDetails/index' && handleUrlParam(path) && !handleQrCode()) {
console.log('————————')
console.log('判断是不是转发分享的砍价海报进来的')
console.log('————————')
let url = handleUrlParam(path);
if (url) {
path = parseUrl({
path: `/${getCurrentPageUrl()}`,
query: {
id: url.bargainId,
partake: url.uid
}
})
cookie.set("spread", url.spread || 0);
} else {
handleNoParameters()
console.log('————————')
console.log('是扫描的砍价海报进来的,但是没有获取到参数')
console.log('————————')
}
}
// 判断是不是拼团进来的
if (getCurrentPageUrl() == 'pages/activity/GroupRule/index' ) {
console.log('————————')
console.log('是拼团进来的')
console.log('————————')
let url = handleQrCode();
if(!url){
url = handleUrlParam(path);
}
if (url) {
path = parseUrl({
path: `/${getCurrentPageUrl()}`,
query: {
id: url.pinkId,
}
})
cookie.set("spread", url.spread || 0);
} else {
console.log('————————')
console.log('是拼团进来的,但是没有获取到参数')
console.log('————————')
handleNoParameters()
}
}
// 判断是不是扫描的砍价海报进来的
if (getCurrentPageUrl() == 'pages/activity/DargainDetails/index' && handleQrCode()) {
console.log('————————')
console.log('是扫描的砍价海报进来的')
console.log('————————')
let url = handleQrCode();
if (url) {
path = parseUrl({
path: `/${getCurrentPageUrl()}`,
query: {
id: url.bargainId,
partake: url.uid
}
})
cookie.set("spread", url.spread || 0);
} else {
handleNoParameters()
console.log('————————')
console.log('是扫描的砍价海报进来的,但是没有获取到参数')
console.log('————————')
}
}
if (getCurrentPageUrl() == 'pages/shop/GoodsCon/index' && handleQrCode()) {
debugger;
console.log('————————')
console.log('是扫描的商品详情')
console.log('————————')
let url = handleQrCode();
console.log(url)
if (url) {
path = parseUrl({
path: `/${getCurrentPageUrl()}`,
query: {
id: url.productId,
}
})
cookie.set("spread", url.spread || 0);
} else {
handleNoParameters()
console.log('————————')
console.log('是扫描的商品详情进来的,但是没有获取到参数')
console.log('————————')
}
}
console.log('————————')