Browse Source

Merge branch 'master' of http://121.4.203.192:9000/mingxue/front

shilipojs 2 years ago
parent
commit
e97eb3a62e
37 changed files with 715 additions and 26 deletions
  1. BIN
      src/assets/images/index/login/banner.png
  2. BIN
      src/assets/images/index/login/banner@2x.png
  3. BIN
      src/assets/images/index/login/banner_knowledge.png
  4. BIN
      src/assets/images/index/login/banner_knowledge@2x.png
  5. BIN
      src/assets/images/index/login/banner_sync.png
  6. BIN
      src/assets/images/index/login/banner_sync@2x.png
  7. BIN
      src/assets/images/index/login/icon_account.png
  8. BIN
      src/assets/images/index/login/icon_account@2x.png
  9. BIN
      src/assets/images/index/login/icon_arrow_down.png
  10. BIN
      src/assets/images/index/login/icon_arrow_down@2x.png
  11. BIN
      src/assets/images/index/login/icon_arrow_right.png
  12. BIN
      src/assets/images/index/login/icon_arrow_right@2x.png
  13. BIN
      src/assets/images/index/login/icon_logo.png
  14. BIN
      src/assets/images/index/login/icon_logo@2x.png
  15. BIN
      src/assets/images/index/login/icon_logo_large.png
  16. BIN
      src/assets/images/index/login/icon_logo_large@2x.png
  17. BIN
      src/assets/images/index/login/icon_logo_medium.png
  18. BIN
      src/assets/images/index/login/icon_logo_medium@2x.png
  19. BIN
      src/assets/images/index/login/icon_phone.png
  20. BIN
      src/assets/images/index/login/icon_phone@2x.png
  21. BIN
      src/assets/images/index/login/icon_pwd.png
  22. BIN
      src/assets/images/index/login/icon_pwd@2x.png
  23. BIN
      src/assets/images/index/login/icon_time.png
  24. BIN
      src/assets/images/index/login/icon_time@2x.png
  25. 22 0
      src/assets/styles/common.scss
  26. 5 0
      src/common/mx-extension.js
  27. 23 21
      src/components/BottomP/index.vue
  28. 1 1
      src/router/index.js
  29. 1 0
      src/store/getters.js
  30. 5 3
      src/views/components/blocks/index-login-check-mixin.js
  31. 26 0
      src/views/index/components/index-card-elective.vue
  32. 36 0
      src/views/index/components/index-card.vue
  33. 100 0
      src/views/index/components/login-form-banner.vue
  34. 29 0
      src/views/index/components/login-top-info.vue
  35. 47 0
      src/views/index/components/login-top-menus.vue
  36. 419 0
      src/views/index/login.vue
  37. 1 1
      src/views/login.vue

BIN
src/assets/images/index/login/banner.png


BIN
src/assets/images/index/login/banner@2x.png


BIN
src/assets/images/index/login/banner_knowledge.png


BIN
src/assets/images/index/login/banner_knowledge@2x.png


BIN
src/assets/images/index/login/banner_sync.png


BIN
src/assets/images/index/login/banner_sync@2x.png


BIN
src/assets/images/index/login/icon_account.png


BIN
src/assets/images/index/login/icon_account@2x.png


BIN
src/assets/images/index/login/icon_arrow_down.png


BIN
src/assets/images/index/login/icon_arrow_down@2x.png


BIN
src/assets/images/index/login/icon_arrow_right.png


BIN
src/assets/images/index/login/icon_arrow_right@2x.png


BIN
src/assets/images/index/login/icon_logo.png


BIN
src/assets/images/index/login/icon_logo@2x.png


BIN
src/assets/images/index/login/icon_logo_large.png


BIN
src/assets/images/index/login/icon_logo_large@2x.png


BIN
src/assets/images/index/login/icon_logo_medium.png


BIN
src/assets/images/index/login/icon_logo_medium@2x.png


