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 @@
"build:my": "node build/build.js my"
},
"dependencies": {
"mayi-analytics": "^1.1.14",
"mayi-analytics": "^1.1.24",
"mayi-front-tools": "^1.0.0",
"mpvue": "^2.0.0",
"mpvue-wxparse": "^0.6.5",
......
......@@ -147,6 +147,12 @@ export default {
getShopInfo({ mixid }) {
shop.getShopInfo({ shopMixId: mixid }).then((res) => {
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();
// 商城基本数据
mpApp.shopCallBack && mpApp.shopCallBack(res.data.data);
......
......@@ -28,6 +28,11 @@ Vue.config.productionTip = false
App.mpType = 'app'
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")
.default;
......
<template>
<div class="contact">
<div class="contact-img">
<img src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/HCe2iRXHsP.png" alt="">
</div>
<div class="btn-wrap">
<button open-type="contact">
<div class="btn-main">
<div class="main-img">
<img src="../../../static/images/wx.png" alt="">
</div>
<div class="main-text">官方微信客服</div>
</div>
<img class="btn-next" src="../../../static/images/next.png" alt="">
</button>
<div class="contact">
<div class="contact-img">
<img src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/HCe2iRXHsP.png" alt="" />
</div>
<div class="btn-wrap">
<button open-type="contact" show-message-card :session-from="sessionFrom">
<div class="btn-main">
<div class="main-img">
<img src="../../../static/images/wx.png" alt="" />
</div>
<div class="main-text">官方微信客服</div>
</div>
<img class="btn-next" src="../../../static/images/next.png" alt="" />
</button>
</div>
</div>
</template>
<script>
import { getUserLocation } from "../../utils/wxIndex.js";
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>
<style scoped>
.contact{
padding: 10px 22px 0 22px;
}
.contact-img{
width: 100%;
height: 154px;
margin-bottom: 24px;
background-color: #ccc;
border-radius: 8px;
}
.contact-img img{
width: 100%;
height: 100%;
}
.btn-wrap{
width: 100%;
height: 80px;
box-sizing: border-box;
}
button{
width: 100%;
height: 80px;
border: none;
padding: 20px 10px 20px 10px;
background-color: white;
box-shadow: #eee 0px 0px 5px 4px;
display: flex;
align-items: center;
justify-content: space-between;
}
.btn-main{
display: flex;
height: 40px;
}
.main-img{
width: 54px;
height: 40px;
border-right: 1px solid #D7D4D4;
padding-top: 3px;
}
.main-img img{
width: 42px;
height: 34px;
}
.main-text{
color: #1C1B1B;
font-size:17px;
margin-left: 10px;
}
.btn-next{
width: 9px;
height: 14px;
}
.btn-next img{
width: 100%;
height: 100%;
}
button::after{
border: none;
}
.contact {
padding: 10px 22px 0 22px;
}
.contact-img {
width: 100%;
height: 154px;
margin-bottom: 24px;
background-color: #ccc;
border-radius: 8px;
}
.contact-img img {
width: 100%;
height: 100%;
}
.btn-wrap {
width: 100%;
height: 80px;
box-sizing: border-box;
}
button {
width: 100%;
height: 80px;
border: none;
padding: 20px 10px 20px 10px;
background-color: white;
box-shadow: #eee 0px 0px 5px 4px;
display: flex;
align-items: center;
justify-content: space-between;
}
.btn-main {
display: flex;
height: 40px;
}
.main-img {
width: 54px;
height: 40px;
border-right: 1px solid #d7d4d4;
padding-top: 3px;
}
.main-img img {
width: 42px;
height: 34px;
}
.main-text {
color: #1c1b1b;
font-size: 17px;
margin-left: 10px;
}
.btn-next {
width: 9px;
height: 14px;
}
.btn-next img {
width: 100%;
height: 100%;
}
button::after {
border: none;
}
</style>
\ No newline at end of file
......@@ -136,6 +136,7 @@ import couponPopup from '@/components/couponPopup.vue'
import NewUser from "../../components/newCustomer/newUser";
import NewPolite from "../../components/newCustomer/newPolite";
import { setTabBarActive, checkTabbarPage,themeColor } from "../../utils/mayi.js";
import indexApi from "@/api/index.js";
import { throttle, concatUrl } from "../../utils/index.js"
const app = getApp();
......@@ -237,6 +238,38 @@ export default {
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());
if (options.from && options.from == "logout") {
//来自用户登出
......@@ -331,6 +364,7 @@ export default {
if(wx.getStorageSync("sessionid")) {
//清空门店id
wx.setStorageSync(this.$store.state.mixid+'storeId','')
wx.setStorageSync(this.$store.state.mixid+'sellerId','')
console.log(111222,app.fenxiaoModel)
app.fenxiaoModel.query_isEntry().then((data)=>{
//分销弹框信息
......
......@@ -89,6 +89,7 @@ export default {
if(wx.getStorageSync("sessionid")) {
//清空门店id
wx.setStorageSync(this.$store.state.mixid+'storeId','')
wx.setStorageSync(this.$store.state.mixid+'sellerId','')
}
this.options = options;
Object.assign(this.$data, this.$options.data());
......@@ -204,6 +205,7 @@ export default {
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)
......@@ -468,7 +470,30 @@ export default {
}
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() {
console.log("卸载----------------", this.options);
......@@ -485,7 +510,9 @@ export default {
}
//分享页面去掉登录态
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) {
......
......@@ -77,7 +77,8 @@ export default {
test_isHaveUnion: "",
test_unionId: "",
fromType:'',//来源类型 mini:小程序跳转到当前登录页
scene:''//场景
scene:'',//场景
ossLink: ''//第三方点击进入链接
};
},
onShow() {
......@@ -105,8 +106,8 @@ export default {
})
},
onLoad(options) {
login.getShopUserProtocol().then(res => {
console.log(res,777888999)
if(res.data.code == '200') {
this.content = res.data.data;
}
......@@ -122,6 +123,9 @@ export default {
let params = JSON.parse(options.params);
this.fromType = params.fromType;
}
if(options.ossLink) {
this.ossLink = decodeURIComponent(options.ossLink)
}
this.getshop();
},
methods: {
......@@ -331,9 +335,13 @@ export default {
wx.navigateBack({
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({
url: `../wxArticle/main?link=${this.backPath}`,
url: `../wxArticle/main?link=${encodeURIComponent(backPath)}`,
});
}else{
let parseLink=decodeURIComponent(this.backPath);
......@@ -394,6 +402,7 @@ export default {
city: this.userInfo.city,
otherPhone: 0,
storeId: wx.getStorageSync(this.$store.state.mixid+'storeId') || '',
sellerId: wx.getStorageSync(this.$store.state.mixid+'sellerId') || '',
articleId: wx.getStorageSync(this.$store.state.mixid+"articleId") || '',
customerSourceType: wx.getStorageSync(this.$store.state.mixid+"articleId")?8:'',
customerSourceId: wx.getStorageSync(this.$store.state.mixid+"articleId") || ''
......@@ -461,6 +470,10 @@ export default {
if(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({
url: `../index/main?from=login&backpath=/login/wxRegister&params=${encodeURIComponent(
......
......@@ -29,6 +29,7 @@ export default {
};
},
async onLoad(options) {
this.link='';
console.log(options, "第三方页面");
/**
* scene=sso 第三方需要登录的页面
......@@ -55,7 +56,6 @@ export default {
if(getUrlKey(decodeURIComponent(link), "getMixId") == '1') {//第三方跳转加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 (!wx.getStorageSync("sessionid")) {
wx.redirectTo({
......@@ -132,6 +132,7 @@ export default {
methods: {
setLink(data) {
this.link = data;
console.log(this.link,89999999)
},
getSsoBcakUrl(link) {
let op = {
......@@ -145,6 +146,7 @@ export default {
};
login.getSsoBcakUrl(op).then((res) => {
if (res.data.code == "200") {
console.log('14888888',res)
this.setLink(res.data.data);
} else {
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 pc = new WXBizDataCrypt(appId, sessionKey);
var data = pc.decryptData(encryptedData, iv);
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