Commit 4c4f7640263fd66ac621602334115888b0ffd17e

Authored by 梁保满
1 parent c1b532ad

路由表,路由前端文件

public/favicon.ico 0 → 100644
No preview for this file type
src/api/apis/login.js
@@ -5,6 +5,10 @@ import loginUrls from "../urls/login" @@ -5,6 +5,10 @@ import loginUrls from "../urls/login"
5 export default { 5 export default {
6 // 账号密码登陆 6 // 账号密码登陆
7 fetchLogin (data) { 7 fetchLogin (data) {
8 - return axios.post(loginUrls.login, data) 8 + // return axios.post(loginUrls.login, data)
  9 + return {
  10 + status:200,
  11 + data:[]
  12 + }
9 } 13 }
10 } 14 }
src/api/index.js
@@ -4,5 +4,5 @@ const modules = modulesFiles.keys().reduce((modules, modulePath) => { @@ -4,5 +4,5 @@ const modules = modulesFiles.keys().reduce((modules, modulePath) => {
4 modules = Object.assign(modules, value.default) 4 modules = Object.assign(modules, value.default)
5 return modules 5 return modules
6 }, {}) 6 }, {})
7 - 7 +console.log(modules)
8 export default modules 8 export default modules
src/router/index.js
@@ -32,8 +32,8 @@ let defaultRouter = [ @@ -32,8 +32,8 @@ let defaultRouter = [
32 }, 32 },
33 { 33 {
34 path: "/index", 34 path: "/index",
35 - iconCls: "fa fa-dashboard", // 图标样式class  
36 - name: "首页", 35 + iconCls: "fa fa-home", // 图标样式class
  36 + name: "应用首页",
37 component: Layout, 37 component: Layout,
38 alone: true, 38 alone: true,
39 children: [ 39 children: [
src/router/permission.js
1 import NProgress from "nprogress" 1 import NProgress from "nprogress"
2 -import en from "../i18n/lang/en"  
3 -import Layout from "@/views/layout/layout"  
4 -import CommerViews from "@/views/commerViews" 2 +
5 import router from "./index" 3 import router from "./index"
6 import store from "../store" 4 import store from "../store"
7 -let routeName = en.routeName  
8 -  
9 -const Erji = () => import("@/views/duoji/erji")  
10 -const Sanji = () => import("@/views/duoji/sanji")  
11 - let addrouters = [ //测试用,后续后端获取  
12 -  
13 - {  
14 - path: "/",  
15 - iconCls: "fa fa-server",  
16 - // name: routeName.multiDirectory,  
17 - name: '多级',  
18 - component: Layout,  
19 - children: [  
20 - {  
21 - path: "/erji1",  
22 - iconCls: "fa fa-server",  
23 - // name: routeName["menu2-1"],  
24 - name: '二级',  
25 - component: Erji,  
26 - meta:{  
27 - role:['admin']  
28 - },  
29 - children: []  
30 - },  
31 - {  
32 - path: "/erji3",  
33 - iconCls: "fa fa-server",  
34 - name: "三级",  
35 - component: CommerViews, // 无限极菜单的容器  
36 - children: [  
37 - {  
38 - path: "/sanji1",  
39 - iconCls: "fa fa-server",  
40 - name: "三级子页面",  
41 - component: Sanji,  
42 - children: []  
43 - },  
44 - ]  
45 - }  
46 - ]  
47 - },  
48 -  
49 - { path: "*",  
50 - redirect: "/404",  
51 - hidden: true,  
52 - children: []  
53 - }  
54 -]  
55 -  
56 5
57 // 获取角色信息,根据用户权限动态加载路由 6 // 获取角色信息,根据用户权限动态加载路由
58 router.beforeEach((to, from, next) => { 7 router.beforeEach((to, from, next) => {
59 NProgress.start() 8 NProgress.start()
60 if (store.getters.token) { 9 if (store.getters.token) {
61 if (to.path === "/login") { 10 if (to.path === "/login") {
62 - next({path: "/"}) 11 + next()
63 } else { 12 } else {
64 - if (!store.getters.info.role) {  
65 - !(async function getAddRouters () {  
66 - // 省略 axios 请求代码 通过 token 向后台请求用户权限等信息,这里用假数据赋值  
67 - await store.dispatch("setInfo", {  
68 - role: "superAdmin",  
69 - permissions: "超级管理员",  
70 - name:"张老师",  
71 - })  
72 - await store.dispatch("newRoutes",addrouters)  
73 - let newAddRouters = store.getters.addRouters  
74 - await router.addRoutes(newAddRouters)  
75 - next({path: to.path})  
76 - }())  
77 - } else {  
78 - let is404 = to.matched.some(record => {  
79 - if (record.meta.role) {  
80 - return store.getters.info.authorityRouter === -1  
81 - }  
82 - })  
83 - if (is404) {  
84 - next({path: "/404"})  
85 - return false  
86 - } 13 + // if (!store.getters.info.permissions) {
  14 + // next({ path: to.path })
  15 + // } else {
  16 + // let is404 = to.matched.some(record => {
  17 + // if (record.meta.role) {
  18 + // return store.getters.info.authorityRouter === -1
  19 + // }
  20 + // })
  21 + // if (is404) {
  22 + // next({ path: "/404" })
  23 + // return false
  24 + // }
87 next() 25 next()
88 - } 26 + // }
89 } 27 }
90 } else { 28 } else {
91 if (to.path === "/login") { 29 if (to.path === "/login") {
92 next() 30 next()
93 } 31 }
94 - next({path: "/login"}) 32 + next({ path: "/login" })
  33 +
95 } 34 }
96 }) 35 })
97 36
src/store/index.js
1 import Vue from "vue" 1 import Vue from "vue"
2 import Vuex from "vuex" 2 import Vuex from "vuex"
3 import Cookies from "js-cookie" 3 import Cookies from "js-cookie"
4 -import routerData from "./modules/routerData"  
5 -import role from "./modules/role"  
6 -import layout from "./modules/layout/index" 4 +import layoutStore from "./modules/layout/index"
  5 +import { defaultRouter } from "@/router/index"
  6 +
  7 +import request from "@/api/index"
  8 +import router from "@/router/index"
  9 +
  10 +import Layout from "@/views/layout/layout"
  11 +import CommerViews from "@/views/commerViews"
  12 +const ExaminationPaper = () => import("@/views/examinationPaper/index")
  13 +const ExaminationPaperAdd = () => import("@/views/examinationPaper/add")
  14 +const ExaminationPaperEdit = () => import("@/views/examinationPaper/edit")
  15 +const ExaminationPaperRecycle = () => import("@/views/examinationPaper/recycle")
  16 +const Ask = () => import("@/views/ask/index")
  17 +const AskAnalysis = () => import("@/views/ask/analysis")
  18 +const Test = () => import("@/views/test/index")
  19 +const TestAnalysis = () => import("@/views/test/analysis")
  20 +const DataSync = () => import("@/views/dataSync/index")
  21 +const Portrait = () => import("@/views/portrait/index")
  22 +const Card = () => import("@/views/card/index")
  23 +const Device = () => import("@/views/device/index")
  24 +const Down = () => import("@/views/down/index")
  25 +const DownClient = () => import("@/views/down/client")
  26 +const SetUpAccount = () => import("@/views/setUp/account")
  27 +const SetUpConglomerate = () => import("@/views/setUp/conglomerate")
  28 +const SetUpSchool = () => import("@/views/setUp/school")
  29 +const SetUpStudent = () => import("@/views/setUp/student")
  30 +const SetUpTeacher = () => import("@/views/setUp/teacher")
  31 +let addrouters = [ //测试用,后续后端获取
  32 + {
  33 + path: "/examinationPaper",
  34 + iconCls: "fa fa-file-text", // 图标样式class
  35 + name: "备题组卷",
  36 + component: Layout,
  37 + alone: true,
  38 + children: [
  39 + {
  40 + path: "/examinationPaper",
  41 + iconCls: "fa fa-file-text", // 图标样式class
  42 + name: "",
  43 + component: ExaminationPaper,
  44 + children: []
  45 + },
  46 + {
  47 + path: "/examinationPaperAdd",
  48 + iconCls: "", // 图标样式class
  49 + name: "添加答题卡",
  50 + component: ExaminationPaperAdd,
  51 + children: []
  52 + },
  53 + {
  54 + path: "/examinationPaperEdit",
  55 + iconCls: "", // 图标样式class
  56 + name: "修改答题卡",
  57 + component: ExaminationPaperEdit,
  58 + children: []
  59 + },
  60 + {
  61 + path: "/examinationPaperRecycle",
  62 + iconCls: "", // 图标样式class
  63 + name: "已归档答题卡",
  64 + component: ExaminationPaperRecycle,
  65 + children: []
  66 + },
  67 + ]
  68 + },
  69 + {
  70 + path: "/ask",
  71 + iconCls: "fa fa-bar-chart", // 图标样式class
  72 + name: "随堂问报表",
  73 + component: Layout,
  74 + alone: true,
  75 + children: [
  76 + {
  77 + path: "/ask",
  78 + iconCls: "fa fa-bar-chart", // 图标样式class
  79 + name: "",
  80 + component: Ask,
  81 + children: []
  82 +
  83 + },
  84 + {
  85 + path: "/askAnalysis",
  86 + iconCls: "", // 图标样式class
  87 + name: "随堂问报表分析",
  88 + component: AskAnalysis,
  89 + children: []
  90 + }
  91 + ]
  92 + },
  93 + {
  94 + path: "/test",
  95 + iconCls: "fa fa-pie-chart", // 图标样式class
  96 + name: "即时测报表",
  97 + component: Layout,
  98 + alone: true,
  99 + children: [
  100 + {
  101 + path: "/test",
  102 + iconCls: "fa fa-pie-chart", // 图标样式class
  103 + name: "",
  104 + component: Test,
  105 + children: []
  106 + },
  107 + {
  108 + path: "/testAnalysis",
  109 + iconCls: "", // 图标样式class
  110 + name: "即时测报表分析",
  111 + component: TestAnalysis,
  112 + children: []
  113 + }
  114 +
  115 + ]
  116 + },
  117 + {
  118 + path: "/portrait",
  119 + iconCls: "fa fa-users", // 图标样式class
  120 + name: "学生画像",
  121 + component: Layout,
  122 + alone: true,
  123 + children: [
  124 + {
  125 + path: "/portrait",
  126 + iconCls: "fa fa-users", // 图标样式class
  127 + name: "",
  128 + component: Portrait,
  129 + children: []
  130 + }
  131 + ]
  132 + },
  133 + {
  134 + path: "/dataSync",
  135 + iconCls: "fa fa-random", // 图标样式class
  136 + name: "数据同步",
  137 + component: Layout,
  138 + alone: true,
  139 + children: [
  140 + {
  141 + path: "/dataSync",
  142 + iconCls: "fa fa-random", // 图标样式class
  143 + name: "",
  144 + component: DataSync,
  145 + children: []
  146 + }
  147 + ]
  148 + },
  149 + {
  150 + path: "/",
  151 + iconCls: "fa fa-cog",
  152 + name: '信息管理',
  153 + component: Layout,
  154 + children: [
  155 + {
  156 + path: "/setUpAccount",
  157 + iconCls: "fa fa-id-card-o",
  158 + name: '账号管理',
  159 + component: SetUpAccount,
  160 + children: []
  161 + },
  162 + {
  163 + path: "/setUpConglomerate",
  164 + iconCls: "fa fa-building",
  165 + name: '集团管理',
  166 + component: SetUpConglomerate,
  167 + children: []
  168 + },
  169 + {
  170 + path: "/setUpSchool",
  171 + iconCls: "fa fa-calculator",
  172 + name: '学校管理',
  173 + component: SetUpSchool,
  174 + children: []
  175 + },
  176 + {
  177 + path: "/setUpTeacher",
  178 + iconCls: "fa fa-male",
  179 + name: '教师管理',
  180 + component: SetUpTeacher,
  181 + children: []
  182 + },
  183 + {
  184 + path: "/setUpStudent",
  185 + iconCls: "fa fa-mortar-board",
  186 + name: '学生管理',
  187 + component: SetUpStudent,
  188 + children: []
  189 + },
  190 + ]
  191 + },
  192 + {
  193 + path: "/card",
  194 + iconCls: "fa fa-id-card", // 图标样式class
  195 + name: "发卡记录",
  196 + component: Layout,
  197 + alone: true,
  198 + children: [
  199 + {
  200 + path: "/card",
  201 + iconCls: "fa fa-id-card", // 图标样式class
  202 + name: "",
  203 + component: Card,
  204 + children: []
  205 + }
  206 + ]
  207 + },
  208 + {
  209 + path: "/device",
  210 + iconCls: "fa fa-dashboard", // 图标样式class
  211 + name: "设备状态",
  212 + component: Layout,
  213 + alone: true,
  214 + children: [
  215 + {
  216 + path: "/device",
  217 + iconCls: "fa fa-dashboard", // 图标样式class
  218 + name: "",
  219 + component: Device,
  220 + children: []
  221 + }
  222 + ]
  223 + },
  224 + {
  225 + path: "/down",
  226 + iconCls: "fa fa-download", // 图标样式class
  227 + name: "软件下载",
  228 + component: Layout,
  229 + alone: true,
  230 + children: [
  231 + {
  232 + path: "/down",
  233 + iconCls: "fa fa-download", // 图标样式class
  234 + name: "",
  235 + component: Down,
  236 + children: []
  237 + },
  238 + {
  239 + path: "/downClient",
  240 + iconCls: "", // 图标样式class
  241 + name: "",
  242 + component: DownClient,
  243 + children: []
  244 + }
  245 + ]
  246 + },
  247 +
  248 + {
  249 + path: "*",
  250 + redirect: "/404",
  251 + hidden: true,
  252 + children: []
  253 + }
  254 +]
7 255
8 Vue.use(Vuex) 256 Vue.use(Vuex)
9 257
10 const store = new Vuex.Store({ 258 const store = new Vuex.Store({
11 state: { 259 state: {
12 - token: Cookies.get("token") 260 + token: Cookies.get("token"),
  261 + info: "", // 每次刷新都要通过token请求个人信息来筛选动态路由
  262 + routers: [],
  263 + addRouters: [],
13 }, 264 },
14 mutations: { 265 mutations: {
15 - setToken (state, token) { 266 + setToken(state, token) {
16 state.token = token 267 state.token = token
17 Cookies.set("token", token, { expires: 1 / 24 }) 268 Cookies.set("token", token, { expires: 1 / 24 })
18 - } 269 + },
  270 + setInfo(state, data) {
  271 + state.info = {
  272 + role: data.role,
  273 + permissions: data.permissions,
  274 + name: data.name,
  275 + authorityRouter: data.authorityRouter,
  276 + avatar: data.avatar ? data.avatar : "",
  277 + uid: data.id
  278 + }
  279 + localStorage.setItem("info", JSON.stringify(store.getters.info))
  280 + },
  281 + setRouters: (state, routers) => {
  282 + state.addRouters = routers // 保存动态路由用来addRouter
  283 + state.routers = defaultRouter.concat(routers) // 所有有权限的路由表,用来生成菜单列表
  284 + },
19 }, 285 },
20 actions: { 286 actions: {
21 - setToken ({commit}, token) {  
22 - return new Promise((resolve, reject) => {  
23 - commit("setToken", token)  
24 - resolve()  
25 - }) 287 + Login({ commit }, that) {
  288 + console.log(that.$router)
  289 + debugger
  290 + // request.fetchLogin(that.loginForm).then(res => {
  291 + // if (res.status == 200) {
  292 + commit("setToken", "xxxx")
  293 + commit("setInfo", {
  294 + permissions: [
  295 + {
  296 + role: "superAdmin",
  297 + roleName: "超级管理员",
  298 + },
  299 + ],
  300 + name: "张老师",
  301 + // avatar: data.avatar ? data.avatar : "",
  302 + // uid: data.id,
  303 + // authorityRouter:[],
  304 + });
  305 + commit("setRouters", addrouters)
  306 + // let newAddRouters = getters.addRouters;
  307 + // await router.addRoutes(newAddRouters)
  308 + addrouters.forEach((res) => {
  309 + that.$router.addRoute(res);
  310 + });
  311 + that.$router.push({ path: "/" })
  312 + // }
  313 + // })
26 } 314 }
27 }, 315 },
28 getters: { 316 getters: {
29 - addRouters: state => state.routerData.addRouters, 317 + addRouters: state => state.addRouters,
30 token: state => state.token, 318 token: state => state.token,
31 - info: state => state.role.info,  
32 - routers: state => state.routerData.routers,  
33 - logoShow: state => state.layout.logoShow,  
34 - isCollapse: state => state.layout.isCollapse,  
35 - uniquerouter: state => state.layout.uniquerouter,  
36 - tabnavBox: state => state.layout.tabnavBox,  
37 - rightNav: state => state.layout.rightNav 319 + info: state => state.info,
  320 + routers: state => state.routers,
  321 + logoShow: state => state.layoutStore.logoShow,
  322 + isCollapse: state => state.layoutStore.isCollapse,
  323 + uniquerouter: state => state.layoutStore.uniquerouter,
  324 + tabnavBox: state => state.layoutStore.tabnavBox,
  325 + rightNav: state => state.layoutStore.rightNav
38 }, 326 },
39 modules: { 327 modules: {
40 - routerData,  
41 - role,  
42 - layout 328 + layoutStore
43 } 329 }
44 }) 330 })
45 331
src/store/modules/role.js deleted
1 -import store from "../index"  
2 -import router from "../../router/index"  
3 -export default {  
4 - state: {  
5 - info: "" // 每次刷新都要通过token请求个人信息来筛选动态路由  
6 - },  
7 - mutations: {  
8 - setInfo (state, data) {  
9 - if (data.authorityRouter) {  
10 - data.authorityRouter = data.authorityRouter.indexOf(",") !== -1 ? data.authorityRouter.split(",") : new Array(data.authorityRouter)  
11 - } else {  
12 - data.authorityRouter = []  
13 - }  
14 -  
15 -  
16 -  
17 - state.info = {  
18 - role: data.role,  
19 - name: data.name,  
20 - authorityRouter: data.authorityRouter,  
21 - avatar: data.avatar ? data.avatar : "",  
22 - uid: data.id  
23 - }  
24 - localStorage.setItem("info", JSON.stringify(store.getters.info))  
25 - }  
26 - },  
27 - actions: {  
28 - setInfo ({commit}, data) {  
29 - commit("setInfo", data)  
30 - }  
31 - }  
32 -}  
src/store/modules/routerData.js deleted
1 -import {defaultRouter} from "@/router/index"  
2 -  
3 -const routerData = {  
4 - state: {  
5 - routers: [],  
6 - addRouters: [],  
7 - },  
8 - mutations: {  
9 - setRouters: (state, routers) => {  
10 - state.addRouters = routers // 保存动态路由用来addRouter  
11 - state.routers = defaultRouter.concat(routers) // 所有有权限的路由表,用来生成菜单列表  
12 - },  
13 - },  
14 - actions: {  
15 - newRoutes ({commit},addRouter) {  
16 - // 通过递归路由表,删除掉没有权限的路由  
17 - function eachSelect (routers) {  
18 - for (let i = 0; i < routers.length; i++) {  
19 - if (routers[i].meta && routers[i].meta.role.length && routers[i].meta.role.indexOf(userRole) === -1) {  
20 - routers.splice(i, 1)  
21 - i = i !== 0 ? i - 1 : i  
22 - }  
23 - if (routers[i].children && routers[i].children.length) {  
24 - eachSelect(routers[i].children, userRole)  
25 - }  
26 - }  
27 - }  
28 - // 仅限演示  
29 - let newArr = [...addRouter] // 拷贝这个数组是因为做权限测试的时候可以从低级切回到高级角色,仅限演示,正式开发时省略这步直接使用 addRouter  
30 - // eachSelect(newArr)  
31 - commit("setRouters", newArr)  
32 -  
33 - // 正式开发  
34 - // eachSelect(addRouter, role)  
35 - // commit('setRouters', addRouter)  
36 - }  
37 - }  
38 -}  
39 -  
40 -export default routerData  
src/views/ask/analysis.vue 0 → 100644
  1 +<template>
  2 + <div>报表分析</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/ask/index.vue 0 → 100644
  1 +<template>
  2 + <div>随堂问报表
  3 + <router-link to="/askAnalysis">报表分析</router-link>
  4 +
  5 + </div>
  6 +</template>
  7 +
  8 +<script>
  9 +export default {
  10 +
  11 +}
  12 +</script>
  13 +
  14 +<style>
  15 +
  16 +</style>
0 \ No newline at end of file 17 \ No newline at end of file
src/views/card/index.vue 0 → 100644
  1 +<template>
  2 + <div>发卡管理</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/dataSync/index.vue 0 → 100644
  1 +<template>
  2 + <div>数据同步</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/device/index.vue 0 → 100644
  1 +<template>
  2 + <div>设备状态</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/down/client.vue 0 → 100644
  1 +<template>
  2 + <div>授课端配置下载</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/down/index.vue 0 → 100644
  1 +<template>
  2 + <div>下载软件
  3 + <router-link to="/downClient">授课端下载</router-link>
  4 + </div>
  5 +</template>
  6 +
  7 +<script>
  8 +export default {
  9 +
  10 +}
  11 +</script>
  12 +
  13 +<style>
  14 +
  15 +</style>
0 \ No newline at end of file 16 \ No newline at end of file
src/views/examinationPaper/add.vue 0 → 100644
  1 +<template>
  2 + <div>添加答题卡</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/examinationPaper/edit.vue 0 → 100644
  1 +<template>
  2 + <div>修改答案</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/examinationPaper/index.vue 0 → 100644
  1 +<template>
  2 + <div>
  3 + 答题卡列表
  4 + <router-link to="/examinationPaperAdd">添加答题卡</router-link>
  5 + <router-link to="/examinationPaperRecycle">已归档答题卡</router-link>
  6 + <router-link to="/examinationPaperEdit">修改答案</router-link>
  7 + </div>
  8 +</template>
  9 +
  10 +<script>
  11 +export default {
  12 + name:"examinationPaper"
  13 +}
  14 +</script>
  15 +
  16 +<style>
  17 +
  18 +</style>
0 \ No newline at end of file 19 \ No newline at end of file
src/views/examinationPaper/recycle.vue 0 → 100644
  1 +<template>
  2 + <div>归档</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/index/mainIndex.vue
1 <template> 1 <template>
2 - <el-row>  
3 - <el-col :span="24">  
4 - <line-echarts  
5 - id="lineEcharts"  
6 - height="300px"  
7 - ref="echarts"  
8 - ></line-echarts>  
9 - </el-col>  
10 - </el-row> 2 + <div>首页</div>
11 </template> 3 </template>
12 4
13 <script> 5 <script>
14 -import LineEcharts from "components/ECharts/lineEcharts";  
15 export default { 6 export default {
16 name: "mainIndex", 7 name: "mainIndex",
17 - components: { LineEcharts },  
18 mounted() { 8 mounted() {
19 this.selfAdaption(); 9 this.selfAdaption();
20 }, 10 },
src/views/layout/aside/aside.vue
@@ -2,8 +2,9 @@ @@ -2,8 +2,9 @@
2 <div> 2 <div>
3 <el-aside id="asideNav"> 3 <el-aside id="asideNav">
4 <div class="logo-name"> 4 <div class="logo-name">
5 - <p v-if="$store.getters.logoShow">XU</p>  
6 - <p v-else>admin</p> 5 + <img class="logo" src="../../../assets/images/logo.png" alt="">
  6 + <p >中天易教</p>
  7 + <img v-if="$store.getters.logoShow" class="logo" src="../../../assets/images/logo.png" alt="">
7 </div> 8 </div>
8 <el-menu 9 <el-menu
9 :default-active="$route.path" 10 :default-active="$route.path"
@@ -53,7 +54,7 @@ export default { @@ -53,7 +54,7 @@ export default {
53 watch: { 54 watch: {
54 // 监听浏览器直接输入路由,将此路由添加到tabnavBox 55 // 监听浏览器直接输入路由,将此路由添加到tabnavBox
55 "$route.path": function (val) { 56 "$route.path": function (val) {
56 - this.selectmenu(val); 57 + // this.selectmenu(val);
57 }, 58 },
58 }, 59 },
59 methods: { 60 methods: {
@@ -113,18 +114,25 @@ $right: right; @@ -113,18 +114,25 @@ $right: right;
113 width: auto !important; 114 width: auto !important;
114 display: flex; 115 display: flex;
115 flex-direction: column; 116 flex-direction: column;
116 - border-right: solid 1px #e6e6e6;  
117 .logo-name { 117 .logo-name {
118 background-color: #03152a !important; 118 background-color: #03152a !important;
  119 + display: flex;
  120 + align-items: center;
  121 + width: 100%;
  122 + height: 50px;
  123 + padding:0 16px;
  124 + box-sizing: border-box;
119 @extend %w100; 125 @extend %w100;
120 - font-weight: 300;  
121 - z-index: 999; 126 + .logo{
  127 + width:24px;
  128 + height:24px;
  129 + margin-right:10px;
  130 + }
122 p { 131 p {
123 - height: 50px;  
124 line-height: 50px; 132 line-height: 50px;
125 text-align: center; 133 text-align: center;
126 font-size: 16px; 134 font-size: 16px;
127 - color: #5e6d82; 135 + color: #fff;
128 } 136 }
129 } 137 }
130 .el-menu-vertical:not(.el-menu--collapse) { 138 .el-menu-vertical:not(.el-menu--collapse) {
src/views/layout/header/header.vue
@@ -5,38 +5,53 @@ @@ -5,38 +5,53 @@
5 ><i class="fa fa-indent fa-lg"></i 5 ><i class="fa fa-indent fa-lg"></i
6 ></span> 6 ></span>
7 <ul class="personal"> 7 <ul class="personal">
  8 + <!-- <li>
  9 + <langSelect></langSelect>
  10 + </li> -->
  11 + <li class="dropdown-box">
  12 + <div class="userInfo">
  13 + <img :src="avatar" />
  14 + <div class="txt">
  15 + <p>{{ `${this.$store.getters.info.name}` }}</p>
  16 + <p>{{ `${permissions[0].roleName}` }}</p>
  17 + </div>
  18 + <i class="el-icon-arrow-down"></i>
  19 + </div>
  20 + <el-dropdown
  21 + class="dropdown"
  22 + @command="handleCommand"
  23 + trigger="click"
  24 + >
  25 + <div class="el-dropdown-link dropdown-link"></div>
  26 + <el-dropdown-menu slot="dropdown" v-if="permissions.length">
  27 + <el-dropdown-item
  28 + v-for="item in permissions"
  29 + :key="item.role"
  30 + :command="item.role"
  31 + >{{ item.roleName }}</el-dropdown-item
  32 + >
  33 + </el-dropdown-menu>
  34 + </el-dropdown>
  35 + </li>
8 <li class="fullScreen" @click="fullScreen"> 36 <li class="fullScreen" @click="fullScreen">
9 <el-tooltip 37 <el-tooltip
10 class="item" 38 class="item"
11 effect="dark" 39 effect="dark"
12 content="全屏" 40 content="全屏"
13 placement="bottom" 41 placement="bottom"
14 - ><i class="fa fa-arrows-alt fa-lg"></i 42 + ><i class="el-icon-rank"></i
15 ></el-tooltip> 43 ></el-tooltip>
16 </li> 44 </li>
17 - <!-- <li>  
18 - <langSelect></langSelect>  
19 - </li> -->  
20 - <li>{{ $t(`role.${this.$store.getters.info.role}`) }}</li>  
21 <li> 45 <li>
22 - <el-dropdown @command="handleCommand">  
23 - <span class="el-dropdown-link">  
24 - {{ $t(`${this.$store.getters.info.name}`) }}<i class="el-icon-arrow-down el-icon--right"></i>  
25 - </span>  
26 - <el-dropdown-menu slot="dropdown">  
27 - <el-dropdown-item command="info">{{  
28 - $t("userDropdownMenu.basicInfor")  
29 - }}</el-dropdown-item>  
30 - <el-dropdown-item command="editPassword">{{  
31 - $t("userDropdownMenu.changePassword")  
32 - }}</el-dropdown-item>  
33 - <el-dropdown-item command="logout" divided>{{  
34 - $t("userDropdownMenu.logout")  
35 - }}</el-dropdown-item>  
36 - </el-dropdown-menu>  
37 - </el-dropdown> 46 + <el-tooltip
  47 + class="item"
  48 + effect="dark"
  49 + content="退出"
  50 + placement="bottom"
  51 + >
  52 + <i @click="logOut" class="el-icon-switch-button"></i
  53 + ></el-tooltip>
38 </li> 54 </li>
39 - <li class="icon"><img :src="avatar" /></li>  
40 </ul> 55 </ul>
41 </el-header> 56 </el-header>
42 <!-- <tabNav></tabNav> --> 57 <!-- <tabNav></tabNav> -->
@@ -53,6 +68,11 @@ import EditPassword from &quot;../../../components/userForm/editPassword&quot;; @@ -53,6 +68,11 @@ import EditPassword from &quot;../../../components/userForm/editPassword&quot;;
53 export default { 68 export default {
54 name: "Header", 69 name: "Header",
55 components: { EditPassword, tabNav, langSelect, UserInfo }, 70 components: { EditPassword, tabNav, langSelect, UserInfo },
  71 + computed: {
  72 + permissions: function () {
  73 + return this.$store.getters.info.permissions || [];
  74 + },
  75 + },
56 data() { 76 data() {
57 return { 77 return {
58 isfullScreen: true, 78 isfullScreen: true,
@@ -100,16 +120,27 @@ export default { @@ -100,16 +120,27 @@ export default {
100 } 120 }
101 }, 121 },
102 handleCommand(command) { 122 handleCommand(command) {
103 - if (command === "info") {  
104 - this.dialogInfoVisible = true;  
105 - this.title = "编辑信息";  
106 - // this.userId = this.$store.getters.info.uid  
107 - } else if (command === "editPassword") {  
108 - this.dialogPassVisible = true;  
109 - } else if (command === "logout") {  
110 - Cookies.remove("token");  
111 - location.reload();  
112 - } 123 + //刷新权限跳转首页
  124 + this.$message("click on item " + command);
  125 +
  126 + this.$store.dispatch("setInfo", {
  127 + permissions: [
  128 + {
  129 + role: "superAdmin",
  130 + roleName: "超级管理员",
  131 + },
  132 + ],
  133 + // authorityRouter:[],
  134 + name: "",
  135 + });
  136 + this.$router.push({
  137 + path: "/index",
  138 + });
  139 + },
  140 + logOut() {
  141 + this.$router.push({
  142 + path: "/login",
  143 + });
113 }, 144 },
114 }, 145 },
115 }; 146 };
@@ -152,8 +183,10 @@ ul.el-menu { @@ -152,8 +183,10 @@ ul.el-menu {
152 max-height: 50px; 183 max-height: 50px;
153 line-height: 50px; 184 line-height: 50px;
154 box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); 185 box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  186 + background: #03152a;
155 display: flex; 187 display: flex;
156 justify-content: space-between; 188 justify-content: space-between;
  189 + color: #fff;
157 .hideAside { 190 .hideAside {
158 @extend %cursor; 191 @extend %cursor;
159 } 192 }
@@ -161,22 +194,51 @@ ul.el-menu { @@ -161,22 +194,51 @@ ul.el-menu {
161 display: flex; 194 display: flex;
162 flex-direction: row; 195 flex-direction: row;
163 li { 196 li {
164 - @include set-value(margin, 13px); 197 + @include set-value(margin, 8px);
165 font-size: 12px; 198 font-size: 12px;
166 - }  
167 - .fullScreen {  
168 @extend %cursor; 199 @extend %cursor;
  200 + position: relative;
169 } 201 }
170 - .el-dropdown-link {  
171 - @extend %cursor; 202 + }
  203 + .userInfo {
  204 + display: flex;
  205 + align-items: center;
  206 + height: 50px;
  207 + @extend %cursor;
  208 + .txt {
  209 + display: flex;
  210 + flex-direction: column;
  211 + justify-content: center;
  212 + margin: 0 5px;
  213 + p {
  214 + line-height: 16px;
  215 + font-size: 12px;
  216 + }
172 } 217 }
173 - .icon img {  
174 - margin-#{$top}: 7px;  
175 - -webkit-border-radius: 5px;  
176 - -moz-border-radius: 5px; 218 + img {
177 border-radius: 5px; 219 border-radius: 5px;
178 - width: 40px;  
179 - height: 40px; 220 + width: 28px;
  221 + height: 28px;
  222 + }
  223 + }
  224 + .el-icon-rank {
  225 + font-size: 20px;
  226 + transform: rotate(45deg);
  227 + }
  228 + .el-icon-switch-button {
  229 + font-size: 18px;
  230 + }
  231 + .fa-lg {
  232 + color: #fff;
  233 + }
  234 + .dropdown {
  235 + position: absolute;
  236 + top: 0;
  237 + right: 0;
  238 + bottom: 0;
  239 + left: 0;
  240 + .dropdown-link {
  241 + height: 50px;
180 } 242 }
181 } 243 }
182 } 244 }
src/views/login/index.vue
@@ -124,33 +124,7 @@ export default { @@ -124,33 +124,7 @@ export default {
124 }); 124 });
125 return false; 125 return false;
126 } else { 126 } else {
127 - // 真实请求参考  
128 - // this.$request.fetchLogin({  
129 - // username: that.loginForm.username,  
130 - // password: that.loginForm.password  
131 - // }).then(res => {  
132 - // that.$restBack(res.data, () => {  
133 - // that.$store.dispatch("setToken", res.data.data.access_token).then(res => {  
134 - // that.$router.push({path: "/"})  
135 - // })  
136 - // }, "登录成功")  
137 - // }).catch((err) => {  
138 - // console.log(err)  
139 - // })  
140 -  
141 - // 将 username 设置为 token 存储在 store,仅为测试效果,实际存储 token 以后台返回为准  
142 - that.$store  
143 - .dispatch("setToken", that.loginForm.username)  
144 - .then(() => {  
145 - that.$router.push({ path: "/" });  
146 - })  
147 - .catch((res) => {  
148 - that.$message({  
149 - showClose: true,  
150 - message: res,  
151 - type: "error",  
152 - });  
153 - }); 127 + this.$store.dispatch("Login",this)
154 } 128 }
155 }, 129 },
156 }, 130 },
src/views/portrait/index.vue 0 → 100644
  1 +<template>
  2 + <div>学生画像</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/setUp/account.vue 0 → 100644
  1 +<template>
  2 + <div>账号管理</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/setUp/conglomerate.vue 0 → 100644
  1 +<template>
  2 + <div>集团管理</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/setUp/school.vue 0 → 100644
  1 +<template>
  2 + <div>学校管理</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/setUp/student.vue 0 → 100644
  1 +<template>
  2 + <div>学生管理</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/setUp/teacher.vue 0 → 100644
  1 +<template>
  2 + <div>老师管理</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/test/analysis.vue 0 → 100644
  1 +<template>
  2 + <div>报表分析</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 +
  8 +}
  9 +</script>
  10 +
  11 +<style>
  12 +
  13 +</style>
0 \ No newline at end of file 14 \ No newline at end of file
src/views/test/index.vue 0 → 100644
  1 +<template>
  2 + <div>即时测报表
  3 + <router-link to="/TestAnalysis">报表分析</router-link>
  4 +
  5 + </div>
  6 +</template>
  7 +
  8 +<script>
  9 +export default {
  10 +
  11 +}
  12 +</script>
  13 +
  14 +<style>
  15 +
  16 +</style>
0 \ No newline at end of file 17 \ No newline at end of file