index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. if (data.column == '定制问卷') {
  73. this.$router.push({ path: '/twoweb/service/project', query: { id: data.id } });
  74. } else {
  75. this.$router.push({ path: '/twoweb/service/question/detail', query: { id: data.id } });
  76. }
  77. },
  78. },
  79. computed: {
  80. ...mapState(['user']),
  81. },
  82. metaInfo() {
  83. return { title: this.$route.meta.title };
  84. },
  85. watch: {
  86. test: {
  87. deep: true,
  88. immediate: true,
  89. handler(val) {},
  90. },
  91. },
  92. };
  93. </script>
  94. <style lang="less" scoped>
  95. .main {
  96. padding: 10px 0;
  97. .one {
  98. height: 600px;
  99. overflow: hidden;
  100. .list {
  101. padding: 10px 0;
  102. border-bottom: 1px dashed #ccc;
  103. .title {
  104. font-size: 16px;
  105. font-weight: bold;
  106. margin: 0 0 5px 0;
  107. }
  108. .other {
  109. margin: 0 0 5px 0;
  110. .otherInfo {
  111. font-size: 14px;
  112. color: #666;
  113. span {
  114. color: #000;
  115. }
  116. }
  117. }
  118. .brief {
  119. overflow: hidden;
  120. text-overflow: ellipsis;
  121. -webkit-line-clamp: 2;
  122. word-break: break-all;
  123. display: -webkit-box;
  124. -webkit-box-orient: vertical;
  125. font-size: 14px;
  126. }
  127. }
  128. }
  129. .two {
  130. text-align: center;
  131. margin: 10px 0;
  132. }
  133. }
  134. </style>