<template>
	<view class="content">
		<!-- <web-view src="https://www.changshuxing.cn/csxing-h5/pages/home.html?origin=1&userId=okjmN5jgd0NHd004YZci3cp7wLCE&sign=&timeStamp=1638958342442"></web-view> -->
		<web-view src="https://cs.tour-ma.com/csxing-h5/pages/wentilv/index.html"></web-view>
		<!-- <view class="zxclist">
			<view class="item" v-for="(el,ind) in datas" :key="ind">
				<view class="tit">{{el.name}}</view>
				<view class="zxcsl">
					<view class="cwzs">
						<view class="wz">车位信息</view>
						<view class="sz">{{el.capacity}}</view>
					</view>
					<view class="cwzs">
						<view class="wz">余位信息</view>
						<view class="sz">{{el.availBike}}</view>
					</view>
					<view class="cwzs02">
						<view class="wz">更新时间</view>
						<view class="sz">{{el.updateTime}}</view>
					</view>
				</view>
				<view class="dizhi">
					<view class="dz">地址：{{el.address}}</view>
					<view class="dzimg" @click="daohang(el.jwd)">导航</view>
				</view>
			</view>
		</view> -->
	</view>
</template>

<script>
	var web = require('@/components/utils/request.js');
	export default{
		data(){
			return{
				token:'',
				datas: [],
				lng:'',
				lat:'',
			}
		},
		onLoad() {
			// this.getToken();
		},
		methods: {
			getToken(){
				var url = 'http://36.153.213.27:8888/api/mc-config/model/aggregation-external/getToken?username=user_xcx&password=Supcon';
				var para = {};
				var that = this;
				web.httpGetxin(that, url, para, function(res) {
					// console.log(res.data.obj);
					that.token=res.data.obj;
					if(res.data.success==false){
						that.sxToken();
					}else{
						that.getdata();
					}
				});
			},
			sxToken(){
				var url = 'http://36.153.213.27:8888/api/mc-config/model/aggregation-external/refreshToken?accessToken='+this.token;
				var para = {};
				var that = this;
				web.httpGetxin(that, url, para, function(res) {
					that.token=res.data.obj;
					that.getdata();
				});
			},
			getdata(){
				uni.showToast({
					title: '加载中...',
					icon:'loading',
				});
				var url = 'http://36.153.213.27:8888/api/mc-config/model/aggregation-external/aggregation?accessToken='+this.token;
				var para = {			
					  "code": "0001_zxc",
					  "params": {},
					  "page": 0,
					  "size": 0,
					  "result": {},
					  "orders": []						
				};
				var that = this;
				web.httpPostxin(that, url, para, function(res) {
					if (res.data.success) {
						uni.hideToast();
						that.datas =[];
						that.datas = res.data.obj.info;
						
					}else {
						uni.showToast({
							title: '加载中...',
							icon:'loading',
							duration:20000
						});
					}
				});
			},
			daohang(jwd){
				var lnglat =jwd.split(",");
				// console.log(lnglat[0]);
				// console.log(lnglat[1]);
				
				this.lng = lnglat[0];
				this.lat = lnglat[1];
				
				var that=this;
				uni.openLocation({
					latitude:Number(that.lat),
					longitude:Number(that.lng),
					complete(e) {
						console.log(e);
					}
				})
				
			}
		}
	}
	
	
</script>

<style  lang="scss">
	.zxclist{
		width: 90%;
		margin: 30upx auto;
		.item{
			margin-bottom: 7%;
			border-radius: 20rpx;
			overflow: hidden;
			box-shadow: 0rpx 0rpx 15rpx 10rpx #eee;
			background: #fff;
			line-height: 2;
			color: #666666;
			.tit{
				font-size: 36rpx;
				background:linear-gradient(0deg, #3269F7 0%, #4A9AF9 70%);
				padding: 10upx 30upx;
				color: #ffffff;
				font-weight: 600;
			}
			.dizhi{
				padding:10rpx 30rpx 30rpx 30rpx;
				display: flex;
				justify-content: space-between;
				.dzimg{
					padding: 0 30upx;
					background:#2dc15c;
					color: #ffffff;
					border-radius: 50rpx;
				}
			}
			.zxcsl{
				padding:0rpx 30rpx;
				display: flex;
				justify-content:center;
				text-align: center;
				margin: 10rpx 0 0rpx 0;
				.cwzs{
					width: 50%;
				}
				.sz{
					color: #333333;
					font-size: 32rpx;
					font-weight: 600;
				}
			}
		}
	}
</style>
