|
|
@@ -38,8 +38,49 @@
|
|
|
},
|
|
|
{
|
|
|
replaceText: languageInfo.langReplaceText,
|
|
|
- langReplaceTextIgnoreKeys: languageInfo.langReplaceTextIgnoreKeys
|
|
|
+ langReplaceTextIgnoreKeys: languageInfo.langReplaceTextIgnoreKeys,
|
|
|
+ fetcher: (params) => {
|
|
|
+ var systemUri = getSystemIp();
|
|
|
+ var method = params.method;
|
|
|
+ var data = params.data;
|
|
|
+ var body = params.body;
|
|
|
+ var url = systemUri + params.url;
|
|
|
+
|
|
|
+ var form = new FormData();
|
|
|
+ form = JSON.stringify(params.data);
|
|
|
+ var ContentType = 'application/x-www-form-urlencoded';
|
|
|
+ // var ContentType = 'application/json';
|
|
|
+ let header = {
|
|
|
+ "Content-Type": ContentType,
|
|
|
+ "Authorization":'Bearer ' + getToken(),
|
|
|
+ }
|
|
|
+
|
|
|
+ let isFormData = (typeof FormData !== 'undefined') && (params['data'] instanceof FormData);
|
|
|
+
|
|
|
+ // if (isFormData) {
|
|
|
+ // delete header['Content-Type'];
|
|
|
+ // form = data;
|
|
|
+ // }
|
|
|
+
|
|
|
+ let headers = new Headers(header);
|
|
|
+
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
+ fetch(url,{
|
|
|
+ method: method,
|
|
|
+ body: params.data,
|
|
|
+ headers: headers
|
|
|
+ }).then(function (response) {
|
|
|
+ return response.json();
|
|
|
+ }).then(function (res) {
|
|
|
+
|
|
|
+ // if (isFormData) {
|
|
|
+ // data['data'] = res.data;
|
|
|
+ // }
|
|
|
+ resolve({ "data": res });
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
+ },
|
|
|
);
|
|
|
|
|
|
getVerify();
|
|
|
@@ -51,9 +92,10 @@
|
|
|
// document.querySelector('.code_img').src = 'http://localhost:8081/login/verifyCode?' + Math.random();
|
|
|
}
|
|
|
function getVerify() {
|
|
|
+ var systemUri = getSystemIp();
|
|
|
// 创建请求对象
|
|
|
var request = new XMLHttpRequest()
|
|
|
- request.open('post', 'http://localhost:8081/login/verifyCode')
|
|
|
+ request.open('post', systemUri+'/login/verifyCode')
|
|
|
request.send()
|
|
|
// 获取网络请求响应的数据
|
|
|
request.onreadystatechange = function () {
|