dynamic.vue 8.9 KB

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