| | |
| | | import axios from 'axios'; |
| | | import pinia from '../stores/index' |
| | | import { ElMessage } from 'element-plus'; |
| | | import { useActiveCheck } from '@/stores/activeCheck'; |
| | | import { router } from '@/router/index'; |
| | | |
| | | const debug = false; |
| | | |
| | |
| | | }); |
| | | $fytz.imgUrl = `${ip2_file}images/`; |
| | | |
| | | const activeCheck = useActiveCheck(pinia); |
| | | |
| | | function resetLoginTime() { |
| | | if (activeCheck.isActive()) { |
| | | // 重置登录时限 |
| | | activeCheck.updateLoginTime() |
| | | } |
| | | } |
| | | //添加拦截器 |
| | | [$fysp, $fytz].forEach((i) => { |
| | | // 添加请求拦截器 |
| | | i.interceptors.request.use( |
| | | function (config) { |
| | | // 在发送请求之前做些什么 |
| | | // 添加登录验证 |
| | | if (router.currentRoute._value.fullPath !== '/common/loginView') { |
| | | resetLoginTime() |
| | | } |
| | | // if (import.meta.env.DEV) { |
| | | // console.log('==>请求开始'); |
| | | // console.log(`${config.baseURL}${config.url}`); |