Commit a077959f authored by lvtz's avatar lvtz

fix

parent 759969be
......@@ -128,6 +128,11 @@ Page({
})
},
onShow: function () { // Do something when page show.
this.setData({
storageUser : LocalStorage.getItem("user")
})
console.log(this.data.storageUser,'user')
if (this.data.sid != 0) {
this.userShow();
}
......@@ -136,6 +141,7 @@ Page({
this.setData({
loginCode: res.code
})
console.log(res,'red')
})
},
onHide: function () { // Do something when page hide.
......@@ -285,6 +291,77 @@ Page({
})
})
},
loginToManagerWaitDel(){
wx.navigateTo({
url: `/business/pages/organizationalmgt/newinfo`
})
},
// 新授权
getPhoneNumber(e){
let that = this;
this.log('loginToManager')
const visitor = LocalStorage.getItem('visitor') || {};
let user = LocalStorage.getItem('user');
console.log(user,'user')
// if(user && user.token){
// wx.navigateTo({
// url: `/business/pages/exchangebusiness/index?from=1`
// })
// return
// }
const { encryptedData, iv } = e.detail;
if (e.detail.errMsg == 'getPhoneNumber:fail user deny') { //用户点击拒绝
wx.showToast({
title: '获取手机号失败',
icon: 'none'
})
} else { //允许授权执行跳转
bTokenExchange({
type: 5,
mobile_code: that.data.loginCode,
mobile_iv: iv,
mobile_data: encryptedData,
}).then(res => {
const { code, data } = res;
if(code == 200){
getMember().then(res=>{
const {data,code} = res;
if(code==40000){
// 没绑定微信或者没有校区
wx.navigateTo({
url: `/business/pages/organizationalmgt/newinfo`
})
}else if(code==200){
if(data.member.length + data.teacher.length > 0){
LocalStorage.setItem('user', {
token: `bearer ${data.token}`,
})
LocalStorage.setItem('teacher', {
token: `bearer ${data.token}`,
})
wx.navigateTo({
url: `/business/pages/exchangebusiness/index?from=1`
})
}else{
wx.navigateTo({
url: `/business/pages/organizationalmgt/newinfo`
})
}
}else{
wx.showToast({
title: '登录失败',
duration: 500
})
}
}).catch((err) => {
wx.navigateTo({
url: `/business/pages/loginregistermgt/login`
})
})
}
})
}
},
noticecountGet() {
noticecount({
......
......@@ -126,6 +126,27 @@
<text class="title">机构登录</text>
<text class="desc">老师/校长在这里登录</text>
</view>
<view class="menu-item" bindtap="loginToManager" wx:if="{{ storageUser && storageUser.token }}">
<loginbtn loginCode="{{loginCode}}"/>
<image class="menuicon" src="{{imageRoot}}2c/ucenter2/icon_tologin.png?{{imageVersion}}"></image>
<text class="title">新登录</text>
<text class="desc"></text>
</view>
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" class="menu-item" wx:else>
<!-- <loginbtn loginCode="{{loginCode}}"/> -->
<image class="menuicon" src="{{imageRoot}}2c/ucenter2/icon_tologin.png?{{imageVersion}}"></image>
<text class="title">新登录</text>
<text class="desc"></text>
</button>
<view class="menu-item" bindtap="loginToManagerWaitDel">
<loginbtn loginCode="{{loginCode}}"/>
<image class="menuicon" src="{{imageRoot}}2c/ucenter2/icon_tologin.png?{{imageVersion}}"></image>
<text class="title">创建新校区</text>
<text class="desc"></text>
</view>
</view>
<btabbar
......
......@@ -217,6 +217,8 @@ page{
flex-direction: column;
position: relative;
padding: 27rpx 0;
margin: 0;
background: #fff;
}
.menu-box .menu-item .menuicon {
width: 46rpx;
......
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