From 41ab203b1d86e17c85314f6ff9c49252767cd351 Mon Sep 17 00:00:00 2001 From: zhaoguoqiang <849348323@qq.com> Date: Tue, 17 Aug 2021 10:14:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.online | 5 +++-- package.json | 2 +- src/views/login.vue | 33 ++++++++++++++++++--------------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.env.online b/.env.online index 9c40544..da31ae7 100644 --- a/.env.online +++ b/.env.online @@ -1,3 +1,4 @@ -NODE_ENV=production +NODE_ENV=online BUILD_ENV=online -VUE_APP_ENV=online \ No newline at end of file +VUE_APP_ENV=online +VUE_APP_BASE_URL="http://test.qingweilai888.xyz" \ No newline at end of file diff --git a/package.json b/package.json index c587253..1fe1e7e 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "serve": "vue-cli-service serve --mode development", + "serve": "vue-cli-service serve --mode online", "build:dev": "vue-cli-service build --mode development", "build:pro": "vue-cli-service build --mode production", "lint": "vue-cli-service lint" diff --git a/src/views/login.vue b/src/views/login.vue index 7b02c46..73a1411 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -6,22 +6,25 @@ let url = this.$route.query; let token; let url_string = JSON.stringify(url); - // if (url_string == "{}") { - // this.$toast('请先登录') - // } else { - // token = url.token_type + " " + url.access_token; - // this.$store.commit("user/setToken", token); - // this.$router.push({ - // path: "/home", - // }); - // } + if (process.env.NODE_ENV == "online") { + token = + "bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC90ZXN0LnFpbmd3ZWlsYWk4ODgueHl6XC9hZG1pblwvbG9naW4iLCJpYXQiOjE2Mjc0NjU1ODksImV4cCI6MTk4NzQ2NTU4OSwibmJmIjoxNjI3NDY1NTg5LCJqdGkiOiJ6clVHYnJCOXlPWkpRanRUIiwic3ViIjoxNjEsInBydiI6IjBiMzZjMGUwMjMyZGVlZTlkOTZhZDA0NGY3YWE2MjQ2YTUwYTU3ZmEifQ.aFc5fCUffmDN7zBRn-D13kx1LuLNG1Ej7vQOu4O2_AA" + this.$store.commit("user/setToken", token); + this.$router.push({ + path: "/home", + }); + } else { + if (url_string == "{}") { + this.$toast('请先登录') + } else { + token = url.token_type + " " + url.access_token; + this.$store.commit("user/setToken", token); + this.$router.push({ + path: "/home", + }); + } + } - token = - "bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC90ZXN0LnFpbmd3ZWlsYWk4ODgueHl6XC9hZG1pblwvbG9naW4iLCJpYXQiOjE2Mjc0NjU1ODksImV4cCI6MTk4NzQ2NTU4OSwibmJmIjoxNjI3NDY1NTg5LCJqdGkiOiJ6clVHYnJCOXlPWkpRanRUIiwic3ViIjoxNjEsInBydiI6IjBiMzZjMGUwMjMyZGVlZTlkOTZhZDA0NGY3YWE2MjQ2YTUwYTU3ZmEifQ.aFc5fCUffmDN7zBRn-D13kx1LuLNG1Ej7vQOu4O2_AA" - this.$store.commit("user/setToken", token); - this.$router.push({ - path: "/home", - }); }, };