Browse Source

Merge branch 'master' of http://git.cc-lotus.info/new_train/train-student

wuhongyuq 5 years ago
parent
commit
246cf663e1

+ 80 - 0
src/layout/class/classGroup.vue

@@ -0,0 +1,80 @@
+<template>
+  <div id="classGroup">
+    <el-row>
+      <el-col :span="24" class="button_class">
+        <van-button v-if="stuIdAndGroupId.type === '班长'" round type="info" icon="smile" @click="dialogFormVisible = true">创建小组</van-button>
+      </el-col>
+      <el-col :span="24">
+        <groupList :groupList="groupList" v-on="$listeners" :stuIdAndGroupId="stuIdAndGroupId"></groupList>
+      </el-col>
+      <el-col :span="24" class="foot">
+        <noGroup></noGroup>
+      </el-col>
+    </el-row>
+    <el-dialog class="createGroup" title="创建小组" :visible.sync="dialogFormVisible" width="100%">
+      <el-form :model="form">
+        <el-form-item label="名称" prop="name" :label-width="formLabelWidth" :rules="[{ required: true, message: '小组名称不能为空' }]">
+          <el-input v-model="form.name" autocomplete="off"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button
+          type="primary"
+          @click="
+            saveGroup();
+            dialogFormVisible = false;
+          "
+          >提 交</el-button
+        >
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import groupList from '@/layout/class/groupList.vue';
+import noGroup from '@/layout/class/noGroup.vue';
+export default {
+  name: 'classGroup',
+  props: {
+    groupList: null,
+    stuIdAndGroupId: null, //登陆者id和小组id
+  },
+  components: {
+    groupList,
+    noGroup,
+  },
+  data: () => ({
+    dialogTableVisible: false,
+    dialogFormVisible: false,
+    form: {
+      name: '',
+    },
+    formLabelWidth: '80px',
+  }),
+  created() {},
+  computed: {},
+  methods: {
+    saveGroup() {
+      this.$emit('saveGroup', { data: this.form });
+      dialogFormVisible: false;
+    },
+    // createGroup() {
+    //   this.$emit('createGroup');
+    // },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.button_class {
+  padding: 0 100px;
+  line-height: 100px;
+}
+button {
+  width: 100%;
+}
+.createGroup {
+  width: 100%;
+}
+</style>

+ 7 - 2
src/layout/class/classList.vue

@@ -4,7 +4,7 @@
       <el-col :span="24">
         <van-tabs v-model="active">
           <van-tab title="班级名单">
-            <span v-if="role === '4'">
+            <span v-if="role === '1'">
               <headNameList v-on="$listeners" :headNameList="headNameList" :assignShow="assignShow" :assignForm="assignForm"></headNameList>
             </span>
             <span v-else>
@@ -12,7 +12,7 @@
             </span>
           </van-tab>
           <van-tab title="班级分组">
-            班级分组,需要有创建分组按钮,显示小组名称,小组人数,加入小组。(未分组学生显示)
+            <classGroup :groupList="groupList" v-on="$listeners" :stuIdAndGroupId="stuIdAndGroupId"></classGroup>
           </van-tab>
         </van-tabs>
       </el-col>
@@ -23,6 +23,7 @@
 <script>
 import headNameList from '@/layout/class/nameList/headNameList.vue';
 import stuNameList from '@/layout/class/nameList/stuNameList.vue';
+import classGroup from '@/layout/class/classGroup.vue';
 export default {
   name: 'classList',
   props: {
@@ -30,6 +31,8 @@ export default {
     assignShow: null, //指派职务弹窗
     assignForm: null, //指派职务form表单
     stuNameList: null, //学生看班级学生名单
+    groupList: null,
+    stuIdAndGroupId: null, //登陆者id和小组id
   },
   components: {
     // 显示班级学生名称(带有职务)
@@ -37,10 +40,12 @@ export default {
     // 学委:给学生上分(平时成绩只有一个,课程作业成绩,都要显示)
     headNameList, //班主任班级学生名单
     stuNameList, //学生班级学生名单
+    classGroup, //班级分组
   },
   data: () => ({
     active: 0,
     role: '4',
+    // groupList: [],
   }),
   created() {},
   computed: {},

+ 78 - 9
src/layout/class/groupList.vue

@@ -2,31 +2,93 @@
   <div id="groupList">
     <el-row>
       <el-col :span="24" class="list" v-for="(item, index) in groupList" :key="index">
-        <el-col :span="20" class="name"> 组名:{{ item.name }} </el-col>
-        <el-col :span="4" class="name">
-          <el-button type="success" size="mini" @click="$router.push({ path: '/class/joinGroup', query: { id: item.id } })">加入</el-button>
-          <!-- <el-button type="success" size="mini" @click="deteles(item.id)">删除</el-button> -->
-        </el-col>
+        <el-collapse accordion>
+          <el-collapse-item>
+            <template slot="title">
+              <el-col :span="2" class="groupName">{{ index + 1 }}.</el-col>
+              <el-col :span="5" class="groupName"> {{ item.name }} </el-col>
+              <el-col :span="4" class="groupName">
+                <el-button v-if="item.students.length >= 10" round plain type="danger" size="mini" disabled>已满员</el-button>
+              </el-col>
+              <el-col :span="1" class="groupName"></el-col>
+              <el-col :span="4" class="groupName">
+                <el-button v-if="stuIdAndGroupId.type === '班长' && item.students.length === 0" round type="danger" size="mini" @click="deleteGroup(item.id)"
+                  >删除</el-button
+                >
+              </el-col>
+              <el-col :span="1" class="groupName"></el-col>
+              <el-col :span="4" class="groupName">
+                <el-button v-if="stuIdAndGroupId.groupId === '' && item.students.length <= 10" round type="success" size="mini" @click="joinGroup(item.id)"
+                  >加入</el-button
+                >
+                <el-button v-if="stuIdAndGroupId.groupId === item.id" round type="danger" size="mini" @click="exitGroup(item.id)">退出</el-button>
+              </el-col>
+            </template>
+            <el-col :span="24" class="list" v-for="(itemStrudent, indexStudent) in item.students" :key="indexStudent">
+              <el-col :span="6" class="childName">{{ itemStrudent.stuname }}</el-col>
+            </el-col>
+          </el-collapse-item>
+        </el-collapse>
       </el-col>
     </el-row>
   </div>
 </template>
 
 <script>
+import Vue from 'vue';
+import { Dialog } from 'vant';
+// 全局注册
+Vue.use(Dialog);
 export default {
   name: 'groupList',
   props: {
     groupList: null,
+    stuIdAndGroupId: null,
   },
   components: {},
   data: () => ({}),
   created() {},
   computed: {},
   methods: {
+    // 进组
+    joinGroup(groupId) {
+      Dialog.confirm({
+        title: '进组',
+        message: '确认要加入此组?',
+      })
+        .then(() => {
+          this.$emit('joinGroup', { groupId });
+        })
+        .catch(() => {
+          // on cancel
+        });
+    },
+    // 退出组
+    exitGroup(groupId) {
+      Dialog.confirm({
+        title: '退组',
+        message: '确认要退出此组?',
+      })
+        .then(() => {
+          this.$emit('exitGroup', { groupId });
+        })
+        .catch(() => {
+          // on cancel
+        });
+    },
     // 删除组
-    // deteles(id) {
-    //   this.$emit('shanchu', id);
-    // },
+    deleteGroup(groupId) {
+      Dialog.confirm({
+        title: '删除',
+        message: '确认删除此组?',
+      })
+        .then(() => {
+          this.$emit('deleteGroup', { groupId });
+        })
+        .catch(() => {
+          // on cancel
+        });
+    },
   },
 };
 </script>
@@ -43,8 +105,15 @@ p {
   padding: 0 10px;
   border-radius: 15px;
 }
-.list .name {
+.list .groupName {
   padding: 15px 0;
   font-size: 18px;
 }
+.childName {
+  padding: 15px 0;
+  font-size: 15px;
+}
+button {
+  width: 120%;
+}
 </style>

+ 32 - 0
src/layout/class/noGroup.vue

@@ -0,0 +1,32 @@
+<template>
+  <div id="noGroup">
+    <el-row>
+      <el-col :span="24">未分组学生</el-col>
+      <el-col :span="6">顾宏伟</el-col>
+      <el-col :span="6">顾宏伟</el-col>
+      <el-col :span="6">顾宏伟</el-col>
+      <el-col :span="6">顾宏伟</el-col>
+      <el-col :span="6">顾宏伟</el-col>
+      <el-col :span="6">顾宏伟</el-col>
+      <el-col :span="6">顾宏伟</el-col>
+      <el-col :span="6">顾宏伟</el-col>
+      <el-col :span="6">顾宏伟</el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'noGroup',
+  props: {
+    noGroupList: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped></style>

+ 2 - 4
src/layout/common/footInfo.vue

@@ -2,7 +2,7 @@
   <div id="footInfo">
     <el-row>
       <el-col :span="24">
-        <van-tabbar v-model="active">
+        <van-tabbar route>
           <van-tabbar-item to="/" icon="home-o">首页</van-tabbar-item>
           <van-tabbar-item to="/class/index" icon="friends-o">班级名单</van-tabbar-item>
           <van-tabbar-item to="/question/index" icon="question-o">问卷调查</van-tabbar-item>
@@ -18,9 +18,7 @@ export default {
   name: 'footInfo',
   props: {},
   components: {},
-  data: () => ({
-    active: 0,
-  }),
+  data: () => ({}),
   created() {},
   computed: {},
   methods: {},

+ 10 - 4
src/layout/common/topInfo.vue

@@ -2,7 +2,8 @@
   <div id="topInfo">
     <el-row>
       <el-col :span="24" class="topInfos">
-        <van-nav-bar title="日程安排" left-text="返回" left-arrow fixed @click-left="onClickLeft" />
+        <!-- <van-nav-bar title="日程安排" left-text="返回" left-arrow fixed @click-left="onClickLeft" /> -->
+        <van-nav-bar :title="title" :left-arrow="isleftarrow" @click-left="onClickLeft" />
       </el-col>
     </el-row>
   </div>
@@ -11,21 +12,26 @@
 <script>
 export default {
   name: 'topInfo',
-  props: {},
+  props: {
+    title: null,
+    isleftarrow: null,
+  },
   components: {},
   data: () => ({}),
   created() {},
   computed: {},
   methods: {
     onClickLeft() {
-      Toast('返回');
+      // 点击回退的时候当做地址回退
+      this.$router.go(-1);
     },
   },
 };
 </script>
 
 <style lang="less" scoped>
-.topInfos{}
+// .topInfos {
+// }
 /deep/.van-nav-bar {
   background: #2c69fe;
 }

+ 11 - 2
src/router/index.js

@@ -8,6 +8,7 @@ const routes = [
   {
     path: '/',
     name: 'index',
+    meta: { title: '日程安排', isleftarrow: true },
     component: () => import('../views/index.vue'),
   },
 
@@ -19,6 +20,7 @@ const routes = [
   // 班级名单
   {
     path: '/class/index',
+    meta: { title: '班級名单', isleftarrow: true },
     component: () => import('../views/class/index.vue'),
   },
 
@@ -30,6 +32,7 @@ const routes = [
   // 班级名单-上成绩
   {
     path: '/class/achieve',
+    meta: { title: '班级成绩', isleftarrow: true },
     component: () => import('../views/class/achieve.vue'),
   },
   // 班级名单-分组
@@ -45,43 +48,49 @@ const routes = [
   // 问卷调查
   {
     path: '/question/index',
+    meta: { title: '问卷调查', isleftarrow: true },
     component: () => import('../views/question/index.vue'),
   },
   // 问卷调查
   {
     path: '/question/question',
+    meta: { title: '填写答案', isleftarrow: true },
     component: () => import('../views/question/question.vue'),
   },
   // 个人信息
   {
     path: '/user/index',
-    name: 'user',
+    meta: { title: '个人信息', isleftarrow: true },
     component: () => import('../views/user/index.vue'),
   },
   // 个人信息-信息详情
   {
     path: '/user/personalDetail',
+    meta: { title: '详细信息', isleftarrow: true },
     component: () => import('../views/user/personalDetail.vue'),
   },
   // 个人信息-请假管理
   {
     path: '/user/leave',
+    meta: { title: '请假管理', isleftarrow: true },
     component: () => import('../views/user/leave.vue'),
   },
   // 个人信息-添加请假
   {
     path: '/user/leaveDetail',
-    meta: { title: '请假', sub: '管理' },
+    meta: { title: '填写请假条', isleftarrow: true },
     component: () => import('../views/user/leaveDetail.vue'),
   },
   // 个人信息-请假结果
   {
     path: '/user/leaveReason',
+    meta: { title: '请假审核', isleftarrow: true },
     component: () => import('../views/user/leaveReason.vue'),
   },
   // 个人信息-考勤管理
   {
     path: '/user/checkWork',
+    meta: { title: '考勤管理', isleftarrow: true },
     component: () => import('../views/user/checkWork.vue'),
   },
 ];

+ 3 - 3
src/store/group.js

@@ -11,8 +11,8 @@ const state = () => ({});
 const mutations = {};
 
 const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.groupInfo}`, { skip, limit, ...info });
+  async query({ commit }, { skip = 0, limit, termid, batchid, classid, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.groupInfo}`, { skip, limit, ...info, termid, batchid, classid });
     return res;
   },
   async create({ commit }, payload) {
@@ -36,7 +36,7 @@ const actions = {
     return res;
   },
   async exit({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.groupInfo}/exit`, payload);
+    const res = await this.$axios.$post(`${api.groupInfo}/exit`, payload);
     return res;
   },
 };

+ 18 - 3
src/views/class/achieve.vue

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <topInfo></topInfo>
+          <!-- <topInfo></topInfo> -->
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
           <achieves
@@ -21,14 +22,14 @@
 </template>
 
 <script>
-import topInfo from '@/layout/common/topInfo.vue';
+import NavBar from '@/layout/common/topInfo.vue';
 import achieves from '@/layout/class/achieve.vue';
 
 export default {
   name: 'achieve',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     achieves, //班级学生成绩列表
   },
   data: () => ({
@@ -84,9 +85,23 @@ export default {
     ],
     show: false,
     form: {},
+    title: '',
+    isleftarrow: '',
+    transitionName: 'fade',
+    navShow: true,
   }),
   created() {},
   computed: {},
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
   methods: {
     clickAchieve() {
       this.show = true;

+ 106 - 6
src/views/class/index.vue

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <topInfo></topInfo>
+          <!-- <topInfo></topInfo> -->
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
           <classList
@@ -14,6 +15,12 @@
             @outForm="outAssignShow"
             @onForm="onAssignShow"
             :stuNameList="stuNameList"
+            :groupList="groupList"
+            @saveGroup="saveGroup"
+            @exitGroup="exitGroup"
+            @deleteGroup="deleteGroup"
+            @joinGroup="joinGroup"
+            :stuIdAndGroupId="stuIdAndGroupId"
           ></classList>
         </el-col>
         <el-col :span="24" class="foot">
@@ -25,15 +32,22 @@
 </template>
 
 <script>
-import topInfo from '@/layout/common/topInfo.vue';
+import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 import classList from '@/layout/class/classList.vue';
-
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapQuestion } = createNamespacedHelpers('group');
+let site = JSON.parse(sessionStorage.getItem('site'));
+const termid = site.termid;
+const batchid = site.batchid;
+const classid = site.classid;
+const stuid = site.id;
+const type = '班长';
 export default {
   name: 'index',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     footInfo, //底部导航
     classList, //班级名单
   },
@@ -78,20 +92,106 @@ export default {
         job: '班长',
       },
     ],
+    groupList: [],
+    stuIdAndGroupId: '',
+    title: '',
+    isleftarrow: '',
+    transitionName: 'fade',
+    navShow: true,
   }),
-  created() {},
+  created() {
+    this.findList();
+  },
   computed: {},
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
   methods: {
     clickAssign() {
       this.assignShow = true;
     },
     onAssignShow(assignForm) {
-      console.log(assignForm);
       this.assignShow = false;
     },
     outAssignShow() {
       this.assignShow = false;
     },
+    ...mapQuestion(['query', 'create', 'delete', 'insert', 'exit']),
+    // 查询小组列表
+    async findList() {
+      let data = {};
+      data.termid = termid;
+      data.batchid = batchid;
+      data.classid = classid;
+      const result = await this.query(data);
+      const groupList = result.data;
+      this.$set(this, 'groupList', groupList);
+      // 找出登陆者在哪个组
+      // 找出组id
+      let groupId = '';
+      var i = groupList.findIndex(value => {
+        var v = value.students.findIndex(value => {
+          return stuid === value.stuid;
+        });
+        return v != -1;
+      });
+      if (i != -1) {
+        groupId = groupList[i].id;
+      }
+      let stuIdAndGroupId = {};
+      // 登陆者id
+      stuIdAndGroupId.stuid = stuid;
+      // 登陆者属于哪个组id
+      stuIdAndGroupId.groupId = groupId;
+      // 登陆者身份是否为班长
+      stuIdAndGroupId.type = type;
+      this.$set(this, 'stuIdAndGroupId', stuIdAndGroupId);
+    },
+    // 创建小组
+    async saveGroup({ data }) {
+      data.termid = termid;
+      data.batchid = batchid;
+      data.classid = classid;
+      const result = await this.create(data);
+      if (result.errcode == 0) {
+        this.findList();
+      }
+    },
+    // 加入小组
+    async joinGroup({ groupId }) {
+      let data = {};
+      data.groupid = groupId;
+      data.stuid = stuid;
+      data.stuname = site.name;
+      const result = await this.insert(data);
+      if (result.errcode == 0) {
+        this.findList();
+      }
+    },
+    // 退出小组
+    async exitGroup({ groupId }) {
+      let data = {};
+      data.groupid = groupId;
+      data.stuid = stuid;
+      const result = await this.exit(data);
+      if (result.errcode == 0) {
+        this.findList();
+      }
+    },
+    // 删除小组
+    async deleteGroup({ groupId }) {
+      const result = await this.delete(groupId);
+      if (result.errcode == 0) {
+        this.findList();
+      }
+    },
   },
 };
 </script>

+ 18 - 7
src/views/index.vue

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <topInfo></topInfo>
+          <!-- <topInfo></topInfo> -->
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
           <mainData :lessionclassInfo="lessionclassInfo" :week="week"></mainData>
@@ -17,7 +18,7 @@
 </template>
 
 <script>
-import topInfo from '@/layout/common/topInfo.vue';
+import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 import mainData from '@/layout/index/mainData.vue';
 const { mapActions: lesson } = createNamespacedHelpers('lesson');
@@ -27,15 +28,18 @@ export default {
   name: 'index',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     footInfo, //底部导航
     mainData, //课程安排主体
   },
   data: () => ({
     lessionclassInfo: { lessons: [] },
-
     dates: '',
     week: '',
+    title: '日程安排',
+    isleftarrow: '',
+    transitionName: 'fade',
+    navShow: true,
   }),
   created() {
     this.getDate();
@@ -43,7 +47,16 @@ export default {
     this.searchSite();
   },
   computed: {},
-  mounted() {},
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
   methods: {
     ...lesson({ lessionInfo: 'fetch', lessionlist: 'query' }),
     ...mapStudent(['fetch']),
@@ -77,9 +90,7 @@ export default {
       var adate = new Date();
       this.value = adate.getFullYear() + '-' + (adate.getMonth() + 1) + '-' + adate.getDate();
       this.$set(this, `dates`, this.value);
-
       var str = '星期' + '日一二三四五六'.charAt(new Date().getDay());
-      console.log(str);
       this.$set(this, `week`, str);
     },
   },

+ 18 - 3
src/views/question/index.vue

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <topInfo></topInfo>
+          <!-- <topInfo></topInfo> -->
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
           <questionnaireInfo :questionnaireList="questionnaireList"></questionnaireInfo>
@@ -17,7 +18,7 @@
 </template>
 
 <script>
-import topInfo from '@/layout/common/topInfo.vue';
+import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 import questionnaireInfo from '@question/src/views/index.vue';
 import { createNamespacedHelpers, mapGetters } from 'vuex';
@@ -26,17 +27,31 @@ export default {
   name: 'index',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     footInfo, //底部导航
     questionnaireInfo, //问卷调查
   },
   data: () => ({
     questionnaireList: [],
+    title: '',
+    isleftarrow: '',
+    transitionName: 'fade',
+    navShow: true,
   }),
   created() {
     this.searchNaireList();
   },
   computed: {},
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
   methods: {
     ...mapQuestion(['query', 'fetch', 'update']),
     async searchNaireList({ ...info } = {}) {

+ 18 - 3
src/views/question/question.vue

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <topInfo></topInfo>
+          <!-- <topInfo></topInfo> -->
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
           <questionInfo :info="info" :form="form" @submit="submit"></questionInfo>
@@ -17,7 +18,7 @@
 </template>
 
 <script>
-import topInfo from '@/layout/common/topInfo.vue';
+import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 import questionInfo from '@question/src/views/question.vue';
 import { createNamespacedHelpers, mapGetters } from 'vuex';
@@ -26,7 +27,7 @@ export default {
   name: 'question',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     footInfo, //底部导航
     questionInfo, //问卷调查
   },
@@ -37,6 +38,10 @@ export default {
     form: {
       opname: [],
     },
+    title: '',
+    isleftarrow: '',
+    transitionName: 'fade',
+    navShow: true,
   }),
   created() {
     this.searchInfo();
@@ -46,6 +51,16 @@ export default {
       return this.$route.query.id;
     },
   },
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
   methods: {
     ...mapQuestion(['query', 'fetch', 'update']),
     async searchInfo({ ...info } = {}) {

+ 18 - 3
src/views/user/checkWork.vue

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <topInfo></topInfo>
+          <!-- <topInfo></topInfo> -->
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
           <el-col :span="24" class="leaveBtn">
@@ -19,13 +20,13 @@
 </template>
 
 <script>
-import topInfo from '@/layout/common/topInfo.vue';
+import NavBar from '@/layout/common/topInfo.vue';
 import checkList from '@/layout/user/checkList.vue';
 export default {
   name: 'checkWork',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     checkList, //考勤列表
   },
   data: () => ({
@@ -51,9 +52,23 @@ export default {
         ],
       },
     ],
+    title: '',
+    isleftarrow: '',
+    transitionName: 'fade',
+    navShow: true,
   }),
   created() {},
   computed: {},
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
   methods: {
     onClickRight() {
       console.log('考勤打卡');

+ 18 - 3
src/views/user/index.vue

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <topInfo></topInfo>
+          <!-- <topInfo></topInfo> -->
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
           <el-col :span="24" class="message">
@@ -22,7 +23,7 @@
 </template>
 
 <script>
-import topInfo from '@/layout/common/topInfo.vue';
+import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 import messageInfo from '@/layout/user/messageInfo.vue';
 import clickBtn from '@/layout/user/clickBtn.vue';
@@ -32,7 +33,7 @@ export default {
   name: 'index',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     footInfo, //底部导航
     messageInfo, //个人信息
     clickBtn, //功能按钮
@@ -57,11 +58,25 @@ export default {
       have_grant: '1',
       job: '班长',
     },
+    title: '',
+    isleftarrow: '',
+    transitionName: 'fade',
+    navShow: true,
   }),
   created() {
     this.searchSite();
   },
   computed: {},
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
   methods: {
     ...mapStudent(['fetch']),
     async searchSite() {

+ 18 - 3
src/views/user/leave.vue

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <topInfo></topInfo>
+          <!-- <topInfo></topInfo> -->
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
           <el-col :span="24" class="leaveBtn">
@@ -19,7 +20,7 @@
 </template>
 
 <script>
-import topInfo from '@/layout/common/topInfo.vue';
+import NavBar from '@/layout/common/topInfo.vue';
 import leaveList from '@/layout/user/leaveList.vue';
 import { createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapLeave } = createNamespacedHelpers('leave');
@@ -27,16 +28,30 @@ export default {
   name: 'leave',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     leaveList, //请假列表
   },
   data: () => ({
     leaveList: [],
+    title: '',
+    isleftarrow: '',
+    transitionName: 'fade',
+    navShow: true,
   }),
   created() {
     this.searchInfo();
   },
   computed: {},
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
   methods: {
     ...mapLeave(['query']),
     async searchInfo({ skip = 0, limit = 10, ...info } = {}) {

+ 18 - 3
src/views/user/leaveDetail.vue

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <topInfo></topInfo>
+          <!-- <topInfo></topInfo> -->
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
           <leaveRequest :form="form" @submit="submitForm" @cancelClick="cancelClick"></leaveRequest>
@@ -14,7 +15,7 @@
 </template>
 
 <script>
-import topInfo from '@/layout/common/topInfo.vue';
+import NavBar from '@/layout/common/topInfo.vue';
 import leaveRequest from '@/layout/user/leaveRequest.vue';
 import { createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapLeave } = createNamespacedHelpers('leave');
@@ -22,11 +23,15 @@ export default {
   name: 'leaveDetail',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     leaveRequest, //请假申请
   },
   data: () => ({
     form: {},
+    title: '',
+    isleftarrow: '',
+    transitionName: 'fade',
+    navShow: true,
   }),
   created() {},
   computed: {
@@ -36,6 +41,16 @@ export default {
       return main;
     },
   },
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
   methods: {
     ...mapLeave(['create']),
     async submitForm(form) {

+ 18 - 3
src/views/user/leaveReason.vue

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <topInfo></topInfo>
+          <!-- <topInfo></topInfo> -->
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
           <leaveRefuse :refuseInfo="refuseInfo"></leaveRefuse>
@@ -14,7 +15,7 @@
 </template>
 
 <script>
-import topInfo from '@/layout/common/topInfo.vue';
+import NavBar from '@/layout/common/topInfo.vue';
 import leaveRefuse from '@/layout/user/leaveRefuse.vue';
 import { createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapLeave } = createNamespacedHelpers('leave');
@@ -22,11 +23,15 @@ export default {
   name: 'leaveReason',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     leaveRefuse, //拒绝理由
   },
   data: () => ({
     refuseInfo: {},
+    title: '',
+    isleftarrow: '',
+    transitionName: 'fade',
+    navShow: true,
   }),
   created() {
     this.searchInfo();
@@ -36,6 +41,16 @@ export default {
       return this.$route.query.id;
     },
   },
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
   methods: {
     ...mapLeave(['fetch']),
     async searchInfo() {

+ 18 - 3
src/views/user/personalDetail.vue

@@ -3,7 +3,8 @@
     <el-row>
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
-          <topInfo></topInfo>
+          <!-- <topInfo></topInfo> -->
+          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
           <studentInfo :messInfo="messInfo"></studentInfo>
@@ -14,7 +15,7 @@
 </template>
 
 <script>
-import topInfo from '@/layout/common/topInfo.vue';
+import NavBar from '@/layout/common/topInfo.vue';
 import studentInfo from '@/layout/user/studentInfo.vue';
 import { createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapStudent } = createNamespacedHelpers('student');
@@ -22,7 +23,7 @@ export default {
   name: 'personalDetail',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     studentInfo, //学生详细信息
   },
   data: () => ({
@@ -45,6 +46,10 @@ export default {
       have_grant: '1',
       job: '班长',
     },
+    title: '',
+    isleftarrow: '',
+    transitionName: 'fade',
+    navShow: true,
   }),
   created() {
     this.searchInfo();
@@ -54,6 +59,16 @@ export default {
       return this.$route.query.id;
     },
   },
+  mounted() {
+    this.title = this.$route.meta.title;
+    this.isleftarrow = this.$route.meta.isleftarrow;
+  },
+  watch: {
+    $route(to, from) {
+      this.title = to.meta.title;
+      this.isleftarrow = to.meta.isleftarrow;
+    },
+  },
   methods: {
     ...mapStudent(['fetch']),
     async searchInfo() {