<template>
	<page-meta :page-style="themeColor"></page-meta>
	<view class="" v-for="(item, index) in list" :key="index">
		<div class="view">
			<div class="top">
				<div class="img">
					<image style="width: 100%;height: 100%;" :src="$util.img(item.logo)" @click="toNews" class="news">
					</image>
				</div>
				<div class="title">{{ item.seo_keywords }}</div>
				<div class="version">{{ versionCode }}</div>
			</div>
			<div class="row">
				<div class="left">邮箱</div>
				<div class="right">{{ item.email }}</div>
			</div>
			<u-line></u-line>
			<div class="row">
				<div class="left">联系电话</div>
				<div class="right">{{ item.site_tel }}</div>
			</div>
			<!-- <u-line></u-line>
			<div class="row">
				<div class="left">官网</div>
				<div class="right">www.baidu..com</div>
			</div> -->
			<u-line></u-line>
			<div class="row" @click="showEgg">
				<div class="left">版本号</div>
				<div class="right">{{ versionCode }}</div>
			</div>
			<div class="btnBox">
				<div class="btn" @click="agreement('用户协议')">《服务协议》</div>
				<div class="btn" @click="agreement('隐私政策')">《隐私协议》</div>
			</div>
		</div>

	</view>
	<egg ref="egg" :IPArray="IPArray" :defaultIP="defaultIP" @change="changeHandle"></egg>
</template>

<script>
import egg from "@/components/egg.vue"
export default {
	components: { egg },
	data() {
		return {
			list: [],
			versionCode: "",
			IPArray: [
				{
					ipConfig: 'http://publish.jtyqt.com',
					title: '正式服务器',
					teamId: '645b01f15f83be001c726475',
				}, {
					ipConfig: 'https://publish.three.xinzhidi.cn',
					title: '测试服务器',
					teamId: '64295bc445f920001c6cec8a'
				},
			],
			defaultIP: ''
		};
	},
	created() { },
	onLoad() {
		//#ifdef APP-PLUS
		plus.runtime.getProperty(plus.runtime.appid, (info) => {
			console.log(JSON.stringify(info));
			this.versionCode = info.version;
			console.log('版本', this.versionCode)
		})
		//#endif
	},
	async onShow() {
		let res = await this.$api.sendRequest({
			url: '/api/config/getConfigInfo',
			data: {},
			async: false,
			success: res => {
				// console.log(res,'res');
			}
		});
		// console.log([res.data],'res');
		this.list = [res.data];
	},
	methods: {
		agreement(title) {
			uni.navigateTo({
				url: '/pages_tool/agreement/agreement?title=' + title
			});
		},
		showEgg() {
			this.defaultIP = uni.getStorageSync('updateConfig') ? uni.getStorageSync('updateConfig').ipConfig : 'http://publish.jtyqt.com'
			this.$refs.egg.openSelectIP();
		},
		changeHandle(v) {
			uni.setStorageSync('updateConfig', v)
		}
	}
};
</script>

<style lang="scss" scoped>
.view {
	min-height: 100vh;
	background-color: #fff;
	padding: 40rpx;
	box-sizing: border-box;

	.top {
		margin-bottom: 48rpx;

		.img {
			margin-top: 24rpx;
			width: 150rpx;
			height: 150rpx;
			// background: #D8D8D8;
			// opacity: 1;

			position: relative;
			left: 50%;
			transform: translate(-50%);
		}

		.title {
			margin-top: 32rpx;
			font-size: 32rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 600;
			color: #222222;
			text-align: center;
		}

		.version {
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			color: #999999;
			text-align: center;
			margin-top: 16rpx;
		}
	}

	.row {
		padding: 30rpx 0 30rpx 0;
		display: flex;

		.left {
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			color: #333333;
		}

		.right {
			flex: 1;
			text-align: right;
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			color: #333333;
		}
	}

	.btnBox {
		position: fixed;
		bottom: 16rpx;
		height: 92rpx;
		width: calc(100% - 60rpx);
		display: flex;
		justify-content: space-evenly;

		.btn {
			text-align: center;

			width: 144rpx;
			height: 34rpx;
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: $base-color;
			line-height: 34rpx;
		}
	}
}
</style>
