Commit 3fe47975 by 张卓

Merge branch 'nativehome_tst' of http://code.mayi888.com/chengmo/mayi-mp-shop into nativehome_tst

parents b6cb2eb0 d7ae7837
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"build:my": "node build/build.js my" "build:my": "node build/build.js my"
}, },
"dependencies": { "dependencies": {
"mayi-analytics": "^1.1.14", "mayi-analytics": "^1.1.24",
"mayi-front-tools": "^1.0.0", "mayi-front-tools": "^1.0.0",
"mpvue": "^2.0.0", "mpvue": "^2.0.0",
"mpvue-wxparse": "^0.6.5", "mpvue-wxparse": "^0.6.5",
......
...@@ -147,6 +147,12 @@ export default { ...@@ -147,6 +147,12 @@ export default {
getShopInfo({ mixid }) { getShopInfo({ mixid }) {
shop.getShopInfo({ shopMixId: mixid }).then((res) => { shop.getShopInfo({ shopMixId: mixid }).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
// 收集用户数据
this.$mpBehavior.init("mayi-moblie-shop-mp", res.data.data.id, {
mode: process.env.NODE_ENV,
gid: res.data.data.groupId
})
let mpApp = getApp(); let mpApp = getApp();
// 商城基本数据 // 商城基本数据
mpApp.shopCallBack && mpApp.shopCallBack(res.data.data); mpApp.shopCallBack && mpApp.shopCallBack(res.data.data);
......
...@@ -28,6 +28,11 @@ Vue.config.productionTip = false ...@@ -28,6 +28,11 @@ Vue.config.productionTip = false
App.mpType = 'app' App.mpType = 'app'
Vue.prototype.$store = Store Vue.prototype.$store = Store
// 用户行为收集
console.log(Store.state,'---35')
let mpBehavior = require("../node_modules/mayi-analytics/dist/mayi.mpBehavior")
Vue.prototype.$mpBehavior = mpBehavior;
// 异常监控(行为收集) // 异常监控(行为收集)
let mpAnalytics = require("../node_modules/mayi-analytics/dist/mayi.mpAnalytics.js") let mpAnalytics = require("../node_modules/mayi-analytics/dist/mayi.mpAnalytics.js")
.default; .default;
......
<template> <template>
<div class="contact"> <div class="contact">
<div class="contact-img"> <div class="contact-img">
<img src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/HCe2iRXHsP.png" alt=""> <img src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/HCe2iRXHsP.png" alt="" />
</div> </div>
<div class="btn-wrap"> <div class="btn-wrap">
<button open-type="contact"> <button open-type="contact" show-message-card :session-from="sessionFrom">
<div class="btn-main"> <div class="btn-main">
<div class="main-img"> <div class="main-img">
<img src="../../../static/images/wx.png" alt=""> <img src="../../../static/images/wx.png" alt="" />
</div> </div>
<div class="main-text">官方微信客服</div> <div class="main-text">官方微信客服</div>
</div>
<img class="btn-next" src="../../../static/images/next.png" alt="">
</button>
</div> </div>
<img class="btn-next" src="../../../static/images/next.png" alt="" />
</button>
</div> </div>
</div>
</template> </template>
<script> <script>
import { getUserLocation } from "../../utils/wxIndex.js";
export default { export default {
data() {
} return {
sessionFrom: "",
};
},
onLoad(options) {
getUserLocation().then((res) => {
options.longitude = res.longitude;
options.latitude = res.latitude;
this.sessionFrom = JSON.stringify(options);
console.log('sessionFrom',this.sessionFrom)
});
},
};
</script> </script>
<style scoped> <style scoped>
.contact{ .contact {
padding: 10px 22px 0 22px; padding: 10px 22px 0 22px;
} }
.contact-img{ .contact-img {
width: 100%; width: 100%;
height: 154px; height: 154px;
margin-bottom: 24px; margin-bottom: 24px;
background-color: #ccc; background-color: #ccc;
border-radius: 8px; border-radius: 8px;
} }
.contact-img img{ .contact-img img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.btn-wrap{ .btn-wrap {
width: 100%; width: 100%;
height: 80px; height: 80px;
box-sizing: border-box; box-sizing: border-box;
} }
button{ button {
width: 100%; width: 100%;
height: 80px; height: 80px;
border: none; border: none;
padding: 20px 10px 20px 10px; padding: 20px 10px 20px 10px;
background-color: white; background-color: white;
box-shadow: #eee 0px 0px 5px 4px; box-shadow: #eee 0px 0px 5px 4px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.btn-main{ .btn-main {
display: flex; display: flex;
height: 40px; height: 40px;
} }
.main-img{ .main-img {
width: 54px; width: 54px;
height: 40px; height: 40px;
border-right: 1px solid #D7D4D4; border-right: 1px solid #d7d4d4;
padding-top: 3px; padding-top: 3px;
} }
.main-img img{ .main-img img {
width: 42px; width: 42px;
height: 34px; height: 34px;
} }
.main-text{ .main-text {
color: #1C1B1B; color: #1c1b1b;
font-size:17px; font-size: 17px;
margin-left: 10px; margin-left: 10px;
} }
.btn-next{ .btn-next {
width: 9px; width: 9px;
height: 14px; height: 14px;
} }
.btn-next img{ .btn-next img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
button::after{ button::after {
border: none; border: none;
} }
</style> </style>
\ No newline at end of file
...@@ -470,7 +470,30 @@ export default { ...@@ -470,7 +470,30 @@ export default {
} }
return params; return params;
} },
delParam(oldUrl,paramKey) {
var url = oldUrl; //页面url
var urlParam = oldUrl.split("?")[1]; //页面参数
var beforeUrl = url.substr(0, url.indexOf("?")); //页面主地址(参数之前地址)
var nextUrl = "";
var arr = new Array();
if (urlParam != "") {
var urlParamArr = urlParam.split("&"); //将参数按照&符分成数组
for (var i = 0; i < urlParamArr.length; i++) {
var paramArr = urlParamArr[i].split("="); //将参数键,值拆开
//如果键雨要删除的不一致,则加入到参数中
if (paramArr[0] != paramKey) {
arr.push(urlParamArr[i]);
}
}
}
if (arr.length > 0) {
nextUrl = "?" + arr.join("&");
}
url = beforeUrl + nextUrl;
return url;
},
}, },
onUnload() { onUnload() {
console.log("卸载----------------", this.options); console.log("卸载----------------", this.options);
...@@ -487,7 +510,9 @@ export default { ...@@ -487,7 +510,9 @@ export default {
} }
//分享页面去掉登录态 //分享页面去掉登录态
if (url.indexOf("sessionid") > -1) { if (url.indexOf("sessionid") > -1) {
url = url.split("?")[0] + "?mixid=" + this.shopId; // url = url.split("?")[0] + "?mixid=" + this.shopId;
url = this.delParam(this.newWindowHref,'sessionid')
url = this.delParam(url,'open_id')
} }
//分销员推广页面 默认分享分销员中心页面 //分销员推广页面 默认分享分销员中心页面
if (url.indexOf("/personalCenter/spokesmanCenter/mine/popularize") > -1) { if (url.indexOf("/personalCenter/spokesmanCenter/mine/popularize") > -1) {
......
// 微信解密 // 微信解密
export function wx_decode(appId,sessionKey,encryptedData,iv) { export function wx_decode(appId, sessionKey, encryptedData, iv) {
var WXBizDataCrypt = require('./WXBizDataCrypt'); var WXBizDataCrypt = require('./WXBizDataCrypt');
var pc = new WXBizDataCrypt(appId, sessionKey); var pc = new WXBizDataCrypt(appId, sessionKey);
var data = pc.decryptData(encryptedData, iv); var data = pc.decryptData(encryptedData, iv);
return data; return data;
}
// 定位方法
export function getUserLocation() {
return new Promise((resolve,reject)=>{
wx.getLocation({
type: 'gcj02', // type有两中类型,gcj02 是腾讯地图所能解析的
success: res => {
resolve(res)
}
})
})
} }
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</view> </view>
<view wx:if="{{datas.componentData.style==='list'}}"> <view wx:if="{{datas.componentData.style==='list'}}">
<view class="imgcontent" bindtap="itemClick" data-item="{{item}}" wx:for="{{datas.componentData.imgList}}" wx:key="index" style="margin-bottom:{{datas.componentData.imgPadding * 2}}rpx"> <view class="imgcontent" bindtap="itemClick" data-item="{{item}}" wx:for="{{datas.componentData.imgList}}" wx:key="index" style="margin-bottom:{{datas.componentData.imgPadding * 2}}rpx">
<image src="{{item.imageUrl}}" lazy-load mode="widthFix"></image> <image src="{{item.imageUrl}}" mode="widthFix"></image>
</view> </view>
</view> </view>
<view wx:elif="{{datas.componentData.style==='across' || datas.componentData.style==='tiled'}}" class="across"> <view wx:elif="{{datas.componentData.style==='across' || datas.componentData.style==='tiled'}}" class="across">
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</view> </view>
<view <view
wx:elif="{{item.iconType==1}}" wx:elif="{{item.iconType==1}}"
class="img-view icons " class="img-view "
> >
<image <image
......
...@@ -1217,9 +1217,19 @@ ...@@ -1217,9 +1217,19 @@
box-sizing: border-box; box-sizing: border-box;
color: white; color: white;
} }
.isItem .item .img-view{
width: 90rpx;
height: 90rpx;
background: var(--main-color);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
border: 4px solid #fff;
}
.icons { .icons {
width: 100rpx; width: 90rpx;
height: 100rpx; height: 90rpx;
background: var(--main-color); background: var(--main-color);
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;
......
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