<template>
	<view class="container">
		<!-- #ifdef APP -->
		<view class="backArrow">
			<text class="iconfont icon-youjiantou zuojiantou" style="left: 5rpx;" @click="goBack()"></text>
			<text style="font-size: 30rpx;">帮助中心</text>
		</view>
		<!-- #endif -->
		
		<view class="filterBox">
			<scroll-view class="scroll-view_H" scroll-x="true"  scroll-left="120">
				<view
					class="scroll-view-item_H" 
					v-for="item in tabList" 
					:key="item.id"
					:class="{active:item.id == currentTab }"
					@click="changeTab(item)"
				>
					{{item.title}}
				</view>
			</scroll-view>
		</view>
		<view class="questionsBox">
			<view class="questionItem" v-for="item in newQuestionData" :key="item.id">
				<view class="" >
					<view class="itemTit">
						<text class="iconfont myIcon" :class="item.icon" ></text>
						{{item.category}}
					</view>
					<view class="itemQuestion" v-for="(question, index) in item.questions" :key="index">
						<view class="Q">
							Q:{{question.Q}}
						</view>
						<view class="A" v-if="question.isMore">
							<view class="">
								A:
							</view>
							<view class="" v-for="(a, index1) in question.A" :key="index1">
								{{a}}
							</view>
						</view>
						<view class="A" v-else>
							A:{{question.A}}
						</view>
					</view>
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	import questionsData from "@/util/questions";
	import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
	export default {
		data() {
			return {
				tabList:[
					{title:'关于团队',id: '1'},
					{title:'关于订单',id: '2'},
					{title:'关于佣金',id: '3'},
				],
				currentTab:'1',
				// questionsData:[]
				
			}
		},
		onShow() {
			// #ifdef H5
						initJssdkShare(() => {
						  setWechatShare();
						}, window.location.href);
						// #endif
		},
		computed:{
			newQuestionData(){
				let result = questionsData.filter(item=>item.id==this.currentTab)
				
				return result
			}
		},
		methods:{
			changeTab(item){
				this.currentTab = item.id
			},
			goBack(){
				uni.navigateBack({
					delta: 1  
				});
			},
		},
		
	}
</script>

<style lang="scss" scoped>
	.container{
		padding-bottom: 50rpx;
		.backArrow{
			box-sizing: border-box;
			display: flex;
			height: 100rpx;
			justify-content: space-between;
			align-items: center;
			position: relative;
			width: 100%;
			color: #333333;
			background-color: #fff;
			
			text:nth-child(2){
				width: 100%;
				text-align: center;
				position: absolute;
			}
		}
		.filterBox{
		    box-sizing: border-box;
			width: 100%;
			background-color: #fff;
			padding: 20rpx 60rpx 0 60rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.scroll-view_H {
					white-space: nowrap;
					width: 100%;
					box-sizing: border-box;
				}
				.scroll-view-item {
					text-align: center;
					font-size: 36rpx;
				}
				.scroll-view-item_H {
					margin-bottom: 20rpx;
					display: inline-block;
					margin-right: 20rpx;
					text-align: center;
					font-size: 27rpx;
					padding: 10rpx 20rpx;
					color: rgba(46, 38, 29, 1);
					&.active{
						color: rgba(32, 39, 155, 1);
						position: relative;
						
					}
					&.active::before{
						display: block;
						content: "";
						position: absolute;
						left: 50%;
						transform: translate(-50%);
						bottom: -3%;
						width: 50%;
						// height: 1rpx;
						border: 1rpx solid rgba(32, 39, 155, 1);
						border-radius: 5rpx;
					}
				}
				.scroll-view-item_H:last-child{
					margin-right: 0rpx;
				}
				.scrollBtn:last-child{
					margin-right: 0rpx;
				}
				.filterItem{
					background: #f7f7f7;
					font-size: 27rpx;
					padding: 10rpx;
					color: rgba(46, 38, 29, 1);
					border-radius: 8rpx;
					&.active{
						background: rgba(32, 39, 155, 1);
						color: #fff;
					}
				}
		}
		.questionsBox{
			padding: 20rpx;
			box-sizing: border-box;
			.questionItem{
				box-sizing: border-box;
				margin-bottom: 20rpx;
				width: 100%;
				background-color: #fff;
				border-radius: 10rpx;
				padding: 20rpx;
				.itemTit{
					font-size: 30rpx;
					font-weight: 500;
					.myIcon{
						font-size: 32rpx;
						color: rgba(32, 39, 155, 1);
					}
				}
				.itemQuestion{
					padding: 20rpx 0;
					border-bottom: 1rpx solid #f2f2f2;
					.Q{
						margin-bottom: 10rpx;
						font-size: 28rpx;
					}
					.A{
						font-size: 26rpx;
						color: #666;
						line-height: 1.5;
					}
				}
				.itemQuestion:last-child{
					border: none;
				}
			}
			
		}
	}
	
</style>