提交 18d7a165 编写于 作者: N ninecents

跨域问题修改(尝试)

上级 d59d918a
......@@ -22,7 +22,8 @@ function createWindow(): void {
sandbox: false,
nodeIntegration: true,
webSecurity: false,
allowRunningInsecureContent: true
allowRunningInsecureContent: true,
contextIsolation: false
}
})
......@@ -46,7 +47,8 @@ function createWindow(): void {
responseHeaders: {
...details.responseHeaders,
'Access-Control-Allow-Origin': ['*'],
'Content-Security-Policy': ['*']
// 'Content-Security-Policy': ['default-src \'none\'']
// 'Content-Security-Policy': ['*']
},
});
});
......
......@@ -35,6 +35,9 @@ class MyMp {
_startlogin(imgcode = '') {
return WechatRequest.request({
url: `${Config.api.bizlogin}?action=startlogin`,
headers: {
Referer: Config.baseurl
},
data: qs.stringify({
username: this.username,
pwd: this.pwd,
......
import axios from 'axios'
// import {httpAdapter} from 'axios/lib/adapters/http'
// import httpAdapter2 from 'axios/lib/adapters/http'
// console.log('httpAdapter = ', httpAdapter, httpAdapter2)
import Config from './config';
// import Log from './log';
// import FileCookieStore from 'tough-cookie-filestore';
// import Cache from './cache';
// axios.defaults.adapter = httpAdapter;
axios.defaults.headers.common['Referer'] = Config.baseurl;
// const cookieCache = new Cache('cookie');
// const j = request.jar(new FileCookieStore(cookieCache.cacheFile));
let WechatRequest = axios.create({
method: 'POST',
headers: {
Referer: Config.baseurl,
Host: Config.host,
'User-Agent': Config.userAgent,
// Referer: Config.baseurl,
// Host: Config.host,
// 'User-Agent': Config.userAgent,
'X-Requested-With': 'XMLHttpRequest',
},
withCredentials: true, // send cookies when cross-domain requests
timeout: 5000 // request timeout
timeout: 5000, // request timeout
// adapter: require('axios/lib/adapters/http')
});
// request interceptor
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册