Bladeren bron

增加超级管理员权限操作

TheLittlePrince 6 jaren geleden
bovenliggende
commit
10591179dd

+ 4 - 1
src/api/index.js

@@ -38,6 +38,8 @@ const SuperApplyTeacherList = urlFn('/api/kmt/correctSys/applyTeacherList')
 const ApplyOperate = urlFn('/api/kmt/correctSys/applyOperate')
 //老师薪酬列表
 const GetTeacherSalaryList = urlFn('/api/kmt/correctSys/getTeacherSalaryList')
+// 处理在线批改老师(升级或封号或解封)
+const DealCorrectTeacher = urlFn('/api/kmt/correctSys/dealCorrectTeacher')
 export {
     GET_TOKEN,
     GET_UUIONID_TOKEN,
@@ -56,5 +58,6 @@ export {
     Downgrade,
     SuperApplyTeacherList,
     ApplyOperate,
-    GetTeacherSalaryList
+    GetTeacherSalaryList,
+    DealCorrectTeacher
 }

+ 5 - 5
src/axios/index.js

@@ -30,11 +30,11 @@ axios.interceptors.response.use(response => {
 // 数据统一处理来自网络及服务器的错误
 function checkStatus (response) {
     if (response && response.status === 200 || response && response.status === 304){
-        Message.success('请求成功')
+        // Message.success('请求成功')
         return response.data
     }
     if (response && response.status === 401){
-        sessionStorage.removeItem("accessToken")
+        localStorage.removeItem("accessToken")
         router.replace({
             path: '/' // 到登录页重新获取token
         })
@@ -52,8 +52,8 @@ function checkCode (response) {
     }
     return response
 }
-// let accessToken = sessionStorage.getItem("accessToken")
-let accessToken = "evbOfyzBDlwwi2Tn8KTc5h3sWKsbrpbiazL7wYh7vyTs9KtJ1vANq6j3DmOwFjbL"
+let accessToken = localStorage.getItem("accessToken")
+// let accessToken = "evbOfyzBDlwwi2Tn8KTc5h3sWKsbrpbiazL7wYh7vyTs9KtJ1vANq6j3DmOwFjbL"
 
 // export default ({method = 'post', url = '', params = {}}) => {
 // 	return new Promise((resolve, reject) => {
@@ -84,7 +84,7 @@ export default {
     },
     post (url, data) {
         if (!accessToken){
-            accessToken = sessionStorage.getItem("accessToken");
+            accessToken = localStorage.getItem("accessToken");
         }
         const params = {accessToken};
         return axios({

+ 1 - 0
src/components/MenuComponent.vue

@@ -100,6 +100,7 @@ export default {
       })
         .then(() => {
           localStorage.removeItem("accessToken");
+          debugger
           this.$store.dispatch("LogOut").then(() => {
             location.reload(); // 为了重新实例化vue-router对象 避免bug
           });

+ 3 - 2
src/components/SuperComponent.vue

@@ -37,7 +37,7 @@ export default {
     return {
          BASE_URL: "https://xt.sharingschool.com/upload/",
       menuData: [ {
-    id: "2",
+    id: "1",
     name: "校区管理员",
     href: "SuperAdmin",
   },
@@ -47,7 +47,7 @@ export default {
     href: "CheckTeacherAudit",
   },
   {
-    id: "2",
+    id: "3",
     name: "批改老师薪酬表",
     href: "CheckTeacherPay",
   },
@@ -151,6 +151,7 @@ export default {
   font-size: 14px;
   color: #666666;
   display: inline-block;
+  cursor: pointer;
 }
 .out-img{
   width: 16px;

+ 150 - 0
src/components/teacherCompoent.vue

@@ -0,0 +1,150 @@
+<template>
+  <el-col :span="24" class="">
+      <el-col :span="2" :offset="2">
+       <img class="logoImg" src="../assets/img/log.png"/>
+      </el-col>
+    <!--v-show="roles.indexOf(item.id) >= 0"-->
+      <el-col :span="2"   v-for="(item, index) of menuData" :key="item.id"
+      @click.native="secondNavClick(item,index)" style="text-align: center">
+        <span class="lineStyle" :class="{active:index == checkindex,menu_item:true}">{{item.name}}</span>
+
+      </el-col>
+
+      <el-col :span="4" :offset="9">
+      <div class="login">   
+        <img  class="userstyle"  :src="BASE_URL + avatar" alt="">
+        <!-- <img class="userstyle" src="../assets/img/user.jpg"> -->
+        <span>{{name}}</span>
+        <i class="el-icon-caret-bottom"></i>
+      </div>
+      <div class="out">
+        <img src="../assets/img/out.png" alt class="out-img">
+        <span @click="Loginout">退出</span>
+      </div>
+    </el-col>
+    <el-col :span="1"></el-col>
+  </el-col>
+</template>
+
+<script>
+import {mapGetters} from 'vuex'
+export default {
+  name: "navMenu",
+  // props: {
+  //   navsData: Array
+  // },
+  data() {
+    return {
+         BASE_URL: "https://xt.sharingschool.com/upload/",
+      menuData: [ {
+    id: "1",
+    name: "在线批改老师",
+    href: "onlineteacher",
+  },
+ ],
+      checkindex: 0
+    };
+  },
+  watch: {
+    navsData(n) {
+      this.navsData = n;
+      this.initNav();
+    }
+  },
+  methods: {
+    // 初始化处理
+    // initNav() {
+    //   this.menuData = JSON.parse(JSON.stringify(this.navsData));
+    // },
+    secondNavClick(val, index) {
+      this.$router.push("/Onteacher/" + val.href);
+      this.checkindex = index;
+    },
+     //  账号管理、退出登录
+    Loginout() {
+      this.$confirm("您确定退出吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          localStorage.removeItem("accessToken");
+          this.$store.dispatch("LogOut").then(() => {
+            location.reload(); // 为了重新实例化vue-router对象 避免bug
+          });
+        })
+        .catch(() => {
+          // console.log(err)
+          this.$message("已取消操作!");
+        });
+    }
+  },
+  computed: {
+      ...mapGetters(['name', 'avatar','roles'])
+    },
+  mounted() {
+    // this.initNav();
+  }
+};
+</script>
+<style scoped>
+/*.mainHeader{*/
+  /*height: 110px;*/
+  /*line-height:110px;*/
+/*}*/
+.menu_item {
+  cursor: pointer;
+  color:#999999; 
+  font-size: 9px;
+  font-family: serif;
+  box-sizing:border-box;
+  height: 80%;
+  text-align:center;
+  padding-bottom:19px ;
+  /*display: inline-block;*/
+}
+.menu_item:hover {
+  color:#52CC60 ;
+  border-bottom:2px solid #52cc60;
+}
+.active {
+  color:#52CC60 !important;
+  border-bottom:2px solid #52cc60;
+}
+.menu_item+.menu_item {
+  border-left: 1px solid #ffffff;
+}
+.logoImg{
+  width:136px;
+  height:52px;
+}
+.sishuLogo{
+  margin-left:125px;
+}
+.userstyle{
+  width:26px;
+  height:26px;
+  border-radius: 15px;
+}
+  .lineStyle{
+    color: #999999;
+    font-size: 18px;
+    text-align: center;
+  }
+.login{
+  color: #333333;
+  font-size: 14px;
+  display: inline-block;
+}
+.out{
+  margin-left: 20px;
+  font-size: 14px;
+  color: #666666;
+  display: inline-block;
+  cursor: pointer;
+}
+.out-img{
+  width: 16px;
+  height: 18px;
+}
+</style>

+ 0 - 35
src/main.js

@@ -41,41 +41,6 @@ sync(store, router);
 Object.keys(filters).forEach(key => {
   Vue.filter(key, filters[key]);
 });
-
-// // 添加请求拦截器
-// Axios.interceptors.request.use(config => {
-//   // 在发送请求之前做些什么
-//   //判断是否存在token,如果存在将每个页面header都添加token
-//   if (store.state.token){
-//   config.headers.common['Authentication-Token'] = store.state.token
-//   }
-   
-//   return config;
-//   }, error => {
-//   // 对请求错误做些什么
-//   return Promise.reject(error);
-//   });
-   
-//   // http response 拦截器
-//   Axios.interceptors.response.use(
-//   response => {
-   
-//   return response;
-//   },
-//   error => {
-   
-//   if (error.response) {
-//   switch (error.response.status) {
-//   case 401:
-//   this.$store.commit('del_token');
-//   router.replace({
-//   path: '/login',
-//   query: {redirect: router.currentRoute.fullPath}//登录成功后跳入浏览的当前页面
-//   })
-//   }
-//   }
-//   return Promise.reject(error.response.data)
-//   });
 window.jQuery = jQuery;
 /* eslint-disable no-new */
 new Vue({

+ 15 - 15
src/pages/Login.vue

@@ -27,7 +27,7 @@ export default {
   },
   watch: {},
   created() {
-    this.getTKByUnionid()
+    // this.getTKByUnionid()
   },
   methods: {
     WxLoginCtl() {
@@ -35,24 +35,24 @@ export default {
       this.$router.push({
         path: "/aikmt/Redirect_uri",
         query: {
-          unionid: "oPHg8wbCbIuZwq6NKEdEUPh6DQFM",
+          unionid: "oPHg8wXraekgH5YKVHvD3H7Ujynw",
           prince: "6666666666666"
         }
       });
     },
-    async getTKByUnionid() {
-      if (window.location.href.indexOf("unionid") >= 0) {
-        // 如果url中包含code,则保存到store中
-        let unionid = window.location.href.split("?")[1];
-        unionid = unionid.substring(8, code.indexOf("&"));
-        let WxCode = unionid;
-        this.WxCode = WxCode;
-        this.$store.dispatch("UnionidLogin", {
-         unionid: this.WxCode
-      });
-      }
-     return
-    }
+    // async getTKByUnionid() {
+    //   if (window.location.href.indexOf("unionid") >= 0) {
+    //     // 如果url中包含code,则保存到store中
+    //     let unionid = window.location.href.split("?")[1];
+    //     unionid = unionid.substring(8, code.indexOf("&"));
+    //     let WxCode = unionid;
+    //     this.WxCode = WxCode;
+    //     this.$store.dispatch("UnionidLogin", {
+    //      unionid: this.WxCode
+    //   });
+    //   }
+    //  return
+    // }
   },
   mounted() {
     var obj = new WxLogin({

+ 23 - 0
src/pages/OnlineTeacher/onlineteacher.vue

@@ -0,0 +1,23 @@
+<template>
+  <div>
+    vue模板
+  </div>
+</template>
+<script>
+export default {
+  name: "model",
+  components: {},
+  props: {},
+  data() {
+    return {};
+  },
+  watch: {},
+  computed: {},
+  methods: {},
+  mounted() {}
+};
+</script>
+
+<!-- Add "scoped" attribute to limit CSS to this component only -->
+<style scoped>
+</style>

+ 290 - 0
src/pages/Onteacher.vue

@@ -0,0 +1,290 @@
+<template>
+  <el-row class="height100">
+    <el-col :span="24" class="">
+      <div class="conterLayout">
+        <div class="main_header">
+          <teacherCompoent></teacherCompoent>
+          <!--<div class="main_header_user">-->
+          <!--<el-dropdown @command="handleCommand">-->
+          <!--<div class="el-dropdown-link" style="position: relative;cursor: pointer;">-->
+          <!--<span style="margin-right:30px; font-size: .14rem;"> {{getUser.name}} </span>-->
+          <!--&lt;!&ndash;<i class="el-icon-caret-right"></i>&ndash;&gt;-->
+          <!--<span class="out">退出</span>-->
+          <!--</div>-->
+          <!--<el-dropdown-menu slot="dropdown">-->
+          <!--<el-dropdown-item command="modifyPwd">修改密码</el-dropdown-item>-->
+          <!--<el-dropdown-item command="logDown" divided>退出登录</el-dropdown-item>-->
+          <!--</el-dropdown-menu>-->
+          <!--</el-dropdown>-->
+          <!--</div>-->
+        </div>
+        <div class="main_conter">
+          <router-view></router-view>
+        </div>
+      </div>
+    </el-col>
+  </el-row>
+</template>
+<script type="es6">
+  import NavMenuComponent from "@/components/NavMenuComponent";
+  import teacherCompoent from "@/components/teacherCompoent";
+  import UserInfoView from "@/components/UserInfoView";
+  import { mapGetters, mapActions } from "vuex";
+  export default {
+    components: { NavMenuComponent, UserInfoView, teacherCompoent },
+    name: "home",
+    data() {
+      return {
+        userImgPath: "",
+        filters: {
+          activitySerachListen: 0,
+          timeFrame: []
+        },
+        filterstwo: {
+          activityMonitoringListen: 0,
+          timeType: "0",
+          timeFrame: []
+        },
+        name: "在线人员管理CRM",
+        userName: "超级管理员",
+        // 菜单相关
+        router: true,
+        navHeight: 0,
+        navsData: [],
+        breadcrumb: "",
+        // 修改密码
+        modifyPwdFormRules: {
+          oldPassword: [
+            { required: true, message: "密码不能为空", trigger: "blur" },
+            { min: 5, message: "密码长度不能小于6", trigger: "blur" },
+            { max: 18, message: "密码长度不能大于18", trigger: "blur" }
+          ],
+          newPassword: [
+            { required: true, message: "新密码不能为空", trigger: "blur" },
+            { min: 5, message: "新密码长度不能小于6", trigger: "blur" },
+            { max: 18, message: "新密码长度不能大于18", trigger: "blur" }
+          ],
+          newPassword2: {
+            validator: (rule, value, callback) => {
+              if (value === "") {
+                callback(new Error("请再次输入密码"));
+              } else if (value !== this.modifyPwdForm.newPassword) {
+                callback(new Error("两次输入密码不一致!"));
+              } else {
+                callback();
+              }
+            },
+            trigger: "blur"
+          }
+        },
+        modifyPwdForm: { oldPassword: "", newPassword: "" },
+        userModifyPwdVisible: false,
+        modifyPwdFormLoading: false,
+
+      };
+    },
+    watch: {
+    },
+    computed: {
+      ...mapGetters(["getUser", "getAtivityTimeFrameData"])
+    },
+    // async beforeCreate() {
+    //   let {
+    //     success,
+    //     permissionsMap
+    //   } = await this.$dao.sysDao.findPagePermissions();
+    //   if (success) this.setPagePermissions(permissionsMap);
+    //   // 判断用户是否登录
+    //   if (sessionStorage.user === undefined) {
+    //     this.$router.push("/");
+    //     return this.$message("请先登录!");
+    //   }
+    //   let menuList = this.$dao.sysDao.getMenuList();
+    //   if (menuList.length < 1) {
+    //     this.$router.push("/");
+    //   }
+    //   this.navsData = menuList;
+    //   this.twoMenu = this.$util.twoMenu(menuList);
+    // },
+    methods: {
+      ...mapActions([
+      ]),
+      ...mapGetters([""]),
+      // 修改密码框显示
+      userModifyPwdShow() {
+        const self = this;
+        self.userAddFormLoading = false;
+        self.userModifyPwdVisible = true;
+        self.modifyPwdForm = { oldPassword: "", newPassword: "" };
+      },
+      // 修改密码提交
+      userModifyPwdSubmit() {
+        const self = this;
+        self.$refs.modifyPwdForm.validate(async valid => {
+          if (!valid) return false;
+          self.userAddFormLoading = true;
+          let data = {
+            oldPassword: self.modifyPwdForm.oldPassword,
+            newPassword: self.modifyPwdForm.newPassword
+          };
+          let { success } = await self.$dao.sysDao.userModifyPwd(data);
+          if (success) {
+            self.userModifyPwdVisible = false;
+            self.$util.messageMethod("success", "修改密码成功!");
+          }
+          self.userAddFormLoading = false;
+        });
+      },
+      //  账号管理、退出登录
+      handleCommand(command) {
+        const self = this;
+        if (command === `logDown`) {
+          this.$confirm("您确定退出吗?", "提示", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+            .then(() => {
+              this.$dao.logout();
+              this.$router.replace("/");
+              this.$util.messageMethod("success", "退出成功!");
+              // location.reload()
+            })
+            .catch(() => {
+              // console.log(err)
+              self.$message("已取消操作!");
+            });
+        } else if (command === `modifyPwd`) {
+          // self.$router.replace('/accountManagement')
+          self.userModifyPwdShow();
+        } else if (command === `accountManagement`) {
+          self.$router.replace("/accountManagement");
+        }
+      },
+      //  路由切换
+      // routerDataPath() {
+      //   const path = this.$route.path;
+      //   if (this.dashboard.indexOf(path) !== -1) this.activeName = path;
+      //   if (path !== "/accountManagement") {
+      //     return path;
+      //   } else {
+      //     return "";
+      //   }
+      // }
+    },
+    mounted() {
+      // this.userImgPath = this.getUser.imagePath;
+      this.breadcrumb = this.$route.name;
+      // this.$nextTick(() => {
+      //   this.navHeight =
+      //     document.body.clientHeight - this.$refs.logoUser.offsetHeight;
+      // });
+    }
+  };
+</script>
+
+<style scoped>
+  .main_conter{
+    min-height: 1000px;
+  }
+  .out{
+    margin-left:10px;
+    color:#333333;
+  }
+  .navlink{
+    float:left;
+    margin-right:24px;
+    color:#999999 ;
+    font-size: 9px;
+  }
+  .menu {
+    /* overflow-y: auto; */
+    position: relative;
+    z-index: 1;
+    background-color: #00253f;
+    box-shadow: 3px 0px 7px #cfcfcf;
+  }
+  .logoUser {
+    position: relative;
+    width: 100%;
+    color: #fff;
+    border-bottom: 1px solid #001625;
+  }
+  .logoImg {
+    padding: 0.2rem;
+  }
+  .logoImg > img {
+    display: inline-block;
+    width: 1.8rem;
+    height: 0.38rem;
+  }
+  .logoImg > h2 {
+    font-size: 0.14rem;
+    color: #82b5d7;
+  }
+  .userImg {
+    display: inline-block;
+    height: 0.9rem;
+    width: 0.9rem;
+    border: 2px solid #00c1de;
+  }
+  .userImg,
+  .userImg > img {
+    border-radius: 50%;
+  }
+  .userTitle > p {
+    margin: 0.1rem 0;
+    font-size: 0.16rem;
+    color: #6e828a;
+  }
+  .userAdmin {
+    display: inline-block;
+    margin-bottom: 0.35rem;
+    padding: 0 0.14rem;
+    height: 0.25rem;
+    background-color: #37bf5b;
+    border-radius: 0.1rem;
+  }
+  .userAdmin > span {
+    font-size: 0.12rem;
+    color: #def0e3;
+    line-height: 0.2rem;
+  }
+  .conterLayout {
+    background-color: #eef1f6;
+    width: 100%;
+    height: 100%;
+  }
+  .main_header {
+    display: flex;
+    position: relative;
+    height: 110px;
+    line-height: 110px;
+    background-color: #fff;
+    box-shadow: 0px 0px 20px #eaeaea;
+  }
+  .el-breadcrumb {
+    line-height: 50px;
+  }
+  .el-breadcrumb .el-breadcrumb__item {
+    padding-top: 13px;
+    line-height: 26px;
+    font-size: 18px;
+  }
+  .main_header_user {
+    position: absolute;
+    right: 30px;
+  }
+  .main_header_user .el-dropdown {
+    color: #333333;
+  }
+  .main_header_user .el-icon-caret-right {
+    transform: rotate(43deg);
+    position: absolute;
+    right: 30px;
+    bottom: 16px;
+  }
+  .ativityTimeFrame .el-radio {
+    margin-left: 15px;
+  }
+</style>

File diff suppressed because it is too large
+ 1406 - 0
src/pages/super/SchoolManager.vue


+ 5 - 2
src/pages/super/SuperAdmin.vue

@@ -65,6 +65,9 @@
             header-align="center"></el-table-column>
           <el-table-column prop="status" label="" header-align="center" width="250">
             <template scope="scope">
+              <!-- <router-link tag="a" :to="{path:'/home/SchoolManager',query{managerId:scope.row.managerId}}">
+              <el-button type="success">小组详情</el-button>
+              </router-link> -->
               <el-button type="success"  @click="groupDetail(scope.row.managerId)">小组详情</el-button>
               <el-button type="success" plain @click="isShow(1,scope.row.managerId)">管理员详情</el-button>
             </template>
@@ -110,7 +113,7 @@
           </div>
           <div class="model-items-other model-active">批改科目 : {{getManagerDetail.subject}}</div>
           <div class="model-items-other">批改年级 : <span v-for="(v, k) of arrGrade" :key=k class="scope-name">{{v}}</span></div>
-          <div class="model-items-other model-active">可批改时间:<el-button type="info" round v-for="(v, k) of arrPeriod" :key=k v-if="v">{{v}}</el-button></div>
+          <div class="model-items-other model-active">可批改时间:<span v-if="v"><el-button type="info" round v-for="(v, k) of arrPeriod" :key=k >{{v}}</el-button></span></div>
           <div class="model-items-other">手机号 : {{getManagerDetail.phone}}</div>
           <div class="model-items-other model-active-last">上次登录时间 : {{getManagerDetail.lastOnlineTime}}</div>
         </div>
@@ -270,7 +273,7 @@
       //小组详情
       groupDetail(str){
         this.$router.push({
-          path: "/home/SchoolManager",
+          path: "/super/SuperSchoolManager",
           query: {
             managerId: str
           }

+ 26 - 59
src/permission.js

@@ -1,59 +1,26 @@
-// import router from './router'
-// import store from './store'
-// import { Message } from 'element-ui'
-// import { getToken } from '@/utils/auth' // 验权
-//
-// let accessToken = sessionStorage.getItem("accessToken")
-// const whiteList = ['/login','/aikmt/Redirect_uri'] // 不重定向白名单
-// router.beforeEach((to, from, next) => {
-//     console.log(1)
-//     // next({ path: '/super' })
-//   if (accessToken) { // 判断是否有token
-//     // debugger
-//     if (to.path === '/login') {
-//         console.log(123, to.path)
-//       next()
-//     } else  {
-//
-//         console.log(3,store.getters.roles)
-//       if (store.getters.roles.length === 0) {
-//         // next()
-//           console.log(123)
-//         //   next({ path: '/super' })
-//         store.dispatch('GetInfo').then(res => { // 拉取用户信息
-//             console.log(res)
-//             // debugger
-//           const roles = res.data.role // note: roles must be a array! such as: ['1']
-//         //   console.log('roles?', roles)
-//           store.dispatch('GenerateRoutes', { roles }).then(() => { // 根据roles权限生成可访问的路由表
-//             // debugger
-//             console.log('addrouters', store.getters.addRouters)
-//             // router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表
-//             console.log(router)
-//             next()
-//             // next({ path: '/home' })
-//             // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
-//           })
-//         }).catch(() => {
-//           store.dispatch('FedLogOut').then(() => {
-//             Message.error('验证失败,请重新登录')
-//             next({ path: '/login' })
-//             console.log('roles====5')
-//           })
-//         })
-//       } else {
-//         console.log('====6')
-//         // next() // 当有用户权限的时候,说明所有可访问路由已生成 如访问没权限的全面会自动进入404页面
-//       }
-//     }
-//   } else {
-//       console.log(to.path,whiteList.indexOf(to.path))
-//     if (whiteList.indexOf(to.path) !== -1) {
-//         console.log(1)
-//       next()
-//     } else {
-//     //     console.log(123)
-//     //   next('/login')
-//     }
-//   }
-// })
+import router from './router'
+import store from './store'
+import { Message } from 'element-ui'
+
+// let accessToken = localStorage.getItem("accessToken")
+router.beforeEach((to, from, next) => {
+    let accessToken = localStorage.getItem("accessToken")
+    // let ToAcess =  to.matched[1].meta.roles[0];
+    // let FromAcess =  from.matched[1].meta.roles[0];
+    // if (ToAcess !== FromAcess){
+    //     debugger
+    //     return
+    // }
+    if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限
+            if (accessToken) { // 判断缓存里面是否有 accessToken  //在登录的时候设置它的值
+                next();
+            } else {
+                Message.error('登陆权限验证失败,请重新登录')
+                next({
+                    path: '/Login'
+                })
+            }
+        } else {
+            next();
+        }
+});

+ 62 - 14
src/router/index.js

@@ -3,15 +3,21 @@ import Router from "vue-router";
 import Login from "@/pages/Login";
 import Home from "@/pages/Home";
 import Super from "@/pages/Super";
+import Onteacher from "@/pages/Onteacher";
 // import Redirect_uri from "@/pages/Redirect_uri";
 import Error from "@/pages/Error";
 import Error404 from "@/pages/Error404";
+// 校区管理员
 import SchoolManager from "@/pages/home/SchoolManager";
 import TeacherApporval from "@/pages/home/TeacherApporval";
 import TeacherPay from "@/pages/home/TeacherPay";
+// 超级管理员
 import CheckTeacherAudit from "@/pages/Super/CheckTeacherAudit";
+import SuperSchoolManager from "@/pages/Super/SchoolManager";
 import CheckTeacherPay from "@/pages/Super/CheckTeacherPay";
 import SuperAdmin from "@/pages/Super/SuperAdmin";
+// 在线批改老师
+import Onlineteacher from "@/pages/OnlineTeacher/onlineteacher";
 import Redirect_uri from "@/pages/aikmt/Redirect_uri"; //微信登陆路由重定向页面
 Vue.use(Router);
 
@@ -20,22 +26,30 @@ export const constantRouterMap =
     {
       path: "/",
       name: "Login",
-      component: Login
+      component: Login,
+      meta: { title: '登陆', roles: ['0'] }
     },
     {
       path: "/Login",
       name: "login",
-      component: Login
+      component: Login,
+      meta: { title: '登陆', roles: ['0'] }
     },
     {
       path: "/aikmt/redirect_uri",
       name: "微信认证重定向页",
-      component: Redirect_uri
+      component: Redirect_uri,
+      meta: { title: '微信认证重定向页', roles: ['0'] }
     },
-
+// 超级管理员角色路由
      {
        path: "/super",
        component: Super,
+       meta: {
+        title: '',
+        requireAuth: true,  // 添加该字段,表示进入这个路由是需要登录的
+
+    },
        children:[
          {
            path: "",
@@ -45,26 +59,37 @@ export const constantRouterMap =
            path: "SuperAdmin",
            name: "SuperAdmin",
            component: SuperAdmin,
-           meta: { title: '超级管理员', roles: ['2'] }
+           meta: { title: '超级管理员', roles: ['3'] }
 
          },
          {
            path: "CheckTeacherAudit",
            name: "CheckTeacherAudit",
            component: CheckTeacherAudit,
-           meta: { title: '批改老师注册审核', roles: ['2'] }
+           meta: { title: '批改老师注册审核', roles: ['3'] }
          },
          {
            path: "CheckTeacherPay",
            name: "CheckTeacherPay",
            component: CheckTeacherPay,
-           meta: { title: '批改老师薪酬表', roles: ['2'] }
+           meta: { title: '批改老师薪酬表', roles: ['3'] }
          },
+         {
+          path: "SuperSchoolManager",
+          name: "SuperSchoolManager",
+          component: SuperSchoolManager,
+          meta: { title: '校区管理员', roles: ['3'] }
+        },
        ]
      },
+    //  校区管理员角色路由
       {
        path: "/home",
        component: Home,
+       meta: {
+        title: '',
+        requireAuth: true,  // 添加该字段,表示进入这个路由是需要登录的
+    },
        children: [
          {
            path: "",
@@ -86,19 +111,42 @@ export const constantRouterMap =
            path: "TeacherPay",
            name: "TeacherPay",
            component: TeacherPay,
-           meta: { title: '教师薪酬管理', roles: ['1'] }
+           meta: { title: '教师薪酬管理', roles: ['2'] }
          },
-         {
-           path: "*",
-           name: "找不到页面",
-           component: Error404
-         }
        ]
      },
+    //  在线批改老师角色路由
+     {
+      path: "/Onteacher",
+      component: Onteacher,
+      meta: {
+       title: '',
+       requireAuth: true,  // 添加该字段,表示进入这个路由是需要登录的
+   },
+      children: [
+        {
+          path: "",
+          redirect: "Onlineteacher"
+        },
+        {
+          path: "Onlineteacher",
+          name: "Onlineteacher",
+          component: Onlineteacher,
+          meta: { title: '在线批改老师', roles: ['1'] }
+        },
+      ]
+    },
+     {
+      path: "*",
+      name: "找不到页面",
+      component: Error404,
+      meta: { title: '找不到页面', roles: ['0'] }
+    },
      {
        path: "*",
        name: "错误页面",
-       component: Error
+       component: Error,
+       meta: { title: '错误页面', roles: ['0'] }
      }
 
   ]

+ 38 - 19
src/store/modules/user.js

@@ -2,7 +2,7 @@ import { GET_UUIONID_TOKEN,GET_TOKEN,GetInfo,InfoWatch,InfoWatchDay,
   InfoWatchMoth,TeacherHomeworkList,TeacherAllotList,
   TeacherAllot,UnallotHomeworkList,GetTeacherDetail,
   GetStudentDetail,GetManagerDetail,Downgrade,SuperManagerList,
-  SuperApplyTeacherList,ApplyOperate,GetTeacherSalaryList,
+  SuperApplyTeacherList,ApplyOperate,GetTeacherSalaryList,DealCorrectTeacher
   } from '@/api'
 import { getToken, setToken, removeToken } from '@/utils/auth'
 import axios from '@/axios'
@@ -98,14 +98,17 @@ const user = {
           if (res && res.code == '999') {
             const data = res.data
             commit('SET_TOKEN', data);
-            sessionStorage.setItem("accessToken",data.accessToken)
+            localStorage.setItem("accessToken",data.accessToken)
                     Message.success('登录成功')
                    dispatch('GetInfo').then(res => { // 拉取用户信息
                         const roles = res.data.role 
+                        if (roles == 1) {
+                          router.push("/Onteacher");
+                        }
                         if (roles == 2) {
                           router.push("/home");
                         }
-                        if (roles == 1) {
+                        if (roles == 3) {
                           router.push("/super");
                         }
                       }).catch(() => {
@@ -126,14 +129,14 @@ const user = {
           if (res && res.code == '999') {
             const data = res.data
             commit('SET_TOKEN', data);
-            sessionStorage.setItem("accessToken",data.accessToken)
+            localStorage.setItem("accessToken",data.accessToken)
                     Message.success('登录成功')
                    dispatch('GetInfo').then(res => { // 拉取用户信息
                         const roles = res.data.role 
                         if (roles == 2) {
                           router.push("/home");
                         }
-                        if (roles == 1) {
+                        if (roles == 3) {
                           router.push("/super");
                         }
                       }).catch(() => {
@@ -294,8 +297,20 @@ const user = {
         })
       })
     },
-    // 校区管理员降级
-    Downgrade({ commit, state }, data) {
+    // 处理在线批改老师(升级或封号或解封)
+    DealCorrectTeacher({ commit, state }, data) {
+      return new Promise((resolve, reject) => {
+        axios.post(DealCorrectTeacher, data).then(response => {
+          const data = response.data
+          commit('SET_DOWNGRADE', data);
+          resolve(response)
+        }).catch(error => {
+          reject(error)
+        })
+      })
+    },
+     // 校区管理员降级
+     Downgrade({ commit, state }, data) {
       return new Promise((resolve, reject) => {
         axios.post(Downgrade, data).then(response => {
           const data = response.data
@@ -348,18 +363,22 @@ const user = {
     },
     // 登出getTeacherSalaryList
     LogOut({ commit, state }) {
-      debugger
-      return new Promise((resolve, reject) => {
-        logout(state.token).then(() => {
-          commit('SET_TOKEN', '')
-          commit('SET_ROLES', [])
-          Message.success('退出成功')
-          router.push("/");
-          resolve()
-        }).catch(error => {
-          reject(error)
-        })
-      })
+      // debugger
+      commit('SET_TOKEN', '')
+      commit('SET_ROLES', [])
+      Message.success('退出成功')
+      router.push("/");
+      // return new Promise((resolve, reject) => {
+      //   logout(state.token).then(() => {
+      //     commit('SET_TOKEN', '')
+      //     commit('SET_ROLES', [])
+      //     Message.success('退出成功')
+      //     router.push("/");
+      //     resolve()
+      //   }).catch(error => {
+      //     reject(error)
+      //   })
+      // })
     },
 
     // 前端 登出