notice.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="content">
  3. <view @click="navTo(item)" v-for="item in newsInfo" :key="item.id" class="newsBox dffd">
  4. <view class="one">
  5. <view class="one_img">
  6. <image :src="item.image" mode=""></image>
  7. </view>
  8. <view class="title">
  9. <view class="title_one">{{item.title}} </view>
  10. <view class="title_time">{{item.create_time}}</view>
  11. </view>
  12. </view>
  13. </view>
  14. <!-- <view @click="navTo(item)" v-for="item in newsInfo" :key="item.id" class="newsBox dffd">
  15. <image src="/static/img/pro/del.png" class="sel" mode=""></image>
  16. <text class="time">{{item.create_time}}</text>
  17. <view class="newsCon">
  18. <view class="newshead dfsb">
  19. {{item.title}}
  20. <text :class="item.is_select?'promain':'textgrey'">{{item.is_select?'已读':'未读'}}</text>
  21. </view>
  22. <view class="shopshead dfsb">
  23. {{item.desc}}
  24. </view>
  25. </view>
  26. </view> -->
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. type:1,
  34. newsInfo: [
  35. // {
  36. // create_time:'2021.03.12 12:00 ',
  37. // title:'fdsiaodi测试测试',
  38. // read: true,
  39. // }
  40. ],
  41. status: 'loadmore',
  42. page: 1,
  43. pagenum:20,
  44. };
  45. },
  46. onLoad(opt) {
  47. console.log('opt:',opt);
  48. if(opt.title)
  49. {
  50. uni.setNavigationBarTitle({
  51. title: opt.title
  52. });
  53. }
  54. this.type=opt.type||1;
  55. // this.newsInfo=[];
  56. // this.page=1;
  57. this.loading();
  58. },
  59. onReachBottom() {
  60. if (this.status == 'nomore') return;
  61. this.status = 'loading';
  62. this.page = ++this.page;
  63. this.loading();
  64. },
  65. methods: {
  66. navTo(item){
  67. uni.navigateTo({
  68. url:'./newsInfo?id=' + item.id+'&type=2'
  69. })
  70. },
  71. loading() {
  72. this.$api
  73. .request('index/getNotice', {
  74. type:this.type||1,
  75. page: this.page,
  76. limit: this.pagenum
  77. })
  78. .then(data => {
  79. if (data.code == 200) {
  80. this.newsInfo = this.newsInfo.concat(data.data);
  81. if (data.data.length < this.pagenum) {
  82. this.status = 'nomore';
  83. }
  84. } else {
  85. this.$api.toast(data.msg);
  86. }
  87. })
  88. }
  89. }
  90. };
  91. </script>
  92. <style lang="scss">
  93. page{
  94. background-color: #F8F9FE;
  95. }
  96. .content {
  97. min-height: 100vh;
  98. // padding: 0 30rpx;
  99. .one{
  100. background-color: #FFFFFF;
  101. padding: 30rpx;
  102. width: 100%;
  103. height:220rpx;
  104. display: flex;
  105. justify-content: flex-start;
  106. flex-direction: row;
  107. align-items: center;
  108. .one_img{
  109. width: 210rpx;
  110. height: 160rpx;
  111. /deep/ image{
  112. width:100%;
  113. height:100%;
  114. }
  115. }
  116. .title{
  117. margin-left: 16rpx;
  118. width: 465rpx;
  119. .title_one{
  120. height: 105rpx;
  121. font-size: 36rpx;
  122. font-family: PingFangSC-Medium, PingFang SC;
  123. font-weight: 600;
  124. text-overflow: -o-ellipsis-lastline;
  125. overflow: hidden;
  126. text-overflow: ellipsis;
  127. display: -webkit-box;
  128. -webkit-line-clamp: 2;
  129. line-clamp: 2;
  130. -webkit-box-orient: vertical;
  131. }
  132. .title_time{
  133. font-size: 30rpx;
  134. display: flex;
  135. justify-content: flex-end;
  136. }
  137. }
  138. }
  139. .newsBox {
  140. width: 100%;
  141. padding: 32rpx 0 0;
  142. align-items: center;
  143. position: relative;
  144. .sel{
  145. position: absolute;
  146. top: -68rpx;
  147. left: 50%;
  148. width: 100rpx;
  149. height: 68rpx;
  150. }
  151. }
  152. .time {
  153. font-size: 22rpx;
  154. color: #fff;
  155. padding: 6rpx 12rpx;
  156. line-height: 52rpx;
  157. background: rgba(214, 214, 214, 1);
  158. border-radius: 12rpx;
  159. margin-bottom: 32rpx;
  160. }
  161. .newsCon {
  162. width: 100%;
  163. padding: 32rpx;
  164. border-radius: 8rpx;
  165. background-color: #fff;
  166. }
  167. .newshead {
  168. margin-bottom: 16rpx;
  169. font-size: 30rpx;
  170. }
  171. .shopshead {
  172. // background-color: #f5f5f5;
  173. image {
  174. width: 124rpx;
  175. height: 124rpx;
  176. margin-right: 10rpx;
  177. }
  178. .elli {
  179. flex: 1;
  180. font-size: 26rpx;
  181. height: 80rpx;
  182. line-height: 42rpx;
  183. /deep/ image{
  184. width: 100%;
  185. }
  186. }
  187. }
  188. }
  189. </style>