odc.xiaohui
2023-05-12 4b48bacef8646cee8b66f5e10b0ed7124534e93e
miniprogram/pages/index/index.ts
@@ -32,23 +32,31 @@
                var info = wx.getStorageSync('info')
                console.log("获取缓存:" + role)
                if (role == 0) {
                        wx.redirectTo(
                            {
                                url: '../user/index'
                            }
                        )
                    wx.switchTab({
                        url: '../user/index'
                    })
                        // wx.redirectTo(
                        //     {
                        //         url: '../user/index'
                        //     }
                        // )
                }
                if (role == 1) {
                    wx.redirectTo(
                        {
                            url: '../manager/index'
                        }
                    )
                    wx.switchTab({
                        url: '../user/index'
                    })
                    // wx.redirectTo(
                    //     {
                    //         url: '../user/index'
                    //     }
                    // )
                }
                wx.navigateTo({
                    url: '../' + value
                wx.switchTab({
                    url: '../user/index'
                })
                // wx.navigateTo({
                //     url: '../user/index'
                // })
            } else {// 未登录 显示 微信授权页面
                this.setData({
                    isShow: true
@@ -71,6 +79,9 @@
        wx.login({
            success: (res) => {
                console.log("code", res.code)
                wx.setStorageSync('uesrCode', res.code)
                wx.setStorageSync('userPhoneNumberCode',e.detail.code)
                wx.request({
                    url:app.globalData.url+"/wx/checkIdentity",
                    data: {
@@ -79,8 +90,36 @@
                    },
                    method: "GET",
                    success:(res)=>{
                        console.log(res);
                        wx.setStorageSync('phone', res.data.msg)
                        if (res.data.data==2) {
                            wx.switchTab({
                                url: '../user/index'
                            })
                            // wx.redirectTo(
                            //                         {    url: '../user/index'
                            //                             //   url: '../user/pubulicty/index'
                            //                             // url: '../user/loginInfo/index'
                            //                         }
                            //                     )
                        }else if(res.data.data==0){
                            wx.switchTab({
                                url: '../user/index'
                            })
                            // wx.redirectTo(
                            //     {
                            //         url: '../user/index'
                            //     }
                            // )
                        }else{
                            wx.switchTab({
                                url: '../user/index'
                            })
                            // wx.redirectTo(
                            //     {url: '../user/index'
                            //         // url: '../manager/index'
                            //     }
                            // )
                        }
                    }
                })
                // wx.request({
@@ -91,7 +130,6 @@
                //     },
                //     method: "GET",
                //     success: (res) => {
                //         console.log(res);
                //         //  如果用户已经注册直接进入  未注册进入宣传   role == 0用户  1警员
                //         wx.setStorageSync('token', res.data.data.token)
                //         wx.setStorageSync('role', res.data.data.role)