diff --git a/api/api.js b/api/api.js index a23d48a..ce62b95 100644 --- a/api/api.js +++ b/api/api.js @@ -1,8 +1,9 @@ -const url_ = "http://code.dev.sa0.online:88"; +import $config from '@/config.js' +const url_ = $config.url; let url_array = {}; url_array['YO'] = `${url_}/api/yo`; const api = (mark) => { if (mark === '') return url_; return url_array[mark]; } -export default api; +export default api; \ No newline at end of file diff --git a/api/index.js b/api/index.js index 887e954..a24e193 100644 --- a/api/index.js +++ b/api/index.js @@ -1,14 +1,16 @@ import { - $post + $post } from '@/lu/axios.js' -const url_ = "http://code.dev.sa0.online:88"; - +import $config from '@/config.js' +const url_ = $config.url; export const yo = async (data) => await $post({ - url: 'YO', - data -}) + url: 'YO', + data +}) export const $image = (path) => { + if (path.indexOf('data:image/') !== -1) return path + if (path.indexOf('http') !== -1) return path return `${url_}${path}` } @@ -21,4 +23,4 @@ export const $response = (response, then, error = () => {}) => { } then() } -} +} \ No newline at end of file diff --git a/config.js b/config.js index 8f76374..368ae87 100644 --- a/config.js +++ b/config.js @@ -1,3 +1,14 @@ +let url = 'http://code.dev.sa0.online:88' +let env = 'online' +if (process.env.NODE_ENV == 'development') { + env = 'dev' +} +// env = 'online' +// env = 'dev' +if (env === 'dev') { + url = 'http://127.0.0.1:8000' +} export default { - title: '鹿和开发套件' -} + title: '鹿和开发套件', + url, +} \ No newline at end of file diff --git a/index.html b/index.html index aa75b77..9efb733 100644 --- a/index.html +++ b/index.html @@ -6,35 +6,6 @@