小洋人
小洋人
  • 发布:2022-12-20 10:39
  • 更新:2024-10-08 09:30
  • 阅读:243

uni.configMTLS每次都认证成功但是,请求接口仍然失败怎么回事,求大神官方解答一下,下方是我的源码

分类:uni-app
uni.configMTLS({  
                // :19081  
                certificates: [{  
                    host: '183.129.242.246',  
                    client: '/static/client.p12',  
                    clientPassword: '123456',  
                    server: ['']  
                }],  
                success: (res) => {  
                    console.log(res);  

                },  
                fail: (err) => {  
                    console.log(err);  
                },  
                complete: (res) => {  
                    console.log(res);  
                }  
            })  

    uni.request({  
                    url: 'https://183.129.242.246:19081/appserver-restful/requestMessage?fid=HQ1001&content={"tenantId":"iot","rid":"","userAccount":"system","urtDept":"1","password":"123","clientId":"1"}&deviceSign=deviceSign&ruleName=HQ1001&version=5.0',  
                    method: 'POST',  
                    // sslVerify: true,  
                    dataType: 'json',  
                    header: {  
                        'Content-Type': 'application/json',  
                        "Connection": "close",  
                        // 'content-type': 'application/json;charset:utf-8'  
                    },  
                    success: function(res) {  
                        console.log(res);  
                        if (res.statusCode === 200)  
                            console.log(res);  
                        else if (res.statusCode == 401) {  

                            console.log(res);  
                            uni.reLaunch({  
                                url: "/pages/login/login?reason=1",  
                                animationDuration: 450  
                            });  
                        } else {  
                            console.log(res, uni.getStorageSync("qwer") + "api/" + url)  
                            uni.showToast({  
                                title: '服务器请求失败'  
                            });  
                        }  
                    },  
                    fail: function(e) {  
                        console.log(e);  
                        uni.showToast({  
                            title: '服务器请求失败'  
                        });  
                    }  
                })  
2022-12-20 10:39 负责人:无 分享
已邀请:
9***@qq.com

9***@qq.com

有解决这个问题嘛,大佬

要回复问题请先登录注册