homePage.vue 9.8 KB

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