收藏
回答

关于界面跳转问题,在模拟器正常,手机必须点开调试才可以跳转,速救?

模拟器 点击正常 跳转。

手机的话 必须开调试模式才可以。

下面是界面两个点击事件的JS 函数

navtap(e) {
    session.getlocation(true).then(res => {
        wx.openSetting({
            success(res) {
                console.log(res.authSetting)
                // res.authSetting = {
                //   "scope.userInfo": true,
                //   "scope.userLocation": true
                // }
            }
        })
    }).catch(e => {
         
        wx.showModal({
            title: '警告',
            content: '请检查是否开启定位'
        })
    })
 
 
    session.getlocation(false).then(res => {
 
        //检查是否 注册过
        app.globalData.bid = 0
        var $this = this
 
         
        session.wxlogin().then(res => {
            if (utils.isEmptyObj(res.user)) {
                app.globalData.needReg = true
                $this.showSplash()
            } else {
                try{
                app.globalData.needReg = false
                $this.show()
 
                let id = e.currentTarget.id
 
                let path = "";
                if (id == 'chengzhong') {
                    path = '/pages/weight/weight'
                } else if (id == 'dianshu') {
                    path = '/pages/count/count'
                }
                wx.switchTab({
                    url: path
                })
                     
                }catch(e){
                    //TODO handle the exception
                    wx.showModal({
                        title: 'TODO',
                        content: 'TODO,TODO'+e
                    })
                }
 
 
            }
        }).catch(e => {
            console.log(e)
            wx.showModal({
                title: '164 error',
                content: '164,164'
            })
        })
        console.log('------------')
 
    }).catch(e => {
        wx.showModal({
            title: '警告',
            content: '请求失败,请检查网络连接'
        })
    })
 
 
      
 
 
}




这是。。提出来的登录 的函数


const wxlogin = () => {
    return new Promise((resolve, reject) => {
        wx.login({
            success: function(res) {
                let code = res.code
                api.get('app/appletUser/openId', {
                    code: code,
                    type:3
                }).then(r => {
                    let app = getApp()
                    app.globalData.userinfo = r
                    if (app.globalData.userinfo.user.name == undefined) {
                        console.log('空了')
                        //註冊
                        wx.navigateTo({
                            url: '/pages/login/login'
                        })
 
                    } else {
                        console.log('23' + app.globalData.userinfo.user.name)
 
                        console.log('23了' + app.globalData.userinfo.mesg)
 
                    }
                    resolve(r)
                }).catch(e => {
                    reject({
                        code: errorcode.ERR_LOGIN_FAILED,
                        msg: e
                    })
                })
            },
            fail: function(e) {
                reject({
                    code: errorcode.ERR_WXLOGIN_FAILED,
                    msg: e
                })
            },
            complete: function() {
 
            }
        })
    })
}
 


最后一次编辑于  11-18
回答关注问题邀请回答
收藏

1 个回答

  • 仙森ღ₅₂₀¹³¹⁴
    仙森ღ₅₂₀¹³¹⁴
    11-18

    写个代码片段吧 老哥。

    11-18
    赞同
    回复 4
    • 青稞
      青稞
      11-18
      谢了,是。。后台的问题,小程序的 服务器域名没有配置 rlgl
      11-18
      回复
    • 仙森ღ₅₂₀¹³¹⁴
      仙森ღ₅₂₀¹³¹⁴
      11-18回复青稞
      emmmm。这样贴代码我们看不出来啥问题。。。提不出啥好的建议。
      11-18
      回复
    • 青稞
      青稞
      11-19回复仙森ღ₅₂₀¹³¹⁴
      不知道啊 选择完格式之后 是好的  点提交就成这样了
      11-19
      回复
    • 仙森ღ₅₂₀¹³¹⁴
      仙森ღ₅₂₀¹³¹⁴
      11-19回复青稞
      好吧。。。😂
      11-19
      回复
问题标签