Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
shanliu committed Jul 23, 2023
1 parent 29489fb commit 5078bb9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion ui/wap/config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"serverURL": "http://175.178.90.181"
"serverURL": "http://lsys.cc",
"serverSslURL": "https://lsys.cc"
}
6 changes: 5 additions & 1 deletion ui/wap/src/utils/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ function errorHandler(error) {
}

export function globalRest(path) {
let api_host = config.serverURL;
if (window.location.protocol == 'https:') {
api_host = config.serverSslURL;
}
let ax = axios.create({
baseURL: config.serverURL + path,
baseURL: api_host + path,
timeout: timeout,
validateStatus: function (status) {
return status >= 200 && status < 600;
Expand Down
3 changes: 2 additions & 1 deletion ui/web/config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"serverURL": "http://175.178.90.181"
"serverURL": "http://lsys.cc",
"serverSslURL": "https://lsys.cc"
}
6 changes: 5 additions & 1 deletion ui/web/src/page/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ function needChangePath(path) {
}
//替换文件路径,图片
function docFileSrc(id, file) {
let url = `${config.serverURL}/api/docs/raw/${id}/${file}`;
let api_host = config.serverURL;
if (window.location.protocol == 'https:') {
api_host = config.serverSslURL;
}
let url = `${api_host}/api/docs/raw/${id}/${file}`;
return url;
}

Expand Down
14 changes: 11 additions & 3 deletions ui/web/src/utils/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ function errorHandler(error) {
}

export function globalRest(path) {
let api_host = config.serverURL;
if (window.location.protocol == 'https:') {
api_host = config.serverSslURL;
}
let ax = axios.create({
baseURL: config.serverURL + path,
baseURL: api_host + path,
timeout: timeout,
validateStatus: function (status) {
return status >= 200 && status < 600;
Expand All @@ -70,16 +74,20 @@ export function globalRest(path) {


export function sessionRest(path) {
let api_host = config.serverURL;
if (window.location.protocol == 'https:') {
api_host = config.serverSslURL;
}
let session = userSessionGet();
if (!session) {
redirectLoginPage()
return axios.create({//防止报错。。。
timeout: timeout,
baseURL: config.serverURL + path,
baseURL: api_host + path,
})
}
let ax = axios.create({
baseURL: config.serverURL + path,
baseURL: api_host + path,
timeout: timeout,
transformResponse: [
(data) => {
Expand Down

0 comments on commit 5078bb9

Please sign in to comment.