|
@@ -1,1219 +0,0 @@
|
|
|
-<template>
|
|
|
|
|
- <view class="outer">
|
|
|
|
|
- <view style="color: #fff;">
|
|
|
|
|
- <tn-nav-bar backgroundColor="#207CF7" :bottomShadow="false">AI绘图</tn-nav-bar>
|
|
|
|
|
- <view :style="{ height: tobheight + 'px' }"></view>
|
|
|
|
|
- </view>
|
|
|
|
|
- <!-- 绘画引导界面 -->
|
|
|
|
|
- <view class="addmask" v-if="showHuiHuaLead">
|
|
|
|
|
- <view class="leadBg">
|
|
|
|
|
- <view class="leadBox1" v-if="showLead1">
|
|
|
|
|
- <view class="nextBtn" @click="nextLead">
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="leadBox2" v-if="showLead2">
|
|
|
|
|
- <view class="nextBtn" @click="finishLead">
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- <u-notice-bar bgColor='#C6D6E4' color='#3F5465' :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="#207CF7" @change="getsubsection" buttonColor="tn-cool-bg-color-7"
|
|
|
|
|
- inactiveColor="#FFFFFF" activeColor="#357aba"></tn-subsection>
|
|
|
|
|
- </view>
|
|
|
|
|
-
|
|
|
|
|
- <view class="directask">
|
|
|
|
|
- <!-- <view v-if="modelslist.length>0" class="cu-form-group"> -->
|
|
|
|
|
- <view 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="#207CF7" borderColor="#207CF7"
|
|
|
|
|
- bgColor="#207CF714"></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="#207CF7" borderColor="#207CF7"
|
|
|
|
|
- bgColor="#207CF714"></u-tag>
|
|
|
|
|
- </block>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="engine-container" @click="showmode = true" v-if="current==0">
|
|
|
|
|
- <view class="model_view">模型:{{xzmodels}}</view>
|
|
|
|
|
- <u-icon name="arrow-down-fill" color="#9e9e9e"></u-icon>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- <!-- mj模型选择新调整 -->
|
|
|
|
|
- <view class="mjSelBox" v-if="current==1">
|
|
|
|
|
- <!-- <view class="mjitem" v-for="(item,index) in modelslist"
|
|
|
|
|
- @click="modelsid = index,showmode = false,form.model_id = item.model_id.toString(),xzmodels = item.name,form.name = item.name"
|
|
|
|
|
- :style="{'border-color':index==modelsid?'#1F79F0':'','background-image':`url(${item.imgs[0]})`}"> -->
|
|
|
|
|
-
|
|
|
|
|
- <view class="mjitem" v-for="(item,index) in modelslist"
|
|
|
|
|
- @click="modelsid = index,showmode = false,form.model_id = item.model_id.toString(),xzmodels = item.name,form.name = item.name"
|
|
|
|
|
- :style="{'border-color':index==modelsid?'#1F79F0':'','background-image':`url(${item.title=='官方V5.1'?'../../static/scy.png':'../../static/ecy.png'})`}">
|
|
|
|
|
- <view class="topRight" style="background-image: url('../../static/sjx.png')">
|
|
|
|
|
- 热
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="bar">
|
|
|
|
|
- {{item.title=='官方V5.1'?'二次元模型':'三次元写实'}}
|
|
|
|
|
- </view>
|
|
|
|
|
- </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"> -->
|
|
|
|
|
- <view v-if="gallerylist.length>0" 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?'#207CF7':'',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="#207CF7" 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="#207CF7" blockColor="#207CF7" min="0" max="100"></u-slider>
|
|
|
|
|
- <u-slider v-else v-model="form.init_strength" showValue activeColor="#207CF7" blockColor="#207CF7" 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 ? '#207CF7':''}">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 ? '#207CF7':''}">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 ? '#207CF7':''}">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 ? '#207CF7':''}">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>
|
|
|
|
|
- <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?'#207CF7':''}"
|
|
|
|
|
- @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="item.imgs.length>1?true:false" indicatorMode="line" circular></u-swiper>
|
|
|
|
|
- <view class="card-info">
|
|
|
|
|
- <view class="card-info-title">{{item.title=='官方V5.1'?'Niji 5':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>
|
|
|
|
|
- <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 {
|
|
|
|
|
- showHuiHuaLead: false,
|
|
|
|
|
- showLead2: false,
|
|
|
|
|
- showLead1: true,
|
|
|
|
|
-
|
|
|
|
|
- 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: 1,
|
|
|
|
|
- showconcern: false,
|
|
|
|
|
- gzhqrcode: '',
|
|
|
|
|
- proportion: ''
|
|
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
- computed: {
|
|
|
|
|
- ...mapGetters(['appInfo', 'homeTemplate', 'userInfo', 'isLogin', 'userData'])
|
|
|
|
|
- },
|
|
|
|
|
- onLoad() {
|
|
|
|
|
- this.showHuiHuaLead = !uni.getStorageSync('showHuiHuaLead')
|
|
|
|
|
- console.log("uni.getStorageSync('showHuiHuaLead')", uni.getStorageSync('showHuiHuaLead'));
|
|
|
|
|
-
|
|
|
|
|
- // mj优先展示
|
|
|
|
|
- this.getsubsection({
|
|
|
|
|
- index: 1
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- 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) {
|
|
|
|
|
-
|
|
|
|
|
- console.log('this.$Route.query.prompt======================+++++++++++++');
|
|
|
|
|
- this.keywords = this.$Route.query.prompt
|
|
|
|
|
- if (this.$Route.query.refImg == "undefined") {
|
|
|
|
|
- // this.refer_img = ''
|
|
|
|
|
- } else {
|
|
|
|
|
- this.refer_img = this.$Route.query.refImg
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- 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']),
|
|
|
|
|
- nextLead() {
|
|
|
|
|
- this.showLead1 = false
|
|
|
|
|
- this.showLead2 = true
|
|
|
|
|
- },
|
|
|
|
|
- finishLead() {
|
|
|
|
|
- this.showHuiHuaLead = false
|
|
|
|
|
- this.showLead2 = false
|
|
|
|
|
- uni.setStorageSync('showHuiHuaLead', true)
|
|
|
|
|
- },
|
|
|
|
|
- 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) {
|
|
|
|
|
- // if (this.keywords) {
|
|
|
|
|
- // this.keywords = ''
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
- 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: #207CF7;padding: 0 4px;'>" +
|
|
|
|
|
- 1 + "</span><span>" + alias +
|
|
|
|
|
- "</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #207CF7;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
|
|
|
|
|
- });
|
|
|
|
|
- if (that.engine == "mj") {
|
|
|
|
|
- this.modelslist = res.data.reverse()
|
|
|
|
|
- } else {
|
|
|
|
|
- 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
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- console.log('模型列表---============================++++++++++++++++++++', this.modelslist);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- 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: '#207CF7',
|
|
|
|
|
- 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: #207CF7;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) {
|
|
|
|
|
- var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
|
|
|
|
|
- this.signTitle =
|
|
|
|
|
- "<p style='font-weight: 550;font-size: 16px;'>绘画需要<span style='color: #207CF7;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 {
|
|
|
|
|
- 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: #207CF7;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: #207CF7;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: #207CF7;padding: 0 4px;'>" +
|
|
|
|
|
- this.plan.unlock_mj_aipainting + "</span><span>" + alias +
|
|
|
|
|
- "</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #207CF7;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: #207CF7;padding: 0 4px;'>" +
|
|
|
|
|
- this.plan.unlock_aipainting * this.form.samples + "</span><span>" + alias +
|
|
|
|
|
- "</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #207CF7;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: #207CF7;padding: 0 4px;'>"+this.plan.unlock_mj_aipainting+"</span><span>"+alias+"</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #207CF7;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: #207CF7;padding: 0 4px;'>"+this.plan.unlock_aipainting*this.form.samples+"</span><span>"+alias+"</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #207CF7;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: '#207CF7',
|
|
|
|
|
- // 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) {
|
|
|
|
|
-
|
|
|
|
|
- // console.log('this.keywords', this.refer_img + ' ' + this.keywords);
|
|
|
|
|
- this.aiPlay(this.refer_img + ' ' + 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';
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- that.form.keywords = that.keywords
|
|
|
|
|
- console.log(that.form);
|
|
|
|
|
-
|
|
|
|
|
- uni.navigateTo({
|
|
|
|
|
- url: that.showmj ? '/pages/painting/generate?prompt=' + (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 +
|
|
|
|
|
- `&refImg=${that.refer_img?that.refer_img:''}&keywords=${that.keywords}` :
|
|
|
|
|
- '/pages/painting/details?form=' + JSON
|
|
|
|
|
- .stringify(this.form)
|
|
|
|
|
- });
|
|
|
|
|
- console.log('创作相似url传递的参数:', 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) {
|
|
|
|
|
-
|
|
|
|
|
- console.log('上传参考图返回值:', res.tempFiles[0].name, res.tempFiles[0].name.toLowerCase());
|
|
|
|
|
- if (!(res.tempFiles[0].name.toLowerCase().endsWith('.png') || res.tempFiles[0].name
|
|
|
|
|
- .toLowerCase().endsWith(
|
|
|
|
|
- '.jpeg') || res.tempFiles[0].name.toLowerCase().endsWith('.jpg'))) {
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '上传失败,请上传png、jpg和jpeg格式的图片',
|
|
|
|
|
- icon: 'none',
|
|
|
|
|
- duration: 2000
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- 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',
|
|
|
|
|
- upload_type: 'ali-oss'
|
|
|
|
|
- },
|
|
|
|
|
- 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;
|
|
|
|
|
-
|
|
|
|
|
- that.form.refer_img = a.data.path
|
|
|
|
|
- // }
|
|
|
|
|
- } 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.form.refer_img = ''
|
|
|
|
|
- this.form.init_image = ''
|
|
|
|
|
- // this.refer_id = 0;
|
|
|
|
|
- // }
|
|
|
|
|
- },
|
|
|
|
|
- open() {
|
|
|
|
|
- // console.log('open');
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
-</script>
|
|
|
|
|
-
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
|
|
- @import './draw.scss';
|
|
|
|
|
-</style>
|
|
|