<template>
	<div class="about">
		<div class="wrapper">
			<div class="left-nav" :style="{height: navHeight}">
				<div class="nav-title">关于我们</div>
				<div class="nav-item" v-for="item in navList" :key="item.uid" :class="{'action': currentIndex == item.uid }" @click="navClick(item.uid)">
					<!-- :class="{'action': currentUrl.indexOf(item.path) !== -1 }"> -->
					<div class="item-name">
						{{item.name}}
					</div>
					<div class="item-icon">
						>
					</div>
				</div>
			</div>
			<div class="right-content">
				<!-- <div class="title moren" v-if="isShow">
					{{rightTitle}}
				</div> -->
				<div style="padding: 35px 50px 35px 50px;" class="line">
					<div class="new-detail">
						<div class="content" v-html="content"></div>
					</div>
				</div>
		
			</div>
		</div>
	</div>
</template>

<script>
import LeftNav from '../components/leftNav/LeftNav.vue';
import { details, getArticleList } from '../request/api.js';
export default {
	components: {
		LeftNav
	},
	data() {
		return {
			content: '',
			currentIndex: '',
			rightTitle: '',
			navList: [
				// { index: 0, name: '关于中国红十字会', path: '/about/chineseRedCross' },
				// { index: 1, name: '中国红十字会法', path: '/about/redCrossLaw' },
				// { index: 2, name: '关于红十字运动', path: '/about/redCrossMovement' },
				// // 第十届监事会监事长名单
				// { index: 3, name: '第十届监事会监事长名单', path: '/about/matrix' },
			],
		};
	},
	computed: {
		navHeight() {
			return this.navList.length * 51 + 52 + 'px'
		},
	},
	mounted() {
		this.getList()
	},
	methods:{
		getList() {
			let that = this
			getArticleList({},43).then(({data}) => {
				// console.log(data)
				let arr = data.list.reverse()
				arr.forEach(item => {
					let obj = {}
					obj.name = item.title
					obj.uid = item.id
					that.navList.push(obj)
					// console.log(that.navList,'55555')
				})
				this.navClick(arr[0].id)
			}).catch( err => {
				console.log(err)
			})
		},
		navClick(id) {
			this.currentIndex = id
			details({},id).then(({data})=> {
				this.content = data.content
			})
		}
	}
};
</script>

<style lang="scss" scoped>
	.wrapper {
		width: 1200px;
		display: flex;
		justify-content: space-between;
	
	}
	
	.left-nav {
		width: 265px;
		// height: 154px;
		box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
	
		.nav-title {
			height: 52px;
			background-color: #d82020;
			line-height: 52px;
			text-align: center;
			font-size: 18px;
			font-family: PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
			letter-spacing: 3px;
			cursor: default;
		}
	
		.nav-item {
			cursor: pointer;
			border-top: 1px #fcfbfb solid;
			display: flex;
			height: 50px;
			background-color: #f2eeef;
			justify-content: space-between;
			line-height: 50px;
			padding: 0 37px 0 26px;
	
			.item-name {
				font-size: 16px;
				font-family: PingFang SC;
				font-weight: bold;
				color: #333333;
				letter-spacing: 1px
			}
	
			.item-icon {
				font-size: 16px;
				font-family: PingFang SC;
				font-weight: bold;
				color: #999999;
			}
		}
	
		.action {
			background-color: #f7dfdf;
		}
	}
	
	.right-content {
		width: 915px;
		min-height: 706px;
		border-top: 2px solid #D82020;
		box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
	
		.title {
			border: 2px #d82020 solid;
			width: 156px;
			height: 50px;
			line-height: 50px;
			text-align: center;
			background: #D82020;
			font-size: 18px;
			font-family: PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
			position: relative;
			top: -2px;
		}
	
		.action {
			background: #FFFFFF;
			color: #D82020;
		}
	}
	
	.line {
		line-height: 1.5;
	}
</style>
