You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
1.6 KiB
80 lines
1.6 KiB
|
|
|
|
|
|
|
|
import aes from "@/utils/aes.js";
|
|
module.exports = {
|
|
config: function(name) {
|
|
var info = null;
|
|
if (name) {
|
|
var name2 = name.split("."); //字符分割
|
|
if (name2.length > 1) {
|
|
info = configdata[name2[0]][name2[1]] || null;
|
|
} else {
|
|
info = configdata[name] || null;
|
|
}
|
|
if (info == null) {
|
|
let web_config = cache.get("web_config");
|
|
if (web_config) {
|
|
if (name2.length > 1) {
|
|
info = web_config[name2[0]][name2[1]] || null;
|
|
} else {
|
|
info = web_config[name] || null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return info;
|
|
},
|
|
post: function(url, data, header) {
|
|
for(var key in data){
|
|
if(key!="loginname"){
|
|
data[key] = aes.aesMinEncrypt(data[key]);
|
|
}
|
|
}
|
|
console.log(data)
|
|
header = header || "application/x-www-form-urlencoded";
|
|
// url = this.config("ROOTPATH")+url;
|
|
return new Promise((succ, error) => {
|
|
uni.request({
|
|
url: url,
|
|
data: data,
|
|
method: "POST",
|
|
header: {
|
|
"content-type": header
|
|
},
|
|
xhrFields : {
|
|
withCredentials : true // 这里设置了withCredentials
|
|
},
|
|
success: function(result) {
|
|
succ.call(self, result.data)
|
|
},
|
|
fail: function(e) {
|
|
error.call(self, e)
|
|
}
|
|
})
|
|
})
|
|
},
|
|
get: function(url, data, header) {
|
|
|
|
header = header || "application/x-www-form-urlencoded";
|
|
// url = this.config("ROOTPATH")+url;
|
|
return new Promise((succ, error) => {
|
|
uni.request({
|
|
url: url,
|
|
data: data,
|
|
method: "GET",
|
|
header: {
|
|
"content-type": header,
|
|
},
|
|
success: function(result) {
|
|
succ.call(self, result.data)
|
|
},
|
|
fail: function(e) {
|
|
error.call(self, e)
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|