BIN
src/assets/images/index/login/icon_phone.png


BIN
src/assets/images/index/login/icon_phone@2x.png


BIN
src/assets/images/index/login/icon_pwd.png


BIN
src/assets/images/index/login/icon_pwd@2x.png


BIN
src/assets/images/index/login/icon_time.png


BIN
src/assets/images/index/login/icon_time@2x.png


+ 22 - 0
src/assets/styles/common.scss

@@ -1,3 +1,11 @@
+.m0 {
+  margin: 0;
+}
+
+.p0 {
+  padding: 0;
+}
+
 .mt60 {
   margin-top: 60px;
 }
@@ -594,11 +602,21 @@
   background-color: #EEEEEE;
 }
 
+.icon50p {
+  width: 50%;
+  height: 50%;
+}
+
 .icon16 {
   width: 16px;
   height: 16px;
 }
 
+.icon22 {
+  width: 22px;
+  height: 22px;
+}
+
 .icon24 {
   width: 24px;
   height: 24px;
@@ -632,6 +650,10 @@
   width: 100%;
 }
 
+.pf {
+  font-family: PingFang;
+}
+
 .f12 {
   font-size: 12px;
 }

+ 5 - 0
src/common/mx-extension.js

@@ -1,3 +1,5 @@
+import auth from '@/utils/auth'
+
 export default {
   install(Vue) {
     // Array ext.
@@ -74,6 +76,9 @@ export default {
     }
 
     // Global func.
+    Vue.prototype.isLogin = function() {
+      return auth.getToken()
+    }
     Vue.prototype.deepClone = function(obj) {
       if (!obj) return obj
       return JSON.parse(JSON.stringify(obj))

+ 23 - 21
src/components/BottomP/index.vue

@@ -1,12 +1,12 @@
 <template>
   <div>
     <div id="bottom" class="layui-fluid noprint"
-      style="overflow: hidden;color: #fff!important;padding: 20px 0px;background-color:#687887;min-width:1200px;margin-top: 40px;font-size: 14px;">
+         style="overflow: hidden;color: #fff!important;padding: 20px 0px;background-color:#687887;min-width:1200px;font-size: 14px;">
       <div class="layui-row layui-col-space20 w1200p">
         <el-row style="margin:20px -10px;text-align:center;">
           <el-col :span="6">
             <img :src="logo_white" style="height: 92px;margin-bottom: 20px; ">
-           <!--<p><a href="###" style="color:#fff">隐私协议</a></p>-->
+            <!--<p><a href="###" style="color:#fff">隐私协议</a></p>-->
             <span v-html="'\u00a0'"></span>
           </el-col>
           <el-col :span="12">
@@ -21,20 +21,22 @@
               </span>
             </p>
             <p style="margin-top:15px;">本站部分资源来源互联网。如有侵犯权益,请联系我们删除!备案号:<a href="https://beian.miit.gov.cn"
-                target="_blank" style="color: #fff!important;">湘ICP备18012964号-2</a></p>
+                                                                          target="_blank"
+                                                                          style="color: #fff!important;">湘ICP备18012964号-2</a>
+            </p>
             <p style="margin-bottom:20px;">Copyright © 2020-2021 mingxuejinbang Inc. All rights reserved. 名学金榜 版权所有</p>
             <!-- <img :src="star4" height="47px" alt=""> -->
           </el-col>
           <el-col :span="6">
             <el-row style="margin:0 -10px">
-             <el-col :span="6" style="padding-top:20px;padding-left:20px;text-align:right">
-                  <img style="height:32px;" :src="icon_tel">
-            </el-col>
-            <el-col :span="18" style="padding-top:20px;padding-left:20px;text-align:left">
-              <p style="font-size:12px;">垂询热线:</p>
-              <p style="font-size:18px;">400-1797-985</p>
-            </el-col>
-          </el-row>
+              <el-col :span="6" style="padding-top:20px;padding-left:20px;text-align:right">
+                <img style="height:32px;" :src="icon_tel">
+              </el-col>
+              <el-col :span="18" style="padding-top:20px;padding-left:20px;text-align:left">
+                <p style="font-size:12px;">垂询热线:</p>
+                <p style="font-size:18px;">400-1797-985</p>
+              </el-col>
+            </el-row>
           </el-col>
         </el-row>
 
@@ -44,19 +46,19 @@
 </template>
 
 <script>
-  export default {
-    data() {
-      return {
-        logo_white: require('@/assets/images/foot_img_logo.png'),
-        icon_tel: require('@/assets/images/icon_tel.png'),
-        star4: require('@/assets/images/star4.png'),
-      }
+export default {
+  data() {
+    return {
+      logo_white: require('@/assets/images/foot_img_logo.png'),
+      icon_tel: require('@/assets/images/icon_tel.png'),
+      star4: require('@/assets/images/star4.png')
     }
   }
+}
 </script>
 
 <style scoped>
-  p {
-    margin: 0
-  }
+p {
+  margin: 0
+}
 </style>

+ 1 - 1
src/router/index.js

@@ -42,7 +42,7 @@ export const constantRoutes = [{
 },
   {
     path: '/login',
-    component: (resolve) => require(['@/views/login'], resolve),
+    component: (resolve) => require(['@/views/index/login'], resolve),
     hidden: true
   },
   {

+ 1 - 0
src/store/getters.js

@@ -13,6 +13,7 @@ const getters = {
   nickName: state => state.user.nickName,
   introduction: state => state.user.introduction,
   school: state => state.user.busiSchool?.first(),
+  schoolName: (state, getters) => getters.school?.schoolName,
   firstClassName: state => state.user.busiSchool?.first()?.grade?.first()?.clazz?.first()?.className,
   roleList: state => state.user.roleList || [],
   roles: (state, getters) => getters.roleList.map(r => r.roleKey),

+ 5 - 3
src/views/components/blocks/index-login-check-mixin.js

@@ -11,15 +11,17 @@ export default {
     ...mapGetters(['currentUser'])
   },
   methods: {
-    isLogin() {
+    hasLoginToken() {
       return !!auth.getToken()
     },
     loginStatusCheck() {
       // 首页统一注入登陆检测方法,未登陆时直接跳至登陆框
-      if (this.isLogin()) {
+      if (this.hasLoginToken()) {
         return Promise.resolve(true)
       }
-      // TODO: 提示并回滚至登陆窗口
+      // TODO: 滚动至登陆输入框
+      this.$message.error('请先登陆!')
+      return Promise.reject(false)
     }
   }
 }

+ 26 - 0
src/views/index/components/index-card-elective.vue

@@ -0,0 +1,26 @@
+<template>
+  <index-card title="选科查询" more-text="我的选科方案" @more="handleElectiveHistory">
+    <div>内容</div>
+  </index-card>
+</template>
+
+<script>
+import IndexCard from '@/views/index/components/index-card'
+import loginCheckMixin from '@/views/components/blocks/index-login-interceptor-mixin'
+
+export default {
+  mixins: [loginCheckMixin],
+  name: 'index-card-elective',
+  components: { IndexCard },
+  methods: {
+    async handleElectiveHistory() {
+      await this.loginCheck()
+      // TODO: 跳转我的选科方案
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 36 - 0
src/views/index/components/index-card.vue

@@ -0,0 +1,36 @@
+<template>
+  <el-card shadow="never" class="bg-white">
+    <template #header>
+      <div class="fx-row fx-bet-base pf bold">
+        <div>
+          <span class="f-333 f24">{{ title }}</span>
+          <span class="f-999 f18 ml30">{{ subTitle }}</span>
+        </div>
+        <div v-if="moreText" class="f-333 f16 pointer" @click="$emit('more')">
+          <span>{{ moreText }}</span>
+          <i class="el-icon-arrow-right index-card-more ml8"></i>
+        </div>
+      </div>
+    </template>
+    <slot></slot>
+  </el-card>
+</template>
+
+<script>
+export default {
+  name: 'index-card',
+  props: ['title', 'subTitle', 'moreText']
+}
+</script>
+
+<style scoped>
+/deep/ .el-card__header {
+  min-height: 60px;
+  padding: 30px 12px 5px 12px;
+}
+
+.index-card-more {
+  border: 1px solid #333;
+  border-radius: 50%;
+}
+</style>

+ 100 - 0
src/views/index/components/login-form-banner.vue

@@ -0,0 +1,100 @@
+<template>
+  <div class="fx-column relative">
+    <el-image :src="require('@/assets/images/index/login/banner@2x.png')" class="width100" fit="contain"></el-image>
+    <div class="bg-white absolute" style="width:400px; padding:30px; top:110px; right:150px;">
+      <img style="width: 60%;margin-left:20%;" src="@/assets/images/login_logo.png"/>
+      <div class="f-primary text-center mt20 mb40 bold f18" style="letter-spacing: 10px;">
+        WELCOME
+      </div>
+      <el-form v-if="!isLogin" ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form"
+               style="width: auto;">
+        <el-form-item prop="username">
+          <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
+            <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon"/>
+          </el-input>
+        </el-form-item>
+        <el-form-item prop="password">
+          <el-input
+            v-model="loginForm.password"
+            type="password"
+            auto-complete="off"
+            placeholder="密码"
+            @keyup.enter.native="handleLogin"
+          >
+            <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
+          </el-input>
+        </el-form-item>
+        <!-- <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> -->
+        <div class="fx-row fx-end-cen mb20">
+          <label class="pointer f-999 f14" @click="handleForgetPwd">忘记密码?</label>
+        </div>
+        <el-form-item style="width:100%;">
+          <el-button :loading="loading" size="medium" type="primary" style="width:100%;"
+                     @click.native.prevent="handleLogin">
+            <span v-if="!loading">登 录</span>
+            <span v-else>登 录 中...</span>
+          </el-button>
+        </el-form-item>
+      </el-form>
+      <div v-if="isLogin">
+        <div class="text-center">
+          <div class="user-info-head">
+            <img src="@/assets/images/profile.jpg" tclass="img-circle img-lg"
+                 style="border-radius:50%;width:80px;"/>
+          </div>
+        </div>
+        <div style="padding-bottom:10px;">
+          <div class="text-center mt20 mb10">
+            {{ currentUser.userName }}
+          </div>
+          <p class="text-center" style="color:#999;font-size:14px">
+            <span>{{ currentUser.nickName }} {{ schoolName }}</span>
+          </p>
+        </div>
+        <div class="list-group-item" style="margin-top:20px;border:none">
+                                        <span style="display:inline-block;width:33%;text-align:center;cursor:pointer">
+                                            <img style="width: 16px;position: relative;top: 2px;margin-right: 5px;"
+                                                 src="@/assets/images/icon_jifen.png" alt/>
+                                            {{ currentUser.points || 0 }}积分
+                                        </span>
+          <span @click="userTo()"
+                style="display:inline-block;width:33%;text-align:center;color:#4055F7;cursor:pointer">
+                                            <img style="width: 16px;position: relative;top: 2px;margin-right: 5px;"
+                                                 src="@/assets/images/icon_user.png" alt/>个人中心
+                                        </span>
+          <span @click="logout"
+                style="display:inline-block;width:33%;text-align:center;color:#C93C3C;cursor:pointer">
+                                            <img style="width: 16px;position: relative;top: 2px;margin-right: 5px;"
+                                                 src="@/assets/images/icon_back.png" alt/>退出
+                                        </span>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+/* TODO: 22.8.23 hht 这里为节省时间,全部由依赖注入主导,没有做逻辑分割 */
+import { mapGetters } from 'vuex'
+
+export default {
+  name: 'login-form-banner',
+  props: ['isLogin', 'loginForm', 'loginRules', 'loading'],
+  inject: ['userTo', 'handleLogin', 'logout', 'handleForgetPwd'],
+  data() {
+    return {}
+  },
+  computed: {
+    ...mapGetters(['currentUser', 'schoolName'])
+  },
+  methods: {
+    validate: function(cb) {
+      return this.$refs.loginForm.validate(cb)
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 29 - 0
src/views/index/components/login-top-info.vue

@@ -0,0 +1,29 @@
+<template>
+  <div class="fx-row jc-bet ai-default" style="padding: 5px 265px;">
+    <div class="fx-row fx-sta-cen">
+      <el-image :src="require('@/assets/images/index/login/icon_logo@2x.png')" class="icon22"></el-image>
+      <el-image :src="require('@/assets/images/index/login/icon_phone@2x.png')" class="icon16 ml30"></el-image>
+      <div class="f14 bold pf ml8 f-333">全国热线:<span class="f-primary">070-123-3337</span></div>
+    </div>
+    <div class="fx-row fx-end-cen f14 bold pf f-333" v-if="isLogin()">
+      <div>{{ currentUser.nickName }}{{ currentUser.userName }}</div>
+      <div class="f-primary ml8">[{{ currentUser['provinceName'] }} {{ currentUser.schoolName }}]</div>
+    </div>
+  </div>
+</template>
+
+<script>
+/* TODO: 22.8.23 hht 这个样式和原来差异很大,而且2维码、未登陆、角色切换等,先不用 */
+import { mapGetters } from 'vuex'
+
+export default {
+  name: 'login-top-info',
+  computed: {
+    ...mapGetters(['currentUser'])
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 47 - 0
src/views/index/components/login-top-menus.vue

@@ -0,0 +1,47 @@
+<template>
+  <div class="fx-row fx-bet-cen bg-white pl60 pr60" style="height:102px;">
+    <el-image :src="require('@/assets/images/index/login/icon_logo_medium@2x.png')" fit="contain"
+              style="width: 152px;"></el-image>
+    <div class="fx-row fx-end-cen fx-1 menus-container">
+      <el-link v-for="(item,idx) in routers" :key="idx" @click="handleMenuClick(item)" class="f16 f-fff"
+               :underline="false">
+        <svg-icon :icon-class="item.meta.icon" style="margin-right:5px"/>
+        {{ item.meta.title }}
+      </el-link>
+    </div>
+  </div>
+</template>
+
+<script>
+import loginCheckMixin from '@/views/components/blocks/index-login-interceptor-mixin'
+
+export default {
+  mixins: [loginCheckMixin],
+  name: 'login-top-menus',
+  props: {
+    routers: {
+      type: Array,
+      default: () => []
+    }
+  },
+  inject: {
+    to: {
+      default: function() {
+
+      }
+    }
+  },
+  methods: {
+    async handleMenuClick(item) {
+      await this.loginCheck()
+      this.to(item)
+    }
+  }
+}
+</script>
+
+<style scoped>
+.menus-container .el-link + .el-link {
+  margin-left: 30px;
+}
+</style>

+ 419 - 0
src/views/index/login.vue

@@ -0,0 +1,419 @@
+<template>
+  <el-container class="login-container">
+    <el-header height="40px" style="background: #fff6e8;" class="p0">
+      <top v-if="topLoadin" @userNavTo="userTo"></top>
+    </el-header>
+    <el-main class="p0">
+      <login-top-menus :routers="visibleRouters"></login-top-menus>
+      <login-form-banner ref="loginForm" :is-login="isLogin" :login-form="loginForm" :login-rules="loginRules"
+                         :loading="loading"></login-form-banner>
+      <div class="fx-column fx-cen-cen">
+        <index-card-elective class="mt20" style="width: 1350px; overflow: hidden;"/>
+      </div>
+      <bottom-p class="mt20"></bottom-p>
+      <el-dialog v-if="dialogVisible" title :visible.sync="dialogVisible" width="850px">
+        <complete-profile @completed="handleProfileCompleted"
+                          style="margin-left:250px; padding:0 30px"></complete-profile>
+      </el-dialog>
+      <el-dialog v-if="forgetDialogVisiable" :visible.sync="forgetDialogVisiable" title="忘记密码" width="650px"
+                 style="height:600px">
+        <forget-password @resetPwdSuccess="forgetDialogVisiable=false"></forget-password>
+      </el-dialog>
+    </el-main>
+  </el-container>
+</template>
+
+<script>
+import store from '@/store'
+import router from '@/router'
+import { mapActions, mapGetters } from 'vuex'
+import auth from '@/utils/auth'
+import { getFrontInitialRouters } from '@/api/system/user'
+import forgetPassword from '@/views/components/forget-pwd.vue'
+import CompleteProfile from '@/views/components/complete-profile.vue'
+import RouterHelpMixin from '@/router/router-help-mixin'
+import LoginTopInfo from '@/views/index/components/login-top-info'
+import LoginFormBanner from '@/views/index/components/login-form-banner'
+import LoginTopMenus from '@/views/index/components/login-top-menus'
+import loginCheckMixin from '@/views/components/blocks/index-login-check-mixin'
+import IndexCardElective from '@/views/index/components/index-card-elective'
+
+export default {
+  mixins: [RouterHelpMixin, loginCheckMixin],
+  components: {
+    IndexCardElective,
+    LoginTopMenus,
+    LoginFormBanner,
+    LoginTopInfo,
+    forgetPassword,
+    CompleteProfile
+  },
+  provide() {
+    return {
+      to: this.to,
+      userTo: this.userTo,
+      handleLogin: this.handleLogin,
+      logout: this.logout,
+      handleForgetPwd: this.handleForgetPwd
+    }
+  },
+  data() {
+    return {
+      forgetDialogVisiable: false,
+      topLoadin: true,
+      isLogin: auth.getToken(),
+      loginObj: {},
+      loading: false,
+      gradeLoading: false,
+      navList: [],
+      loginForm: {
+        username: '',
+        password: '',
+        // rememberMe: false,
+        // code: "",
+        // uuid: "",
+        relation: 1,
+        grade: 2,
+        year: ''
+      },
+      loginRules: {
+        relation: [
+          {
+            required: true,
+            trigger: 'blur',
+            message: '请选择学生端或者老师端'
+          }
+        ],
+        grade: [
+          {
+            required: true,
+            trigger: 'blur',
+            message: '请选择学校类别'
+          }
+        ],
+        username: [
+          {
+            required: true,
+            trigger: 'blur',
+            message: '用户名不能为空'
+          }
+        ],
+        password: [
+          {
+            required: true,
+            trigger: 'blur',
+            message: '密码不能为空'
+          }
+        ],
+        code: [
+          {
+            required: true,
+            trigger: 'change',
+            message: '验证码不能为空'
+          }
+        ]
+      },
+      options: {
+        img: store.getters.avatar //裁剪图片的地址
+      },
+      submitLoading: false,
+      schoolData: [],
+      gradeData: [],
+      classData: [],
+      areaSchoolAndYears: {},
+      isSecd: false,
+      times: 120,
+      form: {
+        username: '',
+        phoneNumber: '',
+        code: '',
+        schoolId: '',
+        gradeId: [],
+        clazzId: []
+      },
+      subjectData: [],
+      dialogVisible: false,
+      id: 0,
+      props: {
+        lazy: true,
+        lazyLoad(node, resolve) {
+          const { level } = node
+          setTimeout(() => {
+            const nodes = Array.from({
+              length: level + 1
+            }).map((item) => {
+              let a = ''
+              if (level == '0') {
+                a = '省'
+              } else if (level == '1') {
+                a = '市'
+              } else {
+                a = '区'
+              }
+              return {
+                value: 1212,
+                label: `选项${a} `,
+                leaf: level >= 2
+              }
+            })
+            // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+            resolve(nodes)
+          }, 1000)
+        }
+      }
+    }
+  },
+  computed: {
+    ...mapGetters([
+      'isFrontStudent',
+      'isFrontTeacher',
+      'isFrontMaster',
+      'currentUser'
+    ]),
+    visibleRouters() {
+      return this.navList.filter((r) => r.meta?.title && !r.hidden)
+    }
+  },
+  created() {
+    let u = navigator.userAgent
+    let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1
+    if (isAndroid) {
+      let url = this.$route.fullPath.split('?')[1]
+      if (url && !this.isLogin) {
+        let urlData = url.split('&')
+        for (let i = 0; i < urlData.length; i++) {
+          this.loginObj[urlData[i].split('=')[0]] =
+            urlData[i].split('=')[1]
+        }
+        if (this.loginObj.username && this.loginObj.password) {
+          // 直接发起登录
+          this.loading = true
+          this.Login(this.loginObj)
+            .then(() => {
+              this.isLogin = true
+              this.loading = false
+              this.getUser()
+              this.getNav()
+              // this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
+            })
+            .catch(() => {
+              this.loading = false
+            })
+        }
+      }
+    } else {
+      this.getUser()
+      this.getNav()
+    }
+  },
+  methods: {
+    ...mapActions(['GenerateRoutes', 'Login', 'LogOut', 'GetInfo']),
+    getNav() {
+      console.log(
+        'getNav called',
+        'real menu=' + !!(this.islogin && this.currentUser.isBind),
+        this.currentUser,
+        this.isLogin
+      )
+      if (this.isLogin) {
+        this.GenerateRoutes().then((accessRoutes) => {
+          console.log('GenerateRoutes accessRoutes', accessRoutes)
+          router.addRoutes(accessRoutes) // 动态添加可访问路由表
+          this.navList = JSON.parse(
+            JSON.stringify(
+              this.$store.state.permission.topbarRouters
+            )
+          )
+        })
+      } else {
+        getFrontInitialRouters().then((res) => {
+          this.navList = res.data.map((r) => ({
+            path: r.path,
+            meta: r.meta
+          }))
+        })
+      }
+    },
+    gouAction(data) {
+      // 22.6.7 hht 作废此方法,只处理了有限级跳转
+      if (data && data.length > 0) {
+        if (data[0].children && data[0].children.length > 0) {
+          if (
+            data[0].children[0].children &&
+            data[0].children[0].children.length > 0
+          ) {
+            return data[0].children[0].children.path
+          } else {
+            return data[0].path + '/' + data[0].children[0].path
+          }
+        } else {
+          return data[0].path
+        }
+      } else {
+        return ''
+      }
+    },
+    handleClick(data) {
+      let item = JSON.parse(JSON.stringify(data))
+      let routes = [] //三级菜单
+      let second = [] //二级
+      let routesTo = []
+      if (item.children) {
+        //有二级菜单
+        item.children.forEach((item2) => {
+          if (item2.children) {
+            item2.children.forEach((item3) => {
+              item3.path =
+                item.path + '/' + item2.path + '/' + item3.path
+            })
+            if (routes.length == 0 && item2.children.length) {
+              //一级菜单下面第一个有3个菜单的二级菜单
+              routes = item2.children
+              routesTo = item2.children
+            }
+          } else {
+            routesTo = item.children
+          }
+          item2.path = item.path + '/' + item2.path
+          item2.level = 2
+          second.push(item2)
+        })
+        let fal = false
+        second.forEach((item) => {
+          if (!fal && item.children && item.children.length > 0) {
+            auth.setActiveMenu(item.path)
+            fal = true
+          }
+        })
+
+        auth.setMenuTab(second)
+        this.three = true
+        this.$store.commit('SET_SIDEBAR_ROUTERS', routes)
+      } else {
+        //没有二级菜单
+        this.$store.commit('SET_SIDEBAR_ROUTERS', [])
+        this.$router.push({
+          path: item.path
+        })
+      }
+      let path = this.findLeafDescendantPath(data)
+      if (path) {
+        this.$router.push({
+          path: path
+        })
+        auth.setMenuListAction(path)
+      } else {
+      }
+      auth.setMenuList(routes)
+    },
+    logout() {
+      this.$confirm('确定注销并退出系统吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.LogOut().then(() => {
+          this.isLogin = false
+          this.getNav()
+          this.topLoadin = false
+          this.loginObj = {}
+          setTimeout(() => {
+            this.topLoadin = true
+            this.$router.push({ path: '/login' })
+          }, 10)
+        })
+      })
+    },
+    getUser() {
+      if (!this.isLogin) return
+      this.GetInfo().then((response) => {
+        this.dialogVisible = !this.currentUser.isBind
+        this.topLoadin = false
+        setTimeout(() => {
+          this.topLoadin = true
+        }, 10)
+      })
+    },
+    userTo() {
+      //跳转至个人中心
+      if (this.isLogin && !this.currentUser.isBind) {
+        this.dialogVisible = true
+        this.$message.error('请先完善信息!')
+        return
+      }
+      const pcRouter = this.navList.find((r) => r.path == '/user')
+      if (pcRouter) this.to(pcRouter)
+    },
+    to(url) {
+      console.log('will go to', url)
+      auth.removeMenuTab()
+      auth.removeMenuList()
+      if (this.isLogin && this.currentUser.isBind) {
+        if (url == '/login') {
+          window.location.reload()
+          return
+        }
+        if (
+          url ==
+          '/index?type=http://8.134.76.179/index.php?m=login&token=94c750ea0f7f41d7753327792e937589'
+        ) {
+          window.open(
+            'http://8.134.76.179/index.php?m=login&token=' +
+            this.currentUser.code
+          )
+        } else if (url == '/user/profile') {
+          this.$router.push({
+            path: url
+          })
+        } else {
+          this.handleClick(url)
+        }
+      } else if (this.isLogin && this.currentUser.isBind) {
+        this.dialogVisible = true
+        this.$message.error('请先完善信息!')
+      } else {
+        this.$message.error('请先登陆!')
+      }
+    },
+    handleForgetPwd() {
+      this.forgetDialogVisiable = true
+    },
+    handleLogin() {
+      this.$refs.loginForm.validate((valid) => {
+        if (valid) {
+          this.loading = true
+          this.Login(this.loginForm)
+            .then(() => {
+              this.isLogin = true
+              this.loading = false
+              this.getUser()
+              this.getNav()
+              // this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
+            })
+            .catch(() => {
+              this.loading = false
+            })
+        }
+      })
+    },
+    handleProfileCompleted() {
+      this.dialogVisible = !this.currentUser.isBind
+      this.getNav() //重新获取菜单
+    }
+  }
+}
+</script>
+
+<style scoped>
+.login-container {
+  background-color: #F2F2F2;
+}
+
+/deep/ .el-dialog {
+  background: url("../../assets/images/img_bg1.png") no-repeat;
+  /* background-size: 100% 100%;
+  height: 580px; */
+  max-height: 520px;
+  width: 800px;
+}
+</style>

+ 1 - 1
src/views/login.vue

@@ -180,7 +180,7 @@
                style="height:600px">
       <forget-password @resetPwdSuccess="forgetDialogVisiable=false"></forget-password>
     </el-dialog>
-    <bottom-p></bottom-p>
+    <bottom-p class="mt40"></bottom-p>
   </div>
 </template>