From b94c71b85aac6bf8551659f8ca990fc2cd643633 Mon Sep 17 00:00:00 2001 From: shuxiaokai <2581105856@qq.com> Date: Thu, 16 Sep 2021 18:08:16 +0800 Subject: [PATCH] =?UTF-8?q?upd:=20=E6=9B=B4=E6=96=B0=E4=B8=8A=E7=BA=BF?= =?UTF-8?q?=E6=96=87=E6=A1=88=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/renderer/App.vue | 21 ++++++++++++++++++++- src/renderer/api/api.ts | 3 +++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7c21765e..dc38ca11 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moyu", - "version": "0.2.0", + "version": "0.8.0", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/src/renderer/App.vue b/src/renderer/App.vue index ab840c50..e4f2d64e 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -14,6 +14,7 @@ import { defineComponent } from "vue" import { ElConfigProvider } from "element-plus" import zhCn from "element-plus/lib/locale/lang/zh-cn" +import config from "@/../config/config" export default defineComponent({ components: { @@ -24,7 +25,25 @@ export default defineComponent({ locale: zhCn, }; }, - methods: { + created() { + if (!config.isDev) { + console.log(` + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + / _ \\ / _ \\ / _ _ _ _ _ _ \\ \\ \\ / / | | | | + / / \\ \\ / / \\ \\ / / \\ \\ \\ \\ / / | | | | + / / \\ \\ / / \\ \\ | | | | \\ / / | | | | + / / \\ \\ / / \\ \\ | | | | \\ / / | | | | + / / \\ \\ / / \\ \\ \\ \\_ _ _ _ _ _/ / / / \\ _|_ _ _ _| _/ + /_/ \\_\\/_/ \\_\\ \\_ _ _ _ _ _ _/ /_ _/ \\ _ _ _ _ _ / + + 基于Vue和Electron的接口文档工具 + + GitHub地址:https://github.com/trueleaf/moyu + + Gitee地址:https://gitee.com/shuzhikai/moyu + `) + console.log(process.env.VUE_APP_BUILD_TIME); + } }, }) diff --git a/src/renderer/api/api.ts b/src/renderer/api/api.ts index 7db677f4..dcf37050 100644 --- a/src/renderer/api/api.ts +++ b/src/renderer/api/api.ts @@ -17,6 +17,9 @@ const axiosPlugin = { const userInfoStr = localStorage.getItem("userInfo") || "{}"; try { const userInfo = JSON.parse(userInfoStr); + if (!userInfo.token) { + router.push("/login"); + } reqConfig.headers.Authorization = userInfo.token } catch (error) { Promise.reject(error)