<template>
	<view>
		<view style="color: #fff;">
			<tn-nav-bar backgroundColor="#26b3a0" :bottomShadow="false">AI绘图</tn-nav-bar>
			<view :style="{ height: tobheight + 'px' }"></view>
		</view>
		<u-notice-bar :text="noticebar" step speed="800"></u-notice-bar>

		<view style="margin: 30rpx 30rpx 0;">
			<tn-subsection :list="tabslist" :current="current" mode="button" :borderRadius="50"
				backgroundColor="tn-cool-bg-color-9" @change="getsubsection" buttonColor="tn-cool-bg-color-7"
				inactiveColor="#FFFFFF" activeColor="#27A1BA"></tn-subsection>
		</view>

		<view class="directask">
			<view v-if="modelslist.length>0" class="cu-form-group">
				<view class="cu-title flxe align-center justify-between">
					<view class="title flxe align-center">模型选择</view>
					<block v-if="showmj">
						<u-tag v-if="userData.vip_info&&userData.is_validity>0"
							:text="(userData.vip_info.mj_type == 'time'?'今日':'会员')+'剩余mj绘画:'+(userData.vip_info.mj_times==-1?'无限量':userData.vip_info.mj_times-userData.vip_info.mj_used+'次')"
							plain shape="circle" plainFill color="#26b3a0" borderColor="#26b3a0"
							bgColor="#26b3a014"></u-tag>
					</block>
					<block v-else>
						<u-tag v-if="userData.vip_info&&userData.is_validity>0"
							:text="(userData.vip_info.sd_type == 'time'?'今日':'会员')+'剩余sd绘画:'+(userData.vip_info.sd_times == -1?'无限量':userData.vip_info.sd_times-userData.vip_info.sd_used+'次')"
							plain shape="circle" plainFill color="#26b3a0" borderColor="#26b3a0"
							bgColor="#26b3a014"></u-tag>
					</block>
				</view>
				<view class="engine-container" @click="showmode = true">
					<view class="model_view">模型：{{xzmodels}}</view>
					<u-icon name="arrow-down-fill" color="#9e9e9e"></u-icon>
				</view>
			</view>
			<view class="cu-form-group" :style="engineid != 0 ? 'margin-top: 20rpx' : ''">
				<view class="cu-title flxe align-center justify-between">
					<view class="title flxe align-center">画面描述</view>
					<!-- <u-icon @click="keywords = '',galleryid =''" name="trash-fill" color="#9e9e9e" size="24"></u-icon> -->
				</view>
				<view class="textarea-container">
					<textarea class="textarea" v-model="keywords" cursor-spacing="30rpx" :maxlength="500"
						placeholder-style="color: #9e9e9e;font-size:28rpx"
						placeholder="输入你的创意，支持中英文，用逗号分隔,关键词越多越精确，关键词越少AI自由发挥越多,如:最好的质量,城市,大雨,远景,赛博朋克" value="keywords"
						@input="textareainput" />
					<view class="textareaoperate tn-flex align-center justify-between">
						<!-- <view @click="getincrease" class="increase">描述增幅</view> -->
						<view @click="show_gpt = true" class="increase tn-main-gradient-orangeyellow">咒语助手</view>
						<view class="tn-flex align-center" style="color: #9e9e9e;">
							<view class="">{{cursor}}/500</view>
							<view style="margin: 0 20rpx;">||</view>
							<u-icon @click="keywords = '',galleryid ='',cursor = 0" name="trash-fill" color="#9e9e9e"
								size="24"></u-icon>
						</view>

					</view>
				</view>
				<!-- <view class="tn-flex align-center justify-between polish">
					<view class="tn-flex">
						<view style="margin-right: 10rpx;">描述增幅</view>
						<u-icon @click="getincrease" name="question-circle" color="#909399" size="20"></u-icon>
					</view>
					
					<u-switch size="26" space="2" activeColor="#f9ae3d" inactiveColor="#f1f1f1" v-model="increaseswitch" @change="changepolish"></u-switch>
				</view> -->
				<view v-if="gallerylist.length>0&&!showmj" class="try-tips">
					<scroll-view class="scroll-view" scroll-x="true">
						<block v-for="(item,index) in gallerylist" :key="index">
							<view @click="tapgallery(index)" class="scroll-item"
								:style="{background: galleryid == item.id?'#26b3a0':'',color: galleryid == item.id?'#fff':''}">
								{{item.name}}
							</view>
						</block>
					</scroll-view>
					<view class="change" @click="initWords"><text class="tn-icon-circle-arrow tn-color-cat"
							style="font-size: 34rpx;"></text></view>
				</view>

			</view>


			<!-- <view class="words-ocntainer">
				<view class="sentences">
					<view class="item" v-for="(item, index) in sentence" :key="index" @click="onWords(item)">{{ item }}</view>
				</view>
				<view class="tags">
					<view class="item" v-for="(item, index) in word" :key="index" @click="onWords(item)">{{ item }}</view>
				</view>
			</view> -->
			<!-- <view class="cu-form-group" style="margin-bottom: 0;">
				<view class="cu-title"><view class="title flxe align-center">风格选择</view></view>
			</view> -->
			<!-- <view class="cu-form-group">
			<view class="cu-title flxe align-center justify-between">
				<view class="title flxe align-center">风格选择</view>
				
				</view>
			
			
				<scroll-view class="scrollview" scroll-x="true" style="height: 140rpx;">
					
					<block v-for="(item, index) in custyle" :key="index">
						<view class="scrollstyle">
							<image :src="item.img" mode="aspectFill"></image>
							<view>{{ item.title }}</view>
						</view>
					</block>
				</scroll-view>
			
			</view> -->
			<!-- <view class="cu-form-group" v-if="engineid == 1 || engineid == 2">
				<view class="cu-title"><view class="title flxe align-center">智能拓展</view></view>
				<scroll-view class="scrollview" scroll-x="true">
					<view class="scrollitems" :class="form.enable_face_enhance ? 'active' : ''" @click="onExtend(0)">面部强化</view>
					<view class="scrollitems" :class="form.is_last_layer_skip ? 'active' : ''" @click="onExtend(1)">色彩狂化</view>
				</scroll-view>
			</view> -->
			<view v-if="!showmj" class="cu-form-group">
				<view class="cu-title">
					<view class="title flxe align-center">图片比例</view>
				</view>
				<view class="flxe proportion">
					<view class="radio flxe align-center justify-center flxe-column"
						:class="ratioIndex == 0 ? 'active' : ''" @click="ratio(0)">
						<view class="cu-proportion flxe align-center justify-center">
							<view class="proportion1"></view>
						</view>
						<view class="describe">1:1</view>
					</view>
					<view class="radio flxe align-center justify-center flxe-column"
						:class="ratioIndex == 1 ? 'active' : ''" @click="ratio(1)">
						<view class="cu-proportion flxe align-center justify-center">
							<view class="proportion2"></view>
						</view>
						<view class="describe">3:4</view>
					</view>
					<view class="radio flxe align-center justify-center flxe-column"
						:class="ratioIndex == 2 ? 'active' : ''" @click="ratio(2)">
						<view class="cu-proportion flxe align-center justify-center">
							<view class="proportion3"></view>
						</view>
						<view class="describe">4:3</view>
					</view>
					<!-- <view class="radio flxe align-center justify-center flxe-column" :class="ratioIndex == 3 ? 'active' : ''" @click="ratio(3)">
						<view class="cu-proportion flxe align-center justify-center"><view class="proportion2"></view></view>
						<view class="describe">9:16</view>
					</view>
					<view class="radio flxe align-center justify-center flxe-column" :class="ratioIndex == 4 ? 'active' : ''" @click="ratio(4)">
						<view class="cu-proportion flxe align-center justify-center"><view class="proportion3"></view></view>
						<view class="describe">16:9</view>
					</view> -->
				</view>
			</view>
			<view class="cu-form-group">
				<view class="cu-title">
					<view class="title flxe align-center">参考图(可选)</view>
				</view>
				<view class="desc-tips">AI绘画时会参考您所上传的参考图的风格进行构图</view>
				<view class="cu-upload flxe align-center justify-center">
					<image class="upload-img" :src="refer_img" v-if="refer_img" mode="aspectFill"
						@click="preViewImg(refer_img)"></image>
					<view class="upload-delete tn-icon-delete tn-color-cat" style="font-size: 40rpx;" v-if="refer_img"
						@click="deleteImg()"></view>
					<view class="flxe flxe-column align-center" v-else @click="uploadImg(engineid)">
						<u-icon name="plus-circle-fill" color="#26b3a0" size="28"></u-icon>
						<view class="upload">上传图片</view>
					</view>
				</view>
			</view>
			<!-- <view class="cu-form-group">
				<view class="cu-title"><view class="title flxe align-center">参考图相似度</view></view>
				<view class="desc-tips">相似度越高越遵照原图风格,越低越有创意</view>
				<u-slider v-if="engineid == 0" v-model="form.fidelity" showValue activeColor="#26b3a0" blockColor="#26b3a0" min="0" max="100"></u-slider>
				<u-slider v-else v-model="form.init_strength" showValue activeColor="#26b3a0" blockColor="#26b3a0" min="0" max="70"></u-slider>
			</view> -->
			<view class="cu-form-group">
				<view class="cu-title">
					<view class="title flxe align-center">生成数量</view>
				</view>
				<view class="flxe generate">
					<block v-if="!showmj">
						<view class="xz_generate flxe align-center justify-center"
							:class="form.samples == 1 ? 'xz_gactive' : ''" @click="form.samples = 1">
							<view :style="{color: form.samples == 1 ? '#26b3a0':''}">1张</view>

						</view>
						<!-- <view class="xz_generate flxe align-center justify-center" :class="form.samples == 2 ? 'xz_gactive' : ''" @click="form.samples = 2">
							<view :style="{color: form.samples == 2 ? '#26b3a0':''}">2张</view>
							
						</view>
						<view class="xz_generate flxe align-center justify-center" :class="form.samples == 3 ? 'xz_gactive' : ''" @click="form.samples = 3">
							<view :style="{color: form.samples == 3 ? '#26b3a0':''}">3张</view>
							
						</view> -->
					</block>
					<block v-else>
						<view class="xz_generate flxe align-center justify-center"
							:class="form.samples == 4 ? 'xz_gactive' : ''" @click="form.samples = 4">
							<view :style="{color: form.samples == 4 ? '#26b3a0':''}">4张</view>

						</view>
					</block>


				</view>
			</view>
			<!-- <view class="footer">
				<view @click="createClick" class="Btn1" :data-styleid="1" hoverClass="active">
					<view class="create">
						<view>生成 | 需要消耗{{ needCoin }}积分</view>
					</view>
				</view>
			</view> -->
		</view>


		<!-- 生成按钮 -->
		<view class="dygbhg">
			<navigator class="whole" open-type="navigateBack">退出</navigator>

			<block v-if="showmj">
				<view
					v-if="userData.vip_info&&userData.is_validity>0&&userData.vip_info.mj_times-userData.vip_info.mj_used>0 ||userData.vip_info&&userData.is_validity>0&&userData.vip_info.mj_times == -1"
					@click="createClick" class="distinguish">立即生成</view>
				<view v-else @click="createClick" class="distinguish">生成 |
					需要消耗{{ plan.unlock_mj_aipainting}}{{appInfo.number_alias ? appInfo.number_alias : '点数'}}</view>
			</block>


			<!-- Ai币按钮 -->
			<block v-else>
				<view
					v-if="userData.vip_info&&userData.is_validity>0&&userData.vip_info.sd_times-userData.vip_info.sd_used>0 ||userData.vip_info&&userData.is_validity>0&&userData.vip_info.sd_times == -1"
					@click="createClick" class="distinguish">立即生成</view>
				<view v-else @click="createClick" class="distinguish">生成 |
					需要消耗{{ plan.unlock_aipainting*form.samples}}{{appInfo.number_alias ? appInfo.number_alias : '点数'}}
				</view>
			</block>



		</view>

		<u-loading-page :loading="loading" loading-text="正在加载" icon-size="35" bgColor="#1a1a1a" color="#fff"
			loadingColor="#fff"></u-loading-page>
		<u-popup :show="showmode" @close="showmode = false" safeAreaInsetTop :round="15" closeable>
			<view class="select u-flex justify-center"><text>选择模型</text></view>
			<scroll-view scroll-y="true" class="scroll_mode">
				<view class="tn-flex justify-between flex-wrap">
					<block v-for="(item,index) in modelslist" :key="index">
						<view v-if="item.title" class="card" :style="{borderColor: modelsid == index?'#91F7C1':''}"
							@click="modelsid = index,showmode = false,form.model_id = item.model_id.toString(),xzmodels = item.name,form.name = item.name">
							<u-swiper :list="item.imgs" radius="0" height="110" indicator indicatorMode="line"
								circular></u-swiper>
							<view class="card-info">
								<view class="card-info-title">{{item.title}}</view>
								<view class="card-info-desc">{{item.name}}</view>
							</view>
						</view>
					</block>

				</view>

			</scroll-view>

		</u-popup>
		<u-popup :show="show_gpt" @close="show_gpt = false" mode="center" :round="10" closeable safeAreaInsetTop>
			<view class="gpt-select">
				<view class="gpt-title"><u--text text="咒语助手" iconStyle="font-size: 20px" color="#1a1a1a" bold size="18"
						lineHeight="30"></u--text></view>
				<u--text text="针对AI绘画场景下的gpt模型,能够生成高质量的描述词" color="#9e9e9e" size="14" lineHeight="30"></u--text>
				<!-- <u--text text="输入你的创意 想象"  iconStyle="font-size: 20px" bold size="16" lineHeight="30"></u--text> -->
				<view class="gpt-textarea-container"><u--textarea v-model="gpt_keywords" placeholder="输入你的创意 想象"
						count></u--textarea></view>
				<view class="use-gpt">
					<u-button :text="appInfo.number_alias ? '灵感一现(消耗1'+appInfo.number_alias+')':'灵感一现(消耗1点数)'"
						shape="circle" color="linear-gradient(to right, rgb(255, 202, 40), rgb(255, 167, 38))"
						@click="getGpt"></u-button>
				</view>
				<view class="gpt-textarea-container" style="margin-bottom: 20rpx;"><u--textarea height="200"
						v-model="gpt_text" v-if="gpt_text"></u--textarea></view>
				<u-button type="success" @click="setGpt" plain text="使用" shape="circle" v-if="gpt_text"></u-button>
			</view>
		</u-popup>
		<!-- midJourneyAi币不足弹窗 -->
		<wike-model v-if="signShow" :authorize="false" :title="signTitle" btnText="立即获取" @save="signSign"
			@close="signShow = false"></wike-model>
			
		<wike-modal-qrcode :qrcode="gzhqrcode" :showconcern="showconcern"
			@concernclose="concernclose"></wike-modal-qrcode>
		<!-- <wike-tabbar :onTabbar="true" :isShowAnimate="true"></wike-tabbar> -->
		<!-- <u-picker :show="showmode" :columns="modelslist" keyName="name" @cancel="showmode = false"></u-picker> -->
	</view>
