Skip to content

Commit

Permalink
Update api.
Browse files Browse the repository at this point in the history
  • Loading branch information
Geek-James committed Dec 10, 2019
1 parent a3a280a commit 93fa9b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/serve/api/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export default function ajax(url = '', params = {}, type = 'GET') {
if (paramsStr) {
paramsStr = paramsStr.substr(0, paramsStr.lastIndexOf('&'));
// 2.5 拼接完整路径
if (url.indexOf('47.98.157.152') === -1) {
url += '?' + paramsStr + '&geek166=' + randomCode(20);
if (url.indexOf('127.0.0.1') === -1) {
url += '?' + paramsStr + '&Geek-James=' + randomCode(20);
} else {
url += '?' + paramsStr;
}
} else {
if (url.indexOf('47.98.157.152') === -1) {
url += '?geek166=' + randomCode(20)
if (url.indexOf('127.0.0.1') === -1) {
url += '?Geek-James=' + randomCode(20)
}
}
// 2.6 发起get请求
Expand Down
2 changes: 1 addition & 1 deletion src/serve/api/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ajax from './ajax'

// 1. 定义基础路径
const BASE_URL = 'http://ddbuy.7-orange.cn:7300/mock/5def6a2d448e330a1116366e/api/'
const BASE_URL = 'http://api.7-orange.cn:7300/mock/5def6a2d448e330a1116366e/api/'

/*****Home 模块*******/
export const getHomeData = () => ajax(BASE_URL + 'homeApi');
Expand Down
2 changes: 1 addition & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
proxy: {
// 配置跨域处理 可以设置多个
'/api': {
target: 'http://ddbuy.7-orange.cn:7300/mock/5def6a2d448e330a1116366e/api/',
target: 'http://api.7-orange.cn:7300/mock/5def6a2d448e330a1116366e/api/',
ws: true,
changeOrigin: true
}
Expand Down

0 comments on commit 93fa9b7

Please sign in to comment.