This commit is contained in:
pengxiaolong
2025-05-15 22:24:39 +08:00
parent 838cfd9986
commit 595c5329a0
44 changed files with 5142 additions and 81 deletions

52
components/request.js Normal file
View File

@@ -0,0 +1,52 @@
export default function request(urldata) {
const {url, data, method, header,userInfo} = urldata;
const baseUrl =
"http://192.168.0.218:8086"
+url;
console.log("``````````````````````````````````",userInfo);
if (userInfo) {
uni.getStorage({
key: "userinfo",
success: (res) => {
if(res.data){
if(res.data.nickName){
return new Promise((resolve, reject) => {
uni.request({
url: baseUrl,
data: data,
method: method,
header: header,
success: function (res) {
resolve(res.data);
},
fail: function (res) {
reject(res);
}
});
});
}else{
uni.reLaunch({ url: "/pages/UserInformation/UserInformation"})
}
}else{
uni.navigateTo({ url: '/pages/login/login' })
}
}
});
}else{
return new Promise((resolve, reject) => {
uni.request({
url: baseUrl,
data: data,
method: method,
header: header,
success: function (res) {
resolve(res.data);
},
fail: function (res) {
reject(res);
}
});
});
}
}