index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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>
  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. metaInfo: { title: '问卷调查' },
  35. name: 'index',
  36. props: {},
  37. components: {
  38. NavBar, //头部导航
  39. footInfo, //底部导航
  40. questionnaireInfo, //问卷调查
  41. // teaClass, //班主任班级名单
  42. },
  43. data: () => ({
  44. questionnaireList: [],
  45. classList: [],
  46. title: '',
  47. isleftarrow: '',
  48. navShow: true,
  49. }),
  50. created() {
  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.getQuestList({ type: 0 });
  74. let termid = this.user.termid;
  75. let ress = await this.query({ termid });
  76. let ids = _.flattenDeep(ress.data.map(i => i.questionnaireid));
  77. console.log(ids);
  78. let quest = await this.getQuestMerge({ method: 'fetch', data: ids });
  79. console.log(quest);
  80. let news = [];
  81. news = [...res.data, ...quest];
  82. console.log(news);
  83. this.$set(this, `questionnaireList`, news);
  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>