Commit bb91e74b by 程默

init

parent f9fb9378
......@@ -6,6 +6,7 @@ module.exports = merge(prodEnv, {//zjgyl
SHOP_MIXID:"'antgood'",
NODE_ENV: '"development"',
// BASE_URL:"'https://shop.mayi888.com'",
// BASE_URL:"'http://192.168.1.146:3005'",
BASE_URL:"'https://test-m-shop.mayi888.cn'",
OLSHOP_URL:'"https://test-m-shop.mayi888.cn/innerApi/shopApiService"',
......
......@@ -20,7 +20,7 @@
},
"miniprogramRoot": "dist/wx/",
"compileType": "miniprogram",
"appid": "wxae95a07ffdf11548",
"appid": "wxdec983ee91e2422a",
"projectname": "mayi-mp-shop",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
......@@ -41,8 +41,12 @@
"currentL": -1,
"list": []
},
"gamePlugin": {
"current": -1,
"list": []
},
"miniprogram": {
"current": 0,
"current": -1,
"list": [
{
"id": 0,
......@@ -57,6 +61,13 @@
"pathName": "pages/login/main",
"query": "",
"scene": null
},
{
"id": 2,
"name": "pages/index/main",
"pathName": "pages/index/main",
"query": "scene=pid_6141",
"scene": 1047
}
]
}
......
<template>
<div class="domain">获取微信地址</div>
<!-- {{address}}----{{openid}} -->
<!-- {{address}}----{{openid}} --{{options}}-->
</template>
<script>
......@@ -44,7 +44,6 @@ export default {
this.init();
},
onShow() {
console.log("onshow", this.openSetting);
if (this.openSetting) {
this.openSetting = false;
this.init();
......@@ -65,7 +64,7 @@ export default {
fail: function(res) {
// chooseAddress:fail auth deny ---用户拒绝后msg
// chooseAddress:fail cancel ---用户点击取消按钮
console.log(res, "-------------------65");
console.log(res, "-------------------65",that.options);
//用户取消
console.log(5);
if (res.errMsg.indexOf("cancel") != -1) {
......@@ -180,6 +179,25 @@ export default {
}
});
console.log(this.areaResult,this.userAddressReq,'=====')
//是否直接返回地址信息
if (this.options.refresh) {
// this.options.back+=`&wxAddress=${encodeURIComponent(JSON.stringify(this.userAddressReq))}`
let url=this.options.back;
url+=encodeURIComponent(`&wxAddress=${JSON.stringify(this.userAddressReq)}`);
console.log('refresh',url)
setTimeout(() => {
wx.reLaunch({
url: `../index/main?from=address&backpath=${url}`
});
}, 200);
} else {
this.addAdressRequest();
}
}
},
addAdressRequest() {
addres
.getUserAddressList()
.then(res => {
......@@ -196,11 +214,6 @@ export default {
if (res.data.code == 200) {
console.log("!!!!!!!!!!!!!", this.options.back);
console.log("微信地址", this.userAddressReq);
// setTimeout(() => {
// wx.reLaunch({
// url: `../index/main?from=address&backpath=${this.options.back}`
// });
// }, 200);
} else {
}
......@@ -222,7 +235,6 @@ export default {
});
}
}
}
};
</script>
......
......@@ -33,14 +33,21 @@ export default {
newHref: "",
shareShopName: "",
shareLogoUrl: "",
sharePathStr: "goods/"
shareOrderSn: "",
shareTid:"",
sharePageList: ["goods/", "receivingGift", "orderDetail"]
};
},
onLoad(options) {
Object.assign(this.$data, this.$options.data());
console.log(options, "index------",this.shopId,'-----',wx.getStorageSync("openid"));
//检测
console.log(
options,
"index------",
this.shopId,
"-----",
wx.getStorageSync("openid")
);
//检测登录态
this.checkLogin();
this.options = options;
......@@ -70,11 +77,10 @@ export default {
data: params.sessionid
});
} else if (options.from && options.from == "login") {
//来自登录页面
//来自小程序登录页面
this.page = decodeURIComponent(options.backpath);
this.params += "&" + decodeURIComponent(options.params);
this.params += "&" + decodeURIComponent(options.params)+"&";
} else if (options.from && options.from == "logout") {
console.log("退出-------------");
//来自用户登出
wx.removeStorage({
key: "sessionid"
......@@ -83,10 +89,9 @@ export default {
key: "openid"
});
} else if (options.from && options.from == "address") {
// 来自小程序地址页面
this.link = decodeURIComponent(options.backpath);
console.log("???", this.link);
console.log('adress',options.backpath,this.link)
this.page = "";
this.params = "";
} else if (options.from == "wxPay") {
......@@ -97,16 +102,27 @@ export default {
//来自扫码
// options 中的scene需要使用decodeURIComponent才能获取到生成二维码时传入的scene
var scene = decodeURIComponent(options.scene); //参数二维码传递过来的参数
var query = options.query.dentistId; // 参数二维码传递过来的场景参数
let querys = scene.split("_");
if (querys) {
if (querys[0] == "pid") {
//商品详情 pid_123
this.page = `/goods/${querys[1]}`;
} else if (querys[0] == "activty") {//活动页面activty_turntable_123
this.params+=`&pageInfo=${scene}`
}
}
console.log(querys,'scene');
// var query = options.query.dentistId; // 参数二维码传递过来的场景参数
}
console.log("url", this.link + this.page + this.params);
this.getSpokesman();
},
onShow(){
onShow() {
// console.log('显示了',options.webViewUrl);
},
methods: {
init() {
// 弃用小程序地位
let that = this;
// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
wx.getSetting({
......@@ -125,11 +141,11 @@ export default {
}
});
},
checkLogin(){
let getOpenid=wx.getStorageSync("openid");
let getSessionid=wx.getStorageSync("sessionid");
if (getOpenid=='' || getSessionid=='') {
this.params+='&logOut=true'
checkLogin() {
let getOpenid = wx.getStorageSync("openid");
let getSessionid = wx.getStorageSync("sessionid");
if (getOpenid == "" || getSessionid == "") {
this.params += "&logOut=true";
}
},
getLocationHandle() {
......@@ -177,30 +193,54 @@ export default {
getMessage(res) {
let len = res.target.data.length - 1;
console.log(res, "h5消息", res.target.data[len]);
this.shareShopName = res.target.data[len].shareShopName || "";
this.shareLogoUrl = res.target.data[len].shareLogoUrl;
this.shareLogoUrl = DFSImg(this.shareLogoUrl, 500, 400);
// console.log()
console.log(this.shareLogoUrl,'logourl');
this.shareLogoUrl = DFSImg(res.target.data[len].shareLogoUrl, 500, 400);
//分享内容中有订单信息为送礼活动
if (res.target.data[len].orderSn) {
this.shareOrderSn = res.target.data[len].orderSn;
this.shareTid=res.target.data[len].shareTid;
}
console.log("分享信息:", this.shareLogoUrl, this.shareShopName);
},
checkPageUrl(val) {
for (let i = 0; i < this.sharePageList.length; i++) {
if (val.indexOf(this.sharePageList[i]) != -1) {
return true;
}
}
return false;
}
},
onUnload() {
console.log("卸载----------------", this.options);
},
onShareAppMessage(res) {
console.log(this.shareShopName, "share", res.webViewUrl,'0000',this.shareLogoUrl);
console.log(
this.shareShopName,
"share",
res.webViewUrl,
"0000",
this.shareLogoUrl
);
let url = res.webViewUrl;
//分享页面去掉登录态
if (url.indexOf("sessionid") > -1) {
url = url.split("?")[0] + "?mixid=" + this.shopId;
}
//分享页面为分类页,商品详情页外 跳转首页
console.log(url.indexOf(this.sharePathStr) == -1,'good?')
if (url.indexOf(this.sharePathStr) == -1) {
//分享页面白名单 白名单以外的分享页面为首页
if (!this.checkPageUrl(url)) {
url = this.baseUrl + "?mixid=" + this.shopId;
}
console.log("+++++", this.shareOrderSn);
//有订单为送礼页面
if (this.shareOrderSn != "") {
url = `${this.baseUrl}/activty/receivingGift?mixid=${
this.shopId
}&orderSn=${this.shareOrderSn}&shareTid=${this.shareTid}`;
}
//增加分销员信息
this.shareUrl = url + this.newHref;
console.log(this.shareUrl, "index12");
......
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