Browse Source

修改首页跳转Bug8.23.10.55

luosixu 2 years ago
parent
commit
e769ee2840

+ 3 - 0
ruoyi-web/.env.development

@@ -6,3 +6,6 @@ VITE_APP_ENV = 'development'
 
 # 若依管理系统/开发环境
 VITE_APP_BASE_API = '/dev-api'
+
+# 从前台跳转到后台登录的地址
+VITE_APP_HREF = 'http://localhost:81/'

+ 4 - 1
ruoyi-web/.env.production

@@ -8,4 +8,7 @@ VITE_APP_ENV = 'production'
 VITE_APP_BASE_API = '/prod-api'
 
 # 是否在打包时开启压缩,支持 gzip 和 brotli
-VITE_BUILD_COMPRESS = gzip
+VITE_BUILD_COMPRESS = gzip
+
+# 从前台跳转到后台登录的地址
+VITE_APP_HREF = 'http://mz.tshe.cn:801/'

+ 3 - 1
ruoyi-web/src/store/index.js

@@ -44,6 +44,7 @@ export default createStore({
       const password = userInfo.password
       const code = userInfo.code
       const uuid = userInfo.uuid
+      const href = userInfo.href
       return new Promise((resolve, reject) => {
         login(username, password, code, uuid).then(res => {
           console.log(res,'res');
@@ -56,7 +57,8 @@ export default createStore({
           // console.log(Cookies.get('token'),'3333333')
           window.open(
               // "http://192.168.124.4/index?token=" +
-              "http://mz.tshe.cn:801/index?token=" +
+              // http://mz.tshe.cn:801/
+              href + "index?token=" +
               res.data.access_token+"&expires_in="+res.data.expires_in
           );
           resolve()

+ 4 - 2
ruoyi-web/src/views/home/index.vue

@@ -311,7 +311,8 @@ let loginForm = reactive({
   password: '',
   code: '',
   uuid: '',
-  rememberMe: false
+  rememberMe: false,
+  href:''
 })
 const formSize = ref('default')
 const loginFormRef = ref(null)
@@ -353,6 +354,8 @@ const handleLogin = async () => {
         Cookies.remove('password')
         Cookies.remove('rememberMe')
       }
+      let href = import.meta.env.VITE_APP_HREF
+      loginForm.href = href
       store
         .dispatch('Login', loginForm)
         .then((res) => {
@@ -363,7 +366,6 @@ const handleLogin = async () => {
           // console.log(res,'res');
           // let str = Cookies.get('Admin-Token');
           // console.log(str,'str');
-
           // location.href = `http://localhost:81?${str}`
         })
         .catch(() => {