dynamic.vue 6.9 KB

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