<template>
	<!--pages/web/web.wxml-->
	<view>
		<web-view :src="webUrl" v-if="webUrl!==''"></web-view>
	</view>
</template>

<script>
	// pages/web/web.js
	const req = require("../../utils/request");
	const app = getApp();

	export default {
		data() {
			return {
				webUrl: '',
				back: false,
			};
		},

		components: {},
		props: {},
		onLoad: function(options) {
			this.query = options;
			let that = this;
			let token = req.getStorage('AUTH_TOKEN');
			let webUrl = req.public.storemanagers + req.header.appId + '&token=' + token;
			console.log('地址>>>>>',webUrl)

			if (!req.getStorage('userInfo')) {
				// console.log("111111111111111");
				app.globalData.openPage('pages/authorize/authorize');
			} else {
				if (this.query.scene) {
					let form = {
						scene: this.query.scene
					};
					req.getRequest('/api/code/params', form, data => {
						// console.log(
						// 	"====================================================================================" +
						// 	data.scene);
						webUrl += '&orderId=' + data.scene;
						this.setData({
							webUrl: webUrl
						});
						// console.log(webUrl, "+++++++++++");
					});
				} else {
					that.setData({
						webUrl: webUrl
					});
					// console.log(webUrl);
				}
			}
		},

		onShow() {
			if (this.back) {
				uni.navigateBack();
			}
		},

		methods: {}
	};
</script>
<style>
	@import "./web.css";
</style>
