<template>
	<view class="content">
		<view class="container">
			<headers :titles="titles"><uni-icons type="arrow-left" color="#000000" size="22px"></uni-icons></headers>
			<view class="f-box">
				<u-parse :content="content"></u-parse>
			</view>

			<jushi-signature :settings="settings" base64 @cancel="signatureCancel"
				@change="signatureChange"></jushi-signature>
		</view>

	</view>
</template>

<script>
	import headers from '../../components/header/headers.vue'
	import request from '@/utils/request.js'
	export default {
		data() {
			return {
				titles: "合同",
				settings: { //签名设置
					width: '750', //签名区域的宽
					height: '500', //签名区域的高
					lineWidth: 4, //签名时线宽
					textColor: '#000' //签名文字颜色
				},
				content: '',
				List: [],
				show: false,
				status: 'loading',
				name: '',
				Address: ''

			}
		},
		onLoad(option) {
			this.name = option.name
			this.Address = option.Address
		},
		onShow() {
			this.getdriveSchool()
			// this.actList = ["1", "1", "1", "1", "1", ]
			// this.status = "nomore" 底部刷新结束
		},
		onPullDownRefresh() {
			console.log("刷新");
			uni.stopPullDownRefresh()
		},
		onReachBottom() {
			// this.show = true
			setTimeout(() => {
				console.log("加载执行");
			}, 2000)
		},
		components: {
			headers
		},
		methods: {
			async getdriveSchool() {
				let res = await request({
					url: '/system/driveSchool/test/1',
					method: 'get',
				})
				this.content = res.data.content
			},

			signatureCancel() {
				uni.navigateBack()
			},
			async signatureChange(e) {
				this.imgUrl = e
				let res = await request({
					url: '/system/driveSchool/contract',
					method: 'post',
					data: {
						userName: this.name,
						address: this.Address
					}
				})
				console.log(res);
				uni.showToast({
					title: '支付成功',
					duration: 3000

				})
				setTimeout(function() {
					// 在这里写需要延迟执行的代码
					uni.navigateTo({
						url: '/pages/index/index'
					})
				}, 3000); // 3000毫秒即为3秒

				// const index = e.lastIndexOf("/")
				// let fileName = e.substring(index + 1, e.length)
				// this.uploadFile(this.imgUrl, fileName)

			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #f4f5f6;

		height: 100vh;
	}

	.container {
		width: 100%;
		background: #f4f5f6;
		box-sizing: border-box;
		padding-top: 88px;
	}

	.f-box {
		width: 100%;
		box-sizing: border-box;
		padding: 15px;
	}
</style>