index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <div class="w_1200">
  6. <el-col :span="24" class="one">
  7. <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
  8. <el-col :span="24" class="title">
  9. {{ item.title }}
  10. <el-button type="primary" size="mini" @click="btn(item)">答卷</el-button>
  11. </el-col>
  12. <el-col :span="24" class="other">
  13. <el-col :span="24" class="otherInfo">
  14. 发布时间:<span>{{ item.create_time || '暂无' }}</span>
  15. </el-col>
  16. </el-col>
  17. <el-col :span="24" class="brief">
  18. {{ item.brief }}
  19. </el-col>
  20. </el-col>
  21. </el-col>
  22. <el-col :span="24" class="two">
  23. <el-pagination
  24. @current-change="searchPage"
  25. :current-page="currentPage"
  26. layout="total, prev, pager, next, jumper"
  27. :total="total"
  28. :page-size="pageSize"
  29. >
  30. </el-pagination>
  31. </el-col>
  32. </div>
  33. </el-col>
  34. </el-row>
  35. </div>
  36. </template>
  37. <script>
  38. import { mapState, createNamespacedHelpers } from 'vuex';
  39. const { mapActions: questionnaire } = createNamespacedHelpers('questionnaire');
  40. export default {
  41. name: 'index',
  42. props: {},
  43. components: {},
  44. data: function() {
  45. return {
  46. list: [],
  47. total: 0,
  48. currentPage: 1,
  49. pageSize: 5,
  50. };
  51. },
  52. created() {
  53. this.search();
  54. },
  55. methods: {
  56. ...questionnaire(['query']),
  57. async search({ skip = 0, limit = 5, ...info } = {}) {
  58. let res = await this.query({ skip, limit, ...info });
  59. if (this.$checkRes(res)) {
  60. this.$set(this, `list`, res.data);
  61. this.$set(this, `total`, res.total);
  62. }
  63. },
  64. searchPage(page = 1) {
  65. this.currentPage = page;
  66. const skip = (this.currentPage - 1) * this.pageSize;
  67. let condition = { skip, limit: this.pageSize };
  68. this.search(condition);
  69. },
  70. // 答卷
  71. btn(data) {
  72. console.log(data);
  73. if (data.column == '定制问卷') {
  74. if (data.title == '『科研助企』活动企业调查问卷') {
  75. this.$router.push({ path: '/twoweb/service/helpCompany/detail', query: { id: data.id } });
  76. } else if (data.title == '企业科技创新能力评价调查问卷') {
  77. this.$router.push({ path: '/twoweb/service/made/detail', query: { id: data.id } });
  78. } else if (data.title == '“院省合作”-企业需求调查表 -2021') {
  79. this.$router.push({ path: '/twoweb/service/comDemand/detail', query: { id: data.id } });
  80. }
  81. } else {
  82. this.$router.push({ path: '/twoweb/service/question/detail', query: { id: data.id } });
  83. }
  84. // if (data.column == '定制问卷') {
  85. // if (data.title == '『科研助企』活动企业调查问卷') {
  86. // this.$router.push({ path: '/twoweb/service/helpCompany/detail', query: { id: data.id } });
  87. // } else {
  88. // this.$router.push({ path: '/twoweb/service/made/detail', query: { id: data.id } });
  89. // }
  90. // } else {
  91. // if (data.title == '『科研助企』活动企业调查问卷') {
  92. // this.$router.push({ path: '/twoweb/service/helpCompany/detail', query: { id: data.id } });
  93. // } else {
  94. //
  95. // }
  96. // }
  97. },
  98. },
  99. computed: {
  100. ...mapState(['user']),
  101. },
  102. metaInfo() {
  103. return { title: this.$route.meta.title };
  104. },
  105. watch: {
  106. test: {
  107. deep: true,
  108. immediate: true,
  109. handler(val) {},
  110. },
  111. },
  112. };
  113. </script>
  114. <style lang="less" scoped>
  115. .main {
  116. padding: 10px 0;
  117. .one {
  118. height: 600px;
  119. overflow: hidden;
  120. .list {
  121. padding: 10px 0;
  122. border-bottom: 1px dashed #ccc;
  123. .title {
  124. font-size: 16px;
  125. font-weight: bold;
  126. margin: 0 0 5px 0;
  127. }
  128. .other {
  129. margin: 0 0 5px 0;
  130. .otherInfo {
  131. font-size: 14px;
  132. color: #666;
  133. span {
  134. color: #000;
  135. }
  136. }
  137. }
  138. .brief {
  139. overflow: hidden;
  140. text-overflow: ellipsis;
  141. -webkit-line-clamp: 2;
  142. word-break: break-all;
  143. display: -webkit-box;
  144. -webkit-box-orient: vertical;
  145. font-size: 14px;
  146. }
  147. }
  148. }
  149. .two {
  150. text-align: center;
  151. margin: 10px 0;
  152. }
  153. }
  154. </style>