dynamic.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <view class="center">
  3. <view class='search' >
  4. <u-search placeholder="请输入关键字" bg-color='#F5F6F9' v-model="keyword" @clear="searchClear" style="width: 96%; margin: 0 auto;"
  5. @search="getData" @custom="getData"></u-search>
  6. </view>
  7. <view class="bottom flex">
  8. <view class="bottonCss" @click="release">
  9. <image src="../../static/img/liangmai/fabu-2-check@3x.png" mode="" style="width: 40rpx; height: 40rpx;">
  10. </image>
  11. <view>发布</view>
  12. </view>
  13. <view class="bottonCss" @click="record">
  14. <image src="../../static/img/liangmai/jilu-2@3x.png" mode="" style="width: 40rpx; height: 40rpx;">
  15. </image>
  16. <view style="color: #656765;">记录</view>
  17. </view>
  18. </view>
  19. <view v-for="(item,index) in releaseList">
  20. <view class="modular">
  21. <view class="flex">
  22. <view class="touxiang">
  23. <image v-if='item.avatarUrl' :src="item.avatarUrl" mode="" style="height: 76rpx;border-radius: 8rpx;"></image>
  24. <image v-else src="../../static/img/myimg/YongHu@3x.png" mode="" style="height: 76rpx;border-radius: 8rpx;"></image>
  25. </view>
  26. <view class="" style="margin: 20rpx 30rpx;">
  27. <view style="color: #333333;font-weight: 600;font-size: 34rpx;">{{item.compName}}</view>
  28. <view style="color: #AFB3BF; margin-top: 4rpx;">{{item.updateDate}}</view>
  29. </view>
  30. </view>
  31. <view class="title">{{item.title}}</view>
  32. <view class="titleText">
  33. <!-- {{item.content}} -->
  34. <u-read-more show-height="200" :shadow-style="shadowStyle" :toggle="true" close-text="展开">
  35. <rich-text :nodes="item.content"></rich-text>
  36. <!-- @load="parseLoaded" -->
  37. <!-- <u-parse :html="item.content" ></u-parse> -->
  38. </u-read-more>
  39. </view>
  40. <view class="imgList flex" v-if="item.address != ''">
  41. <view v-for="(items,count) in item.imgList" style="width: 30%;margin-left: 20rpx;">
  42. <image @click="preview(item.imgList,count)" :src="items" style="height: 220rpx;border-radius: 16rpx;"></image>
  43. </view>
  44. </view>
  45. <view class="flex">
  46. <view class="address flex" style="margin: 30rpx;">
  47. <image src='../../static/img/location.png'
  48. style="width: 26rpx;height: 30rpx;top: 8rpx;margin: 0 10rpx;"></image>
  49. {{item.city}}
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view v-show="isLoadMore">
  55. <!-- <uni-load-more :status="loadStatus" icon icon-type></uni-load-more> -->
  56. <u-loadmore :status="loadStatus" icon icon-type="circle" margin-bottom="200"/>
  57. </view>
  58. <u-back-top :scroll-top="scrollTop" mode="circle" icon="arrow-upward"></u-back-top>
  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. scrollTop: 0,
  82. }
  83. },
  84. computed: {
  85. ...mapState(['hasLogin', 'userInfo'])
  86. },
  87. //下拉刷新
  88. onPullDownRefresh() {
  89. this.getData()
  90. setTimeout(function() {
  91. uni.stopPullDownRefresh();
  92. }, 1000);
  93. },
  94. onReachBottom() { //上拉触底函数
  95. var that = this
  96. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  97. this.isLoadMore = true
  98. this.currentPage += 1
  99. setTimeout(function() {
  100. uni.stopPullDownRefresh();
  101. that.getrelease()
  102. }, 1000);
  103. }
  104. },
  105. onShow() {
  106. this.userName = this.userInfo.userName
  107. this.portraits = this.userInfo.avatarUrl
  108. this.getData()
  109. },
  110. onPageScroll(e) {
  111. this.scrollTop = e.scrollTop;
  112. },
  113. methods: {
  114. preview(img,index){
  115. uni.previewImage({
  116. urls: img,
  117. current:index
  118. });
  119. },
  120. getData() {
  121. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  122. currentPage: 1,
  123. pageSize:10,
  124. searchKeyWord: this.keyword,
  125. searchType:2
  126. })
  127. .then(res => {
  128. if (res.data.code == 200) {
  129. this.releaseList = res.data.data.records
  130. console.log("releaseList",this.releaseList)
  131. for (let i = 0; i < this.releaseList.length; i++) {
  132. if (this.releaseList[i].address != null) {
  133. if(this.releaseList[i].address.indexOf(',')!=-1){
  134. this.releaseList[i].imgList = this.releaseList[i].address.split(",")
  135. }else{
  136. this.releaseList[i].imgList =[this.releaseList[i].address]
  137. }
  138. }
  139. }
  140. }
  141. })
  142. },
  143. getrelease() {
  144. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  145. currentPage: this.currentPage,
  146. pageSize: this.pageSize,
  147. searchKeyWord: this.keyword,
  148. searchType:2
  149. })
  150. .then(res => {
  151. if (res.data.code == 200) {
  152. this.releaseInfo = res.data.data.records
  153. if (this.releaseInfo.length > 0) {
  154. this.releaseList = this.releaseList.concat(this.releaseInfo)
  155. this.isLoadMore = false
  156. for (let i = 0; i < this.releaseList.length; i++) {
  157. if (this.releaseList[i].address != null) {
  158. if(this.releaseList[i].address.indexOf(',')!=-1){
  159. this.releaseList[i].imgList = this.releaseList[i].address.split(",")
  160. }else{
  161. this.releaseList[i].imgList =[this.releaseList[i].address]
  162. }
  163. }
  164. }
  165. } else {
  166. this.loadStatus = 'nomore'
  167. }
  168. }
  169. })
  170. },
  171. searchClear() {
  172. this.keyword = ""
  173. },
  174. release() {
  175. if (!this.hasLogin) {
  176. uni.showModal({
  177. title: '登录提示',
  178. content: '您尚未登录,是否立即登录?',
  179. showCancel: true,
  180. confirmText: '登录',
  181. success: (e) => {
  182. if (e.confirm) {
  183. uni.navigateTo({
  184. url: '/pages/public/login'
  185. })
  186. }
  187. },
  188. fail: () => {},
  189. complete: () => {}
  190. })
  191. }
  192. else{
  193. this.getCompany.loginPhone = this.userInfo.phone
  194. this.$api.doRequest('get', '/settledCompanyInfo/companyList', this.getCompany)
  195. .then(res => {
  196. if (res.data.code == 200) {
  197. console.log("companyList",res)
  198. if(res.data.data.length > 0){
  199. uni.navigateTo({
  200. url: `/pages/grain_pulse/release`
  201. })
  202. }else{
  203. uni.showModal({
  204. content: "您还没有入驻粮脉,不能发布,是否前去完善入驻信息!",
  205. showCancel: true,
  206. confirmText: '前往',
  207. success: function(res) {
  208. if (res.confirm) {
  209. uni.navigateTo({
  210. url: `/pages/grain_pulse/enter`
  211. })
  212. }
  213. }
  214. })
  215. }
  216. }
  217. })
  218. }
  219. },
  220. record() {
  221. if (!this.hasLogin) {
  222. uni.showModal({
  223. title: '登录提示',
  224. content: '您尚未登录,是否立即登录?',
  225. showCancel: true,
  226. confirmText: '登录',
  227. success: (e) => {
  228. if (e.confirm) {
  229. uni.navigateTo({
  230. url: '/pages/public/login'
  231. })
  232. }
  233. },
  234. fail: () => {},
  235. complete: () => {}
  236. })
  237. }
  238. else{
  239. uni.navigateTo({
  240. url: `/pages/grain_pulse/record`
  241. })
  242. }
  243. }
  244. }
  245. }
  246. </script>
  247. <style lang="scss" scoped>
  248. page{
  249. background:#F5F6FA;
  250. }
  251. .center {
  252. padding: 0 4rpx;
  253. }
  254. .bottom {
  255. width: 100%;
  256. height: 160rpx;
  257. background-color: #FFFFFF;
  258. position: fixed;
  259. bottom: 0rpx;
  260. z-index: 9999;
  261. }
  262. .bottonCss {
  263. width: 50%;
  264. height: 40rpx;
  265. margin-top: 40rpx;
  266. text-align: center;
  267. font-size:20rpx;
  268. }
  269. .modular {
  270. width: 96%;
  271. margin: 20rpx auto;
  272. background-color: #FFFFFF;
  273. border-radius: 30rpx;
  274. // margin-top: 40rpx;
  275. }
  276. .touxiang {
  277. width: 76rpx;
  278. height: 76rpx;
  279. margin: 20rpx 0 0 34rpx;
  280. }
  281. .title {
  282. font-size: 38rpx;
  283. font-weight: 600;
  284. margin-left: 30rpx;
  285. }
  286. .titleText {
  287. font-size: 30rpx;
  288. margin-left: 30rpx;
  289. margin-top: 10rpx;
  290. }
  291. .imgList {
  292. width: 100%;
  293. margin-top: 30rpx;
  294. flex-wrap: wrap;
  295. }
  296. .address {
  297. height: 48rpx;
  298. background-color: #F5F6FA;
  299. border-radius: 20rpx;
  300. margin-left: 30rpx;
  301. text-align: center;
  302. line-height: 48rpx;
  303. padding:0px 13px 0 5px;
  304. }
  305. /deep/.u-content {
  306. text-indent:0 !important;
  307. }
  308. .search{
  309. background:#fff;
  310. padding:10px;
  311. }
  312. </style>