dynamic.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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 @click="preview(item.imgList,count)" :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. preview(img,index){
  116. uni.previewImage({
  117. urls: img,
  118. current:index
  119. });
  120. },
  121. getData() {
  122. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  123. currentPage: 1,
  124. pageSize:10,
  125. searchKeyWord: this.keyword,
  126. searchType:2
  127. })
  128. .then(res => {
  129. if (res.data.code == 200) {
  130. this.releaseList = res.data.data.records
  131. console.log("releaseList",this.releaseList)
  132. for (let i = 0; i < this.releaseList.length; i++) {
  133. if (this.releaseList[i].address != null) {
  134. if(this.releaseList[i].address.indexOf(',')!=-1){
  135. this.releaseList[i].imgList = this.releaseList[i].address.split(",")
  136. }else{
  137. this.releaseList[i].imgList =[this.releaseList[i].address]
  138. }
  139. }
  140. }
  141. }
  142. })
  143. },
  144. getrelease() {
  145. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  146. currentPage: this.currentPage,
  147. pageSize: this.pageSize,
  148. searchKeyWord: this.keyword,
  149. searchType:2
  150. })
  151. .then(res => {
  152. if (res.data.code == 200) {
  153. this.releaseInfo = res.data.data.records
  154. if (this.releaseInfo.length > 0) {
  155. this.releaseList = this.releaseList.concat(this.releaseInfo)
  156. this.isLoadMore = false
  157. for (let i = 0; i < this.releaseList.length; i++) {
  158. if (this.releaseList[i].address != null) {
  159. if(this.releaseList[i].address.indexOf(',')!=-1){
  160. this.releaseList[i].imgList = this.releaseList[i].address.split(",")
  161. }else{
  162. this.releaseList[i].imgList =[this.releaseList[i].address]
  163. }
  164. }
  165. }
  166. } else {
  167. this.loadStatus = 'nomore'
  168. }
  169. }
  170. })
  171. },
  172. searchClear() {
  173. this.keyword = ""
  174. },
  175. release() {
  176. this.getCompany.loginPhone = this.userInfo.phone
  177. this.$api.doRequest('get', '/settledCompanyInfo/companyList', this.getCompany)
  178. .then(res => {
  179. if (res.data.code == 200) {
  180. console.log("companyList",res)
  181. if(res.data.data.length > 0){
  182. uni.navigateTo({
  183. url: `/pages/grain_pulse/release`
  184. })
  185. }else{
  186. uni.showModal({
  187. content: "您还没有入驻粮脉,不能发布,是否前去完善入驻信息!",
  188. showCancel: true,
  189. confirmText: '前往',
  190. success: function(res) {
  191. if (res.confirm) {
  192. uni.navigateTo({
  193. url: `/pages/grain_pulse/enter`
  194. })
  195. }
  196. }
  197. })
  198. }
  199. }
  200. })
  201. },
  202. record() {
  203. uni.navigateTo({
  204. url: `/pages/grain_pulse/record`
  205. })
  206. }
  207. }
  208. }
  209. </script>
  210. <style lang="scss" scoped>
  211. page{
  212. background:#F5F6FA;
  213. }
  214. .center {
  215. padding: 10rpx 4rpx;
  216. }
  217. .bottom {
  218. width: 100%;
  219. height: 160rpx;
  220. background-color: #FFFFFF;
  221. position: fixed;
  222. bottom: 0rpx;
  223. z-index: 9999;
  224. }
  225. .bottonCss {
  226. width: 50%;
  227. height: 40rpx;
  228. margin-top: 40rpx;
  229. text-align: center;
  230. font-size:20rpx;
  231. }
  232. .modular {
  233. width: 96%;
  234. margin: 20rpx auto;
  235. background-color: #FFFFFF;
  236. border-radius: 30rpx;
  237. // margin-top: 40rpx;
  238. }
  239. .touxiang {
  240. width: 76rpx;
  241. height: 76rpx;
  242. margin: 20rpx 0 0 34rpx;
  243. }
  244. .title {
  245. font-size: 38rpx;
  246. font-weight: 600;
  247. margin-left: 30rpx;
  248. }
  249. .titleText {
  250. font-size: 30rpx;
  251. margin-left: 30rpx;
  252. margin-top: 10rpx;
  253. }
  254. .imgList {
  255. width: 100%;
  256. margin-top: 30rpx;
  257. flex-wrap: wrap;
  258. }
  259. .address {
  260. height: 48rpx;
  261. background-color: #F5F6FA;
  262. border-radius: 20rpx;
  263. margin-left: 30rpx;
  264. text-align: center;
  265. line-height: 48rpx;
  266. padding:0px 13px 0 5px;
  267. }
  268. /deep/.u-content {
  269. text-indent:0 !important;
  270. }
  271. </style>