<template>
	<view class="page">
		<view class="listcell">
			
			<view class="acon">
				<view class="atop">
					<image src="../../static/image/logo.png"></image>
					<view class="aright">
						<view class="atitle">Hi,您好！</view>
						<view class="ainfo">很高兴为您提供服务~</view>
					</view>
				</view>
				<view class="acontent">
					<mp-html :content="html" :markdown="true" :lazy-load="true"/>
				</view>
			</view>
			 
		</view>
		
		<!-- service 客服-->
		<service ref="serviceId" @goservice="goservice"></service>

	</view>
</template>

<script>
	import top from "../components/top.vue";
	import service from "../components/service.vue";
	import { myCache } from '../../utils/utils.js';
	export default {
		components: {
			top,service
		},
		data() {
			return {
				id:0,
				html: myCache('aboutCache'),
			};
		},
		onLoad(options) {
			if(options.id){
				this.id=options.id;
			}
		},
		onReady(){
			// this.getAboutInfo();
		},
		onShow(){
			this.getAboutInfo();
		},
		methods: {
			async getAboutInfo(){
				try{
					// uni.showLoading({
					// 	title: '数据加载中...'
					// });
					const {data: res} = await uni.$http.post('/platform/getAboutInfo');
					if(res){
						myCache('aboutCache',res);
						this.html=res;
						this.$forceUpdate();
					}
				}
				catch(e){
					console.log(e)
				}
			},
			goservice(val){
				console.log(val);
			},
			gotoprot(key) {
				// 我的协议
				uni.navigateTo({
					url: `/pages/user/info?id=`+key
				});
			},
			async teldo(){
				console.log(myCache('linemobile'))
				if(myCache('linemobile')){
					// 在线客服
					// #ifdef MP-ALIPAY
					uni.makePhoneCall({
						phoneNumber: String(myCache('linemobile')),
						success:function(){
							console.log('拨打电话成功');
						},
						fail() {
							console.log('打电话失败了');
						}
					});
					// #endif
				}
				else{
					const {data: res} = await uni.$http.get('/platform/getHotline');
					console.log(res)
					if (res) {
						myCache('linemobile',res);
						// #ifdef MP-ALIPAY
						uni.makePhoneCall({
							phoneNumber: String(myCache('linemobile')),
							success:function(){
								console.log('拨打电话成功');
							},
							fail() {
								console.log('打电话失败了');
							}
						});
						// #endif
					}
					else{
						uni.showModal({
							title: '提示',
							content: '在线电话获取失败！请稍后再试！',
							cancelText: '取消',
							confirmText: '确定',
							success: ress => {
								if (ress.confirm) {
								}
							}
						});
					}
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		padding: 0;
		position: relative;
	}

	.cbtn {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		background-color: #FFFFFF;
		line-height: 120rpx;
		border: none;
		padding-left: 0;
		padding-right: 0;
	}

	.cbtn::after {
		border: none;
	}

	.exitcon {
		width: 100%;
		height: 168rpx;
		opacity: 1;
		width: 100%;
	}

	.bbtn {
		margin: 0 auto 84rpx;
		font-size: 32rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		color: #A0A0A0;
		width: 566rpx;
		height: 96rpx;
		line-height: 96rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 12rpx 65rpx 2rpx rgba(186, 186, 188, 0.4);
		border-radius: 257rpx 257rpx 257rpx 257rpx;
		opacity: 1;
		border: 2rpx solid #A0A0A0;
		opacity: 1;

		&::after {
			border: none;
		}
	}

	::v-deep .uni-section .uni-section-header__decoration.line {
		width: 2rpx !important;
		height: 24rpx !important;
		background-color: #595959 !important;
	}

	.header {
		width: 750rpx;
		height: 420rpx;
		background: linear-gradient(180deg, #E1F2FF 0%, #FFFFFF 100%);
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		opacity: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		.hcell {
			display: flex;
			align-items: center;
			justify-content: center;
			position: relative;

			.hcoin {
				width: 150rpx;
				height: 150rpx;
				border-radius: 50% 50%;
				margin-bottom: 40rpx;
			}

			.hedit {
				width: 50rpx;
				height: 50rpx;
				position: absolute;
				bottom: 22%;
				right: 10%;
			}

			.hname {
				font-size: 40rpx;
				font-family: PingFang SC-Semibold, PingFang SC;
				font-weight: 600;
				color: #000000;
				display: flex;
				flex-direction: row;
				justify-content: center;
				align-items: center;

				.sextip {
					width: 37rpx;
					height: 32rpx;
					margin-left: 20rpx;
				}
			}

			.hinfo {
				width: 100%;
				display: flex;
				flex-direction: row;
				justify-content: center;
				align-items: center;
				font-size: 24rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #595959;
			}
		}
	}

	.listcell {
		position: relative;
		display: block;
		overflow-y: auto;
		margin: 0;
		box-sizing: border-box;
		width: 100%;
		height: calc(100vh - var(--window-top) - var(--window-bottom));
		padding: 30rpx 20rpx;
		background-image: url('/static/image/bb1.jpg');
		background-size: 100% 100%;
		background-position: top center; 
		background-repeat: no-repeat;
		
		.acon{
			display:flex;
			flex-direction: column;
			.atop{
				display:flex;
				flex-direction: row;
				margin: 20rpx;
				align-items: center;
				image{
					flex-shrink: 0;
					width: 180rpx;
					height: 180rpx;
					margin-left: 20rpx;
					border-radius: 50% 50%;
				}
				.aright{
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: flex-start;
					margin-left: 40rpx;
					.atitle{
						color: #000;
						font-size: 30rpx;
						margin-bottom: 20rpx;
					}
					.ainfo{
						color: #666;
						font-size: 24rpx;
					}
				}
			}
			
			.acontent{
				background-color:  rgba(255, 255,255, 0.5);
				border-radius: 20rpx;
				margin: 20rpx;
				padding: 10rpx 30rpx;
				font-size: 28rpx;
			}
		}
		.abom{
			display: flex;
			flex-direction: row;
			margin: 20rpx;
		}
		.alist{
			width: 48%;
			margin:20rpx 1%;
			background: rgba(255, 255,255, 0.5);
			padding: 30rpx;
			border-radius: 20rpx;
			box-shadow:0 1px 1px 0 rgba(0, 0, 0, 0.03);
			display: flex;
			flex-direction: row;
			align-items: center;
			.txt{
				display: flex;
				flex: 1;
				font-size: 30rpx;
				color: #000;
				margin-left: 20rpx;
			}
		}
		.cells {
			background: #FFFFFF;
			display: flex;
			padding: 0;
			height: 110rpx;
			flex-direction: row;
			align-items: center;
			justify-content: center;
			border-bottom: 1rpx solid #F2F2F2;
			.img {
				width: 48rpx;
				height: 48rpx;
				margin-left: 10rpx;
			}

			.title {
				height: 44rpx;
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #0E1521;
				margin-left: 10rpx;
				flex: 1;
				display: flex;
			}
		}
		
	}
</style>