<template>
	<view></view>
</template>

<script>
	import {configurationUrl,configurationhtmlUrl} from '@/network/config.js'
	export default{
		data(){
			return {
				detailObj:{}
			}
		},
		onLoad(option){
			console.log("获取参数为",option)
			uni.showLoading({
				title: '拼命加载中...'
			});
			
			const id = decodeURIComponent(option.scene);
			console.log("获取id为",id)
			uni.request({
				// method: 'POST',
				method: 'GET',
				url: configurationUrl +'/editor/app/preview/detail/'+id,
				// url: 'http://192.168.21.230:8855/editor/app/preview/detail/'+id,
				// data: {
				// 	// isTemplate:1,
				// 	pageNum: 1,
				// 	pageSize: 10,
				// 	orderByColumn: 'create_time',
				// 	isAsc: 'desc',
				// 	id:id
				// },
				success: res =>{
					console.log("获取组态详情",res)
					if(res.data.data){
						uni.hideLoading();
						let item = res.data;
						// item.url =  configurationhtmlUrl + '/client.html?tag=' + item.filePath + '&name=' + item.name;
						item.url =  configurationhtmlUrl + '/client.html?tag=' + id;
						// item.url = 'http://192.168.18.131:8081/client.html?tag=' + id;
						this.detailObj = item;
						uni.reLaunch({
							url: './configuration-detail?name=' + encodeURIComponent(item.name) + '&url=' + encodeURIComponent(item.url)
						});
					}else{
						this.$u.toast("组态列表为空");
					}
				},
				fail: err => {
					this.u.toast("未获取到组态数据");
				}
			})

		}
	}
</script>

<style>
</style>
