dynamic.vue 6.9 KB

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