<template>
	<view class="help">
		<view class="help-dl" v-for="(a,i) in list" :key="i" :class="a.isClick?'help-dl-on':''" @click="tabItem(i)">
			<view class="dt">
				<image class="icon" :src="a.icon"></image>
				<view class="info">
					<view class="fl">{{a.title}}<text>{{a.content}}</text></view>
					<view class="fr">
						<image class="img2" v-if="a.isClick" src="@/static/icon-help-up.png"></image>
						<image class="img1" v-else src="@/static/icon-help-down.png"></image>
					</view>
				</view>
			</view>
			<view class="dd">
				<view class="item" v-for="(b,idx) in a.contentList" :key="idx" @click.stop="toPage(b)">
					{{b.title}}<image src="@/static/icon-help-right.png"></image>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabIndex: 0,
				list: [],
			};
		},
		onLoad() {
			this.getList();
		},
		methods: {
			toPage(a) {
				uni.setStorageSync("pcontent",a)
				uni.navigateTo({
					url: "/pages/users/xieyi/index"
				})
			},
			tabItem (index) {
				this.list[index].isClick = !this.list[index].isClick;
			},
			async getList() {
				let { code, data } = await this.$api.helpCenter({});
				if(code == 200){
					if(data && data.length > 0){
						data.map(a=>{
							a.isClick = false
						})
					}
					this.list = data
				}
			},
		}
	}
</script>

<style scoped lang="scss">
.help{
	padding: 0 25rpx 25rpx;
	overflow: hidden;
	&-dl{
		width: 100%;
		min-height: 150rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 25rpx;
		box-sizing: border-box;
		margin-top: 20rpx;
		.dt{
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.icon{
				width: 110rpx;
				height: 110rpx;
				margin-right: 20rpx;
			}
			.info{
				flex: 1;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.fl{
					flex: 1;
					font-weight: 500;
					font-size: 30rpx;
					color: #222222;
					text{
						display: block;
						font-weight: 400;
						font-size: 24rpx;
						color: #999999;
						margin-top: 15rpx;
					}
				}
				.fr{
					.img1{
						width: 22rpx;
						height: 13rpx;
						display: block;
					}
					.img2{
						width: 22rpx;
						height: 13rpx;
						display: none;
					}
				}
			}
		}
		.dd{
			margin-top: 10rpx;
			overflow: hidden;
			background: #F3F4F5;
			border-radius: 20rpx;
			padding: 0 20rpx;
			box-sizing: border-box;
			display: none;
			.item{
				padding: 30rpx 0;
				font-weight: 400;
				font-size: 28rpx;
				color: #333333;
				border-top: 1px solid #E3E5E6;
				display: flex;
				align-items: center;
				justify-content: space-between;
				&:first-child{
					border-top-color: transparent;
				}
				image{
					width: 13rpx;
					height: 23rpx;
				}
			}
		}
		&-on{
			.dt{
				.info{
					.fr{
						.img2{
							display: block;
						}
						.img1{
							display: none;
						}
					}
				}
			}
			.dd{
				display: block;
			}
		}
	}
}
</style>
