dynamic.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <view class="center">
  3. <u-search placeholder="请输入货名" v-model="keyword" @clear="searchClear" style="width: 96%; margin: 0 auto;"
  4. @search="getData" @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" :shadow-style="shadowStyle" :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. <u-back-top :scroll-top="scrollTop" mode="circle" icon="arrow-upward"></u-back-top>
  60. </view>
  61. </template>
  62. <script>
  63. import {
  64. mapState
  65. } from 'vuex';
  66. export default {
  67. data() {
  68. return {
  69. keyword: "",
  70. releaseList: [],
  71. releaseInfo: [],
  72. currentPage: 1,
  73. pageSize: 10,
  74. isLoadMore: false,
  75. loadStatus: "loading",
  76. getCompany:{},
  77. shadowStyle: {
  78. backgroundImage: "none",
  79. paddingTop: "0",
  80. marginTop: "20rpx"
  81. },
  82. scrollTop: 0,
  83. }
  84. },
  85. computed: {
  86. ...mapState(['hasLogin', 'userInfo'])
  87. },
  88. //下拉刷新
  89. onPullDownRefresh() {
  90. this.getData()
  91. setTimeout(function() {
  92. uni.stopPullDownRefresh();
  93. }, 1000);
  94. },
  95. onReachBottom() { //上拉触底函数
  96. var that = this
  97. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  98. this.isLoadMore = true
  99. this.currentPage += 1
  100. setTimeout(function() {
  101. uni.stopPullDownRefresh();
  102. that.getrelease()
  103. }, 1000);
  104. }
  105. },
  106. onShow() {
  107. this.userName = this.userInfo.userName
  108. this.portraits = this.userInfo.avatarUrl
  109. this.getData()
  110. },
  111. onPageScroll(e) {
  112. this.scrollTop = e.scrollTop;
  113. },
  114. methods: {
  115. getData() {
  116. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  117. currentPage: 1,
  118. pageSize:10,
  119. searchKeyWord: this.keyword,
  120. searchType:2
  121. })
  122. .then(res => {
  123. if (res.data.code == 200) {
  124. this.releaseList = res.data.data.records
  125. for (let i = 0; i < this.releaseList.length; i++) {
  126. if (this.releaseList[i].address != null) {
  127. if(this.releaseList[i].address.indexOf(',')!=-1){
  128. this.releaseList[i].imgList = this.releaseList[i].address.split(",")
  129. }else{
  130. this.releaseList[i].imgList =[this.releaseList[i].address]
  131. }
  132. }
  133. }
  134. }
  135. })
  136. },
  137. getrelease() {
  138. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  139. currentPage: this.currentPage,
  140. pageSize: this.pageSize,
  141. searchKeyWord: this.keyword,
  142. searchType:2
  143. })
  144. .then(res => {
  145. if (res.data.code == 200) {
  146. this.releaseInfo = res.data.data.records
  147. if (this.releaseInfo.length > 0) {
  148. this.releaseList = this.releaseList.concat(this.releaseInfo)
  149. this.isLoadMore = false
  150. for (let i = 0; i < this.releaseList.length; i++) {
  151. if (this.releaseList[i].address != null) {
  152. if(this.releaseList[i].address.indexOf(',')!=-1){
  153. this.releaseList[i].imgList = this.releaseList[i].address.split(",")
  154. }else{
  155. this.releaseList[i].imgList =[this.releaseList[i].address]
  156. }
  157. }
  158. }
  159. } else {
  160. this.loadStatus = 'nomore'
  161. }
  162. }
  163. })
  164. },
  165. searchClear() {
  166. this.keyword = ""
  167. },
  168. release() {
  169. this.getCompany.loginPhone = this.userInfo.phone
  170. this.$api.doRequest('get', '/settledCompanyInfo/companyList', this.getCompany)
  171. .then(res => {
  172. if (res.data.code == 200) {
  173. console.log("companyList",res)
  174. if(res.data.data.length > 0){
  175. uni.navigateTo({
  176. url: `/pages/grain_pulse/release`
  177. })
  178. }else{
  179. uni.showModal({
  180. content: "您还没有入驻粮脉,不能发布,是否前去完善入驻信息!",
  181. showCancel: true,
  182. confirmText: '前往',
  183. success: function(res) {
  184. if (res.confirm) {
  185. uni.navigateTo({
  186. url: `/pages/grain_pulse/enter`
  187. })
  188. }
  189. }
  190. })
  191. }
  192. }
  193. })
  194. },
  195. record() {
  196. uni.navigateTo({
  197. url: `/pages/grain_pulse/record`
  198. })
  199. }
  200. }
  201. }
  202. </script>
  203. <style lang="scss" scoped>
  204. page{
  205. background:#F5F6FA;
  206. }
  207. .center {
  208. padding: 10rpx 4rpx;
  209. }
  210. .bottom {
  211. width: 100%;
  212. height: 160rpx;
  213. background-color: #FFFFFF;
  214. position: fixed;
  215. bottom: 0rpx;
  216. z-index: 9999;
  217. }
  218. .bottonCss {
  219. width: 50%;
  220. height: 40rpx;
  221. margin-top: 40rpx;
  222. text-align: center;
  223. font-size:20rpx;
  224. }
  225. .modular {
  226. width: 96%;
  227. margin: 20rpx auto;
  228. background-color: #FFFFFF;
  229. border-radius: 30rpx;
  230. // margin-top: 40rpx;
  231. }
  232. .touxiang {
  233. width: 76rpx;
  234. height: 76rpx;
  235. margin: 20rpx 0 0 34rpx;
  236. }
  237. .title {
  238. font-size: 38rpx;
  239. font-weight: 600;
  240. margin-left: 30rpx;
  241. }
  242. .titleText {
  243. font-size: 30rpx;
  244. margin-left: 30rpx;
  245. margin-top: 10rpx;
  246. }
  247. .imgList {
  248. width: 100%;
  249. margin-top: 30rpx;
  250. flex-wrap: wrap;
  251. }
  252. .address {
  253. height: 48rpx;
  254. background-color: #F5F6FA;
  255. border-radius: 20rpx;
  256. margin-left: 30rpx;
  257. text-align: center;
  258. line-height: 48rpx;
  259. padding:0px 13px 0 5px;
  260. }
  261. /deep/.u-content {
  262. text-indent:0 !important;
  263. }
  264. </style>