<template>
	<view class='container'>
		<view class="mar-20">
			<view class="flex-column br-12 fs-28 mt-30" style="background: white;">
				<text class="fs-32 fw-700 pad-30" style="text-align: left;">基本信息</text>
				<view class="flex-row-between pad-30" style="border-bottom: 1rpx solid #E9E9E9;">
					<text style="color: #999999;">职业</text>
					<text>安保</text>
				</view>
				<view class="flex-row-between pad-30" style="border-bottom: 1rpx solid #E9E9E9;">
					<text style="color: #999999;">姓名</text>
					<text>张三</text>
				</view>
				<view class="flex-row-between pad-30" style="border-bottom: 1rpx solid #E9E9E9;">
					<text style="color: #999999;">性别</text>
					<text>男</text>
				</view>
				<view class="flex-row-between pad-30" style="border-bottom: 1rpx solid #E9E9E9;">
					<text style="color: #999999;">手机号</text>
					<text>199****8989</text>
				</view>
			</view>

			<view class="flex-column br-12 fs-24 mt-30 pad-30" style="background: white;color: #999999;">
				<text class="fs-32 fw-700" style="color: #000;">我的位置</text>
				<text class="mt-20">请定位当前位置</text>
				<view @click="onDw" class="mt-20"
					style="display: flex;flex-direction: row-reverse;align-items: center;">
					<text>重新定位</text>
					<image class="w-25 h-25" src="/pagesMine/static/icon_dk_dw.png"></image>
				</view>
				<view class="mt-50" style="height: 1rpx;background: #E9E9E9;"> </view>
				<text class="mt-50" style="color: #000;">拍照</text>
				<view class="mt-20">
					<upload-image v-model="images" maxCount="3" width="70" height="70" type="fullurl"></upload-image>
				</view>
			</view>

		</view>
		<view @click="onSubmit" class="fullscreen-btn mt-100">
			<text>提交打卡</text>
		</view>

		<!-- 提交 -->
		<wskj-modal :show="submitShow" :showCancelButton="true" confirmText="确定" confirmColor="#EB7318"
			@close="submitShow = false" @confirm="onConfirmSubmit" @cancel="submitShow = false">
			<view class="pt-40 pb-40">
				<view>
					<text class="fs-28">确认提交？</text>
				</view>
			</view>
		</wskj-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '安保打卡',
				type: 0,
				reason: '',
				submitShow: false,
				images: '',
			};
		},
		onLoad(e) {
			this.type = e.type
			if (e.type == 0) {
				this.title = "安保打卡"
			} else {
				this.title = "保洁打卡"
			}

		},
		methods: {
			onDw() {
				uni.getLocation({
					type: 'gcj02',
					success: function(res) {
						const latitude = res.latitude;
						const longitude = res.longitude;
						uni.openLocation({
							latitude: latitude,
							longitude: longitude,
							success: function(res) {
								console.log(res);
							}
						});
					}
				});

			},
			onSubmit() {
				this.$wskj.to("/pagesMain/pages/tjsq?type=" + this.type)
				// if (!this.reason) {
				// 	return this.$u.toast('请输入内容')
				// }
				// if (!this.images) {
				// 	return this.$u.toast('请至少上传一张照片')
				// }
				// if (this.reason.length < 10) {
				// 	return this.$u.toast('文字描述最低10个字')
				// }
				// this.submitShow = true
			},
			// 提交
			onConfirmSubmit() {
				// const params = {
				// 	url: '/api/user/yijian',
				// 	loadingTip: '',
				// 	data: {
				// 		content: this.reason,
				// 		images: this.images
				// 	}
				// }
				// // console.log(params);
				// this.$request(params).then(res => {
				// 	// console.log(res)
				// 	this.submitShow = false
				// 	if (res.code === 1) {
				// 		this.$u.toast(res.msg || '提交成功')

				// 		this.reason = ''
				// 		this.images = ''
				// 	} else {
				// 		this.$u.toast(res.msg || '提交失败')
				// 	}
				// }).catch(err => {
				// 	this.submitShow = false
				// 	this.$u.toast(err.msg || '提交失败')
				// })
			}
		},
	};
</script>

<style scoped>
	.container {
		display: flex;
		flex-direction: column;
		background: #F2F2F2;
	}
</style>