This commit is contained in:
duanxiaohai 2024-07-17 16:46:45 +08:00
commit dc41019941
5 changed files with 120 additions and 112 deletions

View File

@ -1,17 +1,16 @@
import axios from 'axios';
import { ElMessage } from 'element-plus'
import tools from '@/utils/tools'
import router from '../router';
import axios from "axios";
import { ElMessage } from "element-plus";
import tools from "@/utils/tools";
import router from "../router";
// axios.defaults.baseURL = '/api'
axios.defaults.timeout = 120000
axios.defaults.timeout = 120000;
// HTTP request 拦截器
axios.interceptors.request.use(
(config) => {
let token = tools.data.get('token');
let token = tools.data.get("token");
if (token) {
config.headers['x-token'] = token
config.headers["x-token"] = token;
}
return config;
},
@ -31,14 +30,14 @@ axios.interceptors.response.use(
ElMessage.error("请重新登录!");
// window.location.href = '/#/login?returnURL=' + window.location.href
window.location.href =
'http://220.191.238.50:996/api/login?returnURL=' +
window.location.href
"http://220.191.238.50:996/api/login?returnURL=" +
window.location.href;
} else if (error.response.status == 404) {
ElMessage.error("Status:404正在请求不存在的服务器记录");
} else if (error.response.status == 500) {
ElMessage.error({
title: '请求错误',
message: "Status:500服务器发生错误"
title: "请求错误",
message: "Status:500服务器发生错误",
});
} else {
ElMessage.error(`Status:${error.response.status},未知错误!`);
@ -51,15 +50,15 @@ axios.interceptors.response.use(
);
var http = {
/** get
* @param {接口地址} url
* @param {请求参数} params
*/
get: function (url, params) {
return new Promise((resolve, reject) => {
axios.get(url, {
params: params
axios
.get(url, {
params: params,
})
.then((response) => {
if (response.data.code == 400 && response.data.msg) {
@ -70,7 +69,7 @@ var http = {
.catch((error) => {
reject(error);
});
})
});
},
/** post
@ -79,7 +78,8 @@ var http = {
*/
post: function (url, params) {
return new Promise((resolve, reject) => {
axios.post(url, params)
axios
.post(url, params)
.then((response) => {
if (response.data.code == 400 && response.data.msg) {
ElMessage.error(response.data.msg);
@ -89,12 +89,13 @@ var http = {
.catch((error) => {
reject(error);
});
})
});
},
put: function (url, params) {
return new Promise((resolve, reject) => {
axios.put(url, params)
axios
.put(url, params)
.then((response) => {
if (response.data.code == 400 && response.data.msg) {
ElMessage.error(response.data.msg);
@ -104,12 +105,13 @@ var http = {
.catch((error) => {
reject(error);
});
})
});
},
delete: function (url, params) {
return new Promise((resolve, reject) => {
axios.delete(url, params)
axios
.delete(url, params)
.then((response) => {
if (response.data.code == 400 && response.data.msg) {
ElMessage.error(response.data.msg);
@ -119,14 +121,14 @@ var http = {
.catch((error) => {
reject(error);
});
})
});
},
download: function (url) {
let user = tools.data.get('user');
let user = tools.data.get("user");
let token = "x-token=" + user.token;
url = url + (url.indexOf("?") > 0 ? "&" : "?") + token;
window.open(url);
}
}
},
};
export default http;

View File

@ -864,6 +864,7 @@ onBeforeUnmount(() => {
}
.left_1 {
cursor: pointer;
background-image: url(@/assets/images/sjfx/lnsjfx.png);
background-repeat: no-repeat;
background-size: 100% 100%;

View File

@ -561,7 +561,7 @@ const selectChange2 = () => {
setTimeout(() => {
showR.value = true;
}, 300);
}, 100);
};
// const ratingBtn = (item) => {
@ -1568,6 +1568,7 @@ onMounted(() => {
.schoolbs {
// width: 128px;
cursor: pointer;
height: 41px;
padding: 0px 20px 0 30px;
background-image: url(@/assets/eduImg/jyImg1.png);

View File

@ -413,6 +413,7 @@
class="ylws_item"
v-for="(item, index) in data.ylwsList"
:key="index"
:style="{'cursor': item.name=='医院卫生院' ? 'pointer' : ''}"
@click="showDialog2(item.name, '/api/ggfwyth/yywsyList')"
>
<div class="name">{{ item.name }}</div>
@ -2507,6 +2508,7 @@ onBeforeMount(async () => {
justify-content: space-around;
&_item {
cursor: pointer;
box-sizing: border-box;
width: 160px;
height: 112px;
@ -3184,6 +3186,7 @@ table {
margin-bottom: 15px;
padding-top: 20px;
.jtsyBoxtop1 {
cursor: pointer;
position: relative;
display: flex;
overflow: hidden;

View File

@ -1087,6 +1087,7 @@ const getData = () => {
align-items: center;
.history1 {
cursor: pointer;
font-size: 26px;
color: #ffffff;
line-height: 30px;