明树Git Lab

Commit e9e1da98 authored by chenron's avatar chenron
parents 754ee983 43d73b63
Pipeline #104033 passed with stage
in 12 seconds
import axios from "axios"; import axios from "axios";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import windowConfig from "@/window";
axios.interceptors.request.use(function (config) { axios.interceptors.request.use(function (config) {
let token = "8681f75e775447f7903708c55a35634e"; let token = "8681f75e775447f7903708c55a35634e";
if (token) { if (token) {
...@@ -23,12 +24,11 @@ axios.interceptors.response.use(response => { ...@@ -23,12 +24,11 @@ axios.interceptors.response.use(response => {
} }
return Promise.reject(err); return Promise.reject(err);
}); });
let baseUrl = "http://10.40.8.9:3000"
export function $get ({ url, params = {}, callback }) { export function $get ({ url, params = {}, callback }) {
return axios({ return axios({
method: "get", method: "get",
url: baseUrl + url, url: windowConfig.baseUrl + url,
params params
}).then(response => { }).then(response => {
callback && callback(response.data); callback && callback(response.data);
...@@ -39,7 +39,7 @@ export function $get ({ url, params = {}, callback }) { ...@@ -39,7 +39,7 @@ export function $get ({ url, params = {}, callback }) {
}; };
export function $post ({ url, data = {}, callback }) { export function $post ({ url, data = {}, callback }) {
return axios.post(baseUrl + url, data).then((response) => { return axios.post(windowConfig.baseUrl + url, data).then((response) => {
if (response.code === 0) { if (response.code === 0) {
callback && callback(response.data); callback && callback(response.data);
} else { } else {
......
...@@ -9,11 +9,13 @@ import { createPinia } from 'pinia'; ...@@ -9,11 +9,13 @@ import { createPinia } from 'pinia';
import "./assets/fonts/font.less"; // 字体样式 import "./assets/fonts/font.less"; // 字体样式
import "../public/iconFont/iconfont.css"; // 图标字体样式 import "../public/iconFont/iconfont.css"; // 图标字体样式
import { $get, $post } from "@/data/https.js"; import { $get, $post } from "@/data/https.js";
import windowConfig from "@/window";
const pinia = createPinia() const pinia = createPinia()
const app = createApp(App) const app = createApp(App)
app.config.globalProperties.$get = $get; app.config.globalProperties.$get = $get;
app.config.globalProperties.$post = $post; app.config.globalProperties.$post = $post;
app.config.globalProperties.windowConfig = windowConfig;
for (const [key, component] of Object.entries(ElIcons)) { for (const [key, component] of Object.entries(ElIcons)) {
app.component(key, component) app.component(key, component)
} }
......
This diff is collapsed.
export default {
baseUrl: "http://10.40.8.9:3000"
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment