Browse Source

feat 新增各种登录功能

sys5923812@126.com 1 month atrás
parent
commit
5f332f2bb7

+ 5 - 5
src/layout/index.vue

@@ -6,13 +6,13 @@
         <div class="center">
             <div class="c1">
                 <img src="@/assets/images/index/1.png">
-                <img src="@/assets/images/index/2.png" @click="indexJump('/integratedmachine/wakeup/index')">
-                <img src="@/assets/images/index/3.png" @click="indexJump('/integratedmachine/cognize/index')">
+                <img src="@/assets/images/index/2.png" @click="indexJump('/xjc-integratedmachine/wakeup/index')">
+                <img src="@/assets/images/index/3.png" @click="indexJump('/xjc-integratedmachine/cognize/index')">
             </div>
             <div class="c2">
-                <img src="@/assets/images/index/4.png" @click="indexJump('/integratedmachine/environment/index')">
-                <img src="@/assets/images/index/5.png" @click="indexJump('/integratedmachine/decision/index')">
-                <img src="@/assets/images/index/6.png" @click="indexJump('/integratedmachine/plan/index')">
+                <img src="@/assets/images/index/4.png" @click="indexJump('/xjc-integratedmachine/environment/index')">
+                <img src="@/assets/images/index/5.png" @click="indexJump('/xjc-integratedmachine/decision/index')">
+                <img src="@/assets/images/index/6.png" @click="indexJump('/xjc-integratedmachine/plan/index')">
             </div>
         </div>
     </div>

+ 68 - 56
src/permission.js

@@ -1,75 +1,87 @@
 import router from './router'
-import { ElMessage } from 'element-plus'
+import {ElMessage} from 'element-plus'
 import NProgress from 'nprogress'
 import 'nprogress/nprogress.css'
-import { getToken } from '@/utils/auth'
-import { isHttp, isPathMatch } from '@/utils/validate'
-import { isRelogin } from '@/utils/request'
+import {getToken} from '@/utils/auth'
+import {isHttp, isPathMatch} from '@/utils/validate'
+import {isRelogin} from '@/utils/request'
 import useUserStore from '@/store/modules/user'
 import useSettingsStore from '@/store/modules/settings'
 import usePermissionStore from '@/store/modules/permission'
 
-NProgress.configure({ showSpinner: false })
+NProgress.configure({showSpinner: false})
+
+const whiteList = ['/login', '/register', '/xjc_index',
+    '/xjc-integratedmachine/wakeup/index',
+    '/integratedmachine/wakeup/rainbow/paint',
+    '/xjc-integratedmachine/cognize/index',
+    '/xjc-integratedmachine/environment/index',
+    '/xjc-integratedmachine/decision/index',
+    '/xjc-integratedmachine/plan/index',
+    '/xjc-integratedmachine/wakeup/index',
+    '/xjc-integratedmachine/wakeup/career_recognize/index',
+    '/xjc-integratedmachine/wakeup/career_maturity/index',
+    '/xjc-integratedmachine/wakeup/career_example/index',
+    '/xjc-integratedmachine/wakeup/career_cinema/index',
+    '/xjc-integratedmachine/login/login_index',
+    '/xjc-integratedmachine/login/student_login',
+    '/xjc-integratedmachine/login/visitor_login'
+
+]
+
 
-const whiteList = ['/login', '/register','/xjc_index',
-  '/integratedmachine/wakeup/index',
-  '/integratedmachine/wakeup/rainbow/paint',
-  '/integratedmachine/cognize/index',
-  '/integratedmachine/environment/index',
-  '/integratedmachine/decision/index',
-  '/integratedmachine/plan/index']
 
 const isWhiteList = (path) => {
-  return whiteList.some(pattern => isPathMatch(pattern, path))
+    return whiteList.some(pattern => isPathMatch(pattern, path))
 }
 
 router.beforeEach((to, from, next) => {
-  NProgress.start()
-  if (getToken()) {
-    to.meta.title && useSettingsStore().setTitle(to.meta.title)
-    /* has token*/
-    if (to.path === '/login') {
-      next({ path: '/' })
-      NProgress.done()
-    } else if (isWhiteList(to.path)) {
-      next()
-    } else {
-      if (useUserStore().roles.length === 0) {
-        isRelogin.show = true
-        // 判断当前用户是否已拉取完user_info信息
-        useUserStore().getInfo().then(() => {
-          isRelogin.show = false
-          usePermissionStore().generateRoutes().then(accessRoutes => {
-            // 根据roles权限生成可访问的路由表
-            accessRoutes.forEach(route => {
-              if (!isHttp(route.path)) {
-                router.addRoute(route) // 动态添加可访问路由表
-              }
-            })
-            next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
-          })
-        }).catch(err => {
-          useUserStore().logOut().then(() => {
-            ElMessage.error(err)
-            next({ path: '/' })
-          })
-        })
-      } else {
-        next()
-      }
-    }
-  } else {
-    // 没有token
-    if (isWhiteList(to.path)) {
-      // 在免登录白名单,直接进入
-      next()
+    NProgress.start()
+    if (getToken()) {
+        to.meta.title && useSettingsStore().setTitle(to.meta.title)
+        /* has token*/
+        if (to.path === '/login') {
+            next({path: '/'})
+            NProgress.done()
+        } else if (isWhiteList(to.path)) {
+            next()
+        } else {
+            if (useUserStore().roles.length === 0) {
+                isRelogin.show = true
+                // 判断当前用户是否已拉取完user_info信息
+                useUserStore().getInfo().then(() => {
+                    isRelogin.show = false
+                    usePermissionStore().generateRoutes().then(accessRoutes => {
+                        // 根据roles权限生成可访问的路由表
+                        accessRoutes.forEach(route => {
+                            if (!isHttp(route.path)) {
+                                router.addRoute(route) // 动态添加可访问路由表
+                            }
+                        })
+                        next({...to, replace: true}) // hack方法 确保addRoutes已完成
+                    })
+                }).catch(err => {
+                    useUserStore().logOut().then(() => {
+                        ElMessage.error(err)
+                        next({path: '/'})
+                    })
+                })
+            } else {
+                next()
+            }
+        }
     } else {
-      next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
-      NProgress.done()
+        // 没有token
+        if (isWhiteList(to.path)) {
+            // 在免登录白名单,直接进入
+            next()
+        } else {
+            next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
+            NProgress.done()
+        }
     }
-  }
 })
 
 router.afterEach(() => {
-  NProgress.done()
+    NProgress.done()
 })

+ 17 - 3
src/router/index.js

@@ -10,10 +10,24 @@ import router_plan from '@/router/router_plan.js'
 // 公共路由
 export const constantRoutes = [
     {
-        path : '/xjc_index',
+        path: '/xjc_index',
         component: () => import('@/layout/index'),
     },
-
+    //一体机登录首页
+    {
+        path: '/xjc-integratedmachine/login/login_index',
+        component: () => import('@/views/xjc-integratedmachine/login/index'),
+    },
+    //学生登录
+    {
+        path: '/xjc-integratedmachine/login/student_login',
+        component: () => import('@/views/xjc-integratedmachine/login/student_login'),
+    },
+    //游客登录
+    {
+        path: '/xjc-integratedmachine/login/visitor_login',
+        component: () => import('@/views/xjc-integratedmachine/login/visitor_login'),
+    },
 
     {
         path: '/redirect',
@@ -149,7 +163,7 @@ export const dynamicRoutes = [
     }
 ]
 const routerArrs = [...router_wakeup.router, ...router_cognize.router, ...router_decision.router,
-    ...router_environment.router, ...router_plan.router,...constantRoutes]
+    ...router_environment.router, ...router_plan.router, ...constantRoutes]
 
 /**
  * Note: 路由配置项

+ 26 - 3
src/router/router_wakeup.js

@@ -1,13 +1,36 @@
 const router = [
+    //生涯首页
     {
-        path: '/integratedmachine/wakeup/index',
+        path: '/xjc-integratedmachine/wakeup/index',
         component: () => import('@/views/xjc-integratedmachine/wakeup/index'),
     },
+    //彩虹图
     {
         path: '/integratedmachine/wakeup/rainbow/paint',
         component: () => import('@/views/xjc-integratedmachine/wakeup/rainbow/paint'),
-    }
+    },
+    //认识生涯
+    {
+        path: '/xjc-integratedmachine/wakeup/career_recognize/index',
+        component: () => import('@/views/xjc-integratedmachine/wakeup/career_recognize/index'),
+    },
+    //生涯成熟度
+    {
+        path: '/xjc-integratedmachine/wakeup/career_maturity/index',
+        component: () => import('@/views/xjc-integratedmachine/wakeup/career_maturity/index'),
+    },
+    //生涯榜样
+    {
+        path: '/xjc-integratedmachine/wakeup/career_example/index',
+        component: () => import('@/views/xjc-integratedmachine/wakeup/career_example/index'),
+    },
+    //生涯榜样
+    {
+        path: '/xjc-integratedmachine/wakeup/career_cinema/index',
+        component: () => import('@/views/xjc-integratedmachine/wakeup/career_cinema/index'),
+    },
+
 ]
-export default{
+export default {
     router
 }

+ 26 - 0
src/views/xjc-integratedmachine/login/index.vue

@@ -0,0 +1,26 @@
+<template>
+
+    <div style="display: flex;flex-direction: column;align-items: center">
+        <el-button @click="jumpTo('/xjc-integratedmachine/login/student_login')">学生登录</el-button>
+        <el-button @click="jumpTo('/xjc-integratedmachine/login/visitor_login')">游客登录</el-button>
+        <div>欢迎访问新基础生涯唤醒一体机
+            www.shengyazhidao.com
+        </div>
+    </div>
+
+
+</template>
+
+<script setup>
+    const router = useRouter()
+    function jumpTo(path) {
+        console.log("path:", path)
+        router.push({
+            path: path,
+        })
+    }
+</script>
+
+<style scoped>
+
+</style>

+ 18 - 0
src/views/xjc-integratedmachine/login/student_login.vue

@@ -0,0 +1,18 @@
+<template>
+
+    <div>
+        身份证号 <el-input></el-input>
+        <br>
+        密码 <el-input type="password"></el-input>
+        <el-button>登录</el-button>
+        <el-button>忘记密码</el-button>
+    </div>
+</template>
+
+<script setup>
+
+</script>
+
+<style scoped>
+
+</style>

+ 11 - 0
src/views/xjc-integratedmachine/login/visitor_login.vue

@@ -0,0 +1,11 @@
+<template>
+游客登录
+</template>
+
+<script setup>
+
+</script>
+
+<style scoped>
+
+</style>

+ 13 - 0
src/views/xjc-integratedmachine/wakeup/career_cinema/index.vue

@@ -0,0 +1,13 @@
+<template>
+    生涯影院
+</template>
+
+<script>
+    export default {
+        name: "index"
+    }
+</script>
+
+<style scoped>
+
+</style>

+ 11 - 0
src/views/xjc-integratedmachine/wakeup/career_example/index.vue

@@ -0,0 +1,11 @@
+<template>
+    生涯榜样
+</template>
+
+<script setup>
+
+</script>
+
+<style scoped>
+
+</style>

+ 11 - 0
src/views/xjc-integratedmachine/wakeup/career_maturity/index.vue

@@ -0,0 +1,11 @@
+<template>
+    生涯成熟度
+</template>
+
+<script setup>
+
+</script>
+
+<style scoped>
+
+</style>

src/views/xjc-integratedmachine/wakeup/recognize_career/index.vue → src/views/xjc-integratedmachine/wakeup/career_recognize/index.vue


+ 5 - 5
src/views/xjc-integratedmachine/wakeup/index.vue

@@ -1,19 +1,19 @@
 <template>
     <head-component :headinfo=headinfo></head-component>
     <div style="display: flex;flex-direction: row">
-        <div class="temp">
+        <div class="temp" @click="jumpTo('/xjc-integratedmachine/wakeup/career_recognize/index')">
             认识生涯
         </div>
-        <div class="temp" @click="jumpTo('/integratedmachine/wakeup/rainbow/paint')">
+        <div class="temp" @click="jumpTo('/xjc-integratedmachine/wakeup/rainbow/paint')">
             生涯彩虹图
         </div>
-        <div class="temp">
+        <div class="temp" @click="jumpTo('/xjc-integratedmachine/wakeup/career_maturity/index')">
             生涯成熟度测评
         </div>
-        <div class="temp">
+        <div class="temp" @click="jumpTo('/xjc-integratedmachine/wakeup/career_example/index')">
             生涯榜样
         </div>
-        <div class="temp">
+        <div class="temp" @click="jumpTo('/xjc-integratedmachine/wakeup/career_cinema/index')">
             生涯影院
         </div>