<template>
	<view>
		<view class="records">
			<view class="records_itemtf" v-if="dataTF">
				暂无更新记录
			</view>
			<u-collapse>
				<u-collapse-item :title="item.head" v-for="(item, index) in itemList" :key="index">
					<p v-for="items,indexs in item.body" :key="indexs">{{indexs+1+"、"+items}}</p>
				</u-collapse-item>
			</u-collapse>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				recordsdata: [],
				indexnum: 0,
				dataTF: false,
				itemList: [],
			}
		},
		methods: {
			async getEquipList() {
				const res = await this.$myRequest({
					url: '/api/api_gateway?method=home.homes.app_version_record'
				})
				console.log(res)
				this.recordsdata = res
				var ids = Number(plus.runtime.version.match(/\d+/g).join(""))
				for (var i = 0; i < res.length; i++) {
					var appnum = Number(res[i].app_num.match(/\d+/g).join(""))
					if (appnum > ids) {
						console.log(appnum, ids)
					} else {
						var obj = {
							head: "版本" + res[i].app_num + "主要更新",
							body: res[i].app_desc,
						}
						this.itemList.push(obj)
					}

				}
				if (res.length == 0) {
					this.dataTF = true
				} else {
					this.dataTF = false
				}
			},
			showtf(index) {
				this.indexnum = index
				console.log(this.indexnum)
			}
		},
		onLoad() {
			this.getEquipList()
		}
	}
</script>
<style lang="scss">
	page {
		background-color: #f1f1f1;
	}

	.u-collapse-item {
		width: 100%;
		// height: 110rpx;
		padding: 10rpx 28rpx;
		justify-content: space-between;
		box-sizing: border-box;
		margin-bottom: 20rpx;
		background-color: #FFFFFF;
	}

	.records {
		margin-top: 20rpx;

		.records_itemtf {
			font-size: 30rpx;
			width: 100%;
			height: 100rpx;
			line-height: 100rpx;
			text-align: center;
		}
	}
</style>
