<!-- 默认复制 -->

<template>
	<view class="content">
		<view class="c-top">
			<view class="" @click="getback()">
				<uni-icons type="left" size="18"></uni-icons>
			</view>
			<view class="c-title">编辑</view>
			<view class=""></view>
		</view>
		<view class="cont">
			<view class="c-box" v-for="(item,index) in arrlist" :key="index">
				<!-- 上 -->
				<view class="c-b-top"  @click="getdetails(item.id)">
					<view class="t-left">
						<image :src="imgs + item.newsCover" mode=""></image>
					</view>
					<view class="t-right">
						<view class="t-tilte">{{item.newsTitle}}</view>
						<!-- <view class="t-zi">{{item.newsContent}}</view> -->
							<view class="t-zi" v-html="item.newsContent"></view>
					</view>
				</view>
				<!-- 下 -->
				<view class="c-b-bom">
					<view class="b-left">{{item.createTime}}</view>
					<view class="b-right">
						<view class="z-lv"  @click="getdetails(item.id)">
							<view class="">编辑</view>
						</view>
						<view class="y-hong" @click="dialogToggle(item.id)">
						<view class="">删除</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<uni-popup ref="alertDialog" type="dialog">
						<uni-popup-dialog :type="msgType" cancelText="关闭" confirmText="同意" title="通知" content="确认删除" @confirm="dialogConfirm"
							@close="dialogClose"></uni-popup-dialog>
			</uni-popup>
	
		<uni-popup ref="message" type="message">
						<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
					</uni-popup>
		<!-- 悬浮按钮 结束-->
	<!-- 	<tabBar></tabBar> -->
	</view>
</template>

<script>
	import config from '@/config'
	import request from '../../utils/request';
	import tabBar from '../../components/tabBar/tabBar.vue'
	export default{
		data(){
			return{
				deleteid:'',
				msgType: 'success',
				isOpen: false,
				fab:false,
				imgs:'',
				arrlist:[],
				animationData: {},
				isRote: false,
				animation: null,
				msgType: 'success',
				messageText: '删除成功',
			}
		},
		components:{
			tabBar,
		},
		onLoad(option) {
			this.type = option.type
		},
		mounted() {
			this.getlistindex()
			this.imgs = this.$baseUrl
		},
		methods:{
			dialogToggle(id) {
					this.deleteid = id
					this.$refs.alertDialog.open()
						},
			dialogClose() {
					console.log('点击关闭')
						},
			async dialogConfirm() {
					console.log('点击确认')
					let data ={
						id : this.deleteid
					}
					let res = await request({
						url:'/admin-api/appInspection/news/del',
						method: 'post',
						params:data
					})
					if(res.code == 200){
						this.$refs.message.open()
						this.getlistindex()
					}
						},
				getfab() {
							this.fab = !this.fab
							let rota = 0;
							if (this.isRote) {
								rota = 90;
								this.isRote = false;
							} else {
								this.isRote = true;	
							}
							this.animation = uni.createAnimation();
							this.animation.rotate(rota).step()
							this.animationData = this.animation.export()
			
						},
			getback(){
			uni.navigateBack({
					delta:1,
				})	
			},
			async getlistindex(){
				//惠民政策
				let res = await request({
					url: '/admin-api/appInspection/news/ownList?type='+this.type,
					method: 'get',
				})
				this.arrlist = res.rows
			},
			getnewadd(){
				//发布文章
				uni.navigateTo({
					url:'/pages/detedetails/newsadd'
				})
			},
			getdetails(id){
				uni.navigateTo({
					url:'/pages/detedetails/editadd?id='+id+'&type='+this.type
				})
			}
			
		}
		
	}
</script>

<style scoped lang="scss">
	.content{
		width: 100%;
		height: calc(100vh);
		background-color: #F6F6F6;
		box-sizing: border-box;
		padding-top: 45px;
	}
	.q-fab{
		position: fixed;
		bottom: 50px;
		right: 15px;
		width: 55px;
		height: 55px;
		border-radius: 50%;
		overflow: hidden;
		image{
			width: 100%;
			height: 100%;
		}
	}
	.fab-z1{
		position: fixed;
		bottom: 115px;
		right: 15px;
		width: 50px;
		height: 50px;
		border-radius: 50%;
		overflow: hidden;
		image{
			width: 100%;
			height: 100%;
		}
	}
	.fab-z2{
		position: fixed;
		bottom: 50px;
		right: 80px;
		width: 50px;
		height: 50px;
		border-radius: 50%;
		overflow: hidden;
		image{
			width: 100%;
			height: 100%;
		}
	}
	.top-icon{
		margin-bottom: 45px;
	}
	.c-top{
		width: 100%;
		box-sizing: border-box;
		padding: 15px;
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: white;
	}
	.c-title{
		font-size: 18px;
		font-weight: bold
	}
	.cont{
		width: 100%;
		padding: 15px;
		box-sizing: border-box;
	}
	.c-box{
		width: 100%;
		box-sizing: border-box;
		padding: 7px;
		background-color: white;
		margin-bottom: 10px;
		border-radius: 10px;
	}
	.c-b-top{
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.t-left{
		width: 130px;
		height: 75px;
		border-radius: 7px;
		// background: #DDDDDD;
		overflow: hidden;
		image{
			width: 100%;
			height: 100%;
		}
		
	}
	.t-right{
		width: 60%;
	}
	.t-tilte{
		font-size: 16px;
		font-weight: bold;
		color: #333333;
		 white-space: nowrap; 
		 overflow: hidden;
		 text-overflow: ellipsis;

	}
	.t-zi{
		font-size: 14px;
		font-weight: 400;
		color: #666666;
		 overflow: hidden;
		  text-overflow: ellipsis;
		  display: -webkit-box;	 
		  -webkit-line-clamp: 3;
		  -webkit-box-orient: vertical;

	}
	.c-b-bom{
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 10px;
	}
	.b-left{
		color: #0D2E8D;
		font-size: 14px;
	}
	.b-right{
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.z-lv{
		display: flex;
		align-items: center;
		color: #43A045;
		font-size: 15px;
		margin-right: 20px;
	}
	.y-hong{
		display: flex;
		align-items: center;
		color: #FF7272;
		font-size: 15px;
		margin-right: 15px;
	}
	.z-img{
		width: 20px;
		height: 15px;
		image{
			width: 100%;
			height: 100%;
		}
		margin-right: 2px;
	}
		// .asdis{
		// 	position: fixed;
		// 	right: 10px;
		// 	bottom: 30px;
		// 	.view{
			
		// 		transform: rotate(90deg);
		// 		.fab-z1 {
		// 			position: absolute;
		// 			bottom: 90px;
		// 			right: 15px;
		// 			width: 50px;
		// 			height: 50px;
		// 			border-radius: 50%;
		// 			overflow: hidden;
				
		// 			image {
		// 				width: 100%;
		// 				height: 100%;
		// 			}
		// 		}
				
		// 		.fab-z2 {
		// 			position: absolute;
		// 			bottom: 15px;
		// 			right: 80px;
		// 			width: 50px;
		// 			height: 50px;
		// 			border-radius: 50%;
		// 			overflow: hidden;
				
		// 			image {
		// 				width: 100%;
		// 				height: 100%;
		// 			}
		// 		}
				
		// 	}
		// }


</style>