<template>
	<view>
		<view class="updataList_ul" v-if="listData.length">
			<view class="updataList_list" @click="defails(item.app_desc)" v-for="item in listData">
				<view ref="listTxt" class="updataList_listTxt">版本{{ item.app_version }} 更新 {{ item.create_time }}</view>
				<u-icon name="arrow-right" color="#666" size="28"></u-icon>
			</view>
		</view>
		<view class="notDataBox" v-else>
			暂无版本更新记录哦~
		</view>

		<!-- 弹框 -->
		<u-modal v-model="show" title="更新内容" :content="content"></u-modal>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				content: '',
				title: '',
				listData: [], //数据数组
			}
		},
		methods: {
			defails(app_desc) {
				this.content = app_desc
				this.show = true
			},
			async listAxios() {
				const res = await this.$myRequest({
					url: '/api/api_gateway?method=back_source.appupdate.get_app_Update_history',
				})
				console.log(res)
				this.listData = res
			},
		},

		// 滚动到底翻页
		onReachBottom() {
			this.listAxios()
		},

		// 监听下拉动作
		onPullDownRefresh() {
			setTimeout(() => {
				this.listData = [],
					this.listAxios()
				uni.stopPullDownRefresh()
			}, 2000)
		},
		onLoad() {
			this.listAxios()
		},
	}
</script>

<style lang="scss">
	.updataList_ul {
		background: #fff;
		margin: 15rpx 0 0 0;

		.updataList_list {
			height: 90rpx;
			display: flex;
			width: 700rpx;
			margin: 0 auto;
			justify-content: space-between;
			border-bottom: 1px solid #dcd7d7;

			.updataList_listTxt {
				color: #5d5d5d;
				padding: 25rpx 0 25rpx 0;
			}

			.updataList_listName {
				color: #5d5d5d;
			}

			.updataList_listRight {
				width: 50rpx;
				height: 50rpx;
				margin: 20rpx 0 0 0;
			}
		}
	}

	// 暂无数据
	.notDataBox {
	text-align: center;
	font-size:34rpx;
	line-height: 200rpx;
	}
</style>
