新换域名后,小程序在开发工具中运行正常,但手机端不正常
发布于 5 年前 作者 minshao 16772 次浏览 来自 问答

新换的域名,也设置了合法域名,现在是开发工具中都正常,但是预览和体验版都不能正常运行,获取不到数据,这是怎么回事呢?有没有遇到同样问题的,求指教。

现在就是完全不知道是什么原因造成的,开发工具也没有错误提示,没法调试啊……

3 回复

你好,这种情况一般是证书的问题。

服务器未正确配置证书、服务器TLS版本需要支持TLS1.2及以下、部分证书在Android平台不受信任……具体情况请参考网上对应教程排查解决。

机型分别是OPPOR7、OPPOR9。微信版本都是:6.5.22。

代码如下:

getMyInfo: function () {
    var page = this;
    var appid = 'wx77891cd8843069e8';
    var secret = '16e7143a2681b2cc905719c10438d656';
    var baseUrl = "https://76act.com/";
 
    wx.login({
      success: function (re) {
        console.log('wx.login:%o', re);
        if (re.code) {
          wx.getUserInfo({
            success: function (res) {
 
              console.log('userinfo:%o',res);
              wx.setStorageSync('userInfo', res.userInfo);
              var address = wx.getStorageSync('address');
 
              var data = {
                'username': re.code,
                'password': '123123123',
                'loginType': 'xcx',
                'userSaveBean': { 'username': re.code, 'password': '123123123', 'nickname': res.userInfo.nickName, 'birth': new Date().getTime, 'address': res.userInfo.city, 'mobile': 13111111111, 'headimg': res.userInfo.avatarUrl }
              }
               
              wx.request({
                url: baseUrl + "user/wxlogin",
                data: data,
                method: 'POST',
                header: {
                  'content-type': 'application/json'
                },
                success: function (res) {
                  console.log('success url:%s,res:%o', baseUrl + "user/wxlogin", res);
 
                },
                fail: function (res) {
                  console.log('fail url:%s,res:%o', baseUrl + "user/wxlogin", res);
                }
              });
 
            }
          });
 
        } else {
          console.log('获取用户登录态失败!' + res.errMsg)
        }
      }
    })
 
  },

在电脑端开发工具可以正常调用后台接口,在手机端无法正常调用,并且返回错误。

手机环境错误截图如下:

另外在电脑端的开发工具中已经关闭了禁用SSL检查选项,运行正常,截图如下:

你好,请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码示例。

回到顶部