</template>

<script>
	import {
		mapMutations,
		mapActions,
		mapState,
		mapGetters
	} from 'vuex';
	import {
		apiurl
	} from '@/common/request/request';
	let rewardedVideoAd = null;
	export default {
		mixins: [],
		components: {},
		data() {
			return {
				signShow: false,
				signTitle: '',
				tobheight: 45,
				platform: this.$platform.get(),
				indexList: [],


				show_gpt: false,
				gpt_keywords: '',
				gpt_text: '',
				cursor: 0,
				form: {
					// is_anime: true,
					// style: '',
					// task: 'txt2img',
					// act: '',
					// fidelity: 50,
					// text: '',
					// prompt: '',
					// init_image: '',
					// init_strength: 50,
					// guidence_scale: 15,
					// ratio: 2,
					// enable_face_enhance: false,
					// is_last_layer_skip: false,
					// engine: 'stable_diffusion'
					name: '',
					init_image: '',
					prompt: '',
					width: '',
					height: '',
					guidance_scale: '7',
					samples: '1',
					model_id: '',
					scheduler: 'DDPMScheduler',
					type: 'text2img',
					num_inference_steps: '30',
					// lora_model:'guofeng3-lora'
				},
				word: [],
				sentence: [],
				enable_face_enhance: false,
				is_last_layer_skip: false,
				ratioIndex: 0,
				isConnected: true, //是否有网
				page: 1,
				loadmore: 'loading',
				loading: true,
				slider: 50,
				value2: '',
				keywords: '',
				increase: '',
				noincrease: '',
				increaseswitch: false,
				keyword: ['莫斯科', '日落', '橄榄树', '椰子树', '小兔子梵高', '海底世界', '星球'],
				custyle: [{
					img: 'https://pub-8b49af329fae499aa563997f5d4068a4.r2.dev/generations/18134196791680595205.png',
					title: '真人模型'
				}, {
					img: 'https://pub-8b49af329fae499aa563997f5d4068a4.r2.dev/generations/17763741241683163592.png',
					title: '宠物模型'
				}, {
					img: 'https://pub-8b49af329fae499aa563997f5d4068a4.r2.dev/generations/4740030011682234157.png',
					title: '漫画模型'
				}, {
					img: 'https://pub-8b49af329fae499aa563997f5d4068a4.r2.dev/generations/20527297251680823430.png',
					title: '海底模型'
				}],
				showcoin: false,
				addSuc: false,
				plan: {},
				// needCoin: 0,
				cos_img: '',
				cos_id: 0,
				refer_img: '',
				refer_id: 0,
				engine: 'sd',
				engineid: 0,
				needCoin: 0,
				gallerylist: [],
				galleryid: '',
				modelslist: [],
				modelsid: 0,
				xzmodels: '',
				showmode: false,
				noticebar: ['精美图片需要时间打磨，预计20秒-120秒出图',
					// '图片生成中请不要退出，否则可能会生成失败'
				],
				tabslist: ['StableDiffusion绘图', 'MidJourney绘图'],
				curNow: 0,
				cardswiper: [
					'https://cos.iseeds.xyz/cover/3.0-1.jpg',
					'https://cos.iseeds.xyz/cover/hhjmix-3.png',
					'https://cos.iseeds.xyz/style/gufeng1.png',
				],
				showmj: false,
				current: 0,
				showconcern: false,
				gzhqrcode: '',
				proportion: ''
			};
		},
		computed: {
			...mapGetters(['appInfo', 'homeTemplate', 'userInfo', 'isLogin', 'userData'])
		},
		onLoad() {
			if (this.platform == 'wxMiniProgram') {
				var menumtop = uni.getMenuButtonBoundingClientRect().top - uni.getSystemInfoSync().statusBarHeight;
				var paddingtop = uni.getSystemInfoSync().statusBarHeight + menumtop;
				this.tobheight = menumtop + paddingtop + uni.getMenuButtonBoundingClientRect().height;
			}
			if (this.$Route.query.prompt) {
				this.keywords = this.$Route.query.prompt
				this.cursor = this.$Route.query.prompt.length
				this.current = this.$Route.query.engine == 'sd' ? 0 : 1
				this.showmj = this.$Route.query.engine == 'sd' ? false : true
				if (this.$Route.query.engine == 'sd') {
					this.form.samples = 1
					this.engine = 'sd'
					this.modelslist = []
					this.getModels();
				} else {
					this.form.samples = 4
					this.engine = 'mj'
					this.modelslist = []
					this.getModels();
				}


			}
			this.gallery();
			this.getModels();
			this.getPlan()
		},
		onShow() {
			// 网络变化检测
			uni.onNetworkStatusChange(res => {
				this.isConnected = res.isConnected;

			});
			if (this.isLogin) {
				this.getUserData();

			}
			this.systemwechat()
		},
		onReady() {
			// #ifdef MP-WEIXIN
			if (wx.createRewardedVideoAd && this.appInfo.video_status == 1) {
				rewardedVideoAd = wx.createRewardedVideoAd({
					adUnitId: this.appInfo.video_id
				});
				rewardedVideoAd.onLoad(() => {
					console.log('onLoad event emit');
				});
				rewardedVideoAd.onError(err => {
					console.log('onError event emit', err);
				});
				rewardedVideoAd.onClose(res => {
					if (res && res.isEnded) {
						// 正常播放结束，可以下发游戏奖励
						this.memberAddCoin();
						this.showcoin = false;
					} else {
						// 播放中途退出，不下发游戏奖励
						uni.showToast({
							title: '看完广告后才可获得积分哦',
							icon: 'none'
						});
					}
				});
			}
			// #endif
			this.loading = false;
		},
		methods: {
			...mapActions(['appInit', 'logout', 'getUserInfo', 'getUserData']),
			signSign() {
				uni.navigateTo({
					url: '/pages/user/member/member'
				});
				this.signShow = false
			},
			systemwechat() {
				this.$http('conf.getGroupConf', {
					group: 'system.wechat'
				}).then(res => {
					if (res.code == 0) {
						this.gzhqrcode = res.data.qrcode_path
						const focuson = uni.getStorageSync('focuson');
						// console.log(focuson);
						if (!focuson) {
							if (this.gzhqrcode) {
								if (this.isLogin && this.appInfo.is_show_logged_qrcode == 1) {
									this.showconcern = true
								}
							}
						}
					}
				})
			},
			concernclose() {
				this.showconcern = false
			},
			getsubsection(e) {
				this.showmj = e.index == 1 ? true : false
				this.current = e.index
				this.modelsid = 0
				if (e.index == 1) {
					this.form.samples = 4
					this.engine = 'mj'
					this.modelslist = []
					this.getModels();
				} else {
					this.form.samples = 1
					this.engine = 'sd'
					this.modelslist = []
					this.getModels();
				}
				this.initWords()
			},

			async getGpt() {
				if (!this.isLogin) {
					uni.navigateTo({
						url: '/pages/user/signin'
					});
					uni.setStorageSync('route', '/pages/painting/draw');
					return;
				}
				if (!this.gpt_keywords) {
					uni.showToast({
						title: '请填写描述词',
						icon: 'none'
					});
					return;
				}
				if (this.userData.coin == 0) {
					var alias = this.appInfo.number_alias ? this.appInfo.number_alias : '点数';
					this.signTitle =
						"<p style='font-weight: 550;font-size: 16px;'>灵感一现需要<span style='color: #26b3a0;padding: 0 4px;'>" +
						1 + "</span><span>" + alias +
						"</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #26b3a0;padding: 0 4px;'>" +
						this.userData.coin + "</span><span>" + alias + "</span>，不支持会员时长，无法生成，快去获取<span>" + alias +
						"</span>吧</p>"
					this.signShow = true
					return;
				}
				uni.showLoading({
					title: '内容审核中...'
				})
				// #ifdef H5
				let check = this.appInfo.is_h5_filter && this.appInfo.is_h5_filter == 1 ? await this.getcheckText(this
						.gpt_keywords) :
					1;
				// #endif
				// #ifdef MP-WEIXIN
				let check = await this.getcheckText(this.gpt_keywords);
				// #endif
				if (check == 1) {
					uni.showLoading({
						title: '咒语生成中...'
					})
					this.$http('gallery.chat', {
						prompt: this.gpt_keywords
					}).then(res => {
						if (res.code == 0) {
							this.gpt_text = res.data;
							uni.hideLoading();
						} else {
							uni.hideLoading();
							uni.showToast({
								title: '使用咒语失败,请尝试重试',
								icon: 'none'
							});
						}
					});
				}
			},
			setGpt() {
				// console.log(this.gpt_text.indexOf("英文："));
				if (this.gpt_text.indexOf("英文：") != -1) {
					let index = this.gpt_text.indexOf("英文：");
					let text = this.gpt_text.substring(index + 3);
					// console.log(text);
					this.keywords = text
					this.cursor = this.keywords.length
					// console.log(this.keywords.length);
				} else {
					let text = this.gpt_text;
					this.keywords = text
					this.cursor = this.keywords.length
				}
				this.show_gpt = false
			},
			textareainput(e) {
				// console.log(e.detail.cursor);
				this.cursor = e.detail.cursor
			},
			sectionChange(index) {
				this.curNow = index;
			},
			gallery() {
				let that = this;
				this.$http('gallery.getWords').then(res => {
					if (res.code == 0) {
						this.gallerylist = res.data
					}
				});
			},
			getModels() {
				let that = this;
				this.$http('gallery.getModels', {
					engine: that.engine
				}).then(res => {
					if (res.code == 0) {
						uni.setNavigationBarTitle({
							title: this.appInfo.site_name
						});
						this.modelslist = res.data
						this.form.model_id = this.modelslist[this.modelsid].model_id.toString()
						this.form.name = this.modelslist[this.modelsid].name
						// this.needCoin = this.modelslist[this.modelsid].coin
						this.xzmodels = this.modelslist[this.modelsid].name
						// console.log(this.modelslist);
						if (this.$Route.query.model_name) {
							for (var ty = 0; ty < this.modelslist.length; ty++) {
								if (this.$Route.query.model_name == this.modelslist[ty].name) {
									// console.log(ty);
									this.modelsid = ty
									this.form.model_id = this.modelslist[ty].model_id.toString()
									// this.needCoin = this.modelslist[ty].coin
									this.xzmodels = this.modelslist[ty].name
									this.form.name = this.modelslist[ty].name
								}
							}
						}
					}
				});
			},
			tapgallery(e) {
				// console.log(this.gallerylist[e].guide.slice(0,500));
				this.keywords = this.gallerylist[e].guide.slice(0, 500)
				this.galleryid = this.gallerylist[e].id
				this.cursor = this.keywords.length
			},

			changepolish() {
				// console.log(e);

				uni.showLoading({
					title: '描述增幅中...'
				})
				this.$http('gallery.chat', {
					prompt: this.keywords
				}).then(res => {
					if (res.code == 0) {
						// this.increaseswitch = e
						// this.increase = res.data
						this.keywords = res.data
					}
				});
				// if(e){
				// 	if(this.increase){
				// 		this.keywords = this.increase
				// 		return;
				// 	}
				// 	this.increaseswitch = false
				// 	uni.showLoading({
				// 		title:'描述增幅中...'
				// 	})
				// 	this.noincrease = this.keywords
				// 	this.$http('gallery.chat', {prompt:this.keywords}).then(res => {
				// 		if (res.code == 0) {
				// 			this.increaseswitch = e
				// 			this.increase = res.data
				// 			this.keywords = res.data
				// 		}
				// 	});
				// 	return;
				// }
				// this.keywords = this.noincrease

			},
			getincrease() {
				var that = this;
				if (!this.keywords) {
					uni.showToast({
						title: '请输入描述',
						icon: 'none'
					})
					return;
				}
				uni.showModal({
					confirmText: '立即增幅',
					// showCancel:false,
					confirmColor: '#26B3A0',
					content: '如果你正在寻找灵感,或懒得输入描述词,开启描述增幅GTP模型将自动根据你的输入的描述词为你补充描述词',
					title: '提示',
					success(res) {
						if (res.confirm) {
							that.changepolish()
						}
					}
				});
			},
			// loadmores() {
			// 	for (let i = 0; i < 30; i++) {
			// 		this.indexList.push({
			// 			url: this.urls[uni.$u.random(0, this.urls.length - 1)]
			// 		});
			// 	}
			// },

			getPlan() {
				this.$http('conf.getGroupConf', {
					group: 'system.plan'
				}).then(res => {
					if (res.code == 0) {
						this.plan = res.data;
						uni.setNavigationBarTitle({
							title: this.appInfo.site_name
						});
						// console.log(this.plan);
					}
				});
			},
			initWords() {
				this.gallerylist = uni.$u.randomArray(this.gallerylist)
			},
			ratio(e) {
				this.ratioIndex = e;
			},
			onExtend(e) {
				if (e == 0) {
					this.form.enable_face_enhance = !this.enable_face_enhance;
				} else {
					this.form.is_last_layer_skip = !this.is_last_layer_skip;
				}
			},
			onWords(e) {
				this.keywords = this.keywords ? this.keywords + ',' + e : e;
			},

			// 点击生成按钮
			async createClick() {
				var that = this;
				// 判断用户是否登录
				if (!this.isLogin) {
					uni.navigateTo({
						url: '/pages/user/signin'
					});
					uni.setStorageSync('route', '/pages/painting/draw');
					return;
				}

				if (that.appInfo.time_member && that.appInfo.time_member == 1) {
					if (that.showmj) {
						if (that.userData.vip_info && that.userData.is_validity > 0 && that.userData.vip_info
							.mj_used ==
							that.userData.vip_info.mj_times && this.userData.coin < this.plan.unlock_mj_aipainting) {
							var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
							// this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的绘画<span>" + alias +
							// 	"</span>不足或会员套餐内剩余绘画次数不足，无法生成绘画</p>"
							this.signTitle =
								"<p style='font-weight: 550;font-size: 16px;'>绘画需要<span style='color: #26b3a0;padding: 0 4px;'>" +
								that.plan.unlock_mj_aipainting + "</span><span>" + alias +
								"</span></p><p style='padding-top: 10px;'>您的绘画<span>" + alias +
								"</span>不足或会员套餐内剩余次数不足，无法生成绘画</p>"
							this.signShow = true
							return;
						}
						if (that.userData.is_validity == 0 && this.userData.coin < this.plan.unlock_mj_aipainting) {
							// 用户绘制没Mjai币不足
							console.log('999999999999999999999999999-2');
							var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
							this.signTitle =
								"<p style='font-weight: 550;font-size: 16px;'>绘画需要<span style='color: #26b3a0;padding: 0 4px;'>" +
								that.plan.unlock_mj_aipainting + "</span><span>" + alias +
								"</span></p><p style='padding-top: 10px;'>您的绘画<span>" + alias +
								"</span>不足或会员套餐内剩余次数不足，无法生成绘画</p>"
							this.signShow = true
							return;
							
						}
					} else {
						// 消耗Ai币
						// 验证是否符合生成条件

						if (that.userData.vip_info && that.userData.is_validity > 0 && that.userData.vip_info
							.sd_used == that.userData.vip_info
							.sd_times && this.userData.coin < (this.plan.unlock_aipainting * this.form.samples)) {
							var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
							// this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的绘画<span>" + alias +
							// 	"</span>不足或会员套餐内剩余次数不足，无法生成绘画</p>"
							this.signTitle =
								"<p style='font-weight: 550;font-size: 16px;'>绘画需要<span style='color: #26b3a0;padding: 0 4px;'>" +
								(this.plan.unlock_aipainting * this.form.samples) + "</span><span>" + alias +
								"</span></p><p style='padding-top: 10px;'>您的绘画<span>" + alias +
								"</span>不足或会员套餐内剩余次数不足，无法生成绘画</p>"
							this.signShow = true
							return;
						}

						if (that.userData.is_validity == 0 && this.userData.coin < (this.plan.unlock_aipainting * this
								.form.samples)) {
							var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
							this.signTitle =
								"<p style='font-weight: 550;font-size: 16px;'>绘画需要<span style='color: #26b3a0;padding: 0 4px;'>" +
								(this.plan.unlock_aipainting * this.form.samples) + "</span><span>" + alias +
								"</span></p><p style='padding-top: 10px;'>您的绘画<span>" + alias +
								"</span>不足或会员套餐内剩余次数不足，无法生成绘画</p>"
							this.signShow = true
							return;
						}

					}
				} else {
					if (that.showmj && this.userData.coin < this.plan.unlock_mj_aipainting) {
						var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
						this.signTitle =
							"<p style='font-weight: 550;font-size: 16px;'>mj绘画需要<span style='color: #26b3a0;padding: 0 4px;'>" +
							this.plan.unlock_mj_aipainting + "</span><span>" + alias +
							"</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #26b3a0;padding: 0 4px;'>" +
							this.userData.coin + "</span><span>" + alias + "</span>，无法生成绘画，快去获取<span>" + alias +
							"</span>吧</p>"
						this.signShow = true
						return;
					}
					if (!that.showmj && this.userData.coin < (this.plan.unlock_aipainting * this.form.samples)) {
						var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
						this.signTitle =
							"<p style='font-weight: 550;font-size: 16px;'>sd绘画需要<span style='color: #26b3a0;padding: 0 4px;'>" +
							this.plan.unlock_aipainting * this.form.samples + "</span><span>" + alias +
							"</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #26b3a0;padding: 0 4px;'>" +
							this.userData.coin + "</span><span>" + alias + "</span>，无法生成绘画，快去获取<span>" + alias +
							"</span>吧</p>"
						this.signShow = true
						return;
					}
				}
				// if(that.showmj){
				// 	if(this.userData.coin < this.plan.unlock_mj_aipainting){
				// 				var alias = this.appInfo.number_alias ? this.appInfo.number_alias : '点数';
				// 				this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>绘画需要<span style='color: #26b3a0;padding: 0 4px;'>"+this.plan.unlock_mj_aipainting+"</span><span>"+alias+"</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #26b3a0;padding: 0 4px;'>"+this.userData.coin+"</span><span>"+alias+"</span>，不支持会员时长，无法生成绘画，快去获取<span>"+alias+"</span>吧</p>"
				// 				this.signShow = true
				// 		return;
				// 	}
				// }else{
				// 	if(this.userData.coin < (this.plan.unlock_aipainting*this.form.samples)){
				// 				var alias = this.appInfo.number_alias ? this.appInfo.number_alias : '点数';
				// 				this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>绘画需要<span style='color: #26b3a0;padding: 0 4px;'>"+this.plan.unlock_aipainting*this.form.samples+"</span><span>"+alias+"</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #26b3a0;padding: 0 4px;'>"+this.userData.coin+"</span><span>"+alias+"</span>，不支持会员时长，无法生成绘画，快去获取<span>"+alias+"</span>吧</p>"
				// 				this.signShow = true
				// 		return;
				// 	}
				// }			
				if (!this.keywords) {
					uni.showToast({
						title: '请输入画面描述词',
						icon: 'none'
					});
					return;
				}
				// console.log(this.form);
				if (!this.form.model_id) {
					uni.showToast({
						title: '请选择绘图模型',
						icon: 'none'
					});
					return;
				}
				// else if (this.userInfo.coin < 100) {
				// 	var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
				// 	uni.showModal({
				// 		confirmText: '立即获取',
				// 		confirmColor: '#26B3A0',
				// 		content: '您的' + alias + '不足，当前绘画需要'+ that.plan.lock_aipainting+alias+'，暂不支持会员时长。',
				// 		title: '提示',
				// 		success(res) {
				// 			if (res.confirm) {
				// 				uni.navigateTo({
				// 					url: '/pages/user/member/member'
				// 				});
				// 			}
				// 		}
				// 	});
				// return;
				// this.showcoin = true;
				// 	return;
				// } 
				else {
					// this.gallerychat()
					uni.showLoading({
						title: '内容审核中...'
					})
					// #ifdef H5
					let check = this.appInfo.is_h5_filter && this.appInfo.is_h5_filter == 1 ? await this.getcheckText(
							this.keywords) :
						1;
					// #endif
					// #ifdef MP-WEIXIN
					let check = await this.getcheckText(this.keywords);
					// #endif
					if (check == 1) {
						this.aiPlay(this.keywords);
					}

				}
				// uni.navigateTo({
				// 	url:'/pages/painting/generate'
				// })
			},
			getcheckText(e) {
				var that = this;
				return new Promise((resolve, reject) => {
					that.$http('ai.checkText', {
						prompt: e
					}).then(res => {
						if (res.code == 0) {
							resolve(1);
						}
					})
				});
			},
			gallerychat() {
				uni.showLoading({
					title: '润色中...'
				})
				this.$http('gallery.chat', {
					prompt: this.keywords
				}).then(res => {
					if (res.code == 0) {
						this.aiPlay(res.data);
					}
				});
			},
			aiPlay(e) {
				let that = this;
				that.form.prompt = e;
				switch (this.ratioIndex) {
					case 0:
						that.form.width = '512';
						that.form.height = '512';
						that.proportion = '';
						break;
					case 1:
						that.form.width = '512';
						that.form.height = '768';
						that.proportion = ' --ar 3:4';
						break;
					case 2:
						that.form.width = '768';
						that.form.height = '512';
						that.proportion = ' --ar 4:3';
						break;
					case 3:
						that.form.width = '512';
						that.form.height = '1024';
						that.proportion = ' --ar 9:16';
						break;
					case 4:
						that.form.width = '1024';
						that.form.height = '512';
						that.proportion = ' --ar 16:9';
						break;
				}

				if (that.refer_img) {
					that.form.init_image = that.refer_img;
					that.form.type = 'img2img';
				} else {
					that.form.type = 'text2img';
				}
				// console.log(that.form);

				uni.navigateTo({
					url: that.showmj ? '/pages/painting/generate?prompt=' + ((that.refer_img ? that.refer_img +
							' ' : '') + that.form.prompt + (that.proportion ? that.proportion : '')) +
						'&model_id=' + (that.modelslist.length > 0 ? this.form.model_id : '') + '&version=' + (that
							.modelslist.length > 0 ? that.modelslist[this.modelsid].version : '-- v5') +
						'&needCoin=' + that.plan.unlock_mj_aipainting : '/pages/painting/details?form=' + JSON
						.stringify(this.form)
				});
				// this.$http('gallery.create', this.form).then(res => {
				// 	if (res.code == 0) {
				// 		if(res.data.output.length > 0){
				// 			uni.navigateTo({
				// 				url: '/pages/painting/details?url=' + res.data.output
				// 			});
				// 		}else{
				// 			uni.showToast({
				// 				title:'生成失败',
				// 				icon:'error'
				// 			})
				// 		}
				// 		uni.hideLoading();
				// 	}
				// });
			},
			close_blur_view() {
				this.showcoin = false;
			},
			toMember() {
				uni.navigateTo({
					url: '/pages/member/member'
				});
			},
			toWelfare() {
				uni.switchTab({
					url: '/pages/welfare/welfare'
				});
			},
			showVideoAd() {
				if (rewardedVideoAd) {
					uni.showToast({
						title: '广告拉取中',
						icon: 'none'
					});
					rewardedVideoAd.show().catch(() => {
						// 失败重试
						rewardedVideoAd
							.load()
							.then(() => rewardedVideoAd.show())
							.catch(err => {
								console.log('激励视频 广告显示失败');
								uni.showToast({
									title: '广告显示失败',
									icon: 'none'
								});
							});
					});
				}
			},
			memberAddCoin() {
				this.$http('member.addCoin', {
					type: 'video'
				}).then(res => {
					if (res.code == 0) {
						uni.showToast({
							title: '获得积分+' + res.data
						});
						// let coin = {coin: this.userData.coin+1}
						// that.$store.commit('userData',coin)
						this.getUserInfo();
					} else {
						uni.showToast({
							title: '获得积分失败',
							icon: 'none'
						});
					}
				});
			},
			uploadImg(engineid) {
				let that = this;
				uni.chooseImage({
					count: 1, //count: 6, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success: function(res) {
						const path = res.tempFilePaths[0];
						uni.uploadFile({
							url: apiurl('common/upload'),
							filePath: path,
							// name: 'img',
							// formData: {
							// 	platform: $platform.get(),
							// 	accept: 'image'
							// },
							name: 'file',
							formData: {
								accept: 'image'
							},
							success: res2 => {
								let a = JSON.parse(res2.data);
								if (a.code == 0) {
									// if (engineid == 0) {
									// 	that.cos_img = a.data.path;
									// 	that.cos_id = a.data.id;
									// } else {
									that.refer_img = a.data.path;
									that.refer_id = a.data.id;
									// }
								} else {
									uni.showToast({
										title: '上传图片失败',
										icon: 'none'
									});
								}
							}
						});
					}
				});
			},
			preViewImg(img) {
				uni.previewImage({
					urls: [img],
					longPressActions: {
						itemList: ['发送给朋友', '保存图片', '收藏'],
						success: function(data) {},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				});
			},
			deleteImg() {
				// if (engineid == 0) {
				// 	this.cos_img = '';
				// 	this.cos_id = 0;
				// } else {
				this.refer_img = '';
				// this.refer_id = 0;
				// }
			},
			open() {
				// console.log('open');
			},

		}
	};
