123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <template>
- <div id="index">
- <el-row>
- <el-col :span="24" class="style">
- <el-col :span="24" class="top">
- <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"></messageInfo>
- </el-col>
- <el-col :span="24" class="clickBtn">
- <clickBtn></clickBtn>
- </el-col>
- </el-col>
- <el-col :span="24" class="foot">
- <footInfo></footInfo>
- </el-col>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- 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';
- import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
- const { mapActions: mapDirectors } = createNamespacedHelpers('director');
- const { mapActions: mapStudent } = createNamespacedHelpers('student');
- const { mapActions: mapDept } = createNamespacedHelpers('dept');
- export default {
- name: 'index',
- props: {},
- components: {
- NavBar, //头部导航
- footInfo, //底部导航
- messageInfo, //个人信息
- clickBtn, //功能按钮
- },
- data: () => ({
- info: {},
- teainfo: {},
- title: '',
- isleftarrow: '',
- navShow: true,
- }),
- created() {
- this.searchSite();
- },
- computed: {
- ...mapState(['user']),
- },
- 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: {
- ...mapDirectors({ directorQuery: 'query', directorFetch: 'fetch' }),
- ...mapStudent({ studentQuery: 'query', studentFetch: 'fetch' }),
- ...mapDept({ deptFetch: 'fetch' }),
- // 查询登录用户信息
- async searchSite() {
- // 1:班主任,4:学生
- 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;
- this.$set(this, `teainfo`, res.data);
- } else if (this.user.type === '4') {
- const res = await this.studentFetch(this.user.userid);
- this.$set(this, `info`, res.data);
- }
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .style {
- width: 100%;
- min-height: 667px;
- position: relative;
- background-color: #f9fafc;
- }
- .top {
- height: 46px;
- overflow: hidden;
- }
- .main {
- min-height: 570px;
- }
- .foot {
- height: 50px;
- overflow: hidden;
- }
- </style>
|