首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >wx.request在使用手机预览时不能执行?

wx.request在使用手机预览时不能执行?

提问于 2018-03-19 00:12:01
回答 3关注 0查看 503

一个登陆按钮,在开发环境中测试正常,能够从后台获取数据。

但在手机上预览时点击无反应。

log只能打出“begin”

登陆按钮代码:

clickLogin: function () {

    var userInput = getApp().data.userPhone;

    var pwdInput = getApp().data.passWord;

    console.log('begin')

    // 登陆验证

  wx.request({

      url: 'https://我自己的=' + userInput + '&password=' + pwdInput,

      header: {

        'content-type': 'application/json'

      },

      success: function (res) {

        console.log(res.data)

        if (res.data.hasData == 1) {

          getApp().data.userName = res.data.user.name;

          getApp().data.userId = res.data.user.admId;

          getApp().data.userAge = res.data.user.age;

          getApp().data.userCity = res.data.user.city;

          getApp().data.userEmail = res.data.user.email;

          getApp().data.userPhone = res.data.user.phone;

          getApp().data.userSex = res.data.user.sex;

          getApp().data.userUpId = res.data.user.upId;

          getApp().data.userRoleType = res.data.user.userRoleType;

          getApp().data.userStatusId = res.data.user.usrStatusId;

         console.log(getApp().data.userId)

          console.log(getApp().data.userName)

          wx.switchTab({

           url: '/pages/index/index',

          })

        } else {

         wx.showToast({

            title: '手机或密码错误',

            icon: 'loading'

          })

        }

      }

    })

  },

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档