dynamic.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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. <u-read-more show-height="200" :toggle="true" close-text="展开">
  32. <!-- <rich-text :nodes="item.content"></rich-text> -->
  33. <!-- @load="parseLoaded" -->
  34. <u-parse :html="item.content" ></u-parse>
  35. </u-read-more>
  36. </view>
  37. <view class="imgList flex" v-if="item.address != ''">
  38. <view v-for="(items,count) in item.imgList" style="width: 30%;margin-left: 20rpx;">
  39. <image :src="items" style="height: 220rpx;border-radius: 16rpx;"></image>
  40. </view>
  41. </view>
  42. <view class="flex">
  43. <view class="address flex" style="margin: 30rpx;">
  44. <image src='../../static/img/location.png'
  45. style="width: 26rpx;height: 30rpx;top: 8rpx;margin: 0 10rpx;"></image>
  46. {{item.city}}
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view v-show="isLoadMore">
  52. <!-- <uni-load-more :status="loadStatus" icon icon-type></uni-load-more> -->
  53. <u-loadmore :status="loadStatus" icon icon-type="circle" margin-bottom="200"/>
  54. </view>
  55. <view style='height:12vh;background:#F5F6FA;line-height:12vh;text-align:center;' v-if='releaseList.length == 0'>
  56. 当前暂无结果
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import {
  62. mapState
  63. } from 'vuex';
  64. export default {
  65. data() {
  66. return {
  67. keyword: "",
  68. releaseList: [],
  69. releaseInfo: [],
  70. currentPage: 1,
  71. pageSize: 10,
  72. isLoadMore: false,
  73. loadStatus: "loading",
  74. getCompany:{},
  75. }
  76. },
  77. computed: {
  78. ...mapState(['hasLogin', 'userInfo'])
  79. },
  80. //下拉刷新
  81. onPullDownRefresh() {
  82. this.getrelease()
  83. setTimeout(function() {
  84. uni.stopPullDownRefresh();
  85. }, 1000);
  86. },
  87. onReachBottom() { //上拉触底函数
  88. var that = this
  89. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  90. this.isLoadMore = true
  91. this.currentPage += 1
  92. setTimeout(function() {
  93. uni.stopPullDownRefresh();
  94. that.getrelease()
  95. }, 1000);
  96. }
  97. },
  98. onShow() {
  99. this.userName = this.userInfo.userName
  100. this.portraits = this.userInfo.avatarUrl
  101. this.getrelease()
  102. },
  103. methods: {
  104. getrelease() {
  105. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  106. currentPage: this.currentPage,
  107. pageSize: this.pageSize,
  108. searchKeyWord: this.keyword
  109. })
  110. .then(res => {
  111. if (res.data.code == 200) {
  112. this.releaseInfo = res.data.data.records
  113. if (this.releaseInfo.length > 0) {
  114. this.releaseList = this.releaseList.concat(this.releaseInfo)
  115. this.isLoadMore = false
  116. for (let i = 0; i < this.releaseList.length; i++) {
  117. if (this.releaseList[i].address != null) {
  118. this.releaseList[i].imgList = this.releaseList[i].address.split(",")
  119. }
  120. }
  121. } else {
  122. this.loadStatus = 'nomore'
  123. }
  124. }
  125. })
  126. },
  127. searchClear() {
  128. this.keyword = ""
  129. },
  130. release() {
  131. this.getCompany.loginPhone = this.userInfo.phone
  132. this.$api.doRequest('get', '/settledCompanyInfo/companyList', this.getCompany)
  133. .then(res => {
  134. if (res.data.code == 200) {
  135. if(res.data.data.length > 0){
  136. uni.navigateTo({
  137. url: `/pages/grain_pulse/release`
  138. })
  139. }else{
  140. uni.showModal({
  141. content: "您还没有入驻粮脉,不能发布,是否前去完善入驻信息!",
  142. showCancel: true,
  143. confirmText: '前往',
  144. success: function(res) {
  145. if (res.confirm) {
  146. uni.navigateTo({
  147. url: `/pages/grain_pulse/enter`
  148. })
  149. }
  150. }
  151. })
  152. }
  153. }
  154. })
  155. },
  156. record() {
  157. uni.navigateTo({
  158. url: `/pages/grain_pulse/record`
  159. })
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. .center {
  166. padding: 10rpx 4rpx;
  167. }
  168. .bottom {
  169. width: 100%;
  170. height: 160rpx;
  171. background-color: #FFFFFF;
  172. position: fixed;
  173. bottom: 0rpx;
  174. z-index: 9999;
  175. }
  176. .bottonCss {
  177. width: 50%;
  178. height: 40rpx;
  179. margin-top: 40rpx;
  180. text-align: center;
  181. }
  182. .modular {
  183. width: 94%;
  184. margin: 40rpx auto;
  185. background-color: #FFFFFF;
  186. border-radius: 40rpx;
  187. // margin-top: 40rpx;
  188. }
  189. .touxiang {
  190. width: 76rpx;
  191. height: 76rpx;
  192. background-color: red;
  193. margin: 20rpx 0 0 34rpx;
  194. }
  195. .title {
  196. font-size: 38rpx;
  197. font-weight: 600;
  198. margin-left: 30rpx;
  199. }
  200. .titleText {
  201. font-size: 30rpx;
  202. margin-left: 30rpx;
  203. margin-top: 10rpx;
  204. }
  205. .imgList {
  206. width: 100%;
  207. margin-top: 30rpx;
  208. flex-wrap: wrap;
  209. }
  210. .address {
  211. width: 60%;
  212. height: 48rpx;
  213. background-color: #F5F6FA;
  214. border-radius: 24rpx;
  215. margin-left: 30rpx;
  216. text-align: center;
  217. line-height: 48rpx;
  218. }
  219. </style>