<template>
	<view class="version">
		<view class="header">
			<image src="../../pageD/images/file.png" class="tit-img" mode=""></image>
			<view class="title">德铭阳光</view>
			<view class="tit-info">版本: {{ $app_version }} for {{ phone_type }}</view>
		</view>
		<view class="main">
			<view @click="viewAboutUs">
				<text class="title">产品介绍</text>
				<u-icon name="arrow-right" color="#999"></u-icon>
			</view>
			<view class="version-view">
				<text class="title">版本更新</text>
				<text class="tips" v-if="version" @click="updateVersion">发现新版本: {{ version }}</text>
				<text class="tips" v-else>已是最新版本</text>
			</view>
		</view>
	</view>
</template>
<script>
export default {
	data() {
		return {
			version: '',
			phone_type: "",
			status: '',
		}
	},
	onLoad() {
		this.getVersion();
		this.phone_type = this.$u.os();
	},
	methods: {
		// 检查版本号
		getVersion() {
			this.$u.post("Specialci/checkVersion",{ app_version: this.$app_version }).then(res => {
				// console.log(res);
				if(res.data.app_version != this.$app_version) {
					this.version = res.data.app_version;
					this.status = res.data.is_focus_upgrade; // 0 不强制 1 强制 
				}
			})
		},
		viewAboutUs() {
			this.$u.route('/pageE/mine/ArticleDetails', {
				type: 2
			});
		},
		updateVersion() {
			this.$u.route('/pageE/setting/updateVersion', {
				status: this.status
			});
		}
	}
};
</script>
<style lang="scss" scoped>
.header {
	width: 500rpx;
	margin: 0 auto;
	padding: 30rpx;
	text-align: center;
    .tit-img {
			width: 200rpx;
			height: 200rpx;
		}
		.title {
			margin: 18rpx 0;
			font-weight: bold;
			font-size: 26rpx;
			letter-spacing: 2rpx;
		}
		.tit-info {
			font-size: 22rpx;
			color: #666;
		}
}
.main {
	margin: 20rpx 0;
	& > view {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		height: 100rpx;
		padding: 0 20rpx;
		line-height: 100rpx;
		color: #333;
		font-size: 30rpx;
		background-color: #fff;
		border-bottom: 1px solid #f2f2f2;
		.title {
			width: 200rpx;
		}
	}
	.tips {
		color: #999;
		font-size: 22rpx;
	}
	.version-view {
		.tips {
			flex: 1;
			text-align: right;
		}
	}
}
.u-content {
    padding: 20rpx;
    font-size: 30rpx;
    text-indent: 1rem;
    line-height: 1.2;
}
</style>