<template>
	<view>
		<view class="line"></view>
		<view class="logo-box">
			<image :src="'http://static.yfpyx.com/bigdata_app'+'/image/c9b4eb88c03b2f7460e8479e80f40fc.png'" mode="widthFix"></image>
			<view class="version">
				<view>
					云飞物联网
				</view>
				<view>
					V{{id}}
				</view>
			</view>
		</view>
		<view class="line"></view>
		<view class="part">
			<view class="info-item">
				<text class="tit">技术支持</text>
				<text class="val">河南云飞科技发展有限公司</text>
			</view>
			<view class="divide"></view>
			<view class="info-item">
				<text class="tit">关注微信</text>
				<text class="val">河南云飞科技发展有限公司</text>
			</view>
		</view>
		<view class="line"></view>
		<view class="part">
			<view class="info-item">
				<text class="tit">公司官网</text>
				<text class="val">www.hnyfkj.cn</text>
			</view>
			<view class="divide"></view>
			<view class="info-item">
				<text class="tit">业务合作</text>
				<text class="val">400-690-7990</text>
			</view>
			<view class="divide"></view>
			<view class="info-item">
				<text class="tit">公司邮箱</text>
				<text class="val">hnyf826@163.com</text>
			</view>
		</view>
		<view class="line"></view>
		<!-- <view class="part">
			<view class="info-item" @click="renewal">
				<text class="tit">版本更新</text>
				<u-icon name="arrow-right"></u-icon>
			</view>
		</view> -->
		<view class="line"></view>
		<view class="record">
			<view class="info-item" @click="record">
				<text class="tit">更新记录</text>
				<u-icon name="arrow-right"></u-icon>
			</view>
		</view>
		<view class="bottom">
			©河南云飞科技发展有限公司
		</view>
		<u-modal title="升级中请勿随意操作" :show-confirm-button="false" v-model="showA" :content="contentA">
			<view class="upgradeBox">
				<u-line-progress v-show="isShow" active-color="#19be6b" :striped="true" :percent="percentNum" :striped-active="true"></u-line-progress>
			</view>
		</u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				 id:'',
				 versions:'',
				 showA: false, //
				 contentA: '',
				 isShow: false, //进度条
				 percentNum: 0, //在线下载进度
			}
		},
		methods: {
			async getEquipList() {
				const res = await this.$myRequest({
					url: '/api/api_gateway?method=home.homes.app_version_record',
					data: {
						ret:"first"
					}
				})
				console.log(res)
				this.id = res[0].app_num
			},
			// 	this.versions = Number(res[0].app_num.match(/\d+/g).join(""))
			// 	var ids = Number(this.id.match(/\d+/g).join(""))
			// 	if (this.versions > ids) {
			// 		uni.showModal({
			// 			title: '提示',
			// 			content: '检测到有新版本，是否更新？',
			// 			success: (res) => {
			// 				if (res.confirm) {
			// 					console.log('用户点击确定');
			// 					this.showA = true
			// 					this.isShow = true
			// 					this.upgrade()
			// 				} else if (res.cancel) {
			// 					plus.runtime.quit();
			// 					console.log('用户点击取消');
			// 				}
			// 			}
			// 		})
			// 	}else{
			// 		uni.showToast({
			// 			title:"当前版本已是最新版本",
			// 			icon:"none"
			// 		})
			// 	}
			// },
			// renewal(){
			// 	this.getEquipList()
			// },
			// upgrade() {
			// 	console.log(this.appName)
			// 	var url = "http://182.92.193.64:8002/app_file/" + this.appName
			// 	console.log(url)
			// 	const downloadTask = uni.downloadFile({
			// 		url: url, //仅为示例，并非真实的资源
			// 		success: (res) => {
			// 			console.log(res)
			// 			if (res.statusCode === 200) {
			// 				console.log('下载成功');
			// 				console.log('安装包下载成功，即将安装：' + JSON.stringify(res, null, 4));
			// 				plus.runtime.openFile(res.tempFilePath);
			// 			}
			// 		},
			// 		fail: (err) => {
			// 			console.log(err)
			// 		},
			// 		complete: (com) => {
			// 			console.log(com)
			// 		}
			// 	});
			// 	downloadTask.onProgressUpdate((res) => {
			// 		this.percentNum = res.progress
			// 		if (res.progress == 100) {
			// 			console.log('下载完成了')
			// 			plus.runtime.quit();
			// 		}
			// 	});
			// },
			record(){
				uni.navigateTo({
					url:"../record/record"
				})
			}
		},
		onLoad(){
			this.getEquipList()
		},
		onShow() {
			// this.id = plus.runtime.version
		},
		onBackPress(option){
			uni.redirectTo({
				url:"../index/index"
			})
		}
	}
</script>

<style lang="scss">
page {
 	background:$uni-bg-color-grey;
}
.line{
	height:16rpx;
	width:100%;
	background:$uni-bg-color-grey;
}
.bottom{
	height:190rpx;
	line-height:190rpx;
	font-size:8px;
	text-align: center;
}
.logo-box{
	background:#fff;
	text-align: center;
	padding:80rpx 0;
	image{
		width:150rpx;
	}
	.version{
		font-size:24rpx;
		margin-top:20rpx;
	}
}
.part{
	background:#fff;
	padding:0 40rpx;
	.divide{
		width:100%;
		height:1px;
		background:$uni-bg-color-grey;
		}
	.info-item{
		display:flex;
		justify-content: space-between;
		line-height:100rpx;
		.tit{font-size:14px}
		.val{
			font-size:12px;
			color:#666;
		}
	}
}
.record{
	background:#fff;
	padding:0 40rpx;
	.info-item{
		display:flex;
		justify-content: space-between;
		line-height:100rpx;
		.tit{font-size:14px}
	}
}
.upgradeBox {
		padding: 15rpx;
	}
</style>
