Browse Source

修改海报监测逻辑

zyh
Gaoxs 4 years ago
parent
commit
4d9486b484
  1. 2
      assets/css/style.css
  2. 2
      assets/css/style.css.map
  3. 11
      assets/css/style.less
  4. 42
      pages/activity/DargainDetails/index.vue
  5. 263
      utils/index.js

2
assets/css/style.css

File diff suppressed because one or more lines are too long

2
assets/css/style.css.map

File diff suppressed because one or more lines are too long

11
assets/css/style.less

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

42
pages/activity/DargainDetails/index.vue

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

263
utils/index.js

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

Loading…
Cancel
Save