<!-- 帮助反馈页面 -->
<template>
	<view>
		<!-- <view class="text-top">常见问题</view> -->

		<view class="bg-list">
			<view v-for="(item,index) in helpClassifyList" :key="index" :title="item.helpClassifyName"
				class="list-title padding-bottom-sm">
				<view class="flex align-center justify-between" @click.stop="openList(item,index)">
					<view class="text-title">{{item.helpClassifyName}}</view>
					<view @click.stop="openList(item,index)" >
						<image src="https://zhaopin.xianmaxiong.com/file/uploadPath/2022/09/05/d56c02cad3db64b1874d01e0ceeb48e1.png" style="width: 21rpx;height: 15rpx;" v-if="item.id==0"></image>
						<image src="https://zhaopin.xianmaxiong.com/file/uploadPath/2022/09/05/8ee353c9b70928dc4f81488e75121441.png" style="width: 21rpx;height: 15rpx;" v-else></image>
					</view>
				</view>
				<view v-for="(problemItem,problemIndex) in item.helpWordList" :key="problemIndex" class="list-question"
					hover-class="hover" @click="onClick(problemItem)" v-if="item.id==0">
					<view class="text-item">{{problemItem.helpWordTitle}}</view>
					<!-- <view class="line" v-if="problemIndex!=item.helpWordList.length-1"></view> -->
				</view>
			</view>
		</view>
		<view class="bg-box">
			<view class="bg-white-box">
				<image src="https://zhaopin.xianmaxiong.com/file/uploadPath/2022/09/05/6ea8d56c2451479b6327c56e3c57e91c.png" class="image"></image>
				<view class="text-feedback" hover-class="hover" @click="goChat">联系客服</view>

				<view class="vertical-line"></view>

				<image src="https://zhaopin.xianmaxiong.com/file/uploadPath/2022/09/05/aa32e4508c2505631a17402d4e086cda.png" class="image"></image>
				<view class="text-feedback" hover-class="hover" @click="toFeedback">我要反馈</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				helpClassifyList: []
			}
		},
		onLoad() {
			this.getlist()
		},
		methods: {
			openList(item,index) {
				console.log(item.id)
				if(item.id===1){
					this.helpClassifyList[index].id=0
				}else{
					this.helpClassifyList[index].id=1
				}
				console.log(this.helpClassifyList)
				this.$forceUpdate()
			},
			getlist() {
				this.$Request.get("/app/helpWord/selectHelpList?types=1").then(res => {
					if (res.code == 0) {
						this.helpClassifyList = res.data
						this.helpClassifyList.map(item=>{
							item.id = 1
						})
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				});
			},
			onClick(item) {
				console.log(item)
				// return  
				uni.navigateTo({
					url: './helpDetail?item='+encodeURIComponent(JSON.stringify(item)),
				})

			},
			// toFeedbackList() {
			// 	wx.openCustomerServiceChat({
			// 		extInfo: {
			// 			url: this.$queue.getData('ZXMessageLink')
			// 		},
			// 		corpId: 'wxc2cd198ca1931c49',
			// 		success(res) {}
			// 	})

			// },
			// 在线客服
			goChat(){
				let that = this
				if(uni.getStorageSync('userType')==1){//用户端
					// #ifdef MP-WEIXIN
					wx.openCustomerServiceChat({
						extInfo: {
							url: that.$queue.getData('kefu')
						},
						corpId: that.$queue.getData('kefuAppid'),
						success(res) {
							console.log(res)
						},
					})
					// #endif
					// #ifdef H5
					window.location.href = that.$queue.getData('kefu');
					// #endif
					// #ifdef APP
					let kefu = that.$queue.getData('kefu')
					console.log(kefu)
					plus.runtime.openURL(kefu, function(res) {});
					// #endif
				}else{//企业端
					// #ifdef MP-WEIXIN
					wx.openCustomerServiceChat({
						extInfo: {
							url: that.$queue.getData('kefuq')
						},
						corpId: that.$queue.getData('kefuAppidq'),
						success(res) {
							console.log(res)
						},
					})
					// #endif
					// #ifdef H5
					window.location.href = that.$queue.getData('kefuq');
					// #endif
					// #ifdef APP
					let kefu = that.$queue.getData('kefuq')
					console.log(kefu)
					plus.runtime.openURL(kefu, function(res) {});
					// #endif
				}
			},
			toFeedback() {
				uni.navigateTo({
					url: '/my/feedback/index',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>

<style>



	.bg-box {
		/* background-color: #ffffff; */
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
	}

	.bg-list {
		margin-bottom: 100rpx;
		background-color: #ffffff;
		padding: 30rpx
	}

	.bg-white-box {
		background-color: #ffffff;
		margin: 30rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		padding: 10rpx;
		border-radius: 20rpx;
		
		font-size: 32rpx;
	}

	.vertical-line {
		height: 20rpx;
		background-color: #cecece;
		width: 2rpx;
		margin-left: 30rpx;
		margin-right: 30rpx;
	}

	.line {
		width: 100%;
		height: 1rpx;
		background-color: #999999;
	}



	.text-title {
		
		font-size: 32rpx;
		font-weight: bold;
	}

	.text-item {
		
		font-size: 28rpx;
		padding: 24rpx;
	}

	.list-title {
		margin-bottom: 30rpx;
	}

	.list-question {
		
		font-size: 28rpx;
	}

	.hover {
		background-color: #f5f5f5;
		opacity: 0.6;
	}

	.image {
		width: 40rpx;
		height: 40rpx;
		margin-left: 20rpx;
	}

	.text-feedback {
		padding: 20rpx;
		/* color: #000000; */
	}

	.text-top {
		margin: 30rpx;
		
		font-size: 34rpx;
	}
</style>
