Commit d8daac12 authored by Mac's avatar Mac

登录处理

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