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

View File

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

View File

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

View File

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

View File

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