news-list.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view class="">
  3. <view class="head">
  4. <view class="" :style="[{background: `url(${info.img})center top / 100% auto no-repeat`},{height:'100%'}]">
  5. <u-navbar leftText="" bgColor="transparent" leftIconColor="#fff" :titleStyle="{color:'#fff'}" :fixed="false" leftIconSize="48" :autoBack="true"></u-navbar>
  6. <view class="head-title">
  7. {{info.name}}
  8. </view>
  9. </view>
  10. <!-- <u-navbar :leftText="info.name" bgColor="transparent" leftIconColor="#fff" :titleStyle="{color:'#fff'}" :fixed="false" leftIconSize="48" :autoBack="true" v-else></u-navbar> -->
  11. </view>
  12. <!-- <view class="head" :style="{height:isShow?'auto':'300rpx'}">
  13. <view class="" :style="[{background: info.img ? `url(${info.img})center top / 100% auto no-repeat` : '#000'},{height:'100%'}]" v-if="!isShow">
  14. <u-navbar leftText="" bgColor="transparent" leftIconColor="#fff" :titleStyle="{color:'#fff'}" :fixed="false" leftIconSize="48" :autoBack="true"></u-navbar>
  15. <view class="head-title">
  16. {{info.name}}
  17. </view>
  18. </view>
  19. <u-navbar :leftText="info.name" bgColor="transparent" leftIconColor="#fff" :titleStyle="{color:'#fff'}" :fixed="false" leftIconSize="48" :autoBack="true" v-else></u-navbar>
  20. </view> -->
  21. <view class="flex screen">
  22. <view class="">
  23. <text :class="{active:is_refining == 0}" @click="setStatus(1)">{{$t('news.lab2')}}</text>
  24. <text :class="{active:is_refining == 1}" @click="setStatus(1)">{{$t('news.lab3')}}</text>
  25. </view>
  26. <view class="flex-start" @click="setStatus(2)">
  27. {{is_reply == 0?$t('news.lab4'):$t('news.lab5')}}
  28. <image src="/static/image/news/screen.png" mode=""></image>
  29. </view>
  30. </view>
  31. <view class="u-demo-block__content" style="padding-bottom: 40rpx;">
  32. <view class="album" @click="$toUrl('./community-detail?id=' + item.id)" v-for="(item,index) in luntanList" :key="index">
  33. <view class="album_top flex-start">
  34. <image class="logo" :src="item.avatar" mode=""></image>
  35. <view class="">
  36. <u--text :text="item.user_nickname" bold size="32"></u--text>
  37. <u--text margin="6px 0 0 0" color="#999" :text="item.addtime"></u--text>
  38. </view>
  39. </view>
  40. <!-- <view class="nav font28">
  41. {{item.title}}
  42. </view> -->
  43. <mote-lines-divide :line="3" @click.stop="" :expandText="$t('news.full')" :foldHint="$t('news.collapsed')">
  44. {{item.title}}
  45. </mote-lines-divide>
  46. <view class="album__content">
  47. <u-album multipleSize="200" space="16" :urls="item.img"></u-album>
  48. </view>
  49. <view class="types flex-start">
  50. <image :src="item.classification_icon" mode=""></image>
  51. {{item.classification_name}}
  52. </view>
  53. <view class="flex tabbar">
  54. <view class="">
  55. <image src="/static/image/news/topic2.png" mode=""></image>
  56. <u--text color="#999" size="24" :text="item.favorites"></u--text>
  57. </view>
  58. <view class="">
  59. <image src="/static/image/news/topic7.png" mode=""></image>
  60. <u--text color="#999" size="24" :text="item.comment"></u--text>
  61. </view>
  62. <view class="">
  63. <image src="/static/image/news/topic6.png" mode=""></image>
  64. <u--text color="#999" size="24" :text="item.click"></u--text>
  65. </view>
  66. </view>
  67. </view>
  68. <u-loadmore
  69. v-if="luntanList.length != 0"
  70. :status="status"
  71. fontSize="28"
  72. :line="true"
  73. :loading-text="statusType.loadingText"
  74. :loadmore-text="statusType.loadmoreText"
  75. :nomore-text="statusType.nomoreText"
  76. />
  77. </view>
  78. <u-empty
  79. v-if="luntanList.length == 0"
  80. mode="data"
  81. width="474"
  82. height="312"
  83. textSize="28"
  84. marginTop="100"
  85. :text="$t('common.nodata')"
  86. icon="/static/image/common/nodata.png"
  87. >
  88. </u-empty>
  89. <!-- <view class="loading">
  90. --{{status == 'more'?'more':status == 'loading'?'loading':'noMore'}}--
  91. </view> -->
  92. </view>
  93. </template>
  94. <script>
  95. import MoteLinesDivide from "@/components/mote-lines-divide/mote-lines-divide"
  96. export default {
  97. components: {
  98. MoteLinesDivide
  99. },
  100. data() {
  101. return {
  102. id:null,
  103. page:1,
  104. info:{
  105. name:''
  106. },
  107. is_reply:0,
  108. is_refining:0,
  109. isShow:false,
  110. statusType:{
  111. loadingText: this.$t('common.lab'),
  112. loadmoreText: this.$t('common.lab1'),
  113. nomoreText: this.$t('common.lab2')
  114. },
  115. status:'loadmore',
  116. luntanList: []
  117. }
  118. },
  119. onLoad(option) {
  120. this.id = option.id;
  121. this.getHeadlines()
  122. },
  123. onReachBottom() { //触底加载
  124. if (this.info.total > this.luntanList.length && this.status == 'loadmore') {
  125. this.page++
  126. this.getHeadlines()
  127. }
  128. },
  129. onPageScroll(e) {
  130. if(e.scrollTop > 200) {
  131. this.isShow = true
  132. }else {
  133. this.isShow = false
  134. }
  135. },
  136. methods:{
  137. /* 筛选 */
  138. setStatus(type) {
  139. if(type == 1) {
  140. this.is_refining = this.is_refining == 0?1:0
  141. }else {
  142. this.is_reply = this.is_reply == 0?1:0
  143. }
  144. this.page = 1;
  145. this.getHeadlines()
  146. },
  147. getHeadlines() {
  148. uni.showLoading({
  149. title:this.$t('common.lab')
  150. })
  151. this.status = 'loading'
  152. uni.$u.http.get('/api/Circle/designatedCategory', {
  153. params:{page: this.page,id:this.id,is_refining:this.is_refining,is_reply:this.is_reply}
  154. }).then(res => {
  155. if(this.page == 1) {
  156. res.info.total = res.list.total;
  157. this.info = res.info
  158. this.luntanList = res.list.data;
  159. }else {
  160. this.luntanList = this.luntanList.concat(res.list.data);
  161. }
  162. if(this.info.total > this.luntanList.length) {
  163. this.status = 'loadmore'
  164. }else {
  165. this.status = 'noMore'
  166. }
  167. uni.hideLoading()
  168. })
  169. }
  170. }
  171. }
  172. </script>
  173. <style lang="scss">
  174. page {
  175. background: #F3F3F7;
  176. }
  177. .loading {
  178. text-align: center;
  179. padding: 10rpx 0;
  180. color: #999;
  181. }
  182. .head {
  183. position: sticky;
  184. top: 0;
  185. z-index: 9999;
  186. height: 300rpx;
  187. background-color: #000;
  188. }
  189. .head-title {
  190. color: #fff;
  191. margin-top: 20%;
  192. padding: 0 24rpx;
  193. }
  194. .album {
  195. margin-bottom: 20rpx;
  196. padding: 32rpx 24rpx;
  197. border-radius: 12rpx;
  198. background-color: white;
  199. .types {
  200. width: fit-content;
  201. // display: inline-block;
  202. color: #E3AC72;
  203. font-size: 28rpx;
  204. margin-top: 24rpx;
  205. padding: 10rpx 16rpx;
  206. background-color: #FFF1E0;
  207. border-radius: 6rpx;
  208. image {
  209. width: 32rpx;
  210. height: 32rpx;
  211. margin-right: 10rpx;
  212. }
  213. }
  214. // border-bottom: 20rpx solid #F3F3F7;
  215. .logo {
  216. width: 72rpx;
  217. height: 72rpx;
  218. border-radius: 50%;
  219. margin-right: 16rpx;
  220. }
  221. .nav {
  222. padding-top: 20rpx;
  223. }
  224. .album__content {
  225. margin-top: 30rpx;
  226. image {
  227. border-radius: 10rpx;
  228. }
  229. }
  230. .tabbar {
  231. margin-top: 22rpx;
  232. padding: 0 22rpx;
  233. image {
  234. width: 48rpx;
  235. height: 48rpx;
  236. }
  237. view {
  238. display: flex;
  239. align-items: center;
  240. justify-content: flex-start;
  241. }
  242. }
  243. }
  244. .screen {
  245. color: #666;
  246. position: sticky;
  247. top: 300rpx;
  248. z-index: 99;
  249. background-color: white;
  250. padding: 18rpx 24rpx;
  251. font-size: 28rpx;
  252. text {
  253. margin-right: 44rpx;
  254. padding: 8rpx 24rpx;
  255. }
  256. .active {
  257. color: #E3AC72;
  258. border-radius: 26rpx;
  259. background-color: #FFF1E0;
  260. }
  261. image {
  262. width: 40rpx;
  263. height: 40rpx;
  264. margin-left: 10rpx;
  265. }
  266. }
  267. </style>