page-answer-special.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <div class="contentBody">
  3. <van-nav-bar title="专项答题" left-arrow @click-left="handleBackFun" />
  4. <van-list
  5. v-model="loading"
  6. :finished="finished"
  7. finished-text="没有更多了"
  8. @load="onLoad()"
  9. >
  10. <van-cell
  11. class="vanCell"
  12. v-for="(item, index) in specialAnswerList"
  13. :key="index"
  14. >
  15. <div slot="default" class="contentItemDiv">
  16. <div class="contentItemTitle">
  17. {{ item.name }}
  18. </div>
  19. <div class="startAnswerBox" @click="clickAnswer(item)">
  20. <!-- 此处的div不可以注释,否则样式会变,只需要注释时间即可 -->
  21. <div>
  22. {{ formateDatesFun(item.createdTime) }}
  23. </div>
  24. <div class="startButtonBox">
  25. <span class="startText">开始答题</span>
  26. </div>
  27. </div>
  28. </div>
  29. </van-cell>
  30. </van-list>
  31. </div>
  32. </template>
  33. <script>
  34. import { mapState } from "vuex";
  35. export default {
  36. name: "page-answer-special",
  37. components: {},
  38. data() {
  39. return {
  40. specialAnswerList: [],
  41. loading: false,
  42. finished: false,
  43. specialPage: 0,
  44. specialSize: 10
  45. };
  46. },
  47. created() {
  48. this.getSpecialAnswerList();
  49. },
  50. destroyed() {},
  51. activated() {},
  52. computed: {
  53. ...mapState({
  54. userInfo: state => state.user.userInfo,
  55. chooseEngneeringWork: state => state.user.chooseEngneeringWork
  56. })
  57. },
  58. methods: {
  59. getSpecialAnswerList() {
  60. this.loading = true;
  61. this.loading = false;
  62. let params = {
  63. page: this.specialPage,
  64. size: this.specialSize,
  65. engineertypeid: this.chooseEngneeringWork.id,
  66. userName: this.userInfo.userName
  67. };
  68. this.$_http
  69. .get(this.$_API.GET_JTXT_SPECIAL_QUESTIONS, { params })
  70. .then(res => {
  71. this.specialAnswerList = [
  72. ...this.specialAnswerList,
  73. ...res.data.content
  74. ];
  75. // 不能上拉了就是加载玩了
  76. this.finished = res.data.last;
  77. this.specialPage++;
  78. this.loading = false;
  79. })
  80. .catch(() => {
  81. this.$store.commit("toggleLoading", false);
  82. });
  83. },
  84. clickAnswer(item) {
  85. this.$store.commit("updateAnswerItemStore", {
  86. field: "answerRecruitId",
  87. value: "special-questions"
  88. });
  89. this.$store.commit("updateAnswerItemStore", {
  90. field: "questionId",
  91. value: item.id
  92. });
  93. this.$router.push({ name: "answerRecruit" });
  94. },
  95. onLoad() {
  96. this.getSpecialAnswerList();
  97. },
  98. // 操作:返回
  99. handleBackFun() {
  100. this.$router.back();
  101. }
  102. }
  103. };
  104. </script>
  105. <style lang="scss" scoped>
  106. .contentBody {
  107. background-color: #f0f0f0;
  108. .contentItemDiv {
  109. .contentItemTitle {
  110. font-size: 0.65rem;
  111. font-weight: bold;
  112. }
  113. .startAnswerBox {
  114. width: 100%;
  115. display: flex;
  116. justify-content: space-between;
  117. align-items: center;
  118. color: #696969;
  119. margin-top: 0.5rem;
  120. .startButtonBox {
  121. border-radius: 2px;
  122. background-color: #b3a38c;
  123. padding: 2px 8px;
  124. }
  125. .startText {
  126. color: #fff;
  127. }
  128. }
  129. }
  130. }
  131. </style>