dynamic.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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 color='#22C572' show-height="140" :index="index" :shadow-style="shadowStyle" :toggle="true" close-text="展开阅读更多内容" @open='open' @close='close'>
  37. <rich-text :nodes="item.content" class="rich-item"></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: 30rpx;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. open(e){
  123. console.log(e)
  124. },
  125. close(e){
  126. console.log(e)
  127. },
  128. preview(img, index) {
  129. uni.previewImage({
  130. urls: img,
  131. current: index
  132. });
  133. },
  134. getData() {
  135. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  136. currentPage: 1,
  137. pageSize: 10,
  138. searchKeyWord: this.keyword,
  139. searchType: 2
  140. })
  141. .then(res => {
  142. if (res.data.code == 200) {
  143. this.releaseList = res.data.data.records
  144. console.log("releaseList", this.releaseList)
  145. for (let i = 0; i < this.releaseList.length; i++) {
  146. if (this.releaseList[i].address != null) {
  147. if (this.releaseList[i].address.indexOf(',') != -1) {
  148. this.releaseList[i].imgList = this.releaseList[i].address.split(",")
  149. } else {
  150. this.releaseList[i].imgList = [this.releaseList[i].address]
  151. }
  152. }
  153. }
  154. }
  155. })
  156. },
  157. getrelease() {
  158. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  159. currentPage: this.currentPage,
  160. pageSize: this.pageSize,
  161. searchKeyWord: this.keyword,
  162. searchType: 2
  163. })
  164. .then(res => {
  165. if (res.data.code == 200) {
  166. this.releaseInfo = res.data.data.records
  167. if (this.releaseInfo.length > 0) {
  168. this.releaseList = this.releaseList.concat(this.releaseInfo)
  169. this.isLoadMore = false
  170. for (let i = 0; i < this.releaseList.length; i++) {
  171. if (this.releaseList[i].address != null) {
  172. if (this.releaseList[i].address.indexOf(',') != -1) {
  173. this.releaseList[i].imgList = this.releaseList[i].address.split(",")
  174. } else {
  175. this.releaseList[i].imgList = [this.releaseList[i].address]
  176. }
  177. }
  178. }
  179. } else {
  180. this.loadStatus = 'nomore'
  181. }
  182. }
  183. })
  184. },
  185. searchClear() {
  186. this.keyword = ""
  187. },
  188. alertBtn() {
  189. uni.navigateTo({
  190. url: '/pages/public/login'
  191. })
  192. },
  193. cancelClick() {
  194. this.isShowAlert = false
  195. },
  196. release() {
  197. if (!this.hasLogin) {
  198. this.isShowAlert = true;
  199. // uni.showModal({
  200. // title: '提示',
  201. // content: '您尚未登录,是否立即登录?',
  202. // showCancel: true,
  203. // confirmText: '登录',
  204. // success: (e) => {
  205. // if (e.confirm) {
  206. // uni.navigateTo({
  207. // url: '/pages/public/login'
  208. // })
  209. // }
  210. // },
  211. // fail: () => {},
  212. // complete: () => {}
  213. // })
  214. } else {
  215. this.getCompany.loginPhone = this.userInfo.phone
  216. this.$api.doRequest('get', '/settledCompanyInfo/companyList', this.getCompany)
  217. .then(res => {
  218. if (res.data.code == 200) {
  219. console.log("companyList", res)
  220. if (res.data.data.length > 0) {
  221. uni.navigateTo({
  222. url: `/pages/grain_pulse/release`
  223. })
  224. } else {
  225. uni.showModal({
  226. content: "您还没有入驻粮脉,不能发布,是否前去完善入驻信息!",
  227. showCancel: true,
  228. confirmText: '前往',
  229. success: function(res) {
  230. if (res.confirm) {
  231. uni.navigateTo({
  232. url: `/pages/grain_pulse/enter`
  233. })
  234. }
  235. }
  236. })
  237. }
  238. }
  239. })
  240. }
  241. },
  242. alertBtn() {
  243. uni.navigateTo({
  244. url: '/pages/public/login'
  245. })
  246. },
  247. cancelClick() {
  248. this.isShowAlert = false
  249. },
  250. record() {
  251. if (!this.hasLogin) {
  252. this.isShowAlert = true;
  253. // uni.showModal({
  254. // title: '提示',
  255. // content: '您尚未登录,是否立即登录?',
  256. // showCancel: true,
  257. // confirmText: '登录',
  258. // success: (e) => {
  259. // if (e.confirm) {
  260. // uni.navigateTo({
  261. // url: '/pages/public/login'
  262. // })
  263. // }
  264. // },
  265. // fail: () => {},
  266. // complete: () => {}
  267. // })
  268. } else {
  269. uni.navigateTo({
  270. url: `/pages/grain_pulse/record`
  271. })
  272. }
  273. }
  274. }
  275. }
  276. </script>
  277. <style lang="scss" scoped>
  278. page {
  279. background: #F5F6FA;
  280. }
  281. .center {
  282. padding: 0 4rpx;
  283. }
  284. .bottom {
  285. width: 100%;
  286. height: 160rpx;
  287. background-color: #FFFFFF;
  288. position: fixed;
  289. bottom: 0rpx;
  290. z-index: 9999;
  291. }
  292. .bottonCss {
  293. width: 50%;
  294. height: 40rpx;
  295. margin-top: 40rpx;
  296. text-align: center;
  297. font-size: 20rpx;
  298. }
  299. .modular {
  300. width: 96%;
  301. margin: 20rpx auto;
  302. background-color: #FFFFFF;
  303. border-radius: 30rpx;
  304. // margin-top: 40rpx;
  305. }
  306. .touxiang {
  307. width: 76rpx;
  308. height: 76rpx;
  309. margin: 20rpx 0 0 34rpx;
  310. }
  311. .title {
  312. font-size: 38rpx;
  313. font-weight: 600;
  314. margin-left: 30rpx;
  315. }
  316. .titleText {
  317. font-size: 30rpx;
  318. margin-left: 30rpx;
  319. margin-top: 10rpx;
  320. }
  321. .imgList {
  322. width: 100%;
  323. margin-top: 30rpx;
  324. flex-wrap: wrap;
  325. }
  326. .address {
  327. height: 48rpx;
  328. background-color: #F5F6FA;
  329. border-radius: 20rpx;
  330. margin-left: 30rpx;
  331. text-align: center;
  332. line-height: 48rpx;
  333. padding: 0px 13px 0 5px;
  334. }
  335. /deep/.u-content {
  336. text-indent: 0 !important;
  337. }
  338. .search {
  339. background: #fff;
  340. padding: 10px;
  341. }
  342. .rich-item{
  343. line-height: 44rpx;
  344. }
  345. </style>