Commit 5dbe6a87 authored by wangxuelai's avatar wangxuelai

''

parent 464b4e88
......@@ -155,9 +155,7 @@ Page({
url: `/business/pages/organizationalmgt/index?sid=${res.data.data.list[0].id}`
})
LocalStorage.setItem('teacher', {
// expires_in: data.expires_in,
token: visitor && visitor.token,
// mobile,
role: 2 // 1是校长 2是老师
});
LocalStorage.setItem('dakarole', 2);
......
......@@ -25,11 +25,44 @@ Component({
methods: {
goUserBusiness () {
const visitor = LocalStorage.getItem('visitor');
console.log(visitor, 'visitor')
getMemberId({
open_id: visitor.openid
}).then((res) => {
const {code, data} = res;
if (code == 200) {
if (data.member_id) { // 查询到该微信有机构的情况
LocalStorage.setItem('user', {
token: `bearer ${data.token}`,
mobile: data.mobile
})
LocalStorage.setItem('dakarole', 1);
if (data.member.length > 0) { // 有机构的情况下 跳转到当前机构
wx.navigateTo({
url: `/business/pages/organizationalmgt/index?sid=${data.member[0].id}`
})
} else { // 没有机构的情况下 跳转到新建机构页面
wx.navigateTo({
url: '/business/pages/shopeditor/index?from=1'
})
}
} else { // // 查询到该微信没有机构的情况
if (data.teacher.length > 0) { // 查询到该微信有老师的情况下 跳转到老师的机构管理页面
wx.navigateTo({
url: `/business/pages/organizationalmgt/index?sid=${data.teacher[0].id}`
})
LocalStorage.setItem('teacher', {
token: visitor && visitor.token,
role: 2 // 1是校长 2是老师
});
LocalStorage.setItem('dakarole', 2);
} else { // 查询到该微信没有老师的情况下 跳转到登录页面
wx.navigateTo({
url: '/business/pages/login/index'
})
}
}
}
})
console.log('ssssssssssssssss');
}
}
})
\ 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