<template>
	<!-- 20221216 -->
	<view class="project-question-page">
		<!-- 页面内容 -->
		<view class="page-content padding-bottom-safe-footer-20">

			<!-- 轮播图 -->
			<view class="padding-tb-10 padding-lr-30 bg-ff" v-if="carousel.length">
				<ty-swiper-swiper :list="carousel"></ty-swiper-swiper>
			</view>

			<view class="padding-lr-30 bg-ff">
				<view class="padding-top-30 padding-bottom-15 text-32 text-bold text-1a">
					常见问题
				</view>
				<view class="">
					<ty-list-list :status="load_status">
						<view v-for="(item,index) in list" :key="index"
							class="line-height-100 border-bottom-ed text-28 text-33"
							@click="go('/pages/project/questionDetail?id='+item.id)">
							{{item.title}}
						</view>
					</ty-list-list>
				</view>

			</view>
			
			<!-- 底部条 -->
			<view class="jc-footer-safe padding-lr-30 bg-ff">
				<view class="line-height-80 radius-40 bg-main text-center text-28 text-ff" style="margin:9rpx 0;"
					@click="callLayerShow = true">
					<text class="tyIcon-dianhua text-34 text-ff"></text>
					拨打客服热线
				</view>
			</view>
		</view>

		<!-- 页面浮层 -->
		<view class="page-layer">
			<!-- 拨打热线浮层 -->
			<jc-project-callLayer :show.sync="callLayerShow" :service-time="serviceTime" :service-hot-line="serviceHotLine"></jc-project-callLayer>
		</view>
	</view>
</template>

<script>
	import project from "./api/project.js"
	export default {
		data() {
			return {
				// 轮播图
				carousel: [],
				// 服务时间
				serviceTime: '',
				// 服务热线
				serviceHotLine: '',
				// 列表状态
				load_status: '',
				// 列表
				list: [],
				// 热线浮层是否显示
				callLayerShow: false
			}
		},

		onReady() {
			// 加载配置
			this.getConfig()

			// 加载列表
			this.loadList(1)
		},

		onReachBottom() {
			this.loadList(0)
		},

		methods: {
			/**
			 * 获取配置
			 * @date 2022-12-16
			 */
			getConfig() {
				project.getQuestionConfig().then(res => {
					if (res.code == 0) {
						this.carousel = res.data.carousel
						this.serviceTime = res.data.service_time
						this.serviceHotLine = res.data.service_hotline
					}
				})
			},

			/**
			 * 加载列表
			 * @param {int} isFirstPage 是否第一页 0--不是 1--是
			 * @date 2022-12-16
			 */
			loadList(isFirstPage) {
				project.listQuestion(this, isFirstPage)
			}
		}
	}
</script>

<style scoped>
	
</style>
