2023年10月9日 修复cas登录失效后开屏报错的问题,新增身份

This commit is contained in:
bai 2023-10-09 10:36:03 +08:00
parent 7e8d2a579f
commit 88380a8f22
5 changed files with 42 additions and 2 deletions

View File

@ -25,11 +25,13 @@ const { createMessage, createErrorModal } = useMessage();
/**
* @description: 便
*/
const transform: AxiosTransform = {
export const transform: AxiosTransform = {
/**
* @description:
*/
transformRequestHook: (res: AxiosResponse<Result>, options: RequestOptions) => {
//console.log('最开始的 res =>',res);
const { t } = useI18n();
const { isTransformResponse, isReturnNativeResponse } = options;
// 是否返回原生响应头 比如:需要获取响应头时使用该属性
@ -191,6 +193,7 @@ const transform: AxiosTransform = {
* @description:
*/
responseInterceptorsCatch: (error: any) => {
//console.log('报错了!',error);
const { t } = useI18n();
const errorLogStore = useErrorLogStoreWithOut();
errorLogStore.addAjaxErrorInfo(error);
@ -202,12 +205,18 @@ const transform: AxiosTransform = {
const err: string = error?.toString?.() ?? '';
let errMessage = '';
//console.log('报错了!',response, code, message, config,error,config?.url);
try {
if (code === 'ECONNABORTED' && message.indexOf('timeout') !== -1) {
errMessage = t('sys.api.apiTimeoutMessage');
}
if (err?.includes('Network Error')) {
errMessage = t('sys.api.networkExceptionMsg');
//errMessage = '请刷新';
//刷新页面
window.location.href = config?.url || window.location.href;
}
if (errMessage) {

View File

@ -44,6 +44,11 @@ export const columns: BasicColumn[] = [
align: "center",
dataIndex: 'ytkcs'
},
{
title: '任教专业',
align: "center",
dataIndex: 'rjzy'
},
// {
// title: '每学期应听课次数',
// align: "center",

View File

@ -38,6 +38,12 @@
<j-input placeholder="请输入听课类型" v-model:value="queryParam.sf"/>
</a-form-item>
</a-col>
<a-col :lg="8">
<a-form-item label="听课类型">
<!-- <j-dict-select-tag placeholder="请输入身份" v-model:value="queryParam.tklx" dictCode="tpkwcqkjzglx"/> -->
<j-input placeholder="请输入听课类型" v-model:value="queryParam.rjzy"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">

View File

@ -37,6 +37,11 @@
<a-input v-model:value="formData.ytkcs" placeholder="请输每学期应听课次数" :disabled="disabled"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="任教专业" v-bind="validateInfos.ytkcs">
<a-input v-model:value="formData.rjzy" placeholder="任教专业" :disabled="disabled"></a-input>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
@ -70,6 +75,7 @@
xm: '',
zt: '',
ytkcs: '',
rjzy: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });

View File

@ -65,6 +65,7 @@
</div>
<span class="topTitle" >
<div hidden @click="testKuayu">点击开始跨域报错</div>
<RouterLink :to="{path:'/site/index'}" style="color:white;">{{ projectName }}
<span style="font-size: 16px;" v-if="getSysConfig().flag1">{{getSysConfig().flag1}}({{getSysConfig().bxqkssj}}{{getSysConfig().bxqjssj}})</span>
<span style="font-size: 16px;margin-left: 20px;" >本学期听课要求{{tkyqcs}}<span v-if="tkyqcs!='未配置'"></span>已完成{{tkyqywc}}</span>
@ -101,7 +102,10 @@
import { useUserStore } from '/@/store/modules/user';
import YjfkModal from '/@/views/site/yjfk/YjfkModal.vue';
import { getUserSf,getSysConfig } from '/@/views/site/utils/index';
import { defHttp } from '/@/utils/http/axios';
import { defHttp, transform } from '/@/utils/http/axios';
import { VAxios } from '/@/utils/http/axios/Axios';
const tkyqcs = ref<string>('未配置');
const tkyqywc = ref<string>('0');
@ -161,6 +165,16 @@ function toIndex(){
YjfkModalTab.value.add()
}
const axios = new VAxios({
transform: {
transformRequestHook: transform.transformRequestHook,
responseInterceptorsCatch: transform.responseInterceptorsCatch,
}
});
function testKuayu() {
axios.get({ url: 'https://webvpn.nenu.edu.cn/vpn_key/update?origin=https%3A%2F%2Fzxkccx.webvpn.nenu.edu.cn%2Fjeecg-boot%2FkcJieci%2FkcJieci%2FgetIndexJcList%3F_t%3D1696816325815&reason=site+zxkccx.webvpn.nenu.edu.cn+not+found' });
}
</script>
<style lang="less" scoped>
#siteMain {