<template>
	<view >
		<!-- <view class="top">
			<view class="top-search">
			</view>
			<view class="top-content">
				<view>
					<navigator url="../scenic/scenic">
						<image src="../../static/img/index/classify1.png"></image>
						<view>景区门票</view>
					</navigator>
					
				</view>
				<view>
					<navigator url="../hotel/hotel">
						<image src="../../static/img/index/classify2.png"></image>
						<view>酒店民宿</view>
					</navigator>
				</view>
				
				<view>
					<navigator url="../restaurant/restaurant">
						<image src="../../static/img/index/classify3.png"></image>
						<view>特色美食</view>
					</navigator>
				</view>
				
				<view>
					<navigator url="../nearby/nearby">
						<image src="../../static/img/index/classify4.png"></image>
						<view>周边游</view>
					</navigator>
				</view>
				
				<view>
					<navigator url="../travelOne/travelOne">
						<image src="../../static/img/index/classify5.png"></image>
						<view>跟团游</view>
					</navigator>
				</view>
				
				<view>
					<navigator url="../travelTwo/travelTwo">
						<image src="../../static/img/index/classify6.png"></image>
						<view>亲子游</view>
					</navigator>
				</view>
				
				<view>
					<navigator url="../dingzhi/dingzhi">
						<image src="../../static/img/index/classify7.png"></image>
						<view>行程订制</view>
					</navigator>
				</view>
				
				<view>
					<navigator url="../special/special">
						<image src="../../static/img/index/classify8.png"></image>
						<view>特产好礼</view>
					</navigator>
				</view>
			</view>
			<view class="top-img">
				
			</view>
			
		</view> -->
		<!-- <text @click="getUserInfo()"> 授权获取头像昵称 </text> -->
		<view class="bottom">
			<web-view :src="outUrl"></web-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				outUrl:"",//跳出地址
				companyId:"",//公司Id
			}
		},
		onLoad(option){
			this.companyId=option.companyId||""
			if(!this.companyId){
				this.getCompanyId()
			}else{
				let pdOpenid=uni.getStorageSync("openid")//胖丁小程序openid,临时用，当公众号授权做好之后可以删除
				let pdToken=uni.getStorageSync("token")
				let pdCreateUserId=uni.getStorageSync("createUserId")
				let pdUserId=uni.getStorageSync("userId")
				this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&companyId="+this.companyId
			}
		},
		methods: {
			getUserInfo() {	// 获取用户信息
				uni.getUserProfile({
					lang:'zh_CN',
					desc:'登录',
					success:(res)=>{
						console.log(res)
					},
					fail:(res)=>{
						
					}
				})
			},
			getCompanyId(){//获取公司Id
				let pdOpenid=uni.getStorageSync("openid")//胖丁小程序openid,临时用，当公众号授权做好之后可以删除
				let pdToken=uni.getStorageSync("token")
				let pdCreateUserId=uni.getStorageSync("createUserId")
				let pdUserId=uni.getStorageSync("userId")
				let data={
					openid:pdOpenid
				}
				this.$request("wechatUser/wxUser/getLastRecord",data).then((res) => {
					if (res.code == "00"){
						this.companyId=res.data.companyId||""
						this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&companyId="+this.companyId
					}else{
						this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&companyId="+this.companyId

					}
				}).catch(()=>{
					this.outUrl="https://wx.pangdly.com/#/home?pdOpenid="+pdOpenid+"&pdToken="+pdToken+"&pdCreateUserId="+pdCreateUserId+"&pdUserId="+pdUserId+"&companyId="+this.companyId
				})
			}
	
		}
	}
</script>

<style>
	.top{padding: 0 24rpx;}
	.top-content{display: flex;flex-wrap: wrap;background: #FFFFFF;border-radius:24rpx;padding-bottom:32rpx;}
	.top-content>view{width: 25%;text-align: center;margin-top:40rpx;}
	.top-content view image{width:64rpx;height:64rpx;}
</style>
