<template>
    <view class="rf-category" style="height: 100%">
        <!--搜索导航栏-->
        <view class="icoStyle">
            <u-navbar :back-text="i18n('Back')" :title="i18n('ResearchResources')+i18n('resourceDetails')" :background="barBackground"
                      back-icon-color="white" title-color="white" :back-text-style="backStyle">
            </u-navbar>
        </view>
        <web-view :src="url" style="height: 100;top: 88upx;overflow-y:hidden"></web-view>
    </view>
</template>

<script>
    /**
     * option ： url
    * */
	var wv;
    var currentWebview;
	const { windowWidth, windowHeight } = uni.getSystemInfoSync();	
    export default {
        data() {
            return {
				ifShare:false,
				barBackground: {
				    backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
				},
				backStyle: {
				    color: '#fff'
				},
                barHeight:'',
				webViewHeight:'',
                url:null,
            }
        },
        async onShow() {
			
		},
        async onLoad(option) {
            this.url = option.url;
			// #ifdef APP-PLUS
			currentWebview = this.$scope.$getAppWebview();
            setTimeout(function() {
			    wv = currentWebview.children()[0];
			    wv.setStyle({height:0})
			}, 500);
			// #endif
        },
        watch:{

        },
		mounted(){
			this.getBarHeight()
			this.openWebView()
		},
        methods: {
			async getBarHeight(){
				const query = uni.createSelectorQuery().in(this);
				query.select('.icoStyle').boundingClientRect(data => {
				  this.barHeight = data.height;
				  this.webViewHeight = windowHeight-this.barHeight
				}).exec();
			},
			async openWebView(){
				const that = this
				// #ifdef APP-PLUS
				setTimeout(function() {
				    wv.setStyle({top:that.barHeight,height:that	.webViewHeight})
					// let commonrightd = document.getElementsByClassName("body-bg");
					// console.log(commonrightd)
				}, 500);
				let commonrightd = document.getElementsByClassName("body-bg");
				console.log(commonrightd)
				// #endif
			},
            back() {
                uni.navigateBack();
            },
            //中英文切换
            i18n (data) {
                return this.$t('common.'+data);
            },
        }
    }
</script>

<style lang="scss" scoped>
    .icoStyle {
        display: flex;
        align-items:center;
        .leftArrow {
            width:36upx;
            height:36upx;
            position: fixed;
            z-index: 99;
            /*  #ifdef  APP-PLUS  */
            padding-top: calc(20upx + var(--status-bar-height));
            /*  #endif  */
        }
    }
</style>