1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <template>
- <div id="teaProgress">
- <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">
- <quesProgress :quesProgress="quesProgress"></quesProgress>
- </el-col>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import NavBar from '@/layout/common/topInfo.vue';
- import quesProgress from '@/layout/question/quesProgress.vue';
- import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
- const { mapActions: classes } = createNamespacedHelpers('classes');
- const { mapActions: questionnaire } = createNamespacedHelpers('questionnaire');
- const { mapActions: termquest } = createNamespacedHelpers('termquest');
- import _ from 'lodash';
- export default {
- name: 'teaProgress',
- props: {},
- components: {
- NavBar, //头部导航
- quesProgress, //班级问卷进度
- },
- data: () => ({
- classInfo: {},
- quest: [],
- quesProgress: [],
- title: '',
- isleftarrow: '',
- navShow: true,
- }),
- created() {
- this.searchInfo();
- },
- computed: {
- id() {
- return this.$route.query.classid;
- },
- ...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: {
- ...classes({ classFectch: 'fetch' }),
- ...questionnaire({ getQuestionnaireList: 'query' }),
- ...termquest({ getTermQuestList: 'query' }),
- // 查询班级信息,全部问卷,当前期问卷
- async searchInfo() {
- // 班级信息
- let classInfo = await this.classFectch(this.id);
- if (this.$checkRes(classInfo)) {
- this.$set(this, `classInfo`, classInfo.data);
- }
- //查询所有问卷
- const quest = await this.getQuestionnaireList();
- if (this.$checkRes(quest)) {
- this.$set(this, `quest`, quest.data);
- }
- //查询这期的所有问卷,id=>数据
- const res = await this.getTermQuestList({ termid: this.classInfo.termid });
- let { questionnaireid, termid, ...othrers } = res.data[0];
- let newArr = this.quest.filter(q => (_.find(questionnaireid, sq => sq === q.id) ? q : ''));
- this.$set(this, `quesProgress`, newArr);
- },
- },
- };
- </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;
- }
- </style>
|