123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <template>
- </template>
- <script>
- import http from '@/utils/request'
- import * as commonuni from '@/utils/commonuni'
- const ystabbar = () => {
- uni.setTabBarItem({
- index: 0,
- visible: true
- })
- uni.setTabBarItem({
- index: 1,
- visible: true
- })
- uni.setTabBarItem({
- index: 2,
- visible: false
- })
- uni.setTabBarItem({
- index: 3,
- visible: false
- })
- }
- const djtabbar = () => {
- uni.setTabBarItem({
- index: 0,
- visible: false
- })
- uni.setTabBarItem({
- index: 1,
- visible: false
- })
- uni.setTabBarItem({
- index: 2,
- visible: true
- })
- uni.setTabBarItem({
- index: 3,
- visible: true
- })
- }
- export default {
- onLoad(option) {
- if (option && (option.code || option.openId)) {
- console.log('code', option.code) // name eagle
- var code = option.code
- var openId = option.openId
- var url = openId != undefined ? "app-api/wxLogin/loginOpenId?openId=" + openId :
- "app-api/wxLogin/login?code=" + code
- http.get(url).then(e => {
- uni.setStorage({
- key: 'openId',
- data: e.openId,
- })
- // commonuni.setStorage("openId",e.openId)
- // 4001 没有该用户 4002未审核 4003审核拒绝
- if (e.code == '4001') {
- //注册页面
- uni.navigateTo({
- url: '../login/register'
- });
- return
- }
- if (e.code == '4002') {
- // 未审核
- uni.navigateTo({
- url: '../login/registerSuccess'
- });
- return
- }
- if (e.code == '4003') {
- // 未审核
- uni.navigateTo({
- url: '../login/registerFail'
- });
- return
- }
- uni.setStorage({
- key: 'token',
- data: e.token,
- })
- http.get("app-api/wxLogin/userInfo").then(user => {
- console.log(user)
- uni.setStorage({
- key: 'userInfo',
- data: user,
- })
- if(e.roleCode.toString().indexOf('YCAdmin')!= -1 && e.roleCode.toString().indexOf('flyAdmin') != -1){
- uni.navigateTo({
- url:'/pages/login/multipleRoles'
- })
- }
- if (e.roleCode.toString().indexOf('YCAdmin') != -1) {
- uni.switchTab({
- url: '../ypczk/djfk/index/djfkIndex'
- });
- djtabbar()
- }
- if(e.roleCode.toString().indexOf('flyAdmin') != -1){
- uni.switchTab({
- url: '../ypczk/index/leaderIndex'
- });
- ystabbar()
- }
- else {
- uni.navigateTo({
- url: '../login/registerFail'
- });
- }
- })
- })
- }
- }
- }
- </script>
- <style>
- </style>
|