Commit d7ae7837 by chengzhichun

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

parents 5de90fc3 0efd79d8
...@@ -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> </div>
<img class="btn-next" src="../../../static/images/next.png" alt=""> <img class="btn-next" src="../../../static/images/next.png" alt="" />
</button> </button>
</div> </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;
...@@ -53,35 +67,35 @@ export default { ...@@ -53,35 +67,35 @@ export default {
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
...@@ -136,6 +136,7 @@ import couponPopup from '@/components/couponPopup.vue' ...@@ -136,6 +136,7 @@ import couponPopup from '@/components/couponPopup.vue'
import NewUser from "../../components/newCustomer/newUser"; import NewUser from "../../components/newCustomer/newUser";
import NewPolite from "../../components/newCustomer/newPolite"; import NewPolite from "../../components/newCustomer/newPolite";
import { setTabBarActive, checkTabbarPage,themeColor } from "../../utils/mayi.js"; import { setTabBarActive, checkTabbarPage,themeColor } from "../../utils/mayi.js";
import indexApi from "@/api/index.js";
import { throttle, concatUrl } from "../../utils/index.js" import { throttle, concatUrl } from "../../utils/index.js"
const app = getApp(); const app = getApp();
...@@ -237,6 +238,38 @@ export default { ...@@ -237,6 +238,38 @@ export default {
data: JSON.stringify(options) data: JSON.stringify(options)
}); });
} }
if(options.scene){
//新二维码扫码进入
wx.nextTick(() => {
indexApi.getShareSceneRecord(options.scene).then(res=>{
if(res.data.code == '200'){
this.page = res.data.data.pageUri;
let paramsObj = JSON.parse(res.data.data.scene);
wx.setStorageSync('attractingCustomerChannelId',paramsObj.attractingCustomerChannelId);
wx.setStorageSync(this.$store.state.mixid+'storeId',paramsObj.storeId);
wx.setStorageSync(this.$store.state.mixid+'sellerId',paramsObj.sellerId);
console.log(res.data.data)
console.log(wx.getStorageSync("openid"))
console.log(333333)
if(wx.getStorageSync("openid")) {
indexApi.addRecord(
{
attractingCustomersChannelId: paramsObj.attractingCustomerChannelId,
miniOpenId: wx.getStorageSync("openid"),
registerFlag: 1,
newRegisterFlag: 0,
}
).then(ele=>{
//清空引客渠道id
wx.setStorageSync('attractingCustomerChannelId','');
})
}
}
}).catch((err)=>{
})
});
}
Object.assign(this.$data, this.$options.data()); Object.assign(this.$data, this.$options.data());
if (options.from && options.from == "logout") { if (options.from && options.from == "logout") {
//来自用户登出 //来自用户登出
...@@ -331,6 +364,7 @@ export default { ...@@ -331,6 +364,7 @@ export default {
if(wx.getStorageSync("sessionid")) { if(wx.getStorageSync("sessionid")) {
//清空门店id //清空门店id
wx.setStorageSync(this.$store.state.mixid+'storeId','') wx.setStorageSync(this.$store.state.mixid+'storeId','')
wx.setStorageSync(this.$store.state.mixid+'sellerId','')
console.log(111222,app.fenxiaoModel) console.log(111222,app.fenxiaoModel)
app.fenxiaoModel.query_isEntry().then((data)=>{ app.fenxiaoModel.query_isEntry().then((data)=>{
//分销弹框信息 //分销弹框信息
......
...@@ -89,6 +89,7 @@ export default { ...@@ -89,6 +89,7 @@ export default {
if(wx.getStorageSync("sessionid")) { if(wx.getStorageSync("sessionid")) {
//清空门店id //清空门店id
wx.setStorageSync(this.$store.state.mixid+'storeId','') wx.setStorageSync(this.$store.state.mixid+'storeId','')
wx.setStorageSync(this.$store.state.mixid+'sellerId','')
} }
this.options = options; this.options = options;
Object.assign(this.$data, this.$options.data()); Object.assign(this.$data, this.$options.data());
...@@ -204,6 +205,7 @@ export default { ...@@ -204,6 +205,7 @@ export default {
let paramsObj = JSON.parse(res.data.data.scene); let paramsObj = JSON.parse(res.data.data.scene);
wx.setStorageSync('attractingCustomerChannelId',paramsObj.attractingCustomerChannelId); wx.setStorageSync('attractingCustomerChannelId',paramsObj.attractingCustomerChannelId);
wx.setStorageSync(this.$store.state.mixid+'storeId',paramsObj.storeId); wx.setStorageSync(this.$store.state.mixid+'storeId',paramsObj.storeId);
wx.setStorageSync(this.$store.state.mixid+'sellerId',paramsObj.sellerId);
console.log(res.data.data) console.log(res.data.data)
console.log(wx.getStorageSync("openid")) console.log(wx.getStorageSync("openid"))
console.log(333333) console.log(333333)
...@@ -468,7 +470,30 @@ export default { ...@@ -468,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);
...@@ -485,7 +510,9 @@ export default { ...@@ -485,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) {
......
...@@ -77,7 +77,8 @@ export default { ...@@ -77,7 +77,8 @@ export default {
test_isHaveUnion: "", test_isHaveUnion: "",
test_unionId: "", test_unionId: "",
fromType:'',//来源类型 mini:小程序跳转到当前登录页 fromType:'',//来源类型 mini:小程序跳转到当前登录页
scene:''//场景 scene:'',//场景
ossLink: ''//第三方点击进入链接
}; };
}, },
onShow() { onShow() {
...@@ -105,8 +106,8 @@ export default { ...@@ -105,8 +106,8 @@ export default {
}) })
}, },
onLoad(options) { onLoad(options) {
login.getShopUserProtocol().then(res => { login.getShopUserProtocol().then(res => {
console.log(res,777888999)
if(res.data.code == '200') { if(res.data.code == '200') {
this.content = res.data.data; this.content = res.data.data;
} }
...@@ -122,6 +123,9 @@ export default { ...@@ -122,6 +123,9 @@ export default {
let params = JSON.parse(options.params); let params = JSON.parse(options.params);
this.fromType = params.fromType; this.fromType = params.fromType;
} }
if(options.ossLink) {
this.ossLink = decodeURIComponent(options.ossLink)
}
this.getshop(); this.getshop();
}, },
methods: { methods: {
...@@ -331,9 +335,13 @@ export default { ...@@ -331,9 +335,13 @@ export default {
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
}); });
}else if (this.scene=='sso' || this.backPath.includes('scene=sso')) { }else if (this.scene=='sso' || this.backPath.includes('scene=sso') || this.ossLink.indexOf('scene=sso')>-1) {
let backPath = this.backPath;
if(this.ossLink) {
backPath += '?'+this.ossLink
}
wx.redirectTo({ wx.redirectTo({
url: `../wxArticle/main?link=${this.backPath}`, url: `../wxArticle/main?link=${encodeURIComponent(backPath)}`,
}); });
}else{ }else{
let parseLink=decodeURIComponent(this.backPath); let parseLink=decodeURIComponent(this.backPath);
...@@ -394,6 +402,7 @@ export default { ...@@ -394,6 +402,7 @@ export default {
city: this.userInfo.city, city: this.userInfo.city,
otherPhone: 0, otherPhone: 0,
storeId: wx.getStorageSync(this.$store.state.mixid+'storeId') || '', storeId: wx.getStorageSync(this.$store.state.mixid+'storeId') || '',
sellerId: wx.getStorageSync(this.$store.state.mixid+'sellerId') || '',
articleId: wx.getStorageSync(this.$store.state.mixid+"articleId") || '', articleId: wx.getStorageSync(this.$store.state.mixid+"articleId") || '',
customerSourceType: wx.getStorageSync(this.$store.state.mixid+"articleId")?8:'', customerSourceType: wx.getStorageSync(this.$store.state.mixid+"articleId")?8:'',
customerSourceId: wx.getStorageSync(this.$store.state.mixid+"articleId") || '' customerSourceId: wx.getStorageSync(this.$store.state.mixid+"articleId") || ''
...@@ -461,6 +470,10 @@ export default { ...@@ -461,6 +470,10 @@ export default {
if(wx.getStorageSync(this.$store.state.mixid+'storeId')) { if(wx.getStorageSync(this.$store.state.mixid+'storeId')) {
query.storeId = wx.getStorageSync(this.$store.state.mixid+'storeId') query.storeId = wx.getStorageSync(this.$store.state.mixid+'storeId')
} }
//埋点导购员
if(wx.getStorageSync(this.$store.state.mixid+'sellerId')) {
query.sellerId = wx.getStorageSync(this.$store.state.mixid+'sellerId')
}
//绑定手机号 //绑定手机号
wx.navigateTo({ wx.navigateTo({
url: `../index/main?from=login&backpath=/login/wxRegister&params=${encodeURIComponent( url: `../index/main?from=login&backpath=/login/wxRegister&params=${encodeURIComponent(
......
...@@ -29,6 +29,7 @@ export default { ...@@ -29,6 +29,7 @@ export default {
}; };
}, },
async onLoad(options) { async onLoad(options) {
this.link='';
console.log(options, "第三方页面"); console.log(options, "第三方页面");
/** /**
* scene=sso 第三方需要登录的页面 * scene=sso 第三方需要登录的页面
...@@ -55,7 +56,6 @@ export default { ...@@ -55,7 +56,6 @@ export default {
if(getUrlKey(decodeURIComponent(link), "getMixId") == '1') {//第三方跳转加mixid if(getUrlKey(decodeURIComponent(link), "getMixId") == '1') {//第三方跳转加mixid
link = forUrlAddKey(decodeURIComponent(link),{mixid: this.$store.state.mixid}) link = forUrlAddKey(decodeURIComponent(link),{mixid: this.$store.state.mixid})
} }
console.log(wx.getStorageSync("sessionid"),446466777777,getUrlKey(decodeURIComponent(link), "mixid"),this.$store.state.mixid)
if (getUrlKey(decodeURIComponent(link), "scene") == "sso") { if (getUrlKey(decodeURIComponent(link), "scene") == "sso") {
if (!wx.getStorageSync("sessionid")) { if (!wx.getStorageSync("sessionid")) {
wx.redirectTo({ wx.redirectTo({
...@@ -132,6 +132,7 @@ export default { ...@@ -132,6 +132,7 @@ export default {
methods: { methods: {
setLink(data) { setLink(data) {
this.link = data; this.link = data;
console.log(this.link,89999999)
}, },
getSsoBcakUrl(link) { getSsoBcakUrl(link) {
let op = { let op = {
...@@ -145,6 +146,7 @@ export default { ...@@ -145,6 +146,7 @@ export default {
}; };
login.getSsoBcakUrl(op).then((res) => { login.getSsoBcakUrl(op).then((res) => {
if (res.data.code == "200") { if (res.data.code == "200") {
console.log('14888888',res)
this.setLink(res.data.data); this.setLink(res.data.data);
} else { } else {
wx.showToast({ title: res.data.msg, icon: "none" }); wx.showToast({ title: res.data.msg, icon: "none" });
......
// 微信解密 // 微信解密
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
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