123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422 |
- <template>
- <view>
- <!-- 吸顶搜索框 -->
- <view class="sticky" v-if="flag">
- <input type="text" @click="gotoUrl('pages/search/searchResult')" placeholder="请输入搜索内容">
- </view>
- <!-- 轮播图 -->
- <view class="slideshow">
- <view class="wrap">
- <view class="search-box" @click="gotoUrl('pages/search/searchResult')" >
- <u-search color="black"
-
- search-icon-color="#fff" placeholder-color="#fff" bg-color="#8a7170"
- placeholder="请输入搜索内容" :show-action="false" input-align="center"></u-search>
- </view>
- <u-swiper mode="none" @click="swiperclick" img-mode="scaleToFill"
- :list="list" :title="true" height="422"></u-swiper>
- </view>
- </view>
- <!-- 公告 -->
- <view class="notice">
- <view class="title">
- 公告
- </view>
- <view class="content">
- <u-notice-bar :volume-icon="false"
- padding=" 12px 0 " duration="4000" @click="noticeclick"
- type="none" :is-circular="false" @change="noticechange"
- mode="vertical" :list="toplistShow"></u-notice-bar>
-
- </view>
- <view class="date" v-if="toplist.length">
- {{substrDate(toplist[topindex].createTime)}}
- </view>
- </view>
- <!-- 宫格 -->
- <view class="grid">
- <u-grid :col="4" :border="false">
- <u-grid-item @click="ckList(noticeList[0],'铁路概况')" >
- <img src="../../assets/img/tlgk.png" alt="">
- <view class="grid-text">铁路概况</view>
- </u-grid-item>
- <u-grid-item @click="ckList(noticeList[1],'机构设置')">
- <img src="../../assets/img/jgsz.png" alt="">
- <view class="grid-text">机构设置</view>
- </u-grid-item>
- <u-grid-item @click="ckList(noticeList[2],'政务动态')">
- <img src="../../assets/img/zwdt.png" alt="">
- <view class="grid-text">政务动态</view>
- </u-grid-item>
- <u-grid-item @click="ckList(noticeList[3],'党建动态')" >
- <img src="../../assets/img/djdt.png" alt="">
- <view class="grid-text">党建动态</view>
- </u-grid-item>
- <u-grid-item @click="ckList(noticeList[4],'法治宣传')" >
- <img src="../../assets/img/fzxc.png" alt="">
- <view class="grid-text">法治宣传</view>
- </u-grid-item>
- <u-grid-item @click="ckList(noticeList[8],'纪检监察')">
- <img src="../../assets/img/jjjc.png" alt="">
- <view class="grid-text">纪检监察</view>
- </u-grid-item>
- <u-grid-item @click="ckList(noticeList[9],'文明创建')" >
- <img src="../../assets/img/wmcj.png" alt="">
- <view class="grid-text">文明创建</view>
- </u-grid-item>
- <u-grid-item @click="ckList(noticeList[5],'为您服务')">
- <img src="../../assets/img/wnfw.png" alt="">
- <view class="grid-text">为您服务</view>
- </u-grid-item>
- </u-grid>
- </view>
- <!-- 新闻资讯 -->
- <view class="news" style="padding-bottom: 0px;">
- <view class="title">
- <view class="icon">
- <img src="../../assets/img/news.png" alt="">
- </view>
- <view class="text">
- 新闻资讯
- </view>
- </view>
- <view class="news-item" v-for="(item,i) in footlist" @click="ckInfo(item.id)" :key="i" >
- <view class="content">
- <view class="news-title">
- {{item.title}}
- </view>
- <view class="information">
- <view class="classify">
- {{item.typeName}}
- </view>
- <view class="date">
- {{substrDate(item.createTime)}}
- </view>
- </view>
- </view>
- <view class="img">
- <img v-if="item.pic" :src="imgurl+item.pic" alt="">
- <img v-else src="@/assets/img/default_img.png" alt="">
-
- </view>
- </view>
- </view>
- <u-divider bg-color="#F2F4F4" @click="ckList(noticeList[11],'新闻资讯')" border-color="#CFD2D5">点击查看更多</u-divider>
- <tabbar ref="mytabbar"
- current="0"></tabbar>
- </view>
- </template>
- <script>
- import * as API from '@/apis/pagejs/news.js'
- import tabbar from "../../components/Tabbar.vue"
- export default {
- components: {
- tabbar
- },
- data() {
- return {
- noticeList:[
- "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
- "",//all 11
-
- ],
- flag: false,
- scrollTop: "",
- list: [
- ],
- toplist:[],
- footlist:[],
- topindex:0,
- imgurl:'',
- }
- },
- onLoad(){
-
- this.getSwiperList()
- this.getListtoplist("de3958c2-0010-4009-b7e1-15bfdcc60cef",5,"toplist");//通知公告
- this.getListfootlist("",5,"footlist");//新闻资讯-图片新闻
- //ee0ea72a-75bf-4970-ad34-11e3132bc6a3
-
- },
- onShow(){
-
- },
- computed:{
- toplistShow(){
- var sz=[];
- for(var i in this.toplist){
- var item=this.toplist[i]
- sz.push(item.title)
- }
- return sz;
- }
- },
- methods: {
- noticeclick(e){
- var id=this.toplist[e].id;
- this.ckInfo(id);
- },
- noticechange(e){
- this.topindex=e
- },
- ckList(id,title){
- var url="/pages/news/news?id="+id+"&title="+title;
- uni.navigateTo({
- url:url
- })
- },
- ckInfo(id){
- var url="/pages/news/articleDetails?id="+id;
- uni.navigateTo({
- url:url
- })
- },
- swiperclick(index){
-
- var id=this.list[index].id;
- this.ckInfo(id);
- },
- getListfootlist(id,pageSize,sz){
-
- API.tabList({
- pageSize: pageSize,
- typeId:id,
- }).then((response) => {
- uni.hideLoading();
- this.footlist=response.data
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getListtoplist(id,pageSize,sz){
-
- API.tabList({
- pageSize: pageSize,
- typeId:id,
- }).then((response) => {
- uni.hideLoading();
- this.toplist=response.data
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getSwiperList(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
- API.swiperList({
- pageSize: 5,
-
- }).then((response) => {
- uni.hideLoading();
- this.list=[]
- for(var i in response.data){
- var item=response.data[i]
- if(item.url){
- this.list.push({
- id:item.id,
- image: ''+item.url,
- title:item.title
- })
- }
-
- }
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- onPageScroll(e) {
- this.scrollTop = e.scrollTop;
- //console.log(this.scrollTop);
- if (this.scrollTop >= 200) {
- this.flag = true;
- } else {
- this.flag = false;
- }
- },
- },
- }
- </script>
- <style scoped lang="scss">
- page {
- padding-bottom: 50px;
- font-family: 'Regular';
- }
- .sticky {
- width: 100%;
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- z-index: 100;
- border-bottom: 1px solid #fff;
- padding: 16rpx 40rpx;
- background-color: #fff;
- uni-input {
- background-color: #E8E8E8;
- height: 32px;
- line-height: 32px;
- border-radius: 8px;
- text-align: center;
- }
- }
- .u-search {
- /deep/.uni-input-placeholder {
- font-weight: bold;
- }
- /deep/.uni-input-input {
- color: #ffffff !important;
- font-weight: bold;
- }
- }
- .search-box {
- width: 100%;
- background-color: #4F3C27;
- padding: 16rpx 40rpx;
- position: absolute;
- line-height: 32px;
- color: #ffffff !important;
- opacity: 0.4;
- z-index: 999;
- opacity: 0.4;
- }
- // 公告
- .notice {
- background-color: rgba(255, 255, 255, 1);
- line-height: 40px;
- display: flex;
- padding: 0 32rpx;
- .title {
- color: rgba(31, 74, 153, 1);
- font-size: 18px;
- font-weight: bold;
- }
- .content {
- width: 380rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- color: rgba(51, 51, 51, 1);
- margin-left: 14px;
- }
- .date {
- color: rgba(119, 119, 119, 1);
- margin-left: auto;
- }
- }
- // 宫格
- .grid {
- img {
- width: 80rpx;
- height: 80rpx;
- }
- .grid-text {
- color: rgba(51, 51, 51, 1);
- margin-top: 8rpx;
- }
- }
- // 新闻资讯
- .news {
- padding: 40rpx 32rpx;
- background-color: rgba(244, 244, 244, 1);
- .title {
- display: flex;
- align-items: center;
- margin-bottom: 40rpx;
- font-family: 'SemiBold';
- img {
- width: 40rpx;
- height: 40rpx;
- margin-right: 8rpx;
- }
- }
- .news-item {
- display: flex;
- justify-content: space-between;
- margin-bottom: 40rpx;
- max-height:100px;
- min-height: 80px;
- .content {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .news-title {
- color: rgba(51, 51, 51, 1);
- font-size: 16px;
- text-align: justify;
- width: 438rpx;
- font-weight: bold;
- // white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .information {
- margin-top: 8rpx;
- display: flex;
- justify-content: space-between;
- color: #777777;
- }
- }
- }
- .img {
- width: 224rpx;
-
- border-radius: 5px;
- overflow: hidden;
- img {
- border-radius: 5px;
- width: 100%;
- height: 100%;
-
- }
- }
- }
- </style>
|