<template>
	<web-view
		:src="`${webviewServer}/mobile/startFlow?id=${id}&name=${name}&processInstanceId=${processInstanceId}&defaultTitle=${defaultTitle}&authtoken=${authtoken}&longitude=${longitude}&latitude=${latitude}&scanResult=${scanResult}&fromMobile=true&restart=${restart}`">
	</web-view>
</template>

<script>
	import webview from './webview'
	export default {
		mixins: [webview],
		data() {
			return {
				defaultTitle: '',
				processInstanceId: '',
				id: '',
				name: '',
				longitude: '',
				latitude: '',
				scanResult: '',
                restart:false
			};
		},
		onLoad(options) {
			this.processInstanceId = options.processInstanceId
			this.defaultTitle = options.defaultTitle
			this.id = options.id
			this.name = options.name
            this.restart = options.restart
			this.getLocation()
			if (options.scanCode) this.scanCode()
            // console.log('diboot带入的token是',this.authtoken)
		},
		methods: {
			getLocation() {
				let that = this
				uni.getLocation({
					type: 'gcj02',
					success: function(res) {
						that.longitude = res.longitude
						that.latitude = res.latitude
					},
					fail: function(err) {
						console.log('获取位置信息失败', err)
						// uni.showToast({
						// 	title: '获取位置信息失败',
						// 	icon: 'none',
						// 	duration: 3000
						// });
					}
				});
			},
			scanCode() {
				let that = this
				uni.scanCode({
					onlyFromCamera: true,
					success: function(res) {
						that.scanResult = res.result
					}
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
