<template>
	<view class="wrap">
		11111
	</view>
</template>

<script>
	import { textToImg} from '@/api/paint.js';
	export default {
		onLoad(options) {
			//接收上一个页面传来的绘画参数
			const paintData = JSON.parse(options.data);
			console.log('paintData',paintData);
			// this.imgHeight = paintData.height;
			// this.imgWidth = paintData.width;
			// this.prompt = paintData.prompt;
			// this.styleName = paintData.styleName;
			textToImg(paintData).then(res =>{
				if(res.data.code === 200){
					uni.hideLoading();
					console.log('res',res);
					// this.base64ToPath(res.data.data.images);
					// this.successFlag = true;
					// this.paintTime = res.data.data.paintTime;
					// this.paintId = res.data.data.paintId;
			 	}else{
					uni.switchTab({
						url: '/pages/ai/paint/paint',
						success() {
							uni.showToast({
								title: res.data.msg,
								icon: 'none',
								duration: 2000
							});	
						}
					})
					
				}
				
			 });
			 
			 //加载广告
			 //initReward();
			 
		}
	}
</script>

<style>
</style>