hejianhao
2025-03-31 c755c856dffb98fe1a34f9f8ded92d0cff278332
打包配置修改、401拦截跳转管理后台
5个文件已修改
38 ■■■■ 已修改文件
.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/DataScreen.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vite.config.js 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -11,6 +11,7 @@
node_modules
.DS_Store
dist
guotouScreen
dist-ssr
*.local
src/main.js
@@ -3,6 +3,7 @@
import App from './App.vue'
import router from './router'
import store from './store'
import "element-ui/lib/theme-chalk/index.css";
import './assets/main.css'
src/utils/request.js
@@ -3,7 +3,7 @@
  Message
} from 'element-ui'
const service = axios.create({
  baseURL: '/',  // 使用相对路径,让代理生效
  baseURL: 'https://xzgt.test.591taxi.cn/admin',
  withCredentials: false, // 当跨域请求时发送cookie
  timeout: 30000, // request timeout
})
@@ -57,6 +57,18 @@
        })
        return Promise.reject(new Error(res.data.message))
      }
      if (res.data.code == 103 || res.data.code == 401) {
        Message({
          message: '登录已过期,请重新登录',
          type: 'warning',
          duration: 2000
        })
        setTimeout(() => {
          localStorage.clear();
          window.location.replace(`https://xzgt.test.591taxi.cn/web/?#/login`);
        }, 2000)
        return Promise.reject(res.data.data)
      }
      return res.data
    } else {
      Message({
src/views/DataScreen.vue
@@ -18,6 +18,9 @@
import RightPanel from '@/components/RightPanel.vue'
import BottomCharts from '@/components/BottomCharts.vue'
import { getStaticsData, getRentRank, getRentIncomeTrend, getTenantCountTrend } from '@/components/service'
import {
  Message
} from 'element-ui'
export default {
  name: 'DataScreen',
@@ -41,6 +44,16 @@
    if (this.$route.query.token || localStorage.getItem('token')) {
      localStorage.setItem('token', 'Bearer ' + this.$route.query.token)
      this.fetchData()
    } else {
      Message({
        message: '登录已过期,请重新登录',
        type: 'warning',
        duration: 2000
      })
      setTimeout(() => {
        localStorage.clear();
        window.location.replace(`https://xzgt.test.591taxi.cn/web/?#/login`);
      }, 2000)
    }
  },
  methods: {
@@ -69,13 +82,13 @@
}
/* 添加全局字体声明 */
@font-face {
/* @font-face {
  font-family: 'DIN';
  src: url('https://fonts.cdnfonts.com/css/din-next-lt-arabic') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
} */
.main-content {
  flex: 1;
vite.config.js
@@ -5,8 +5,11 @@
// https://vitejs.dev/config/
export default defineConfig({
  build: {
    outDir: 'guotouScreen',
  },
  plugins: [vue2()],
  publicPath: './',
  base: '/large',
  server: {
    proxy: {
      "/screen": {