index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-col :span="24" class="top">
  6. <nav-bar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </nav-bar>
  7. </el-col>
  8. <el-col :span="24" class="main">
  9. <span v-if="this.user.type === '1'">
  10. <teaClass :classList="classList" @turnto="turnto" title="班级问卷进度"></teaClass>
  11. </span>
  12. <span v-else>
  13. <questionnaire-info :questionnaireList="questionnaireList"></questionnaire-info>
  14. </span>
  15. </el-col>
  16. <el-col :span="24" class="foot">
  17. <footInfo></footInfo>
  18. </el-col>
  19. </el-col>
  20. </el-row>
  21. </div>
  22. </template>
  23. <script>
  24. import NavBar from '@/layout/common/topInfo.vue';
  25. import footInfo from '@/layout/common/footInfo.vue';
  26. import teaClass from '@/layout/question/teaClass.vue';
  27. import questionnaireInfo from '@question/src/views/index.vue';
  28. import { mapState, createNamespacedHelpers } from 'vuex';
  29. const { mapActions: termquest } = createNamespacedHelpers('termquest');
  30. const { mapActions: questionnaire } = createNamespacedHelpers('questionnaire');
  31. const { mapActions: mapClass } = createNamespacedHelpers('classes');
  32. const { mapActions: mapStudent } = createNamespacedHelpers('student');
  33. export default {
  34. name: 'index',
  35. props: {},
  36. components: {
  37. NavBar, //头部导航
  38. footInfo, //底部导航
  39. questionnaireInfo, //问卷调查
  40. teaClass, //班主任班级名单
  41. },
  42. data: () => ({
  43. questionnaireList: [],
  44. classList: [],
  45. title: '',
  46. isleftarrow: '',
  47. navShow: true,
  48. }),
  49. created() {
  50. this.searchInfo();
  51. this.search();
  52. },
  53. computed: {
  54. ...mapState(['user']),
  55. },
  56. mounted() {
  57. this.title = this.$route.meta.title;
  58. this.isleftarrow = this.$route.meta.isleftarrow;
  59. },
  60. watch: {
  61. $route(to, from) {
  62. this.title = to.meta.title;
  63. this.isleftarrow = to.meta.isleftarrow;
  64. },
  65. },
  66. methods: {
  67. ...termquest(['query']),
  68. ...questionnaire({ getQuestList: 'query', getQuestMerge: 'mergeRequest' }),
  69. ...mapClass({ classinfo: 'query' }),
  70. ...mapStudent({ stuQuery: 'query', stuFetch: 'fetch' }),
  71. // 查询问卷调查列表
  72. async search() {
  73. let res = await this.query({ termid: this.user.termid });
  74. if (this.$checkRes(res)) {
  75. let ids = _.flattenDeep(res.data.map(i => i.questionnaireid));
  76. let quest = await this.getQuestMerge({ method: 'fetch', data: ids });
  77. this.$set(this, `questionnaireList`, quest);
  78. }
  79. },
  80. // 班主任查询管理班级列表
  81. async searchInfo({ ...info } = {}) {
  82. const res = await this.classinfo({ headteacherid: this.user.userid });
  83. this.$set(this, `classList`, res.data);
  84. },
  85. turnto(data) {
  86. this.$router.push({ path: '/question/teaProgress', query: { classid: data.id } });
  87. },
  88. },
  89. };
  90. </script>
  91. <style lang="less" scoped>
  92. .style {
  93. width: 100%;
  94. min-height: 667px;
  95. position: relative;
  96. background-color: #f9fafc;
  97. }
  98. .top {
  99. height: 46px;
  100. overflow: hidden;
  101. position: relative;
  102. z-index: 999;
  103. }
  104. .main {
  105. min-height: 570px;
  106. margin: 0 0 50px 0;
  107. }
  108. </style>