<template>
  <web-view v-if='src' :src="src"></web-view>
</template>

<script>
  export default {
    data() {
      return {
        token:'',
		id:'',
		src:'',
		userid:''
      };
    },
	onLoad(options) {
		// console.log('options',options);
		if(options){
			this.id = options.id
		}
		let that = this
		uni.getStorage({
			key: 'token',
			success: function(res) {
				// console.log('res',res);
				that.token = res.data;
				uni.getStorage({
					key:'userid',
					success:function(res){
						that.userid = res.data
						that.src = `https://portal.lihe-control.com/#/irrigateSet?id=${that.id}&token=${that.token}&userid=${that.userid}`
						// console.log(that.src);
					}
				})
			},
			fail:function(err){
				uni.navigateTo({
					url:'/pages/fertilizer_machine/fertilizer_machine'
				});
				uni.showToast({
					title: "跳转失败!",
					icon: 'fail',
				})
			}
		})
	}
  }
</script>

<style lang="scss">

</style>
