Bladeren bron

页面头部底部更新

guhongwei 5 jaren geleden
bovenliggende
commit
3885f4ee3f

+ 1 - 1
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>

+ 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'),
   },
   // 班级信息
@@ -18,11 +19,13 @@ const routes = [
   // 班级名单
   {
     path: '/class/index',
+    meta: { title: '班級名单', isleftarrow: true },
     component: () => import('../views/class/index.vue'),
   },
   // 班级名单-上成绩
   {
     path: '/class/achieve',
+    meta: { title: '班级成绩', isleftarrow: true },
     component: () => import('../views/class/achieve.vue'),
   },
   // 班级名单-分组
@@ -38,43 +41,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'),
   },
 ];

+ 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;

+ 18 - 3
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
@@ -25,7 +26,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 classList from '@/layout/class/classList.vue';
 
@@ -33,7 +34,7 @@ export default {
   name: 'index',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     footInfo, //底部导航
     classList, //班级名单
   },
@@ -78,9 +79,23 @@ export default {
         job: '班长',
       },
     ],
+    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: {
     clickAssign() {
       this.assignShow = true;

+ 18 - 5
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"></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,14 +28,17 @@ export default {
   name: 'index',
   props: {},
   components: {
-    topInfo, //头部导航
+    NavBar, //头部导航
     footInfo, //底部导航
     mainData, //课程安排主体
   },
   data: () => ({
     lessionclassInfo: { lessons: [] },
-
     dates: '',
+    title: '日程安排',
+    isleftarrow: '',
+    transitionName: 'fade',
+    navShow: true,
   }),
   created() {
     this.getDate();
@@ -42,7 +46,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']),

+ 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() {