From 118eb6451015ec7685071bf73d6dcbeb85e4e2d0 Mon Sep 17 00:00:00 2001 From: Apple <> Date: Wed, 13 Jul 2022 05:27:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=8B=E5=87=8F=E9=87=91=E5=90=8E=E5=8F=B0V1?= =?UTF-8?q?=5F3=5F0=E9=94=81=E5=AE=9A=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 41 +++++++++++++++++------------------- src/pages/login/loginform.js | 2 +- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/assets/api.js b/src/assets/api.js index 2ea1094b..17b28957 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -1,27 +1,24 @@ import { Notify } from 'zent' // export const baseurl = 'https://marketapi.1688sup.com' -// window.baseurl = 'https://marketapi.1688sup.com' -// const Version = 'v1.2.0' -window.baseurl = 'http://pre.marketapi.1688sup.com' -let baseurl = 'http://pre.marketapi.1688sup.com' -// if (process.env.NODE_ENV == 'test' || process.env.NODE_ENV == 'development') { -// // 测试环境 -// baseurl = 'http://192.168.6.75' -// window.baseurl = 'http://192.168.6.75' -// } -// if (process.env.NODE_ENV == 'production') { -// // 生成环境 -// baseurl = 'https://marketapi.1688sup.com' -// } -// export let HOST = host; -// export let API_URL = api_url; -// export const baseurl = window.baseurl +const Version = 'v1.3.0' +// window.baseurl = 'http://pre.marketapi.1688sup.com' +let baseurl = '' +if (process.env.NODE_ENV == 'test' || process.env.NODE_ENV == 'development') { + // 测试环境 + baseurl = 'http://192.168.6.75' + window.baseurl = 'http://192.168.6.75' +} +if (process.env.NODE_ENV == 'production') { + // 生成环境 + baseurl = 'https://marketapi.1688sup.com' + window.baseurl = 'https://marketapi.1688sup.com' +} const upload = (method, url, params, responseType) => { let obj = { method: method, headers: new Headers({ authorization: sessionStorage.getItem('authorization'), - // Version: Version + Version: Version }), body: params } @@ -63,7 +60,7 @@ const derive = (method, url, params, responseType) => { responseType: 'blob', headers: new Headers({ authorization: sessionStorage.getItem('authorization'), - // Version: Version + Version: Version }) } if (method == 'get') { @@ -119,7 +116,7 @@ const getData = (method, url, params, responseType) => { obj = { headers: new Headers({ authorization: sessionStorage.getItem('authorization'), - // Version: Version + Version: Version }) } if (params) { @@ -179,7 +176,7 @@ const req = (method, url, params, responseType) => { obj = { headers: new Headers({ authorization: sessionStorage.getItem('authorization'), - // Version: Version + Version: Version }) } if (params) { @@ -201,7 +198,7 @@ const req = (method, url, params, responseType) => { body: JSON.stringify(params), headers: new Headers({ 'Content-Type': 'application/json', - // Version: Version + Version: Version }) } } @@ -213,7 +210,7 @@ const req = (method, url, params, responseType) => { headers: new Headers({ 'Content-Type': 'application/json', authorization: sessionStorage.getItem('authorization'), - // Version: Version + Version: Version }) } } diff --git a/src/pages/login/loginform.js b/src/pages/login/loginform.js index 0f1f3f3f..85397c21 100644 --- a/src/pages/login/loginform.js +++ b/src/pages/login/loginform.js @@ -160,7 +160,7 @@ const getAccountList = () => { console.log(145, window.baseurl); const xhr = new XMLHttpRequest(); xhr.open("GET", window.baseurl + "/auth/login/verify"); - // xhr.setRequestHeader("Version", "v1.2.0"); + xhr.setRequestHeader("Version", "v1.3.0"); xhr.responseType = "arraybuffer"; xhr.onreadystatechange = function (response) { response.header = {