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. 30
      pages/activity/DargainDetails/index.vue
  5. 159
      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 {

30
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>
</view>
<view class="wrapper bargain-box">
<div class="pictxt">
<count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '" <count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '"
:secondText="' 秒'" :datatime="datatime"></count-down> :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;
@ -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;
} }
.bargain .wrapper .pictxt {
.bargain-header {
image {
width: 100rpx;
height: 100rpx;
border-radius: 100rpx;
}
.text{
}
}
}
</style> </style>

159
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,7 +685,6 @@ 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) {
@ -709,10 +706,6 @@ export function handleQrCode() {
} }
} }
return null return null
} catch {
return null
}
} }
export function handleUrlParam(path) { export function handleUrlParam(path) {
@ -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,121 +847,26 @@ 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('————————')
}
}
// 是分享转发拼团进来的
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()
}
}
// 是分享转发秒杀进来的 let path = '/' + getCurrentPageUrlWithArgs()
if (getCurrentPageUrl() == 'pages/activity/SeckillDetails/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 (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 (qrCode) {
// 当前是通过海报扫描进入的
}
}
// 判断是不是拼团进来的 // 判断是不是拼团进来的
if (getCurrentPageUrl() == 'pages/activity/GroupRule/index' ) { if (currentPageUrl == 'pages/activity/GroupRule/index') {
console.log('————————') console.log('————————')
console.log('是拼团进来的') console.log('是拼团进来的')
console.log('————————') console.log('————————')
if (qrCode.pinkId) {
let url = handleQrCode();
if(!url){
url = handleUrlParam(path);
}
if (url) {
path = parseUrl({ path = parseUrl({
path: `/${getCurrentPageUrl()}`, path: `/${currentPageUrl}`,
query: { query: {
id: url.pinkId, id: qrCode.pinkId,
} }
}) })
cookie.set("spread", url.spread || 0); cookie.set("spread", qrCode.spread || 0);
} else { } else {
console.log('————————') console.log('————————')
console.log('是拼团进来的,但是没有获取到参数') console.log('是拼团进来的,但是没有获取到参数')
@ -978,46 +876,41 @@ export const handleLoginFailure = () => {
} }
// 判断是不是扫描的砍价海报进来的 // 判断是不是扫描的砍价海报进来的
if (getCurrentPageUrl() == 'pages/activity/DargainDetails/index' && handleQrCode()) { if (currentPageUrl == 'pages/activity/DargainDetails/index') {
console.log('————————') console.log('————————')
console.log('是扫描的砍价海报进来的') console.log('是扫描的砍价海报进来的')
console.log('————————') console.log('————————')
let url = handleQrCode();
if (url) { if (qrCode.bargainId) {
path = parseUrl({ path = parseUrl({
path: `/${getCurrentPageUrl()}`, path: `/${currentPageUrl}`,
query: { query: {
id: url.bargainId, id: qrCode.bargainId,
partake: url.uid partake: qrCode.uid
} }
}) })
cookie.set("spread", url.spread || 0); cookie.set("spread", qrCode.spread || 0);
} else { } else {
handleNoParameters() handleNoParameters()
console.log('————————') console.log('————————')
console.log('是扫描的砍价海报进来的,但是没有获取到参数') console.log('是扫描的砍价海报进来的,但是没有获取到参数')
console.log('————————') console.log('————————')
} }
} }
if (getCurrentPageUrl() == 'pages/shop/GoodsCon/index' && handleQrCode()) { if (currentPageUrl == 'pages/shop/GoodsCon/index') {
debugger;
console.log('————————') console.log('————————')
console.log('是扫描的商品详情') console.log('是扫描的商品详情')
console.log('————————') console.log('————————')
let url = handleQrCode(); if (qrCode.productId) {
console.log(url)
if (url) {
path = parseUrl({ path = parseUrl({
path: `/${getCurrentPageUrl()}`, path: `/${currentPageUrl}`,
query: { query: {
id: url.productId, id: qrCode.productId,
} }
}) })
cookie.set("spread", url.spread || 0); cookie.set("spread", qrCode.spread || 0);
} else { } else {
handleNoParameters() handleNoParameters()
console.log('————————') console.log('————————')
@ -1025,6 +918,8 @@ export const handleLoginFailure = () => {
console.log('————————') console.log('————————')
} }
} }
}
console.log('————————') console.log('————————')

Loading…
Cancel
Save