<template>
	<view>
		<web-view :src="href"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				href: ""
			};
		},
		onLoad(option) {
			// 获取位置
			uni.getLocation({
				type: 'gcj02',
				geocode: true ,
				success: (res)=> {
					console.log(res.address)
					// console.log('当前位置的经度：' + res.longitude);
					// console.log('当前位置的纬度：' + res.latitude);
					
					this.$api.workflow_save_location({
						staff_num: uni.getStorageSync('user').staff_num,
						location: JSON.stringify(res)
					}).then((res)=>{
						console.log(res.data)
					})
				}
			});
			
			
			// #ifndef APP-NVUE
			const eventChannel = this.getOpenerEventChannel();
			// #endif
			// 监听acceptDataFromOpenerPage事件，获取上一页面通过eventChannel传送到当前页面的数据
			eventChannel.on('acceptDataFromOpenerPage', (data) => {
				// console.log(data)

				uni.setNavigationBarTitle({
					title: data.title
				})
				
				let link_neiwang = data.url.replace('oa_system.nxjiewei.com:8011','n.oa_system.nxjiewei.com:8011')
				
				// let url = escape(data.url)
				let title = escape(data.title)
				
				// this.href = "http://oa_system.nxjiewei.com:8011/oa_login?staff_num=" + uni.getStorageSync('user')
				// 	.staff_num + "&url=" + url + "&title=" + title
				
				// 内网
				let url = escape(link_neiwang)
				this.href = "http://n.oa_system.nxjiewei.com:8011/oa_login/index_neiwang.html?staff_num=" + uni.getStorageSync('user')
					.staff_num + "&url=" + url + "&title=" + title
			})

		}
	}
</script>

<style lang="scss">

</style>
