viewHistory.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <div class="myKaifainMobile">
  3. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" class="listArea">
  4. <div style="text-align: center" v-if="firstLoading">
  5. <van-loading size="24px">加载中...</van-loading>
  6. </div>
  7. <van-list
  8. v-else
  9. v-model="loading"
  10. :finished="finished"
  11. finished-text="没有更多了"
  12. @load="onLoad"
  13. :immediate-check="false"
  14. class="list"
  15. :error="error"
  16. >
  17. <div
  18. class="cell"
  19. v-for="(item, index) in dataList" :key="'dataList' + index"
  20. @click="jumpToKaifain(item)"
  21. >
  22. <div class="cellContent">
  23. <div class="topInfo">
  24. <div class="topLeft">
  25. <img :src="item.provider.images" alt="">
  26. </div>
  27. <div class="topRight">
  28. <div class="title">{{item.provider.title}}</div>
  29. <div class="tapList">
  30. <div class="tapCell"><p>{{item.provider.industryName}}</p></div>
  31. <div class="tapCell"><p>{{item.provider.techTypeName}}</p></div>
  32. </div>
  33. <div class="desc">{{item.provider.description}}</div>
  34. </div>
  35. </div>
  36. <div class="bottomArea">
  37. <div class="companyInfo">
  38. <div class="companyImg">
  39. <img :src="item.provider.companyInfo.logo"
  40. onerror="this.src='https://stacdn.proginn.com/image/uCenter/company_logo.png'"
  41. alt="">
  42. </div>
  43. <div class="companyName">{{item.provider.companyInfo.name}}</div>
  44. </div>
  45. <div class="time">{{item.contactCreatedAtFormat}}</div>
  46. </div>
  47. </div>
  48. </div>
  49. </van-list>
  50. </van-pull-refresh>
  51. </div>
  52. </template>
  53. <script>
  54. const sList = [
  55. { name: "审核通过", value: 2 },
  56. { name: "审核失败", value: 3 },
  57. { name: "审核中", value: 1 },
  58. ]
  59. /** 我咨询的解决方案 **/
  60. export default {
  61. name: "ViewHistory",
  62. showCommonFooter: false,
  63. components: {},
  64. head() {
  65. let obj = {
  66. title: "我的咨询",
  67. meta: [
  68. {
  69. 'name': 'keywords',
  70. 'content': ""
  71. }, {
  72. 'name': 'descrption',
  73. 'content': ""
  74. }, {
  75. 'name': 'h1',
  76. 'content': ""
  77. }
  78. ]
  79. }
  80. return obj
  81. },
  82. async asyncData({ app }) {
  83. return {
  84. mobile: app.$deviceType.isMobile()
  85. }
  86. },
  87. data() {
  88. return {
  89. sList,
  90. page: {
  91. page: 1,
  92. total: 0,
  93. size: 20,
  94. },
  95. dataList: [],
  96. error: false,
  97. finished: false, //移动端列表是否完全加载完成
  98. loading: false, //web端列表首次加载loading todo true
  99. refreshing: false,
  100. firstLoading: false, //移动端加载loading
  101. isLoading: false //控制防止一次没响应,重复请求接口
  102. }
  103. },
  104. watch: {},
  105. computed: {},
  106. async created() {
  107. this.checkLogin()
  108. this.getList()
  109. },
  110. methods: {
  111. getList() {
  112. const { page } = this
  113. let url = "/api/kaifawu/getMyContactList"
  114. if (this.isLoading) {
  115. return
  116. }
  117. let data = {
  118. ...page,
  119. }
  120. this.loading = true
  121. this.isLoading = true
  122. this.$axios.post(url, data).then(res => {
  123. if (Number(res.data.status) === 1) {
  124. let data = res.data.data
  125. let list = data.lists || []
  126. this.page.total = data.total
  127. if (this.page.page === 1 || !this.mobile) {
  128. this.dataList = [ ...list ]
  129. } else {
  130. this.dataList = [ ...this.dataList, ...list ]
  131. }
  132. if (this.mobile) {
  133. this.page.page += 1
  134. }
  135. if (Number(this.page.total) <= this.dataList.length) {
  136. this.finished = true
  137. }
  138. this.error = false
  139. }
  140. }).finally(() => {
  141. this.firstLoading = false
  142. this.refreshing = false
  143. this.isLoading = false
  144. this.$nextTick(() => {
  145. this.loading = false
  146. })
  147. }).catch(() => {
  148. this.error = "请求失败"
  149. })
  150. },
  151. pageChange(i) {
  152. this.page.page = i
  153. this.getList()
  154. },
  155. /** 移动端下拉刷新 **/
  156. onRefresh() {
  157. // 清空列表数据
  158. this.finished = false;
  159. this.page.page = 1
  160. this.page.total = 0
  161. this.onLoad();
  162. },
  163. onLoad() {
  164. console.log('onLoad')
  165. this.getList()
  166. },
  167. jumpToKaifain(item) {
  168. const {provider: {id, hash_id} = {}} = item
  169. location.href = `/kaifain/s/${hash_id}`
  170. }
  171. }
  172. }
  173. </script>
  174. <style scope lang="scss">
  175. .delete-button {
  176. height: 100%;
  177. }
  178. @import "@/assets/css/otherpage/kaifain/viewHistory";
  179. </style>