Commit d8daac12 authored by Mac's avatar Mac

登录处理

parent 1449ee1c
......@@ -118,7 +118,7 @@
let Up = uni.getStorageSync("Up") ? uni.getStorageSync("Up").Up : 0;
let SmallShopId = uni.getStorageSync("SmallShopId") ? uni.getStorageSync("SmallShopId").SmallShopId : 0;
let CounponPassword = uni.getStorageSync("CounponPassword") ? uni.getStorageSync("CounponPassword").CounponPassword : 0;
let KeyWord = uni.getStorageSync("KeyWord") ? uni.getStorageSync("KeyWord").KeyWord : '';
that.request2({
url: '/api/AppletLogin/Login',
data: {
......@@ -130,7 +130,8 @@
SuperiorId: pid,
SmallShopId: SmallShopId,
UserPageType: Up,
CounponPassword:CounponPassword
CounponPassword:CounponPassword,
KeyWord:KeyWord,
}
},
res => {
......@@ -146,6 +147,7 @@
uni.removeStorageSync('SmallShopId');
uni.removeStorageSync("Up");
uni.removeStorageSync("CounponPassword");
uni.removeStorageSync("KeyWord");
}
}
);
......
......@@ -130,7 +130,7 @@
add_show: 1,
showtabs: true,
showCoupons: false,
couponMessage: "",
couponMessage: "恭喜获得20元优惠券",
pageTitleStr: "",
titleStyle: "",
pagePaddingBottom: "0px",
......@@ -184,6 +184,7 @@
educationteacher
},
onLoad(options) {
let that = this;
uni.getSystemInfo({
success(res) {
......@@ -254,12 +255,27 @@
SmallShopId: options.SmallShopId
});
}
options={
CounponPassword:5,
KeyWord:'sadaskdjas',
ComeFrom:'甲鹤专属',
}
//从其他小程序跳转过来
if (options && options.CounponPassword) {
if (options && options.CounponPassword) {//小程序的来自
uni.setStorageSync("CounponPassword", {
CounponPassword: options.CounponPassword
});
}
if (options && options.KeyWord) {//口令
uni.setStorageSync("KeyWord", {
KeyWord: options.KeyWord
});
}
if (options && options.ComeFrom) {//跳过来的文字描述
uni.setStorageSync("ComeFrom", {
ComeFrom: options.ComeFrom
});
}
if (options && options.scene) {
//兼容之前小程序的调转
this.getjump(options.scene);
......@@ -326,34 +342,14 @@
};
that.updateuserinfo(msg);
that.getPageType()
that.sharejump();
// 如果登录的情况下直接跳转商品详情或者直播列表
that.sharejump();
//如果登录状态 并且是uni.getStorageSync("CounponPassword")
if(uni.getStorageSync("CounponPassword")){
that.getunilogin(res)
}
} else {
//静默登录操作
uni.login({
provider: "weixin",
success: (info) => {
let obj = {
Name: res.userInfo.nickName,
Photo: res.userInfo.avatarUrl,
code: info.code,
};
that.getCode(obj);
},
fail: () => {
uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
if (!that.u) {
that.u = {
nickName: "未登录",
avatarUrl: "",
};
that.showAuth = true;
}
},
});
that.getunilogin(res)
}
},
fail: function(e) {
......@@ -487,6 +483,34 @@
},
methods: {
getunilogin(res){
let that = this
//静默登录操作
uni.login({
provider: "weixin",
success: (info) => {
let obj = {
Name: res.userInfo.nickName,
Photo: res.userInfo.avatarUrl,
code: info.code,
};
that.getCode(obj);
},
fail: () => {
uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
if (!that.u) {
that.u = {
nickName: "未登录",
avatarUrl: "",
};
that.showAuth = true;
}
},
});
},
//获取IsOpenReserve
getIsOpenReserve(){
this.request2({
......@@ -589,6 +613,7 @@
uni.getStorageSync("SmallShopId").SmallShopId :
0;
let CounponPassword = uni.getStorageSync("CounponPassword") ? uni.getStorageSync("CounponPassword").CounponPassword : 0;
let KeyWord = uni.getStorageSync("KeyWord") ? uni.getStorageSync("KeyWord").KeyWord : '';
that.request2({
url: "/api/AppletLogin/Login",
......@@ -601,7 +626,8 @@
SuperiorId: pid,
SmallShopId: SmallShopId,
UserPageType: Up,
CounponPassword:CounponPassword
CounponPassword:CounponPassword,
KeyWord:KeyWord,
},
},
(res) => {
......@@ -616,6 +642,7 @@
uni.removeStorageSync("SmallShopId");
uni.removeStorageSync("Up");
uni.removeStorageSync("CounponPassword");
uni.removeStorageSync("KeyWord");
that.getPageType()
if (res.data.IsOpenSchool == 1) { //校园开启
that.init()
......@@ -1094,7 +1121,7 @@
},
yj(){
uni.navigateTo({
url: '/pages/school/investigation?ID=9' //6未开始 9已填 10 //活动结束 //4未填写
url: '/pages/school/investigation?ID=4' //6未开始 9已填 10 //活动结束 //4未填写
})
}
},
......
......@@ -310,7 +310,7 @@
let Up = uni.getStorageSync("Up") ? uni.getStorageSync("Up").Up : 0;
let SmallShopId = uni.getStorageSync("SmallShopId") ? uni.getStorageSync("SmallShopId").SmallShopId : 0;
let CounponPassword = uni.getStorageSync("CounponPassword") ? uni.getStorageSync("CounponPassword").CounponPassword : 0;
let KeyWord = uni.getStorageSync("KeyWord") ? uni.getStorageSync("KeyWord").KeyWord : '';
that.request2({
url: '/api/AppletLogin/Login',
data: {
......@@ -322,7 +322,8 @@
SuperiorId: pid,
SmallShopId: SmallShopId,
UserPageType: Up,
CounponPassword:CounponPassword
CounponPassword:CounponPassword,
KeyWord:KeyWord,
}
},
res => {
......@@ -331,6 +332,8 @@
uni.removeStorageSync('pid');
uni.removeStorageSync('SmallShopId');
uni.removeStorageSync("Up");
uni.removeStorageSync("CounponPassword");
uni.removeStorageSync("KeyWord");
}
}
);
......
......@@ -81,6 +81,7 @@ export default {
let Up = uni.getStorageSync("Up") ? uni.getStorageSync("Up").Up : 0;
let SmallShopId = uni.getStorageSync("SmallShopId") ? uni.getStorageSync("SmallShopId").SmallShopId : 0;
let CounponPassword = uni.getStorageSync("CounponPassword") ? uni.getStorageSync("CounponPassword").CounponPassword : 0;
let KeyWord = uni.getStorageSync("KeyWord") ? uni.getStorageSync("KeyWord").KeyWord : '';
this.request2({
url: '/api/AppletLogin/Login',
data: {
......@@ -92,7 +93,8 @@ export default {
SuperiorId: pid,
SmallShopId: SmallShopId,
UserPageType: Up,
CounponPassword:CounponPassword
CounponPassword:CounponPassword,
KeyWord:KeyWord,
}
},
res => {
......@@ -102,6 +104,7 @@ export default {
uni.removeStorageSync('SmallShopId');
uni.removeStorageSync("Up");
uni.removeStorageSync("CounponPassword");
uni.removeStorageSync("KeyWord");
}
}
);
......
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