homePage.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <template>
  2. <view>
  3. <!-- 吸顶搜索框 -->
  4. <view class="sticky" v-if="flag">
  5. <input type="text" @click="gotoUrl('pages/search/searchResult')" placeholder="请输入搜索内容">
  6. </view>
  7. <!-- 轮播图 -->
  8. <view class="slideshow">
  9. <view class="wrap">
  10. <view class="search-box" @click="gotoUrl('pages/search/searchResult')" >
  11. <u-search color="black"
  12. search-icon-color="#fff" placeholder-color="#fff" bg-color="#8a7170"
  13. placeholder="请输入搜索内容" :show-action="false" input-align="center"></u-search>
  14. </view>
  15. <u-swiper mode="none" @click="swiperclick" img-mode="scaleToFill"
  16. :list="list" :title="true" height="422"></u-swiper>
  17. </view>
  18. </view>
  19. <!-- 公告 -->
  20. <view class="notice">
  21. <view class="title">
  22. 公告
  23. </view>
  24. <view class="content">
  25. <u-notice-bar :volume-icon="false"
  26. padding=" 12px 0 " duration="4000" @click="noticeclick"
  27. type="none" :is-circular="false" @change="noticechange"
  28. mode="vertical" :list="toplistShow"></u-notice-bar>
  29. </view>
  30. <view class="date" v-if="toplist.length">
  31. {{substrDate(toplist[topindex].createTime)}}
  32. </view>
  33. </view>
  34. <!-- 宫格 -->
  35. <view class="grid">
  36. <u-grid :col="4" :border="false">
  37. <u-grid-item @click="ckList(noticeList[0],'铁路概况')" >
  38. <img src="../../assets/img/tlgk.png" alt="">
  39. <view class="grid-text">铁路概况</view>
  40. </u-grid-item>
  41. <u-grid-item @click="ckList(noticeList[1],'机构设置')">
  42. <img src="../../assets/img/jgsz.png" alt="">
  43. <view class="grid-text">机构设置</view>
  44. </u-grid-item>
  45. <u-grid-item @click="ckList(noticeList[2],'政务动态')">
  46. <img src="../../assets/img/zwdt.png" alt="">
  47. <view class="grid-text">政务动态</view>
  48. </u-grid-item>
  49. <u-grid-item @click="ckList(noticeList[3],'党建动态')" >
  50. <img src="../../assets/img/djdt.png" alt="">
  51. <view class="grid-text">党建动态</view>
  52. </u-grid-item>
  53. <u-grid-item @click="ckList(noticeList[4],'法治宣传')" >
  54. <img src="../../assets/img/fzxc.png" alt="">
  55. <view class="grid-text">法治宣传</view>
  56. </u-grid-item>
  57. <u-grid-item @click="ckList(noticeList[8],'纪检监察')">
  58. <img src="../../assets/img/jjjc.png" alt="">
  59. <view class="grid-text">纪检监察</view>
  60. </u-grid-item>
  61. <u-grid-item @click="ckList(noticeList[9],'文明创建')" >
  62. <img src="../../assets/img/wmcj.png" alt="">
  63. <view class="grid-text">文明创建</view>
  64. </u-grid-item>
  65. <u-grid-item @click="ckList(noticeList[5],'为您服务')">
  66. <img src="../../assets/img/wnfw.png" alt="">
  67. <view class="grid-text">为您服务</view>
  68. </u-grid-item>
  69. </u-grid>
  70. </view>
  71. <!-- 新闻资讯 -->
  72. <view class="news" style="padding-bottom: 0px;">
  73. <view class="title">
  74. <view class="icon">
  75. <img src="../../assets/img/news.png" alt="">
  76. </view>
  77. <view class="text">
  78. 新闻资讯
  79. </view>
  80. </view>
  81. <view class="news-item" v-for="(item,i) in footlist" @click="ckInfo(item.id)" :key="i" >
  82. <view class="content">
  83. <view class="news-title">
  84. {{item.title}}
  85. </view>
  86. <view class="information">
  87. <view class="classify">
  88. {{item.typeName}}
  89. </view>
  90. <view class="date">
  91. {{substrDate(item.createTime)}}
  92. </view>
  93. </view>
  94. </view>
  95. <view class="img">
  96. <img v-if="item.pic" :src="imgurl+item.pic" alt="">
  97. <img v-else src="@/assets/img/default_img.png" alt="">
  98. </view>
  99. </view>
  100. </view>
  101. <u-divider bg-color="#F2F4F4" @click="ckList(noticeList[7],'新闻资讯')" border-color="#CFD2D5">点击查看更多</u-divider>
  102. <tabbar ref="mytabbar"
  103. current="0"></tabbar>
  104. </view>
  105. </template>
  106. <script>
  107. import * as API from '@/apis/pagejs/news.js'
  108. import tabbar from "../../components/Tabbar.vue"
  109. export default {
  110. components: {
  111. tabbar
  112. },
  113. data() {
  114. return {
  115. noticeList:[
  116. "2044eba8-776d-4195-b54f-b3d00928ed98",// 铁路概况0 "86e29bf7-9e8f-4a28-9361-1001705d3dc6",// 机构设置 1 "939fbcca-8c31-478f-a7dc-6c649648164e",// 政务动态 2 "f57b8b67-db9a-4110-bc9b-7ec382a07954",// 党建动态 3 "39599bb3-78e9-4e84-99b5-2d6a5c1c40e3",// 法治宣传 4 "7288376a-b582-4e9a-98fa-c218e35b5c30",// 为您服务5 "696d571d-54ba-4954-804e-74f4310e4d6a",// 公众参与6 "ee0ea72a-75bf-4970-ad34-11e3132bc6a3",// 图片新闻7 "8e7f6d22-2b5b-4efc-b354-dbcddb46a8b3",// 纪检监察8 "a4870553-44e0-4172-91db-263cedf5938f",// 文明创建9 "de3958c2-0010-4009-b7e1-15bfdcc60cef",// 通知公告10
  117. "",//all 11
  118. ],
  119. flag: false,
  120. scrollTop: "",
  121. list: [
  122. ],
  123. toplist:[],
  124. footlist:[],
  125. topindex:0,
  126. imgurl:'',
  127. }
  128. },
  129. onLoad(){
  130. this.getSwiperList()
  131. this.getListtoplist("de3958c2-0010-4009-b7e1-15bfdcc60cef",5,"toplist");//通知公告
  132. this.getListfootlist("ee0ea72a-75bf-4970-ad34-11e3132bc6a3",5,"footlist");//新闻资讯-图片新闻
  133. //ee0ea72a-75bf-4970-ad34-11e3132bc6a3
  134. },
  135. onShow(){
  136. },
  137. computed:{
  138. toplistShow(){
  139. var sz=[];
  140. for(var i in this.toplist){
  141. var item=this.toplist[i]
  142. sz.push(item.title)
  143. }
  144. return sz;
  145. }
  146. },
  147. methods: {
  148. noticeclick(e){
  149. var id=this.toplist[e].id;
  150. this.ckInfo(id);
  151. },
  152. noticechange(e){
  153. this.topindex=e
  154. },
  155. ckList(id,title){
  156. var url="/pages/news/news?id="+id+"&title="+title;
  157. uni.navigateTo({
  158. url:url
  159. })
  160. },
  161. ckInfo(id){
  162. var url="/pages/news/articleDetails?id="+id;
  163. uni.navigateTo({
  164. url:url
  165. })
  166. },
  167. swiperclick(index){
  168. var id=this.list[index].id;
  169. this.ckInfo(id);
  170. },
  171. getListfootlist(id,pageSize,sz){
  172. API.pageList({
  173. pageSize: pageSize,
  174. typeId:id,
  175. }).then((response) => {
  176. uni.hideLoading();
  177. this.footlist=response.data.data
  178. }).catch(error => {
  179. uni.showToast({
  180. title: error,
  181. icon: "none"
  182. })
  183. })
  184. },
  185. getListtoplist(id,pageSize,sz){
  186. API.pageList({
  187. pageSize: pageSize,
  188. typeId:id,
  189. }).then((response) => {
  190. uni.hideLoading();
  191. this.toplist=response.data.data
  192. }).catch(error => {
  193. uni.showToast({
  194. title: error,
  195. icon: "none"
  196. })
  197. })
  198. },
  199. getSwiperList(){
  200. uni.showLoading({
  201. title: "加载中",
  202. mask: true,
  203. })
  204. API.swiperList({
  205. pageSize: 5,
  206. }).then((response) => {
  207. uni.hideLoading();
  208. this.list=[]
  209. for(var i in response.data){
  210. var item=response.data[i]
  211. if(item.url){
  212. this.list.push({
  213. id:item.id,
  214. image: ''+item.url,
  215. title:item.title
  216. })
  217. }
  218. }
  219. }).catch(error => {
  220. uni.showToast({
  221. title: error,
  222. icon: "none"
  223. })
  224. })
  225. },
  226. onPageScroll(e) {
  227. this.scrollTop = e.scrollTop;
  228. //console.log(this.scrollTop);
  229. if (this.scrollTop >= 200) {
  230. this.flag = true;
  231. } else {
  232. this.flag = false;
  233. }
  234. },
  235. },
  236. }
  237. </script>
  238. <style scoped lang="scss">
  239. page {
  240. padding-bottom: 50px;
  241. font-family: 'Regular';
  242. }
  243. .sticky {
  244. width: 100%;
  245. position: fixed;
  246. top: 0;
  247. left: 0;
  248. right: 0;
  249. z-index: 100;
  250. border-bottom: 1px solid #fff;
  251. padding: 16rpx 40rpx;
  252. background-color: #fff;
  253. uni-input {
  254. background-color: #E8E8E8;
  255. height: 32px;
  256. line-height: 32px;
  257. border-radius: 8px;
  258. text-align: center;
  259. }
  260. }
  261. .u-search {
  262. /deep/.uni-input-placeholder {
  263. font-weight: bold;
  264. }
  265. /deep/.uni-input-input {
  266. color: #ffffff !important;
  267. font-weight: bold;
  268. }
  269. }
  270. .search-box {
  271. width: 100%;
  272. background-color: #4F3C27;
  273. padding: 16rpx 40rpx;
  274. position: absolute;
  275. line-height: 32px;
  276. color: #ffffff !important;
  277. opacity: 0.4;
  278. z-index: 999;
  279. opacity: 0.4;
  280. }
  281. // 公告
  282. .notice {
  283. background-color: rgba(255, 255, 255, 1);
  284. line-height: 40px;
  285. display: flex;
  286. padding: 0 32rpx;
  287. .title {
  288. color: rgba(31, 74, 153, 1);
  289. font-size: 18px;
  290. font-weight: bold;
  291. }
  292. .content {
  293. width: 380rpx;
  294. white-space: nowrap;
  295. overflow: hidden;
  296. text-overflow: ellipsis;
  297. color: rgba(51, 51, 51, 1);
  298. margin-left: 14px;
  299. }
  300. .date {
  301. color: rgba(119, 119, 119, 1);
  302. margin-left: auto;
  303. }
  304. }
  305. // 宫格
  306. .grid {
  307. img {
  308. width: 80rpx;
  309. height: 80rpx;
  310. }
  311. .grid-text {
  312. color: rgba(51, 51, 51, 1);
  313. margin-top: 8rpx;
  314. }
  315. }
  316. // 新闻资讯
  317. .news {
  318. padding: 40rpx 32rpx;
  319. background-color: rgba(244, 244, 244, 1);
  320. .title {
  321. display: flex;
  322. align-items: center;
  323. margin-bottom: 40rpx;
  324. font-family: 'SemiBold';
  325. img {
  326. width: 40rpx;
  327. height: 40rpx;
  328. margin-right: 8rpx;
  329. }
  330. }
  331. .news-item {
  332. display: flex;
  333. justify-content: space-between;
  334. margin-bottom: 40rpx;
  335. max-height:100px;
  336. min-height: 80px;
  337. .content {
  338. display: flex;
  339. flex-direction: column;
  340. justify-content: space-between;
  341. .news-title {
  342. color: rgba(51, 51, 51, 1);
  343. font-size: 16px;
  344. text-align: justify;
  345. width: 438rpx;
  346. font-weight: bold;
  347. // white-space: nowrap;
  348. overflow: hidden;
  349. text-overflow: ellipsis;
  350. }
  351. .information {
  352. margin-top: 8rpx;
  353. display: flex;
  354. justify-content: space-between;
  355. color: #777777;
  356. }
  357. }
  358. }
  359. .img {
  360. width: 224rpx;
  361. border-radius: 5px;
  362. overflow: hidden;
  363. img {
  364. border-radius: 5px;
  365. width: 100%;
  366. height: 100%;
  367. }
  368. }
  369. }
  370. </style>