noticeList.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view>
  3. <u-navbar :title="title">
  4. <!-- <view class="slot-wrap">
  5. <u-icon name="search"
  6. @click="gotoUrl('pages/search/searchResult?type='+listForm.typeId)"
  7. size="48" color="#777777"></u-icon>
  8. </view> -->
  9. </u-navbar>
  10. <u-popup v-model="show" height="600"
  11. :closeable="true"
  12. mode="bottom" border-radius="30" >
  13. <view class="showInfo">
  14. <view class="row">
  15. <view class="name">
  16. 标题
  17. </view>
  18. <view class="value">
  19. {{showInfo.name}}
  20. </view>
  21. </view>
  22. <view class="row" v-if="infoList.length"
  23. >
  24. <view class="name">
  25. 附件
  26. </view>
  27. <view class="url" >
  28. <view class="urlitem" v-for="(item,i) in infoList"
  29. :key="i"
  30. @click="downInfo(item)" >
  31. {{item.name}} 下载
  32. </view>
  33. </view>
  34. </view>
  35. <view class="row" v-else >
  36. <u-divider
  37. :isnone="true" nonetext="未上传附件"
  38. ></u-divider>
  39. </view>
  40. </view>
  41. </u-popup>
  42. <view class="news">
  43. <view class="news-item" v-for="(item,i) in list"
  44. @click="ckInfo(item)" :key="i">
  45. <view class="content">
  46. <view class="news-title">
  47. {{item.name}}
  48. </view>
  49. <view class="information">
  50. <view class="classify">
  51. {{item.typeN}}
  52. </view>
  53. <view class="date">
  54. {{substrDate(item.uploadTime)}}
  55. </view>
  56. </view>
  57. </view>
  58. <view class="img">
  59. </view>
  60. </view>
  61. </view>
  62. <u-divider v-if="list.length==recordsTotal"
  63. :isnone="list.length==0" nonetext="没有找到相关内容"
  64. >已经到底了</u-divider>
  65. </view>
  66. </template>
  67. <script>
  68. import * as API from '@/apis/pagejs/addressbook.js'
  69. export default {
  70. data() {
  71. return {
  72. title:"内网公告",
  73. list:[],
  74. listForm:{
  75. pageIndex:1,
  76. // typeId:"",
  77. // title:"",
  78. pageSize:20,
  79. },
  80. recordsTotal:0,
  81. imgurl:'',
  82. show:false,
  83. showInfo:{
  84. url:"",
  85. },
  86. }
  87. },
  88. onLoad(op){
  89. // if(op.title){
  90. // this.title=op.title
  91. // }
  92. // this.listForm.typeId=op.id
  93. this.getList()
  94. },
  95. onReachBottom() {
  96. if (this.list.length < this.recordsTotal) {
  97. this.myLoadmore();
  98. }
  99. },
  100. computed:{
  101. infoList(){
  102. var url=this.showInfo.url;
  103. if(url){
  104. return JSON.parse(url)
  105. }
  106. return []
  107. }
  108. },
  109. methods: {
  110. downInfo(item){
  111. window.location.href=item.url
  112. },
  113. ckInfo(item){
  114. // var url="/pages/news/articleDetails?id="+id;
  115. // uni.navigateTo({
  116. // url:url
  117. // })
  118. this.showInfo=item;
  119. this.show=true
  120. },
  121. myLoadmore(){
  122. this.listForm.pageIndex += 1;
  123. this.getList();
  124. },
  125. getList(){
  126. uni.showLoading({
  127. title: "加载中",
  128. mask: true,
  129. })
  130. API.networkNoticeList(this.listForm).then((res) => {
  131. uni.hideLoading();
  132. this.list = [
  133. ...this.list,
  134. ...res.data.data
  135. ];
  136. this.recordsTotal = res.data.recordsTotal;
  137. }).catch(error => {
  138. uni.showToast({
  139. title: error,
  140. icon: "none"
  141. })
  142. })
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="scss" scoped>
  148. .showInfo{
  149. padding: 60rpx;
  150. .row{
  151. display: flex;
  152. font-size: 32rpx;
  153. margin-top: 12rpx;
  154. .name{
  155. margin-right: 16rpx;
  156. color: #9E9E9E;
  157. }
  158. .value{
  159. font-size: 36rpx;
  160. font-weight: bold;
  161. }
  162. .url{
  163. font-size: 32rpx;
  164. color: #00BCD4;
  165. .urlitem{
  166. margin-bottom: 12rpx;
  167. }
  168. }
  169. }
  170. }
  171. /deep/.u-slot-content {
  172. display: block;
  173. text-align: right !important;
  174. margin-right: 16px;
  175. color: #333333;
  176. }
  177. .news{
  178. .news-item{
  179. padding:30rpx;
  180. margin: 20rpx;
  181. background: #fff;
  182. border-radius: 10px;
  183. .news-title{
  184. font-size: 42rpx;
  185. font-weight: bold;
  186. }
  187. .information{
  188. display: flex;
  189. justify-content: space-between;
  190. color: #9E9E9E;
  191. }
  192. }
  193. }
  194. </style>