dynamic.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="center">
  3. <u-search placeholder="请输入货名" v-model="keyword" @clear="searchClear" style="width: 96%; margin: 0 auto;"
  4. @custom="getrelease"></u-search>
  5. <view class="bottom flex">
  6. <view class="bottonCss" @click="release">
  7. <image src="../../static/img/liangmai/fabu-2@3x.png" mode="" style="width: 40rpx; height: 40rpx;">
  8. </image>
  9. <view style="color: #22C572;">发布</view>
  10. </view>
  11. <view class="bottonCss" @click="record">
  12. <image src="../../static/img/liangmai/jilu-2@3x.png" mode="" style="width: 40rpx; height: 40rpx;">
  13. </image>
  14. <view style="color: #656765;">记录</view>
  15. </view>
  16. </view>
  17. <view v-for="(item,index) in releaseList">
  18. <view class="modular">
  19. <view class="flex">
  20. <view class="touxiang">
  21. <image :src="portraits" mode="" style="height: 76rpx;border-radius: 8rpx;"></image>
  22. </view>
  23. <view class="" style="margin: 20rpx 30rpx;">
  24. <view style="color: #333333;font-weight: 600;font-size: 34rpx;">{{item.compName}}</view>
  25. <view style="color: #AFB3BF; margin-top: 4rpx;">{{item.updateDate}}</view>
  26. </view>
  27. </view>
  28. <view class="title">{{item.title}}</view>
  29. <view class="titleText">
  30. {{item.content}}
  31. </view>
  32. <view class="imgList flex" v-if="item.address != ''">
  33. <view v-for="(items,count) in item.imgList" style="width: 30%;margin-left: 20rpx;">
  34. <image :src="items" style="height: 220rpx;border-radius: 16rpx;"></image>
  35. </view>
  36. </view>
  37. <view class="flex">
  38. <view class="address flex" style="margin: 30rpx;">
  39. <image src='../../static/img/location.png'
  40. style="width: 26rpx;height: 30rpx;top: 8rpx;margin: 0 10rpx;"></image>
  41. {{item.city}}
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view v-show="isLoadMore">
  47. <uni-load-more :status="loadStatus"></uni-load-more>
  48. <!-- <u-loadmore :status="status" /> -->
  49. </view>
  50. <view style='height:12vh;background:#F5F6FA;line-height:24vh;text-align:center;' v-if='releaseInfo.length == 0'>
  51. 当前暂无结果
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import {
  57. mapState
  58. } from 'vuex';
  59. export default {
  60. data() {
  61. return {
  62. keyword: "",
  63. releaseList: [],
  64. releaseInfo:[],
  65. currentPage: 1,
  66. pageSize: 10,
  67. isLoadMore:false,
  68. loadStatus:"loading"
  69. }
  70. },
  71. computed: {
  72. ...mapState(['hasLogin', 'userInfo'])
  73. },
  74. //下拉刷新
  75. onPullDownRefresh() {
  76. this.getrelease()
  77. setTimeout(function() {
  78. uni.stopPullDownRefresh();
  79. }, 1000);
  80. },
  81. onReachBottom() { //上拉触底函数
  82. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  83. this.isLoadMore = true
  84. this.currentPage += 1
  85. setTimeout(function() {
  86. uni.stopPullDownRefresh();
  87. }, 1000);
  88. this.getrelease()
  89. }
  90. },
  91. onShow() {
  92. this.userName = this.userInfo.userName
  93. this.portraits = this.userInfo.avatarUrl
  94. this.getrelease()
  95. },
  96. methods: {
  97. getrelease() {
  98. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  99. currentPage: this.currentPage,
  100. pageSize: this.pageSize,
  101. searchKeyWord: this.keyword
  102. })
  103. .then(res => {
  104. if (res.data.code == 200) {
  105. this.releaseInfo = res.data.data.records
  106. if(res.data.data.records.length > 0){
  107. this.releaseList=this.releaseList.concat(this.releaseInfo)
  108. this.isLoadMore = false
  109. for (let i = 0; i < this.releaseList.length; i++) {
  110. this.releaseList[i].imgList = this.releaseList[i].address.split(",")
  111. }
  112. }else{
  113. this.loadStatus = 'nomore'
  114. }
  115. }
  116. })
  117. },
  118. searchClear() {
  119. this.keyword = ""
  120. },
  121. release() {
  122. uni.navigateTo({
  123. url: `/pages/grain_pulse/release`
  124. })
  125. },
  126. record() {
  127. uni.navigateTo({
  128. url: `/pages/grain_pulse/record`
  129. })
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. .center {
  136. padding: 10rpx 4rpx;
  137. }
  138. .bottom {
  139. width: 100%;
  140. height: 160rpx;
  141. background-color: #FFFFFF;
  142. position: fixed;
  143. bottom: 0rpx;
  144. z-index: 9999;
  145. }
  146. .bottonCss {
  147. width: 50%;
  148. height: 40rpx;
  149. margin-top: 40rpx;
  150. text-align: center;
  151. }
  152. .modular {
  153. width: 94%;
  154. margin: 20rpx auto;
  155. background-color: #FFFFFF;
  156. border-radius: 40rpx;
  157. margin-top: 40rpx;
  158. }
  159. .touxiang {
  160. width: 76rpx;
  161. height: 76rpx;
  162. background-color: red;
  163. margin: 20rpx 0 0 34rpx;
  164. }
  165. .title {
  166. font-size: 38rpx;
  167. font-weight: 600;
  168. margin-left: 30rpx;
  169. }
  170. .titleText {
  171. font-size: 34rpx;
  172. margin-left: 30rpx;
  173. margin-top: 10rpx;
  174. }
  175. .imgList {
  176. width: 100%;
  177. margin-top: 30rpx;
  178. flex-wrap: wrap;
  179. }
  180. .address {
  181. width: 60%;
  182. height: 48rpx;
  183. background-color: #F5F6FA;
  184. border-radius: 24rpx;
  185. margin-left: 30rpx;
  186. text-align: center;
  187. line-height: 48rpx;
  188. }
  189. </style>