wuhongyu 4 năm trước cách đây
mục cha
commit
d23b65479d
4 tập tin đã thay đổi với 207 bổ sung8 xóa
  1. 68 0
      src/layout/user/clickBtn.vue
  2. 90 0
      src/layout/user/messageInfo.vue
  3. 2 1
      src/store/index.js
  4. 47 7
      src/views/user/index.vue

+ 68 - 0
src/layout/user/clickBtn.vue

@@ -0,0 +1,68 @@
+<template>
+  <div id="clickBtn">
+    <el-row>
+      <el-col :span="24">
+        <el-col :span="24" class="native" v-if="this.user.type === '1'">
+          <van-cell is-link @click="$router.push({ path: '/user/teaLeave' })">请假管理</van-cell>
+        </el-col>
+        <el-col :span="24" class="native" v-if="this.user.type === '4'">
+          <van-cell is-link @click="$router.push({ path: '/user/leave' })">请假</van-cell>
+        </el-col>
+        <el-col :span="24" class="native" v-if="this.user.type === '4'">
+          <van-cell is-link @click="$router.push({ path: '/user/checkWork' })">考勤</van-cell>
+        </el-col>
+        <el-col :span="24" class="native" v-if="this.user.type === '4'">
+          <van-cell is-link @click="$router.push({ path: '/user/homework' })">作业管理</van-cell>
+        </el-col>
+
+        <el-col :span="24" class="native">
+          <van-cell is-link @click="$router.push({ path: '/user/pingfenclass' })">评分</van-cell>
+        </el-col>
+        <el-col :span="24" class="native" v-if="this.user.type === '4'">
+          <van-cell is-link @click="$router.push({ path: '/user/quit' })">退出</van-cell>
+        </el-col>
+        <el-col :span="24" class="native" v-if="this.user.type === '1'">
+          <van-cell is-link @click="$router.push({ path: '/user/teaquit' })">退出</van-cell>
+        </el-col>
+        <el-col :span="24" class="native" v-if="this.user.type === '1'">
+          <van-cell is-link @click="$router.push({ path: '/user/teacher' })">查看任课教师</van-cell>
+        </el-col>
+        <!-- <el-col :span="24" class="native" v-if="this.user.type === '3'">
+          <van-cell is-link @click="$router.push({ path: '/user/terstudent' })">查看任课教师</van-cell>
+        </el-col> -->
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+export default {
+  name: 'clickBtn',
+  props: {},
+  components: {},
+  data: () => ({}),
+  created() {
+    console.log(this.user.type);
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+.native {
+  height: 50px;
+  background-color: #fff;
+  margin: 0 0 5px 0;
+}
+/deep/.van-cell {
+  line-height: 30px;
+}
+/deep/.van-cell__right-icon {
+  height: 30px;
+  line-height: 30px;
+}
+</style>

+ 90 - 0
src/layout/user/messageInfo.vue

@@ -0,0 +1,90 @@
+<template>
+  <div id="messageInfo">
+    <el-row>
+      <el-col :span="24" class="message" @click.native="$router.push({ path: '/user/personalDetail', query: { id: info.id } })" v-if="this.user.type === '4'">
+        <el-col :span="7" class="name">
+          {{ info.name }}
+        </el-col>
+        <el-col :span="17" class="mess">
+          <p>{{ info.school_name }}</p>
+          <p>{{ info.faculty }}&nbsp;&nbsp;{{ info.major }}</p>
+          <p>民族:{{ info.nation }}&nbsp;性别:{{ info.gender }}</p>
+        </el-col>
+      </el-col>
+      <el-col
+        :span="24"
+        class="message"
+        @click.native="$router.push({ path: '/user/personalDetail', query: { id: teainfo.id } })"
+        v-if="this.user.type === '1'"
+      >
+        <el-col :span="7" class="name">
+          {{ teainfo.name }}
+        </el-col>
+        <el-col :span="17" class="mess">
+          <p>年龄:{{ teainfo.age }}&nbsp;&nbsp;性别:{{ teainfo.gender }}</p>
+          <p>手机号:{{ teainfo.phone }}</p>
+          <p>所在部门:{{ teainfo.department }}</p>
+        </el-col>
+      </el-col>
+      <el-col
+        :span="24"
+        class="message"
+        @click.native="$router.push({ path: '/user/personalDetail', query: { id: jiaoshiinfo.id } })"
+        v-if="this.user.type === '3'"
+      >
+        <el-col :span="7" class="name">
+          {{ jiaoshiinfo.name }}
+        </el-col>
+        <el-col :span="17" class="mess">
+          <p>年龄:{{ jiaoshiinfo.age }}&nbsp;&nbsp;性别:{{ jiaoshiinfo.gender }}</p>
+          <p>手机号:{{ jiaoshiinfo.phone }}</p>
+          <p>所在部门:{{ jiaoshiinfo.department }}</p>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+export default {
+  name: 'messageInfo',
+  props: {
+    info: null,
+    teainfo: null,
+    jiaoshiinfo: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {
+    ...mapState(['user']),
+  },
+  methods: {},
+};
+</script>
+
+<style lang="less" scoped>
+p {
+  padding: 0;
+  margin: 0;
+}
+.message {
+  padding: 10px 0;
+}
+.name {
+  text-align: center;
+  padding: 20px 0;
+  font-size: 20px;
+  font-family: 微软雅黑;
+  font-weight: bold;
+}
+.mess p {
+  padding: 5px 0;
+  font-size: 16px;
+  color: #333;
+}
+.tea {
+  padding: 10px 0;
+}
+</style>

+ 2 - 1
src/store/index.js

@@ -6,7 +6,7 @@ import classes from '@frame/store/classes';
 import director from '@frame/store/director';
 import lesson from '@frame/store/lesson';
 import teacher from '@frame/store/teacher';
-
+import dept from '@frame/store/dept';
 import * as ustate from '@frame/store/user/state';
 import * as umutations from '@frame/store/user/mutations';
 Vue.use(Vuex);
@@ -22,5 +22,6 @@ export default new Vuex.Store({
     director,
     lesson,
     teacher,
+    dept,
   },
 });

+ 47 - 7
src/views/user/index.vue

@@ -6,7 +6,12 @@
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
-          個人中心
+          <el-col :span="24" class="message">
+            <messageInfo :info="info" :teainfo="teainfo" :jiaoshiinfo="jiaoshiinfo"></messageInfo>
+          </el-col>
+          <el-col :span="24" class="clickBtn">
+            <clickBtn></clickBtn>
+          </el-col>
         </el-col>
         <el-col :span="24" class="foot">
           <footInfo></footInfo>
@@ -15,27 +20,62 @@
     </el-row>
   </div>
 </template>
-
 <script>
 import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
-import { mapState, createNamespacedHelpers } from 'vuex';
+import messageInfo from '@/layout/user/messageInfo.vue';
+import clickBtn from '@/layout/user/clickBtn.vue';
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapDirectors } = createNamespacedHelpers('director');
+const { mapActions: mapStudent } = createNamespacedHelpers('student');
+const { mapActions: mapTeacher } = createNamespacedHelpers('teacher');
+const { mapActions: mapDept } = createNamespacedHelpers('dept');
 export default {
   name: 'index',
   props: {},
   components: {
-    NavBar,
-    footInfo,
+    NavBar, //头部导航
+    footInfo, //底部导航
+    messageInfo, //个人信息
+    clickBtn, //功能按钮
   },
   data: function() {
     return {
+      info: {},
+      teainfo: {},
+      jiaoshiinfo: {},
       title: '',
       isleftarrow: '',
       navShow: true,
     };
   },
-  created() {},
-  methods: {},
+  created() {
+    this.searchSite();
+  },
+  methods: {
+    ...mapDirectors({ directorQuery: 'query', directorFetch: 'fetch' }),
+    ...mapStudent({ studentQuery: 'query', studentFetch: 'fetch' }),
+    ...mapTeacher({ teacherlist: 'query', teacherfetch: 'fetch' }),
+    ...mapDept({ deptFetch: 'fetch' }),
+    // 查询登录用户信息
+    async searchSite() {
+      // 1:班主任,4:学生
+      console.log(this.user);
+      if (this.user.type === '1') {
+        const res = await this.directorFetch(this.user.userid);
+        const arr = await this.deptFetch(res.data.department);
+        res.data.department = arr.data.name;
+
+        console.log(res.data);
+
+        this.$set(this, `teainfo`, res.data);
+      } else if (this.user.type === '3') {
+        const res = await this.teacherfetch(this.user.userid);
+        console.log(res.data);
+        this.$set(this, `jiaoshiinfo`, res.data);
+      }
+    },
+  },
   computed: {
     ...mapState(['user']),
   },