</script>

<style lang="scss">
	.bg {
		position: fixed;
		top: 0;
		width: 100%;
		height: 100%;
		// background: linear-gradient(-45deg, #1a1a1a, #262626, #0d0d0d);
		z-index: -1;
	}


	@-webkit-keyframes Btn1 {
		0% {
			background-position: 0 50%;
		}

		50% {
			background-position: 100% 50%;
		}

		100% {
			background-position: 0 50%;
		}
	}

	@keyframes Btn1 {
		0% {
			background-position: 0 50%;
		}

		50% {
			background-position: 100% 50%;
		}

		100% {
			background-position: 0 50%;
		}
	}

	@-webkit-keyframes Btn1_ {
		0% {
			transform: translateX(-100%);
		}

		100% {
			transform: translateX(0);
		}
	}

	@keyframes Btn1_ {
		0% {
			transform: translateX(-100%);
		}

		100% {
			transform: translateX(0);
		}
	}

	.Btn1::before {
		// animation: Btn1__1 0.4s linear 0.4s infinite;
		background: #fff;
		border-radius: 100rpx;
		content: '';
		height: 100rpx;
		left: calc(50% - 50rpx);
		opacity: 0;
		position: absolute;
		top: calc(50% - 50rpx);
		width: 100rpx;
	}

	@-webkit-keyframes Btn1__1 {
		0% {
			opacity: 0.7;
			transform: scale(0);
		}

		100% {
			opacity: 0;
			transform: scale(2);
		}
	}

	@keyframes Btn1__1 {
		0% {
			opacity: 0.7;
			transform: scale(0);
		}

		100% {
			opacity: 0;
			transform: scale(2);
		}
	}

	.Btn1::after {
		// animation: Btn1__2 0.8s linear 0.4s infinite;
		background: #fff;
		border-radius: 100rpx;
		content: '';
		height: 100rpx;
		left: calc(50% - 50rpx);
		opacity: 0;
		position: absolute;
		top: calc(50% - 50rpx);
		width: 100rpx;
	}

	@-webkit-keyframes Btn1__2 {
		0% {
			opacity: 0.7;
			transform: scale(0);
		}

		100% {
			opacity: 0;
			transform: scale(2.5);
		}
	}

	@keyframes Btn1__2 {
		0% {
			opacity: 0.7;
			transform: scale(0);
		}

		100% {
			opacity: 0;
			transform: scale(2.5);
		}
	}

	.Btn1 text {
		line-height: 38rpx;
		text-align: center;
	}

	.Btn1 image {
		animation: Btn1_image 0.8s linear infinite alternate;
		left: 30rpx;
		position: absolute;
		top: -30rpx;
	}

	@-webkit-keyframes Btn1_image {
		0% {
			transform: rotate(0);
		}

		100% {
			transform: rotate(18deg);
		}
	}

	@keyframes Btn1_image {
		0% {
			transform: rotate(0);
		}

		100% {
			transform: rotate(18deg);
		}
	}

	.cu-form-group {
		padding: 16rpx 0;

		.cu-title {
			margin-bottom: 4rpx;

			.title {
				text-align: justify;
				padding-right: 30rpx;
				font-size: 30rpx;
				position: relative;
				height: 60rpx;
				line-height: 60rpx;
				min-width: calc(5em + 15px);
				font-weight: bold;
				color: #000;
				// view {
				// 	color: red;
				// }
				// .shu {
				// 	background: #fff;
				// 	width: 5px;
				// 	height: 38rpx;
				// 	margin-right: 20rpx;
				// }
			}

			.cu-empty {
				.empty {
					margin-right: 8rpx;
					font-size: 26rpx;
					color: #fff;
					z-index: 9;
				}
			}
		}

		.engine-container {
			background-color: #f1f1f1;
			padding: 20rpx;
			border-radius: 22rpx;
			display: flex;
			justify-content: space-between;
			margin-top: 16rpx;

			.model_view {
				color: #9e9e9e;
			}
		}

		.textarea-container {
			// padding: 30rpx;
			background: #f1f1f1;
			border-radius: 18rpx;

			// textarea {
			// 	width: 100%;
			// 	height: 100rpx;
			// 	font-size: 28rpx;
			// 	color: #303133db;
			// }
			.textarea {
				background-color: #f1f1f1;
				width: 100%;
				height: 260rpx;
				padding: 20rpx;
				border-radius: 18rpx;
				margin-top: 16rpx;
				color: #9e9e9e;
			}

			.textareaoperate {
				padding: 0 30rpx 22rpx;

				.increase {
					// background: #ffa726;
					color: #fff;
					padding: 6px 16px;
					font-size: 14px;
					border-radius: 20px;
				}

				view {
					font-size: 32rpx;
					// margin-right: 30rpx;
				}
			}

			.trash {
				width: 100%;
				justify-content: flex-end;
			}
		}

		.scrollview {
			white-space: nowrap;
			margin-top: 16rpx;

			.scrollitems {
				display: inline-block;
				background: #f3f3f3;
				text-align: center;
				padding: 12rpx 32rpx;
				margin-right: 30rpx;
				border-radius: 6rpx;
				font-size: 26rpx;
			}

			.scrollitems.active {
				background: #6f2fdb;
				color: #fff;
			}
		}

		.scrollstyle {
			display: inline-block;
			position: relative;
			width: 200rpx;
			height: 140rpx;
			margin-right: 30rpx;

			image {
				width: 200rpx;
				height: 140rpx;
				border-style: solid;
				border-color: #ffca28;
				border-width: 8rpx;
			}

			view {
				position: absolute;
				bottom: 8rpx;
				width: 184rpx;
				text-align: center;
				color: #fff;
				background: #000000a8;
				font-size: 24rpx;
				margin-left: 8rpx;
			}
		}

		.proportion {
			// margin-left: 30rpx;
			display: flex;
			margin-top: 16rpx;

			.radio {
				margin-right: 48rpx;
				border-radius: 8rpx;
			}

			.describe {
				font-size: 28rpx;
				margin-top: 12rpx;
				color: #9e9e9e;
			}
		}

		.cu-proportion {
			width: 100rpx;
			height: 100rpx;
			border-style: solid;
			border-width: 4rpx;
			border-radius: 10rpx;
			border-color: #d9d9d9;


			.proportion1 {
				width: 72rpx;
				height: 72rpx;

				background: #d9d9d9;
				border-radius: 10rpx;

			}

			.proportion2 {
				width: 45rpx;
				height: 72rpx;
				border-radius: 4rpx;
				background: #d9d9d9;
				border-radius: 10rpx;
			}

			.proportion3 {
				width: 72rpx;
				height: 45rpx;
				border-radius: 4rpx;
				background: #d9d9d9;
				border-radius: 10rpx;
			}
		}

		.radio.active {
			color: #26b3a0;

			.cu-proportion {
				border-color: #26b3a0;
			}

			.cu-proportion view {
				background: #26b3a0;
			}
		}

		.cu-upload {
			width: 100%;
			height: 260rpx;
			background: #f1f1f1;
			border-radius: 20rpx;
			// border-style: double;
			border-color: #d3d4d6;
			position: relative;

			.upload-img {
				width: 100%;
				height: 100%;
				border-radius: 20rpx;
			}

			.upload-delete {
				position: absolute;
				right: 8rpx;
				top: 8rpx;
				color: #26b3a0;
			}

			.upload {
				margin-top: 12rpx;
				color: #9e9e9e;
			}
		}

		.tn-slider__custom-block {
			background-color: #fff;
			width: auto;
			height: 40rpx;
			line-height: 40rpx;
			padding: 0 5rpx;
			border-radius: 50%;
			text-align: center;
			color: #ffffff;
		}
	}

	.bnt {
		font-size: 32rpx;
		font-weight: bold;
		color: #fff;
		width: 690rpx;
		height: 100rpx;
		text-align: center;
		border-radius: 100rpx;
		line-height: 100rpx;
		margin: 64rpx auto 15rpx;
		background: #fff;
	}

	.buttonhover {
		background: #fff;
		opacity: 0.7;
	}

	/* 底部安全边距 start*/
	.tn-tabbar-height {
		min-height: 120rpx;
		height: calc(140rpx + env(safe-area-inset-bottom) / 2);
		height: calc(140rpx + constant(safe-area-inset-bottom));
	}

	.try-tips {
		// padding: 0 16rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-top: 20rpx;
		// color: #d9d9d9;

		.change {
			display: flex;
			align-items: center;

			&-text {
				margin-left: 6rpx;
			}
		}
	}

	.polish {
		margin-top: 20rpx;

		view {
			font-size: 30rpx;
			font-weight: bold;
			color: #000;
			// margin-right: 30rpx;
		}
	}

	.words-ocntainer {
		padding: 0 16rpx;

		.sentences {
			display: flex;
			flex-wrap: wrap;

			.item {
				padding: 8rpx 16rpx;
				margin-bottom: 10rpx;
				background: #333333;
				color: #8f8f8f;
				font-size: 14px;
				border-radius: 10rpx;
				font-size: 13px;
			}
		}

		.tags {
			display: flex;
			flex-wrap: wrap;

			.item {
				padding: 8rpx 16rpx;
				margin-bottom: 10rpx;
				margin-right: 10rpx;
				background: #333333;
				color: #8f8f8f;
				font-size: 14px;
				border-radius: 10rpx;
				font-size: 13px;
			}
		}
	}

	.desc-tips {
		margin-bottom: 20rpx;
		color: #d9d9d9;
		font-size: 13px;
	}



	.footer {
		margin-top: 80rpx;
		// padding-bottom: 100rpx;
		position: fixed;
		bottom: 60rpx;
		width: 92%;
		z-index: 999;
		border-radius: 20rpx;

		.Btn1 {

			// animation: Btn1 3s ease infinite alternate, Btn1_ 0.4s linear alternate;
			// background: linear-gradient(60deg, #f79533, #f37055, #6f2fdb, #a166ab, #5073b8, #1098ad, #07b39b, #6fba82);

			// background-size: 300% 300%;
			// border: solid #fff;
			// border-radius: 20rpx;
			// border-width: 2rpx 2rpx 6rpx;
			// box-shadow: 0rpx 20rpx 20rpx 0rpx rgba(162, 253, 197, 0.4);
			border-radius: 20rpx;
			background: linear-gradient(to right, #00ca88, #00BCD4);
			color: #fff;
			display: flex;
			font-size: 30rpx;
			font-weight: 600;
			height: 80rpx;
			justify-content: center;
			align-items: center;
			// width: 650rpx;

			.create {
				width: 100%;
				display: flex;
				align-items: center;
				flex-direction: column;
			}
		}


	}



	.userAvatarUrl_view {
		border-radius: 100rpx;
		height: 80rpx;
		margin-bottom: 15rpx;
		overflow: hidden;
		width: 80rpx;
	}

	.scroll-view {
		white-space: nowrap;
		width: 94%;

		.scroll-item {
			display: inline-block;
			text-align: center;
			margin-right: 10rpx;
			padding: 10rpx 20rpx;
			background-color: #f1f1f1;
			height: 60rpx;
			border-radius: 30rpx;
			color: #26b3a0;
		}
	}

	.directask {
		padding: 14rpx 30rpx 250rpx;
	}

	.dygbhg {
		background: #ffffff;
		border-radius: 20rpx 20rpx 0 0;
		position: fixed;
		bottom: 0;
		width: 100%;
		box-shadow: 0px 0px 10px #00000024;
		display: flex;
		align-items: center;
		justify-content: space-evenly;
		z-index: 999;
	}

	.whole {
		width: 30%;
		height: 80rpx;
		display: flex;
		color: #ffffff;
		align-items: center;
		justify-content: center;
		background: #d9d9d9;
		// font-weight: bold;
		border-radius: 60rpx;
	}

	.distinguish {
		width: 56%;
		height: 80rpx;
		display: flex;
		color: #ffffff;
		align-items: center;
		justify-content: center;
		background: linear-gradient(to right, #00ca88, #00BCD4);
		font-weight: bold;
		border-radius: 60rpx;
		margin: 38rpx 0;
		margin-left: 4%;
	}

	.select {
		font-weight: bold;
		font-size: 32rpx;
		margin: 30rpx;
	}

	.scroll_mode {
		height: 1100rpx;
		padding: 0rpx 30rpx 30rpx;

		.card {
			// border-radius: 8px;
			width: 32%;
			height: 12.5rem;
			background: #f1f1f180;
			margin-bottom: 20rpx;
			border-style: solid;
			border-color: #fff;
			border-width: 3px;
			// border: 3px solid transparent;

			.card-info {
				padding: .4375rem .375rem;

				.card-info-title {
					// color: #fff;
					line-height: 1.5rem;
				}

				.card-info-desc {
					font-size: 24rpx;
					line-height: 1.25rem;
					height: 40px;
					color: #999;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
					overflow: hidden;
				}
			}

		}
	}

	.generate {
		margin-top: 8px;

		.xz_generate {
			width: 150rpx;
			height: 90rpx;
			background: #f1f1f1;
			margin-right: 30rpx;
			border-style: solid;
			border-color: #f1f1f1;
			border-width: 3px;
			border-radius: 6px;
		}

		.xz_gactive {
			width: 150rpx;
			height: 90rpx;
			background: #f1f1f1;
			border-style: solid;
			border-color: #26b3a0;
			border-width: 3px;
			border-radius: 6px;
		}
	}

	.gpt-select {
		padding: 30rpx;

		.gpt-textarea-container {
			margin-top: 20rpx;
		}

		.use-gpt {
			margin-top: 30rpx;
		}
	}
</style>