<template>
	<view class="content" style="position: relative;">
		<view>	
			<image src="/static/icon/backgroundimg.png" mode="" class="header"></image>
		</view>
		<view class="align-items" style="position: absolute; top: 90rpx; left: 0;" @click="gotopage('/pages/noLogin/typeList')">
			<back></back>
		</view>
		<view style="margin: 0 30rpx;">
			<swiper class="swiper" @change="change" autoplay="true" interval="3000">
				<swiper-item v-for="(item,index) in lunbo" :key="index">
					<view>
						<image :src="item.picUrl" mode=""></image>
					</view>
				</swiper-item>
			</swiper>
		</view>
		<view class="distance justify-content">
			<view class="square" @click="gotopage('/pages/cityConstrution/cityConstrution')">
				<image src="/static/icon/city.png" mode="" class="icon"></image>
				<view class="font-thirty-six">
					阀管施工
				</view>
			</view>
			<view class="square" @click="history()">
				<image src="/static/icon/construction.png" mode="" class="icon"></image>
				<view class="font-thirty-six">
					历史施工
				</view>
			</view>
			<view class="square" @click="gotopage('/pages/service/service')">
				<image src="/static/icon/service.png" mode="" class="icon"></image>
				<view class="font-thirty-six">
					服务说明
				</view>
			</view>
			<view class="square" @click="gotopage('/pages/aboutme/aboutme')">
				<image src="/static/icon/construction.png" mode="" class="icon"></image>
				<view class="font-thirty-six">
					关于我们
				</view>
			</view>
		</view>
		<view class="justify-content" style="margin: 50rpx 30rpx 0;">
			<view class="font-forty-eight text">
				公告内容
			</view>
			<view class="font-thirty-six darkgray" @click="more()">
				查看更多
				<u-icon name="arrow-right"></u-icon>
			</view>
		</view>
		<view class="notice" v-for="(item,index) in list" :key="index">
			<view class="justify-content">
				<view class="font-forty">
					{{item.title}}
				</view>
				<view class="font-twenty-eight gray">
					{{item.time}}
				</view>
			</view>
			<view class="font-thirty-two black" style="margin: 30rpx 0;">
				<rich-text :nodes="item.text"></rich-text>
			</view>
		</view>
	</view>
</template>

<script>
	import service from '@/api/index.js'
	export default {
		data() {
			return {
				list:[],
				lunbo:[]
			}
		},
		onLoad() {
			this.getLunBo();  
			
		},
		onShow() {
			this.getnotice();
		},
		methods: {
			change(e) {
				this.current = e.detail.current;
			},
			gotopage(url){
				uni.navigateTo({
					url
				})
			},
			getLunBo(){
				service.getLunBo().then(res=>{
					this.lunbo = res;
				})
			},
			getnotice(){
				service.getNoticeList().then(res=>{
					this.list = res
				})
			},
			more(){
				uni.navigateTo({
					url:'/pages/notice/noticeList'
				})
			},
			history(){
				uni.switchTab({
					url:'/pages/historyConstruction/historyConstruction'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.header {
		width: 100%;
		height: 300rpx;
	}

	.swiper {
		position: absolute;
		top: 200rpx;
		width: 690rpx;
		height: 280rpx;
		margin: 0 30rpx;
	}
	.distance{
		margin: 250rpx 30rpx 0;
		.square{
			margin: 15rpx;
			text-align: center;
			.icon{
				width: 100rpx;
				height: 100rpx;
			}
		}
	}
	.notice{
		margin: 20rpx;
		padding: 20rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 8rpx 17rpx 0rpx rgba(0, 0, 0, 0.04);
		border-radius: 10rpx;
	}
	.text{
		border-left: 15rpx solid #3857F3;
		padding-left: 20rpx;
	}
</style>
