123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <template>
- <div id="index">
- <el-row>
- <el-col :span="24" class="style">
- <el-col :span="24" class="top">
- <nav-bar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </nav-bar>
- </el-col>
- <el-col :span="24" class="main">
- <span v-if="this.user.type === '1'">
- <teaClass :classList="classList"></teaClass>
- </span>
- <span v-else>
- <questionnaire-info :questionnaireList="questionnaireList"></questionnaire-info>
- </span>
- </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 teaClass from '@/layout/question/teaClass.vue';
- import questionnaireInfo from '@question/src/views/index.vue';
- import { mapState, createNamespacedHelpers } from 'vuex';
- const { mapActions: termquest } = createNamespacedHelpers('termquest');
- const { mapActions: questionnaire } = createNamespacedHelpers('questionnaire');
- const { mapActions: mapClass } = createNamespacedHelpers('classes');
- const { mapActions: mapStudent } = createNamespacedHelpers('student');
- export default {
- name: 'index',
- props: {},
- components: {
- NavBar, //头部导航
- footInfo, //底部导航
- questionnaireInfo, //问卷调查
- teaClass, //班主任班级名单
- },
- data: () => ({
- questionnaireList: [],
- classList: [],
- title: '',
- isleftarrow: '',
- navShow: true,
- }),
- created() {
- this.search();
- this.searchInfo();
- },
- 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: {
- ...termquest(['query']),
- ...questionnaire({ getQuestList: 'query', getQuestMerge: 'mergeRequest' }),
- ...mapClass({ classinfo: 'query' }),
- ...mapStudent({ stuQuery: 'query', stuFetch: 'fetch' }),
- // 查询问卷调查列表
- async search() {
- let res = await this.query({ termid: this.user.termid });
- if (this.$checkRes(res)) {
- let ids = _.flattenDeep(res.data.map(i => i.questionnaireid));
- let quest = await this.getQuestMerge({ method: 'fetch', data: ids });
- this.$set(this, `questionnaireList`, quest);
- }
- },
- // 班主任查询管理班级列表
- async searchInfo({ ...info } = {}) {
- const res = await this.classinfo({ ...info });
- var result = res.data.filter(item => item.headteacherid === this.user.userid);
- this.$set(this, `classList`, result);
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .style {
- width: 100%;
- min-height: 667px;
- position: relative;
- background-color: #f9fafc;
- }
- .top {
- height: 46px;
- overflow: hidden;
- position: relative;
- z-index: 999;
- }
- .main {
- min-height: 570px;
- margin: 0 0 50px 0;
- }
- </style>
|