lrf402788946 5 jaren geleden
bovenliggende
commit
3faf80c203
6 gewijzigde bestanden met toevoegingen van 17 en 8 verwijderingen
  1. 1 1
      .env
  2. 5 1
      src/layout/index/logo.vue
  3. 2 2
      src/router/index.js
  4. 1 0
      src/store/login.js
  5. 6 2
      src/views/login.vue
  6. 2 2
      vue.config.js

+ 1 - 1
.env

@@ -1,2 +1,2 @@
 VUE_APP_AXIOS_BASE_URL = ''
-VUE_APP_ROUTER="/www"
+VUE_APP_ROUTER="/login"

+ 5 - 1
src/layout/index/logo.vue

@@ -3,7 +3,11 @@
     <el-row>
       <el-col :span="24" class="logo">
         <span v-if="info.logourl">
-          <el-image style="width:690px;height:66px;" :src="info.logourl"></el-image>
+          <el-image style="width:690px;height:66px;" :src="info.logourl">
+            <div slot="error" class="image-slot">
+              <el-image style="width:690px;height:66px;" :src="logourl"></el-image>
+            </div>
+          </el-image>
         </span>
         <span v-else>
           <el-image style="width:690px;height:66px;" :src="logourl"></el-image>

+ 2 - 2
src/router/index.js

@@ -5,7 +5,7 @@ Vue.use(VueRouter);
 
 const routes = [
   {
-    path: '/login',
+    path: '/',
     meta: { title: '登陆' },
     component: () => import('../views/login.vue'),
   },
@@ -13,7 +13,7 @@ const routes = [
 
 const router = new VueRouter({
   mode: 'history',
-  base: process.env.BASE_URL,
+  base: process.env.NODE_ENV === 'development' ? '/' : process.env.VUE_APP_ROUTER,
   routes,
 });
 

+ 1 - 0
src/store/login.js

@@ -38,6 +38,7 @@ const actions = {
       //   type: 'success',
       //   duration: 2000,
       // });
+      return res;
     } else {
       if (needReturn) return res;
       else {

+ 6 - 2
src/views/login.vue

@@ -39,13 +39,17 @@ export default {
       }
     },
     async submitLogin(form) {
-      await this.toLogin({ user: form });
+      const res = await this.toLogin({ user: form });
+      if (!res) return;
+      if (res.role == '1') {
+        window.location.href('./admin');
+      }
     },
     async submitRegister(forms) {
       let data = this.forms;
       let res = await this.userCreate(data);
       let msg = `注册成功`;
-      if (this.$checkRes(res, msg)) this.$router.push({ path: '/login' });
+      this.$checkRes(res, msg);
     },
   },
   computed: {

+ 2 - 2
vue.config.js

@@ -1,6 +1,6 @@
 const path = require('path');
 module.exports = {
-  publicPath: '/',
+  publicPath: process.env.NODE_ENV === 'development' ? '/' : process.env.VUE_APP_ROUTER,
   configureWebpack: config => {
     Object.assign(config, {
       // 开发生产共同配置
@@ -64,7 +64,7 @@ module.exports = {
         // pathRewrite: { '^/api/affairs': '/api' },
       },
       '/api': {
-        target: 'http://127.0.0.1:9004',
+        target: 'http://10.16.10.72:9004',
         changeOrigin: true,
         ws: true,
         // pathRewrite: { '^/api/affairs': '/api' },