<template>
	<view class="content" style="position: relative;">
		<view>	
			<image src="https://zdsz.obs.cn-south-1.myhuaweicloud.com/file/5fde4230055e4eefb4dded5ba3325333.png" mode="" class="header"></image>
		</view>
		<view class="justify-content">
			<view class="align-items" style="position: absolute; top: 66rpx;left: 40rpx;">
				<image src="/static/icon/sgglpt.png" mode="" class="header-title"></image>
			</view>
		<view class="align-items" style="position: absolute; top: 180rpx; left: 300rpx; font-size: 10pt;font-size: 36rpx; color: #fff;">
			{{name}} !欢迎你登录本应用
			</view>
		<!-- <view class="align-items" style="position: absolute; top: 90rpx; left: 0;" @click="gotopage('/pages/noLogin/typeList')">
			<back></back>
		</view> -->
		</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="tongzhicont">
			<view class="gonggao">
				<view class="justify-content">
					<view class="font-forty-eight text" >
						公告内容
					</view>
					<view class="font-thirty-six darkgray more"  @click="more()"  >
						更多<u-icon name="arrow-right" ></u-icon>
					</view>
				</view>
				<view   v-for="(item,index) in list" style="margin: 30rpx 0;">
						<u-parse class="title" :html="item.text"></u-parse>
				</view>
			</view>
			<view class="notice" :key="index">
				<view  style="margin: 30rpx 0;">
					<rich-text class="one-title" :nodes="oneManage.title"></rich-text>
					<rich-text class="one-time" :nodes="oneManage.time"></rich-text>
					<!-- <view class="font-forty"> -->
						<mpHtml :content="oneManage.text"></mpHtml>
					<!-- </view> -->
				</view>
			</view>
		<!-- 	</view> -->
		</view>
	</view>
</template>

<script>
	import service from '@/api/index.js'
	import mpHtml from'@/components/mp-html/mp-html.vue'
	export default {
		components:{
			mpHtml
		},
		data() {
			return {
				list:[],
				oneManage:{},
				name:'',
				lunbo:[]
			}
		},
		onLoad() {
			uni.showTabBar();
			//this.getLunBo();  
			this.getUserName();
		},
		onShow() {
			this.getOne();
			this.getnotice()
			uni.showTabBar();
		},
		methods: {
			getUserName(){
				service.getUserName().then(res=>{
					this.name = res.name;
					this.power = res.power;
				})
			},
			change(e) {
				this.current = e.detail.current;
			},
			gotopage(url){
				uni.navigateTo({
					url
				})
			},
			getLunBo(){
				service.getLunBo().then(res=>{
					this.lunbo = res;
				})
			},
			getOne()
			{
				service.getOne().then(res=>{
					this.oneManage= res
					console.log(this.oneManage)
					
				})
			},
			getnotice(){
				service.getNoticeList().then(res=>{
					let list =[]
					this.list=[]
					list=res
					let i=res.length-1
					if(res.length!=0)
					{
						this.list.push(list[i])
					}else{
						this.list=res
					}
					
				})
			},
			more(){
				console.log(11111)
				uni.navigateTo({
					url:'/pages/notice/noticeList'
				})
			},
			history(){
				uni.switchTab({
					url:'/pages/historyConstruction/historyConstruction'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.header {
		width: 100%;
		height: 530rpx;
	}
	.header-title{
		width: 310rpx;
		height: 40rpx;
	}
		 .row-item{
		    overflow: hidden;
		    -webkit-line-clamp: 2;
		    text-overflow: ellipsis;
		    display: -webkit-box;
		    -webkit-box-orient: vertical;
		}
	.tongzhicont{
		position: absolute;
		top: 396rpx;
		width: 100%;
	}
	.more{
		font-size: 30rpx;
		color: #666666;
	}
	.gonggao{
		width: 90%;
		margin: 0 auto;
		border-radius: 30rpx;
		background: linear-gradient(45deg, #ffffff, #e7f9ff);
		box-shadow: 7rpx 1rpx 10rpx #e5f0ff;
		padding: 20rpx;
	}
	.one-title{
		font-size: 40rpx;
		font-weight: bold;
		color: #666;
		line-height: 2rem;
	}
	.one-time{
		color: #999;
		font-size: 32rpx;
	}
	.font-forty{
		font-size: 32rpx;
		line-height: 2rem;
		margin: 20rpx 0 0 0;
	}
	.title{
		       overflow: hidden;
		       		text-overflow: ellipsis;
		       		width: 100%;
		       		/*将对象作为弹性伸缩盒子模型显示*/
		       		display: -webkit-box;
		       		/*限制文本行数*/
		       		-webkit-line-clamp: 2;
		       		/*子元素的排列方式*/
		       		-webkit-box-orient: vertical;
		       		/*将对象作为弹性伸缩盒子模型显示*/
	}
	.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{
		padding-left: 20rpx;
		font-size: 44rpx;
		font-weight: bold;
		color: #4194fd;
	}
</style>
