-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
410 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
NODE_ENV=development | ||
VUE_APP_API= | ||
VUE_APP_DEV=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
NODE_ENV=production | ||
VUE_APP_API= | ||
VUE_APP_DEV=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
NODE_ENV=test | ||
VUE_APP_API= | ||
VUE_APP_DEV=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
module.exports = { | ||
presets: ["@vue/app"] | ||
presets: ["@vue/app"], | ||
plugins: [ | ||
[ | ||
"component", | ||
{ | ||
libraryName: "element-ui", | ||
styleLibraryName: "theme-chalk" | ||
} | ||
] | ||
] | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Vue from "vue"; | ||
import Vuex from "vuex"; | ||
import user from "./modules/user"; | ||
|
||
Vue.use(Vuex); | ||
|
||
const store = new Vuex.Store({ | ||
strict: process.env.NODE_ENV !== "production", | ||
modules: { | ||
user | ||
} | ||
}); | ||
|
||
export default store; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const user = { | ||
state: {}, | ||
mutations: {}, | ||
actions: {}, | ||
getters: {} | ||
}; | ||
|
||
export default user; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import axios from "axios"; | ||
|
||
axios.defaults.headers = { | ||
"Content-Type": "application/json;charset=utf8" | ||
// token: Cookies.get("system_token") || "" | ||
}; | ||
|
||
axios.defaults.baseURL = process.env.VUE_APP_API ? process.env.VUE_APP_API : ""; | ||
// console.log("process.env.VUE_APP_API", process.env.VUE_APP_API); | ||
|
||
// 请求拦截器 | ||
axios.interceptors.request.use( | ||
config => { | ||
return config; | ||
}, | ||
error => Promise.reject(error) | ||
); | ||
|
||
axios.interceptors.response.use( | ||
response => { | ||
return response; | ||
}, | ||
error => Promise.resolve(error.response) | ||
); | ||
|
||
export function formateURLOnlyGet(link: string, json: object) { | ||
let url = link; | ||
var data = Object.entries(json); | ||
|
||
if (data.length) { | ||
url += url.indexOf("?") == -1 ? "?" : ""; | ||
url += Object.entries(data) | ||
.map(item => { | ||
return item[1].join("="); | ||
}) | ||
.join("&"); | ||
} | ||
return url; | ||
} | ||
|
||
/** | ||
* GET请求方法 | ||
* @param {String} url 请求地址 | ||
* @param {json} json 请求参数 | ||
*/ | ||
export function getData(url: string, json: object) { | ||
return axios | ||
.get(formateURLOnlyGet(url, json)) | ||
.then(res => res.data) | ||
.catch(error => error.response); | ||
} | ||
|
||
export function postData(url: string, json: object) { | ||
return axios | ||
.post(url, json) | ||
.then(res => res.data) | ||
.catch(error => error.response); | ||
} | ||
export function deleteData(url: string, json: object) { | ||
return axios({ | ||
url: formateURLOnlyGet(url, json), | ||
method: "delete" | ||
// data: json | ||
}) | ||
.then(res => res.data) | ||
.catch(error => error.response); | ||
} | ||
export function deleteJSON(url: string, json: object) { | ||
return axios({ | ||
url: url, | ||
method: "delete", | ||
data: json | ||
}) | ||
.then(res => res.data) | ||
.catch(error => error.response); | ||
} | ||
export function putData(url: string, json: object) { | ||
return axios({ | ||
url, | ||
method: "put", | ||
data: json | ||
}) | ||
.then(res => res.data) | ||
.catch(error => error.response); | ||
} | ||
|
||
export function downloadFile(url: string, json: object) { | ||
return axios({ | ||
url, | ||
method: "post", | ||
data: json, | ||
withCredentials: true, | ||
responseType: "blob" | ||
}) | ||
.then(res => res) | ||
.catch(error => error.response); | ||
} |
Oops, something went wrong.