소스 검색

周六提交

李万涛 1 년 전
부모
커밋
0abc68be66
8개의 변경된 파일2048개의 추가작업 그리고 122개의 파일을 삭제
  1. 1 1
      common/config.js
  2. 11 11
      common/request/request.js
  3. 141 35
      pages/robot/generate/index.scss
  4. 362 57
      pages/robot/generate/index.vue
  5. 698 0
      pages/robot/generate/index1.scss
  6. 797 0
      pages/robot/generate/index1.vue
  7. 37 17
      pages/robot/index.vue
  8. 1 1
      utils/request/index.js

+ 1 - 1
common/config.js

xqd
@@ -1,3 +1,3 @@
 module.exports = {
-	baseImgUrl: 'http://meta.swdz.com/index.php/api.common/upload?uniacid=5059'
+	baseImgUrl: 'https://meta.swdz.com/index.php/api.common/upload?uniacid=5059'
 }

+ 11 - 11
common/request/request.js

xqd
@@ -1,20 +1,20 @@
 // 源代码基础接口配置
 
-var siteConfig = {
-	uniacid: 2,
-	siteroot: "https://dev.iduomi.cc/addons/wike_chatgpt/public/index.php/",
-	root: "https://dev.iduomi.cc/addons/wike_chatgpt/public/",
-};
-let uniacid = 5059;
-
-// 凡云AI
 // var siteConfig = {
-// 	uniacid: 5059,
-// 	siteroot: "http://nywhcm.com/addons/wike_aging/public/index.php/",
-// 	root: "http://nywhcm.com/addons/wike_aging/public/",
+// 	uniacid: 2,
+// 	siteroot: "https://dev.iduomi.cc/addons/wike_chatgpt/public/index.php/",
+// 	root: "https://dev.iduomi.cc/addons/wike_chatgpt/public/",
 // };
 // let uniacid = 5059;
 
+// 凡云AI
+var siteConfig = {
+	uniacid: 5059,
+	siteroot: "http://nywhcm.com/addons/wike_aging/public/index.php/",
+	root: "http://nywhcm.com/addons/wike_aging/public/",
+};
+let uniacid = 5059;
+
 
 // var siteConfig = {
 // 	uniacid: 2,

+ 141 - 35
pages/robot/generate/index.scss

xqd xqd xqd xqd xqd xqd
@@ -21,22 +21,57 @@ page {
 			.top{
 				display: flex;
 				justify-content: center;
-				.videoBox1{
-					width: 380rpx;
-					aspect-ratio: 9/16;
-					image{
-						width: 100%;
-						height: 100%;
-					}
-				}
-				.videoBox2{
-					height: 380rpx;
-					aspect-ratio: 16/9;
-					image{
-						width: 100%;
-						height: 100%;
-					}
-				}
+			.videoBox1{
+								width: 380rpx;
+								aspect-ratio: 9/16;
+								position: relative;
+								.img16{
+									width: 100%;
+									height: 100%;
+									position: absolute;
+									z-index: 1;
+								}
+								.role{
+									position: absolute;
+									z-index: 9;
+									height: 100%;
+									width:100%;
+									margin-left: 50%;
+									transform: translateX(-50%);
+									display: flex;
+									align-items: flex-end;
+									justify-content: center;
+									image{
+										width: 60%;
+										height: 50%;
+									}
+								}
+							}
+							.videoBox2{
+								height: 380rpx;
+								aspect-ratio: 16/9;
+								position: relative;
+								.img16{
+									width: 100%;
+									height: 100%;
+									position: absolute;
+									z-index: 1;
+								}
+								.role{
+									position: absolute;
+									z-index: 9;
+									height: 100%;
+									width: 50%;
+									margin-left: 50%;
+									transform: translateX(-50%);
+									display: flex;
+									align-items: flex-end;
+									image{
+										width: 100%;
+										height:80%;
+									}
+								}
+							}
 			}
 			
 			.centerMenuBar{
@@ -267,14 +302,15 @@ page {
 					align-items: center;
 					margin: 0 30rpx;
 					margin-bottom: 20rpx;
-					image{
-						width: 128rpx;
-						height: 128rpx;
-						border-radius: 50%;
-					}
-					.name{
-						margin-top: 10rpx;
-					}
+						image{
+							width: 128rpx;
+							height: 128rpx;
+							border-radius: 50%;
+						}
+						.name{
+							margin-top: 10rpx;
+							
+						}
 				}
 				.sel{
 					border:6rpx solid #26b3a0;
@@ -498,6 +534,8 @@ page {
 				}
 				
 				}
+				
+				// 声音弹框样式
 			
 			.filterConList{
 				display: flex;
@@ -505,20 +543,34 @@ page {
 				flex-wrap: wrap;
 			
 				.item{
-					width: 128rpx;
+					width: 25%;
 					display: flex;
-					flex-direction: column;
-					justify-content: center;
-					align-items: center;
+					// flex-direction: column;
+					// justify-content: center;
+					// align-items: center;
 					margin: 0 30rpx;
+					margin-left: 30rpx;
 					margin-bottom: 20rpx;
-					image{
-						width: 128rpx;
-						height: 128rpx;
-						border-radius: 50%;
+					.avtarBox{
+						display: flex;
+						flex-direction: column;
+						justify-content: center;
+						align-items: center;
+						image{
+							width: 128rpx;
+							height: 128rpx;
+							border-radius: 50%;
+						}
+						.name{
+							margin-top: 10rpx;
+						}
 					}
-					.name{
-						margin-top: 10rpx;
+					.playBox{
+						color:orange;
+						display: flex;
+						align-items:flex-end;
+						// width:250rpx;
+						// background: red;
 					}
 				}
 				.sel{
@@ -644,6 +696,7 @@ page {
 		font-size: 24rpx;
 		color: #999;
 		text-align: center;
+		width: 132rpx;
 		
 		height: 65rpx;
 		text-overflow: ellipsis;
@@ -660,4 +713,57 @@ page {
 	
 	
 	
-	
+	.audioList{
+		.audioListBox{
+			display: flex;
+			
+			.con{
+				word-break: break-all;
+				word-wrap: break-word;
+				width: 90%;
+			}
+			.rightIcon{
+				margin-left: 10rpx;
+			}
+		}
+	}
+	
+	
+	// 自定义背景图
+	.defBox{
+		display: flex;
+		width: 100%;
+		// height: 100%;
+		// align-items: center;
+		padding-top: 50rpx;
+		.type1{
+			width: 50%;
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			.des{
+				line-height: 40rpx;
+				.lab{
+					font-weight: 600;
+					font-size:40rpx;
+				}
+			}
+			.btn{
+				margin-top: 50rpx;
+				display: flex;
+				justify-content: center;
+				align-items: center;
+				width: 80%;
+				height:80rpx;
+				background: #06C68E;
+				color: white;
+				border-radius: 15rpx;
+			}
+		}
+	}
+	
+	.bgBox{
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+	}

+ 362 - 57
pages/robot/generate/index.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -5,18 +5,31 @@
 		</view>
 		<view class="context">
 			<view class="top" @click="show4=true">
-				<view class="videoBox1" v-if="bgItem.scale==1&&selBgPic">
-					<image class="img16" :src="selBgPic" mode=""></image>
-				</view>
-				<view class="videoBox2" v-if="bgItem.scale==2&&selBgPic" :style="{}">
-					<image class="img16" :src="selBgPic" mode=""></image>
+				<view class="top" @click="show4=true">
+					<view class="videoBox1" v-if="bgItem.scale==1&&selBgPic">
+						<image class="img16" :src="selBgPic" mode=""></image>
+						<view class="role">
+							<image :src="selRoleItem.url" mode=""></image>
+						</view>
+					</view>
+					<view class="videoBox2" v-if="bgItem.scale==2&&selBgPic" :style="{}">
+						<image class="img16" :src="selBgPic" mode=""></image>
+						<view class="role">
+							<image :src="selRoleItem.url" mode=""></image>
+						</view>
+					</view>
+					<view class="videoBox" v-if="!bgItem.scale&&!selBgPic" :style="{minHeight:!selBgPic?'465rpx':''}">
+						<view class="emptyVideo" style="background: #ccc;height: 100%;"></view>
+					</view>
 				</view>
+
+
 				<view class="videoBox" v-if="!bgItem.scale&&!selBgPic" :style="{minHeight:!selBgPic?'465rpx':''}">
 					<view class="emptyVideo" style="background: #ccc;height: 100%;"></view>
 				</view>
 			</view>
 			<view class="selCon">
-				<view class="item" @click="show=true">
+				<view class="item" @click="show=true" v-if="!audioUrl">
 					<view class="label">
 						语速:
 					</view>
@@ -24,7 +37,7 @@
 						{{roundRate}}X
 					</view>
 				</view>
-				<view class="item" @click="show1=true">
+				<view class="item" @click="show1=true" v-if="!audioUrl">
 					<view class="label">
 						声音:{{selVoiceItem.name}}
 					</view>
@@ -57,10 +70,22 @@
 				<uni-easyinput :inputBorder="true" :clearable="false" v-model="robotName"
 					placeholder="请输入播报标题"></uni-easyinput>
 			</view>
-			<u--textarea height="" border="none" :autoHeight="true" maxlength="9999" v-model="textAreaValue"
-				placeholder="请输入播报内容"></u--textarea>
+			<u--textarea height="" :disabled="audioUrl?true:false" border="none" :autoHeight="true" maxlength="9999"
+				v-model="textAreaValue" placeholder="请输入播报内容"></u--textarea>
 
-			<!-- <button @click="uploadVideo">上传录音文件</button> -->
+			<button @click="uploadVideo">上传录音文件</button>
+			<view class="audioList" v-if="audioUrl">
+				<view class="">
+					已上传的音频:
+				</view>
+				<view class="audioListBox">
+					<view class="con">
+						{{audioUrl}}
+					</view>
+					<text @click="audioUrl=''" class="iconfont icon-shanchu rightIcon"
+						:style="{fontSize:isPc?'64rpx':'32rpx'}"></text>
+				</view>
+			</view>
 
 			<view class="btnBox">
 				<view class="btn draft" @click="saveDraft">
@@ -101,7 +126,7 @@
 		<u-popup :show="show1" @close="close1" @open="open">
 			<view class="contentBox">
 				<view class="toolBar">
-					<view class="cancel" @click="show1=false">
+					<view class="cancel" @click="handleAudioClose">
 						<image src="/static/images/closeBtn.png" mode=""></image>
 					</view>
 					<view class="center">
@@ -112,30 +137,24 @@
 					</view>
 				</view>
 				<view class="content">
-					<!-- 			<view class="filterBox">
-						<view class="tabList">
-							<view class="item1" v-for="(item,index) in voiceList"
-								:class="[currTabIndex==index?'tabActive':'']" @click="currTabIndex=index">
-								{{item}}
-							</view>
-						</view>
-						<view class="filterBtn" @click="handleFilter">
-							<text class="iconfont icon-shaixuanguolv" style="font-size: 44rpx; color: #26b3a0;"></text>
-
-						</view>
-					</view> -->
-
 					<view class="filterConList" style="max-height: 500rpx;min-height: 500rpx;overflow-y: scroll;">
-						<view class="item" v-for="(item,index) in allList" @click="handleVoiceSel(item,index)">
-							<view class="imgBox">
-								<image :class="[currTabIndexAll==index?'sel':'']" :src="item.url" mode="">
-							</view>
-							</image>
-							<view class="nameDes">
-								{{item.title}}
+						<view class="item" v-for="(item,index) in allList">
+							<view class="avtarBox" @click="handleVoiceSel(item,index)">
+								<view class="imgBox">
+									<image :class="[currTabIndexAll==index?'sel':'']" :src="item.url" mode="">
+								</view>
+								<!-- </image> -->
+								<view class="nameDes">
+									{{item.title}}
+								</view>
+								<view class="name" :class="[currTabIndexAll==index?'selTxt':'']">
+									{{item.name}}
+								</view>
+
 							</view>
-							<view class="name" :class="[currTabIndexAll==index?'selTxt':'']">
-								{{item.name}}
+
+							<view class="playBox" style="" @click="playAudio(item)">
+								试听
 							</view>
 						</view>
 					</view>
@@ -164,6 +183,9 @@
 							<view class="name" :class="[currTabIndexModal==index?'selTxt':'']">
 								{{item.name}}
 							</view>
+							<view class="ratio">
+								{{'('+item.proportion+')'}}
+							</view>
 						</view>
 					</view>
 				</view>
@@ -194,15 +216,59 @@
 							</view>
 						</view>
 					</view> -->
+					<!-- 		<view class="filterBox">
+						<view class="tabList">
+							<view class="item1" style="padding-left: 40rpx;padding-right: 40rpx;"
+								v-for="(item,index) in bgList" :class="[currTabIndex2==index?'tabActive':'']"
+								@click="currTabIndex2=index">
+								{{item}}
+							</view>
+						</view>
+					</view> -->
 
 					<view class="filterConList2" style="max-height: 500rpx;min-height: 500rpx;overflow-y: scroll;">
 						<view class="pictureBox" v-if="currTabIndex2==0">
-							<image :class="[currTabIndexBg==index?'sel':'']" :src="item.url" mode=""
-								v-for="(item,index) in bgPicList" @click="handleSelBg(item,index)"></image>
+							<view class="bgBox" v-for="(item,index) in bgPicList">
+								<image :class="[currTabIndexBg==index?'sel':'']" :src="item.url" mode=""
+									@click="handleSelBg(item,index)"></image>
+								<view class="ratio">
+									{{item.scale==1?'(9:16)':'(16:9)'}}
+								</view>
+							</view>
 						</view>
 						<view class="pictureBox" v-if="currTabIndex2==1">
-							<view class="color" :style="{background:item}" :class="[currTabIndexBgc==index?'sel':'']"
-								v-for="(item,index) in bgColorList" @click="currTabIndexBgc=index"></view>
+							<!-- <view class="color" :style="{background:item}" :class="[currTabIndexBgc==index?'sel':'']"
+								v-for="(item,index) in bgColorList" @click="currTabIndexBgc=index"></view> -->
+							<view class="defBox">
+								<view class="type1">
+									<view class="des">
+										<text class="lab">尺寸:9:16</text><br>
+										背景图要求:<br>
+										像素:1080P<br>
+										文件大小:1M以内
+									</view>
+									<view class="btn" @click="uploadBg1">
+										上传背景图(9:16)
+									</view>
+								</view>
+								<view class="type1">
+									<view class="des">
+										<text class="lab">尺寸:16:9</text><br>
+										背景图要求:<br>
+										像素:1080P<br>
+										文件大小:1M以内
+									</view>
+									<view class="btn" @click="uploadBg2">
+										上传背景图(16:9)
+									</view>
+								</view>
+
+							</view>
+							<view class=""
+								style="margin-left: 30rpx;margin-top: 20rpx;word-break: break-all;word-wrap: break-word;">
+								已选择的背景图:<br>
+								{{testCusBgImg}}
+							</view>
 						</view>
 					</view>
 				</view>
@@ -295,6 +361,8 @@
 			</view>
 		</u-popup>
 
+		<!-- <audio :src="tempAudioUrl" autoplay ref="audioRef" style=""></audio> -->
+
 		<!-- <wike-tabbar :onTabbar="true" :isShowAnimate="true"></wike-tabbar> -->
 	</view>
 	</view>
@@ -308,16 +376,26 @@
 		backList
 	} from '@/api/robot/index.js'
 	import indexVue from './index.vue';
+
+	import
+	uploadImgUrl
+	from '@/common/config.js';
 	export default {
 		data() {
 			return {
+				testCusBgImg: '',
+				// tempAudioUrl: 'https://oaigc.oss-cn-chengdu.aliyuncs.com/20230804/90d3618dd8ae5a9ea50b932dba34f295.mp3',
+
+				audioUrl: '',
+
 				bgItem: {
 
 				},
 				show5: false,
 
 				show4: false,
-				bgList: ['图片', '颜色'],
+				// bgList: ['图片', '颜色'],
+				bgList: ['预置', '自定义'],
 				currTabIndex2: 0,
 				currTabIndexBg: -1,
 				currTabIndexBgc: -1,
@@ -395,14 +473,14 @@
 						icon: require('@/static/images/audio.png'),
 						name: '声音'
 					},
-					{
-						icon: require('@/static/images/role.png'),
-						name: '角色'
-					},
 					{
 						icon: require('@/static/images/bg.png'),
 						name: '背景'
 					},
+					{
+						icon: require('@/static/images/role.png'),
+						name: '角色'
+					},
 				],
 				videoSrc: '',
 				showMoreMenu: false,
@@ -422,7 +500,15 @@
 
 				roundRate: 1,
 				isGenerate: false,
-				isCreate: false
+				isCreate: false,
+
+				roleList2: [],
+				bgPicList2: [],
+
+				newBgItem: {
+					id: -1
+				},
+				music: null
 			};
 		},
 		computed: {
@@ -436,6 +522,8 @@
 
 		},
 		onLoad(o) {
+
+
 			if (o.type == 'create') {
 				this.isCreate = true
 				this.selRoleId = 5
@@ -465,14 +553,23 @@
 			this.roundRate = getApp().draftDetail.stage
 			this.selVoiceItem = getApp().draftDetail.audios
 			this.selRoleItem = getApp().draftDetail.roles
-			console.log('传过来的草稿项:', this.detail, this.selBgPic);
+
+
+			this.audioUrl = getApp().draftDetail.audio_url
+			console.log('传过来的草稿项:', this.detail);
 		},
 		async onShow() {
+
+
 			let res = await roleList({})
 			if (res.code == 0) {
 
 				this.roleList = res.msg
+
+				this.roleList2 = res.msg
 				console.log('数字人角色列表返回值:', res);
+
+
 				this.currTabIndexModal = res.msg.findIndex((item, index) => {
 					return item.id == this.selRoleId + 1
 				})
@@ -508,12 +605,35 @@
 
 			let res3 = await backList({})
 			if (res3.code == 0) {
-				// this.roleList = res.data
 				this.bgPicList = res3.msg
+				this.bgPicList2 = res3.msg
 				console.log('数字人背景列表返回值:', res3);
+
 				this.currTabIndexBg = res3.msg.findIndex((item, index) => {
 					return item.id == this.selBgId + 1
 				})
+				// if (this.detail.backs.scale == 2) {
+				// 	this.bgPicList = res3.msg.filter((item, index) => {
+				// 		return item.scale == 2
+				// 	})
+				// 	this.currTabIndexBg = res3.msg.filter((item, index) => {
+				// 		return item.scale == 2
+				// 	}).findIndex((item, index) => {
+				// 		return item.id == this.selBgId + 1
+				// 	})
+				// } else {
+				// 	this.bgPicList = res3.msg.filter((item, index) => {
+				// 		return item.scale == 1
+				// 	})
+				// 	this.currTabIndexBg = res3.msg.filter((item, index) => {
+				// 		return item.scale == 1
+				// 	}).findIndex((item, index) => {
+				// 		return item.id == this.selBgId + 1
+				// 	})
+				// }
+
+
+
 				if (this.isCreate) {
 					this.selBgPic = this.bgPicList[0].url
 					this.bgItem = this.bgPicList[0]
@@ -526,28 +646,135 @@
 				})
 			}
 		},
+		onHide() {
+			// this.music.src = ''
+			// this.music = null
+			if (this.music) this.music.destroy()
+		},
+		beforeDestroy() {
+			console.log('beforeDestroy()');
+			if (this.music) this.music.destroy()
+		},
 		onShareAppMessage: function(res) {
 
 		},
 
 		methods: {
+			uploadBg1() {
+				let that = this;
+				uni.chooseImage({
+					count: 1, //默认9
+					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+					sourceType: ['album', 'camera'], //从相册选择
+					success: function(res) {
+						const tempFilePaths = res.tempFilePaths;
+						//上传服务器将服务器;
+						uni.uploadFile({
+							url: uploadImgUrl.baseImgUrl,
+							filePath: tempFilePaths[0],
+							name: 'file',
+							formData: {
+								accept: 'image',
+								upload_type: 'ali-oss'
+							},
+							success: res2 => {
+								let a = JSON.parse(res2.data);
+								if (a.code == 0) {
+									that.testCusBgImg = a.data.path.trim()
+									console.log('上传图片返回值:', that.testCusBgImg);
+									// that.ifimg = true
+								} else {
+									uni.showToast({
+										title: '上传图片失败',
+										icon: 'none'
+									})
+									// that.ifimg = false
+								}
+							}
+						});
+					}
+				});
+			},
+			uploadBg2() {
+				let that = this;
+				uni.chooseImage({
+					count: 1, //默认9
+					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+					sourceType: ['album', 'camera'], //从相册选择
+					success: function(res) {
+						const tempFilePaths = res.tempFilePaths;
+						//上传服务器将服务器;
+						uni.uploadFile({
+							url: uploadImgUrl.baseImgUrl,
+							filePath: tempFilePaths[0],
+							name: 'file',
+							formData: {
+								accept: 'image',
+								upload_type: 'ali-oss'
+							},
+							success: res2 => {
+								let a = JSON.parse(res2.data);
+								if (a.code == 0) {
+									that.testCusBgImg = a.data.path.trim()
+									console.log('上传图片返回值:', that.testCusBgImg);
+									// that.ifimg = true
+								} else {
+									uni.showToast({
+										title: '上传图片失败',
+										icon: 'none'
+									})
+									// that.ifimg = false
+								}
+							}
+						});
+					}
+				});
+			},
+
+
+
+
+			playAudio(item) {
+				if (this.music) {
+					this.music.destroy()
+				}
+				this.music = uni.createInnerAudioContext(); //创建播放器对象
+				this.music.autoplay = true;
+				this.music.src =
+					"https://oaigc.oss-cn-chengdu.aliyuncs.com/20230804/90d3618dd8ae5a9ea50b932dba34f295.mp3"; //音频地址
+				// this.music.play();
+			},
+
+
 			uploadVideo() {
+				let _this = this
 				uni.chooseFile({
 					count: 1, //默认100
 					extension: ['.mp3'],
 					success: function(res) {
-						console.log(JSON.stringify(res.tempFilePaths));
-
+						let tempFilePaths = res.tempFilePaths;
+						uni.showLoading({
+							title: "上传中...",
+						});
 
 						uni.uploadFile({
-							url: 'https://www.example.com/upload', //仅为示例,非真实的接口地址
+							url: uploadImgUrl.baseImgUrl,
 							filePath: tempFilePaths[0],
+							// filePath: JSON.stringify(res.tempFilePaths),
 							name: 'file',
+							fileType: "audio",
 							formData: {
-								'user': 'test'
+								accept: 'audio',
+								upload_type: 'ali-oss'
 							},
 							success: (uploadFileRes) => {
-								console.log(uploadFileRes.data);
+								uni.hideLoading();
+								const ret = JSON.parse(uploadFileRes.data);
+								if (ret.code == 0) {
+									_this.audioUrl = ret.data.path
+									console.log(ret);
+								}
+
 							}
 						});
 					}
@@ -556,9 +783,16 @@
 
 
 			close() {
+
 				this.show = false
 			},
 			close1() {
+				// this.music.src = ''; //音频地址
+				// this.music.stop(); //执行播放  
+				if (this.music) {
+					this.music.destroy()
+				}
+
 				this.show1 = false
 			},
 			close3() {
@@ -568,17 +802,50 @@
 				this.show4 = false
 			},
 			handleSelBg(item, index) {
+
+				this.bgItem = item
+				this.newBgItem = item
+				console.log('111111111', item);
+
+				// return
+				this.selRoleItem = {}
+				this.currTabIndexModal = -1
+
+				if (item.scale == 1) {
+					this.roleList = this.roleList2.filter((item, index) => {
+						return item.proportion == '9:16'
+
+					})
+				} else {
+					this.roleList = this.roleList2.filter((item, index) => {
+						return item.proportion == '16:9'
+					})
+				}
+
+
+
 				this.bgItem = item
 				this.selBgPic = item.url
 				this.selBgId = item.id - 1
 				this.currTabIndexBg = index
 			},
 			handleVoiceSel(item, index) {
+				this.music.src = ''; //音频地址
+				this.music.stop(); //执行播放  
+
+
 				this.selVoiceItem = item
 				this.selVoiceId = item.id - 1
 				this.currTabIndexAll = index
 			},
 			handleRoleSel(item, index) {
+				if (this.bgItem.id != this.newBgItem.id) {
+					return uni.showToast({
+						title: '请先选择背景图,再选择角色',
+						icon: 'none'
+					})
+				}
+
 				this.selRoleItem = item
 				this.selRoleId = item.id - 1
 				this.currTabIndexModal = index
@@ -591,6 +858,7 @@
 					// back: this.selBgId,
 					// audio: this.selVoiceId,
 					stage: this.roundRate,
+					audio_url: this.audioUrl,
 					is_draft: 1
 				}
 				if (this.selRoleId != -1) {
@@ -605,6 +873,7 @@
 
 
 				console.log('保存数字人草稿参数:', parmas);
+				// return
 				let res = await generateWork(parmas)
 				if (res.code == 0) {
 					uni.showToast({
@@ -633,13 +902,27 @@
 				}
 
 
-				let parmas = {
-					name: this.robotName,
-					content: this.textAreaValue,
-					role: this.selRoleId,
-					back: this.selBgId,
-					audio: this.selVoiceId,
-					stage: this.roundRate
+				let parmas = {}
+				if (this.audioUrl) {
+					parmas = {
+						name: this.robotName,
+						// content: this.textAreaValue,
+						role: this.selRoleId,
+						back: this.selBgId,
+						// audio: this.selVoiceId,
+						// stage: this.roundRate,
+						audio_url: this.audioUrl
+					}
+				} else {
+					parmas = {
+						name: this.robotName,
+						content: this.textAreaValue,
+						role: this.selRoleId,
+						back: this.selBgId,
+						audio: this.selVoiceId,
+						stage: this.roundRate,
+						audio_url: this.audioUrl
+					}
 				}
 				console.log('创建数字人参数:', parmas);
 				// return
@@ -670,8 +953,17 @@
 				// this.show1 = false
 				this.show2 = true
 			},
+			handleAudioClose() {
+				this.show1 = false
+				if (this.music) {
+					this.music.destroy()
+				}
+			},
 			handleBtnConfirm1() {
 				this.show1 = false
+				if (this.music) {
+					this.music.destroy()
+				}
 			},
 			handleBtnConfirm2() {
 				this.show3 = false
@@ -682,10 +974,23 @@
 
 			handleSetBox(item) {
 				if (item.name == '全局语速') {
+					if (this.audioUrl) {
+						return uni.showToast({
+							title: '上传音频不支持全局语速',
+							icon: 'none'
+						})
+					}
 					this.show = true
 				} else if (item.name == '声音') {
+					if (this.audioUrl) {
+						return uni.showToast({
+							title: '上传音频不支持声音选择',
+							icon: 'none'
+						})
+					}
 					this.show1 = true
 				} else if (item.name == '角色') {
+
 					this.show3 = true
 				} else if (item.name == '背景') {
 					this.show4 = true

+ 698 - 0
pages/robot/generate/index1.scss

xqd
@@ -0,0 +1,698 @@
+page {
+		// background: #f2f2f2;
+	}
+	.pos{
+		height: 45px;
+	}
+
+	view {
+		box-sizing: border-box;
+	}
+	.u-textarea{
+		min-height:400rpx;
+	}
+	.container{
+		// padding-bottom:130rpx;
+		.context{
+			padding: 40rpx;
+			padding-left: 0;
+			padding-right: 0;
+			padding-bottom: 0;
+			.top{
+				display: flex;
+				justify-content: center;
+				.videoBox1{
+					width: 380rpx;
+					aspect-ratio: 9/16;
+					position: relative;
+					display: flex;
+					align-items: bottom;
+					.img16{
+						width: 100%;
+						height: 100%;
+					background-size: 100% 100%;
+					background-repeat:no-repeat;
+					.role{
+						position:relative;
+						z-index: 9;
+						width: 50%;
+						height: 100%;
+						margin-left: 50%;
+						transform: translateX(-50%);
+					}
+					}
+				}
+				.videoBox2{
+					height: 380rpx;
+					aspect-ratio: 16/9;
+					.img16{
+						width: 100%;
+						height: 100%;
+						background-size: 100% 100%;
+						.role{
+							position:relative;
+							z-index: 9;
+							width: 50%;
+							height: 100%;
+							margin-left: 50%;
+							transform: translateX(-50%);
+						}
+					}	
+				}
+			}
+			
+			.centerMenuBar{
+				display: flex;
+				justify-content: space-between;
+				height: 96rpx;
+				background: linear-gradient(to right,#06C68E,#02BCCD);
+				margin-top: 30rpx;
+				padding-left: 40rpx;
+				padding-right: 40rpx;
+				color: white;
+				.barItem{
+					display: flex;
+					align-items: center;
+					.left{
+						width: 64rpx;
+						height: 64rpx;
+						// margin-right: 10rpx;
+						image{
+							width: 100%;
+							height: 100%;
+							border-radius: 50%;
+						}
+					}
+					.right{
+						
+					}
+				}
+			}
+			.btnBox{
+			padding: 0 40rpx;
+			// position: fixed;
+			// bottom: 0rpx;
+			background: #fff;
+			height: 150rpx;
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
+			width: 100%;
+			border-top: 1px solid #ccc;
+				.btn{
+					background: #26b3a0;
+					color: #fff;
+					width: 45%;
+					height: 94rpx;
+					border-radius: 15rpx;
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					font-size: 32rpx;
+				}
+				.draft{
+					background: #fff;
+					border:2rpx solid  #26b3a0;
+					color: #26b3a0;
+				}
+			}
+		}
+		
+	}
+	::v-deep .u-popup__content{
+		border-radius: 15rpx;
+	}
+	
+	.contentBox2{
+		.toolBar{
+			height: 100rpx;
+			display: flex;
+			align-items: center;
+			border-radius: 15rpx 15rpx 0 0;
+			.cancel{
+				width: 10%;
+				height: 35rpx;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+				image{
+					width: 35rpx;
+					height: 35rpx;
+				}
+			}
+			.center{
+				width: 80%;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+			}
+			.confirm{
+				width: 10%;
+				height: 35rpx;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+				image{
+					width: 40rpx;
+					height: 35rpx;
+				}
+			}
+			
+		}
+		.toolBar2{
+			height: 100rpx;
+			display: flex;
+			align-items: center;
+			justify-content:flex-end;
+			border-radius: 15rpx 15rpx 0 0;
+			.closeBtn{
+				width: 44rpx;
+				height: 44rpx;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+				background: #999;
+				margin-right: 30rpx;
+				color: white;
+				border-radius: 50%;
+				// image{
+				// 	width: 40rpx;
+				// 	height: 35rpx;
+				// }
+			}
+		}
+		.content{
+			.videoRatioBox{
+				display: flex;
+				justify-content: space-between;
+				padding: 20rpx 60rpx;
+				padding-bottom: 50rpx;
+				.item{
+					background: #ccc;
+					width: 45%;
+					height: 154rpx;
+					border-radius: 10rpx;
+					display: flex;
+					
+					flex-direction: column;
+					align-items: center;
+					justify-content: center;
+					.top{
+						margin-bottom: 10rpx;
+					}
+					.bottom{	
+					}
+				}
+			}
+			
+			.slider{
+				margin-top: 0;
+				width: 85%;
+				margin-left: 50%;
+				transform: translateX(-50%);
+			}
+			.sliderValue{
+				text-align: center;
+			}
+			
+			
+			// 声音
+			.filterBox{
+				display: flex;
+				.tabList{
+					width: 90%;
+					overflow-x: scroll;
+					white-space: nowrap;
+					padding: 0 20rpx;
+					.item1{
+						padding: 10rpx 30rpx;
+						display: inline-block;
+						margin-right: 20rpx;
+						border-radius: 10rpx;
+						background:#ccc ;
+					}
+					.tabActive{
+						background:#26b3a0 ;
+						color: white;
+					}
+
+				}
+				.filterBtn{
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					width: 10%;
+					image{
+						width: 44rpx;
+						height: 44rpx;
+					}
+				}
+				
+			}
+				
+			.filterConList2{
+				.pictureBox{
+					padding-top: 30rpx;
+					padding-bottom: 50rpx;
+					display: flex;
+					flex-wrap: wrap;
+					.sel{
+						border:6rpx solid #26b3a0;
+						padding: 5rpx;
+					}
+					image{
+						width: 128rpx;
+						height: 176rpx;
+						margin:10rpx  30rpx;
+					}
+					.color{
+						width: 128rpx;
+						height: 176rpx;
+						margin:10rpx  30rpx;
+					}
+				}
+				
+				}
+			
+			.filterConList{
+				display: flex;
+				padding-top: 30rpx;
+				flex-wrap: wrap;
+				min-height: 500rpx;
+				max-height: 500rpx;
+				overflow-y: scroll;
+				.item{
+					width: 128rpx;
+					display: flex;
+					flex-direction: column;
+					justify-content: center;
+					align-items: center;
+					margin: 0 30rpx;
+					margin-bottom: 20rpx;
+					image{
+						width: 128rpx;
+						height: 128rpx;
+						border-radius: 50%;
+					}
+					.name{
+						margin-top: 10rpx;
+					}
+				}
+				.sel{
+					border:6rpx solid #26b3a0;
+					padding: 5rpx;
+				}
+			}
+			
+			
+			.scenList{
+				// background: #26b3a0;
+				display: flex;
+				flex-wrap: wrap;
+				padding:0 40rpx;
+				margin-bottom: 20rpx;
+				.item{
+					background: #ccc;
+					padding: 10rpx 20rpx;
+					margin-right: 20rpx;
+					margin-bottom: 20rpx;
+					border-radius: 10rpx;
+				}
+			}
+			.sexList{
+				// background: #26b3a0;
+				display: flex;
+				flex-wrap: wrap;
+				padding:0 40rpx;
+				margin-bottom: 20rpx;
+				.item{
+					background: #ccc;
+					padding: 10rpx 20rpx;
+					margin-right: 20rpx;
+					margin-bottom: 20rpx;
+					border-radius: 10rpx;
+				}
+			}
+			.ageList{
+				display: flex;
+				flex-wrap: wrap;
+				padding:0 40rpx;
+				margin-bottom: 20rpx;
+				.item{
+					background: #ccc;
+					padding: 10rpx 20rpx;
+					margin-right: 20rpx;
+					margin-bottom: 20rpx;
+					border-radius: 10rpx;
+				}
+			}
+			.active{
+				background: #26b3a0!important;
+				color:white;
+			}
+			
+			.filterBtn2{
+				color: white;
+				background: #26b3a0;
+				height: 94rpx;
+				display: flex;
+				justify-content: center;
+				align-items: center;
+				border-radius: 15rpx;
+				margin-bottom: 50rpx;
+				width: 670rpx;
+				margin-left: 50%;
+				transform: translateX(-50%);
+			}
+
+		}
+	}
+	
+	.contentBox{
+	
+		.toolBar{
+			height: 100rpx;
+			display: flex;
+			align-items: center;
+			border-radius: 15rpx 15rpx 0 0;
+			.cancel{
+				width: 10%;
+				height: 35rpx;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+				image{
+					width: 35rpx;
+					height: 35rpx;
+				}
+			}
+			.center{
+				width: 80%;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+			}
+			.confirm{
+				width: 10%;
+				height: 35rpx;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+				image{
+					width: 40rpx;
+					height: 35rpx;
+				}
+			}
+			
+		}
+		.toolBar2{
+			height: 100rpx;
+			display: flex;
+			align-items: center;
+			justify-content:flex-end;
+			border-radius: 15rpx 15rpx 0 0;
+			.closeBtn{
+				width: 44rpx;
+				height: 44rpx;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+				background: #999;
+				margin-right: 30rpx;
+				color: white;
+				border-radius: 50%;
+				// image{
+				// 	width: 40rpx;
+				// 	height: 35rpx;
+				// }
+			}
+		}
+		.content{
+			.videoRatioBox{
+				display: flex;
+				justify-content: space-between;
+				padding: 20rpx 60rpx;
+				padding-bottom: 50rpx;
+				.item{
+					background: #ccc;
+					width: 45%;
+					height: 154rpx;
+					border-radius: 10rpx;
+					display: flex;
+					
+					flex-direction: column;
+					align-items: center;
+					justify-content: center;
+					.top{
+						margin-bottom: 10rpx;
+					}
+					.bottom{	
+					}
+				}
+			}
+			
+			.slider{
+				margin-top: 20%;
+				width: 85%;
+				margin-left: 50%;
+				transform: translateX(-50%);
+			}
+			.sliderValue{
+				text-align: center;
+			}
+			
+			
+			// 声音
+			.filterBox{
+				display: flex;
+				.tabList{
+					width: 90%;
+					overflow-x: scroll;
+					white-space: nowrap;
+					padding: 0 20rpx;
+					.item1{
+						padding: 10rpx 30rpx;
+						display: inline-block;
+						margin-right: 20rpx;
+						border-radius: 10rpx;
+						background:#ccc ;
+					}
+					.tabActive{
+						background:#26b3a0 ;
+						color: white;
+					}
+	
+				}
+				.filterBtn{
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					width: 10%;
+					image{
+						width: 44rpx;
+						height: 44rpx;
+					}
+				}
+				
+			}
+				
+			.filterConList2{	
+				
+				.pictureBox{
+					padding-top: 30rpx;
+					padding-bottom: 50rpx;
+					display: flex;
+					flex-wrap: wrap;
+					.sel{
+						border:6rpx solid #26b3a0;
+						padding: 5rpx;
+					}
+					image{
+						width: 128rpx;
+						height: 176rpx;
+						margin:10rpx  30rpx;
+					}
+					.color{
+						width: 128rpx;
+						height: 176rpx;
+						margin:10rpx  30rpx;
+					}
+				}
+				
+				}
+			
+			.filterConList{
+				display: flex;
+				padding-top: 30rpx;
+				flex-wrap: wrap;
+			
+				.item{
+					width: 128rpx;
+					display: flex;
+					flex-direction: column;
+					justify-content: center;
+					align-items: center;
+					margin: 0 30rpx;
+					margin-bottom: 20rpx;
+					image{
+						width: 128rpx;
+						height: 128rpx;
+						border-radius: 50%;
+					}
+					.name{
+						margin-top: 10rpx;
+					}
+				}
+				.sel{
+					border:6rpx solid #26b3a0;
+					padding: 5rpx;
+				}
+			}
+			
+			
+			.scenList{
+				// background: #26b3a0;
+				display: flex;
+				flex-wrap: wrap;
+				padding:0 40rpx;
+				margin-bottom: 20rpx;
+				.item{
+					background: #ccc;
+					padding: 10rpx 20rpx;
+					margin-right: 20rpx;
+					margin-bottom: 20rpx;
+					border-radius: 10rpx;
+				}
+			}
+			.sexList{
+				// background: #26b3a0;
+				display: flex;
+				flex-wrap: wrap;
+				padding:0 40rpx;
+				margin-bottom: 20rpx;
+				.item{
+					background: #ccc;
+					padding: 10rpx 20rpx;
+					margin-right: 20rpx;
+					margin-bottom: 20rpx;
+					border-radius: 10rpx;
+				}
+			}
+			.ageList{
+				display: flex;
+				flex-wrap: wrap;
+				padding:0 40rpx;
+				margin-bottom: 20rpx;
+				.item{
+					background: #ccc;
+					padding: 10rpx 20rpx;
+					margin-right: 20rpx;
+					margin-bottom: 20rpx;
+					border-radius: 10rpx;
+				}
+			}
+			.active{
+				background: #26b3a0!important;
+				color:white;
+			}
+			
+			.filterBtn2{
+				color: white;
+				background: #26b3a0;
+				height: 94rpx;
+				display: flex;
+				justify-content: center;
+				align-items: center;
+				border-radius: 15rpx;
+				margin-bottom: 50rpx;
+				width: 670rpx;
+				margin-left: 50%;
+				transform: translateX(-50%);
+			}
+	
+		}
+	}
+	
+	::v-deep uni-slider .uni-slider-handle-wrapper{
+		height: 15rpx;
+	}
+	::v-deep .tn-custom-nav-bar__bar--fixed{
+		z-index:999!important;
+	}
+
+	
+	
+	.robotNameBox{
+		padding: 20rpx 10rpx;
+		.name{
+			margin-bottom: 10rpx;
+			margin-top: 20rpx;
+		}
+	}
+	
+	::v-deep .is-focused{
+		border-color: #26b3a0!important;
+	}
+	
+	.selCon{
+		margin-top: 30rpx;
+		padding-left: 30rpx;
+		
+		display: flex;
+		justify-content: space-around;
+		.item{
+			display: flex;
+			align-items: center;
+		
+			.label{
+			}
+			.con{
+				display: flex;
+				align-items: center;
+				padding-top: 5rpx;
+			}
+			.conImg{
+				width:50rpx;
+				height:50rpx;
+				margin-left: 20rpx;
+			}
+		}
+	}
+	
+	
+	
+	.nameDes{
+		margin-top:  10rpx;
+		font-size: 24rpx;
+		color: #999;
+		text-align: center;
+		
+		height: 65rpx;
+		text-overflow: ellipsis;
+		 display: -webkit-box;     /* 弹性盒旧式语法 */
+		  -webkit-box-orient: vertical;    /* 经过个人实测,vertical或horizontal都没问题,只是必须设置该属性 */
+		  -webkit-line-clamp: 2;    /* 限制两行 */
+		  overflow: hidden;
+	}
+	
+	.selTxt{
+		color:#26b3a0 !important;
+		font-weight: 600;
+	}
+	
+	
+	
+	.audioList{
+		.audioListBox{
+			display: flex;
+			
+			.con{
+				word-break: break-all;
+				word-wrap: break-word;
+				width: 90%;
+			}
+			.rightIcon{
+				margin-left: 10rpx;
+			}
+		}
+	}

+ 797 - 0
pages/robot/generate/index1.vue

xqd
@@ -0,0 +1,797 @@
+<template>
+	<view class="container">
+		<tn-nav-bar :isBack="true" backgroundColor="#fff" :bottomShadow="false">数字人创建</tn-nav-bar>
+		<view class="pos">
+		</view>
+		<view class="context">
+			<view class="top" @click="show4=true">
+				<view class="videoBox1" v-if="bgItem.scale==1&&selBgPic">
+					<view class="img16" style="background-size: 100% 100%;background-repeat:no-repeat;"
+						:style="{background:'url('+selBgPic+')',backgroundSize:selBgPic?'100% 100%':'100% 100%'}">
+						<image class="role" :src="selRoleItem.url" mode=""></image>
+					</view>
+				</view>
+
+				<view class="videoBox2" v-if="bgItem.scale==2&&selBgPic" :style="{}">
+					<view class="img16" style="background-size: 100% 100%;background-repeat:no-repeat;"
+						:style="{background:'url('+selBgPic+') ',backgroundSize:'100% 100%'}">
+						<image class="role" :src="selRoleItem.url" mode=""></image>
+					</view>
+				</view>
+
+
+				<view class="videoBox" v-if="!bgItem.scale&&!selBgPic" :style="{minHeight:!selBgPic?'465rpx':''}">
+					<view class="emptyVideo" style="background: #ccc;height: 100%;"></view>
+				</view>
+			</view>
+			<view class="selCon">
+				<view class="item" @click="show=true" v-if="!audioUrl">
+					<view class="label">
+						语速:
+					</view>
+					<view class="con">
+						{{roundRate}}X
+					</view>
+				</view>
+				<view class="item" @click="show1=true" v-if="!audioUrl">
+					<view class="label">
+						声音:{{selVoiceItem.name}}
+					</view>
+					<image class="conImg" :src="selVoiceItem.url">
+					</image>
+				</view>
+				<view class="item" @click="show3=true">
+					<view class="label">
+						角色:{{selRoleItem.name}}
+					</view>
+					<image class="conImg" :src="selRoleItem.url">
+					</image>
+				</view>
+			</view>
+			<view class="centerMenuBar">
+				<view class="barItem" v-for="(item,index) in menuList" @click="handleSetBox(item)">
+					<view class="left" style="display: flex;justify-content: flex-end;align-items: center;">
+						<!-- <text class="iconfont " :class="[item.icon]" style="color: #26b3a0;font-weight: 600;"></text> -->
+						<image :src="item.icon" mode=""></image>
+					</view>
+					<view class="right">
+						{{item.name}}
+					</view>
+				</view>
+			</view>
+			<view class="robotNameBox">
+				<!-- 	<view class="name">
+					播报标题:
+				</view> -->
+				<uni-easyinput :inputBorder="true" :clearable="false" v-model="robotName"
+					placeholder="请输入播报标题"></uni-easyinput>
+			</view>
+			<u--textarea height="" :disabled="audioUrl?true:false" border="none" :autoHeight="true" maxlength="9999"
+				v-model="textAreaValue" placeholder="请输入播报内容"></u--textarea>
+
+			<button @click="uploadVideo">上传录音文件</button>
+			<view class="audioList" v-if="audioUrl">
+				<view class="">
+					已上传的音频:
+				</view>
+				<view class="audioListBox">
+					<view class="con">
+						{{audioUrl}}
+					</view>
+					<text @click="audioUrl=''" class="iconfont icon-shanchu rightIcon"
+						:style="{fontSize:isPc?'64rpx':'32rpx'}"></text>
+				</view>
+			</view>
+
+			<view class="btnBox">
+				<view class="btn draft" @click="saveDraft">
+					存草稿
+				</view>
+				<view class="btn" @click="genRobot" style="background: linear-gradient(to right,#06C68E,#02BCCD);">
+					合成
+				</view>
+			</view>
+
+		</view>
+		<u-picker :showIcon="true" :show="showMoreMenu" :columns="columns" title="更多" confirmColor=""
+			@cancel="showMoreMenu=false" @confirm="handleConfirm"></u-picker>
+
+		<u-popup :show="show" @close="close" @open="open">
+			<view class="contentBox">
+				<view class="toolBar">
+					<view class="cancel" @click="show=false">
+						<image src="/static/images/closeBtn.png" mode=""></image>
+					</view>
+					<view class="center">
+						全局语速
+					</view>
+					<view class="confirm" @click="handleBtnConfirm">
+						<image src="/static/images/selected.png" mode=""></image>
+					</view>
+				</view>
+				<view class="content" style="min-height: 300rpx;">
+					<u-slider height="50" min="0.7" max="1.3" step="0.1" class="slider" :showValue='false'
+						@change="handleChange" activeColor="#26b3a0" v-model="voiceRate"></u-slider>
+					<view class="sliderValue">
+						{{roundRate}}X
+					</view>
+				</view>
+			</view>
+		</u-popup>
+		<!-- 声音 -->
+		<u-popup :show="show1" @close="close1" @open="open">
+			<view class="contentBox">
+				<view class="toolBar">
+					<view class="cancel" @click="show1=false">
+						<image src="/static/images/closeBtn.png" mode=""></image>
+					</view>
+					<view class="center">
+						声音
+					</view>
+					<view class="confirm" @click="handleBtnConfirm1">
+						<image src="/static/images/selected.png" mode=""></image>
+					</view>
+				</view>
+				<view class="content">
+					<!-- 			<view class="filterBox">
+						<view class="tabList">
+							<view class="item1" v-for="(item,index) in voiceList"
+								:class="[currTabIndex==index?'tabActive':'']" @click="currTabIndex=index">
+								{{item}}
+							</view>
+						</view>
+						<view class="filterBtn" @click="handleFilter">
+							<text class="iconfont icon-shaixuanguolv" style="font-size: 44rpx; color: #26b3a0;"></text>
+
+						</view>
+					</view> -->
+
+					<view class="filterConList" style="max-height: 500rpx;min-height: 500rpx;overflow-y: scroll;">
+						<view class="item" v-for="(item,index) in allList" @click="handleVoiceSel(item,index)">
+							<view class="imgBox">
+								<image :class="[currTabIndexAll==index?'sel':'']" :src="item.url" mode="">
+							</view>
+							</image>
+							<view class="nameDes">
+								{{item.title}}
+							</view>
+							<view class="name" :class="[currTabIndexAll==index?'selTxt':'']">
+								{{item.name}}
+							</view>
+						</view>
+					</view>
+				</view>
+			</view>
+		</u-popup>
+		<!-- 模型 -->
+		<u-popup :show="show3" @close="close3" @open="open">
+			<view class="contentBox2">
+				<view class="toolBar">
+					<view class="cancel" @click="show3=false">
+						<image src="/static/images/closeBtn.png" mode=""></image>
+					</view>
+					<view class="center">
+						角色
+					</view>
+					<view class="confirm" @click="handleBtnConfirm2">
+						<image src="/static/images/selected.png" mode=""></image>
+					</view>
+				</view>
+				<view class="content">
+					<view class="filterConList">
+						<view class="item" v-for="(item,index) in roleList" @click="handleRoleSel(item,index)">
+							<image :class="[currTabIndexModal==index?'sel':'']" :src="item.url" mode="">
+							</image>
+							<view class="name" :class="[currTabIndexModal==index?'selTxt':'']">
+								{{item.name}}
+							</view>
+						</view>
+					</view>
+				</view>
+			</view>
+		</u-popup>
+
+		<!-- 背景 -->
+		<u-popup :show="show4" @close="close4" @open="open">
+			<view class="contentBox2">
+				<view class="toolBar">
+					<view class="cancel" @click="show4=false">
+						<image src="/static/images/closeBtn.png" mode=""></image>
+					</view>
+					<view class="center">
+						背景
+					</view>
+					<view class="confirm" @click="handleBtnConfirm3">
+						<image src="/static/images/selected.png" mode=""></image>
+					</view>
+				</view>
+				<view class="content">
+					<!-- 	<view class="filterBox">
+						<view class="tabList">
+							<view class="item1" style="padding-left: 40rpx;padding-right: 40rpx;"
+								v-for="(item,index) in bgList" :class="[currTabIndex2==index?'tabActive':'']"
+								@click="currTabIndex2=index">
+								{{item}}
+							</view>
+						</view>
+					</view> -->
+
+					<view class="filterConList2" style="max-height: 500rpx;min-height: 500rpx;overflow-y: scroll;">
+						<view class="pictureBox" v-if="currTabIndex2==0">
+							<image :class="[currTabIndexBg==index?'sel':'']" :src="item.url" mode=""
+								v-for="(item,index) in bgPicList" @click="handleSelBg(item,index)"></image>
+						</view>
+						<view class="pictureBox" v-if="currTabIndex2==1">
+							<view class="color" :style="{background:item}" :class="[currTabIndexBgc==index?'sel':'']"
+								v-for="(item,index) in bgColorList" @click="currTabIndexBgc=index"></view>
+						</view>
+					</view>
+				</view>
+			</view>
+		</u-popup>
+
+		<!-- 声音筛选弹框 -->
+		<u-popup :show="show2" @close="close" @open="open">
+			<view class="contentBox">
+				<view class="toolBar2">
+					<view class="closeBtn" @click="show2=false">
+						<!-- <image src="/static/images/selected.png" mode=""></image> -->
+						X
+					</view>
+				</view>
+				<view class="content">
+					<!-- 场景 -->
+					<view class="scenList">
+						<view class="item " v-for="(item, index) in scenList"
+							:class="[currScenIndex==index?'active':'']" @click="currScenIndex=index">
+							{{item}}
+						</view>
+					</view>
+					<!-- 性别-->
+					<view class="sexList">
+						<view class="item " v-for="(item, index) in sexList" :class="[currSexIndex==index?'active':'']"
+							@click="currSexIndex=index">
+							{{item}}
+						</view>
+					</view>
+					<!-- 年龄-->
+					<view class="ageList">
+						<view class="item " v-for="(item, index) in ageList" :class="[currAgeIndex==index?'active':'']"
+							@click="currAgeIndex=index">
+							{{item}}
+						</view>
+					</view>
+
+					<view class="filterBtn2" @click="filter">
+						确认
+					</view>
+				</view>
+			</view>
+		</u-popup>
+
+		<!-- 备用-视频尺寸 -->
+		<u-popup :show="show5" @close="close" @open="open">
+			<view class="contentBox">
+				<!-- 	<view class="toolBar2">
+					<view class="closeBtn" @click="show5=false">
+						X
+					</view>
+				</view> -->
+				<view class="toolBar toolBar2">
+					<view class="cancel">
+					</view>
+					<view class="center">
+						视频尺寸
+					</view>
+					<view class="confirm" @click="handleBtnConfirm2">
+						<!-- <image src="/static/images/selected.png" mode=""></image> -->
+						<view class="closeBtn" @click="show5=false">
+							X
+						</view>
+					</view>
+				</view>
+				<view class="content">
+					<view class="videoRatioBox">
+						<view class="item">
+							<view class="top">
+								竖版视频
+							</view>
+							<view class="bottom">
+								9:16
+							</view>
+						</view>
+						<view class="item">
+							<view class="top">
+								横版视频
+							</view>
+							<view class="bottom">
+								16:9
+							</view>
+						</view>
+					</view>
+					<view class="filterBtn2" @click="show5=false">
+						确认
+					</view>
+				</view>
+			</view>
+		</u-popup>
+
+		<!-- <wike-tabbar :onTabbar="true" :isShowAnimate="true"></wike-tabbar> -->
+	</view>
+	</view>
+</template>
+
+<script>
+	import {
+		generateWork,
+		roleList,
+		voiceList,
+		backList
+	} from '@/api/robot/index.js'
+	import indexVue from './index.vue';
+
+	import
+	uploadImgUrl
+	from '@/common/config.js';
+	export default {
+		data() {
+			return {
+				audioUrl: '',
+
+				bgItem: {
+
+				},
+				show5: false,
+
+				show4: false,
+				bgList: ['图片', '颜色'],
+				currTabIndex2: 0,
+				currTabIndexBg: -1,
+				currTabIndexBgc: -1,
+				bgPicList: [],
+				bgColorList: ['red', 'green', 'blue', 'orange', 'green', 'blue', 'orange'],
+
+				show3: false,
+				viewList: ['2D', '3D'],
+				currTabIndex1: 0,
+				currTabIndexModal: -1,
+				modalList: [{
+						img: '',
+						name: '模型名称'
+					},
+					{
+						img: '',
+						name: '模型名称'
+					},
+					{
+						img: '',
+						name: '模型名称'
+					},
+					{
+						img: '',
+						name: '模型名称'
+					},
+					{
+						img: '',
+						name: '模型名称'
+					},
+					{
+						img: '',
+						name: '模型名称'
+					},
+					{
+						img: '',
+						name: '模型名称'
+					},
+				],
+
+				show2: false,
+				currTabIndexAll: -1,
+
+				scenList: ['全部场景', '热门', '新闻咨询', '影视咨询', '热门', '新闻咨询', '影视咨询'],
+				currScenIndex: 0,
+
+				sexList: ['全部性别', '男声', '女声'],
+				currSexIndex: 0,
+
+				ageList: ['全部年龄', '儿童', '少年', '青年', '中年', '老年'],
+				currAgeIndex: 0,
+
+				allList: [],
+				// voiceList: ['全部', '热门', '新闻咨询', '影视综艺', '其他'],
+				show1: false,
+				currTabIndex: 0,
+
+				robotName: '',
+				textAreaValue: '',
+				voiceRate: 1,
+				selRoleId: -1,
+				selVoiceId: -1,
+				selBgId: -1,
+				selBgPic: '',
+
+				roleList: [],
+
+				value: 1,
+				show: false,
+				menuList: [{
+						icon: require('@/static/images/yusu.png'),
+						name: '全局语速'
+					},
+					{
+						icon: require('@/static/images/audio.png'),
+						name: '声音'
+					},
+					{
+						icon: require('@/static/images/bg.png'),
+						name: '背景'
+					},
+					{
+						icon: require('@/static/images/role.png'),
+						name: '角色'
+					},
+				],
+				videoSrc: '',
+				showMoreMenu: false,
+				columns: [
+					[]
+				],
+				selVoiceItem: {
+					name: '',
+					url: ''
+				},
+				selRoleItem: {
+					name: '',
+					url: ''
+				},
+
+				detail: {},
+
+				roundRate: 1,
+				isGenerate: false,
+				isCreate: false
+			};
+		},
+		computed: {
+
+		},
+
+		onReady() {
+
+		},
+		onUnload() {
+
+		},
+		onLoad(o) {
+			if (o.type == 'create') {
+				this.isCreate = true
+				this.selRoleId = 5
+				this.selBgId = 0
+				this.selVoiceId = 9
+				this.roundRate = 1
+				this.voiceRate = 1
+				return
+				console.log('create')
+			}
+
+
+
+
+			this.detail = getApp().draftDetail
+
+			this.robotName = getApp().draftDetail.name
+			this.textAreaValue = getApp().draftDetail.content
+			this.selRoleId = getApp().draftDetail.role - 1
+			this.selBgId = getApp().draftDetail.back - 1
+			this.selVoiceId = getApp().draftDetail.audio - 1
+			this.voiceRate = getApp().draftDetail.stage
+
+			this.selBgPic = getApp().draftDetail.backs.url
+			this.bgItem = getApp().draftDetail.backs
+
+			this.roundRate = getApp().draftDetail.stage
+			this.selVoiceItem = getApp().draftDetail.audios
+			this.selRoleItem = getApp().draftDetail.roles
+
+
+			this.audioUrl = getApp().draftDetail.audio_url
+			console.log('传过来的草稿项:', this.detail);
+		},
+		async onShow() {
+			let res = await roleList({})
+			if (res.code == 0) {
+
+				this.roleList = res.msg
+				console.log('数字人角色列表返回值:', res);
+				this.currTabIndexModal = res.msg.findIndex((item, index) => {
+					return item.id == this.selRoleId + 1
+				})
+
+				if (this.isCreate) {
+					this.selRoleItem = this.roleList[5]
+				}
+			} else {
+				uni.showToast({
+					title: res.msg,
+					icon: 'none'
+				})
+			}
+
+			let res1 = await voiceList({})
+			if (res1.code == 0) {
+				// this.roleList = res.data
+				this.allList = res1.msg
+				console.log('数字人声音列表返回值:', res1);
+				this.currTabIndexAll = res1.msg.findIndex((item, index) => {
+					return item.id == this.selVoiceId + 1
+				})
+				if (this.isCreate) {
+					this.selVoiceItem = this.allList[9]
+				}
+
+			} else {
+				uni.showToast({
+					title: res1.msg,
+					icon: 'none'
+				})
+			}
+
+			let res3 = await backList({})
+			if (res3.code == 0) {
+				// this.roleList = res.data
+				this.bgPicList = res3.msg
+				console.log('数字人背景列表返回值:', res3);
+				this.currTabIndexBg = res3.msg.findIndex((item, index) => {
+					return item.id == this.selBgId + 1
+				})
+				if (this.isCreate) {
+					this.selBgPic = this.bgPicList[0].url
+					this.bgItem = this.bgPicList[0]
+				}
+				console.log('index3', this.currTabIndexBgc);
+			} else {
+				uni.showToast({
+					title: res3.msg,
+					icon: 'none'
+				})
+			}
+		},
+		onShareAppMessage: function(res) {
+
+		},
+
+		methods: {
+			uploadVideo() {
+				let _this = this
+				uni.chooseFile({
+					count: 1, //默认100
+					extension: ['.mp3'],
+					success: function(res) {
+						let tempFilePaths = res.tempFilePaths;
+						uni.showLoading({
+							title: "上传中...",
+						});
+
+						uni.uploadFile({
+							url: uploadImgUrl.baseImgUrl,
+							filePath: tempFilePaths[0],
+							// filePath: JSON.stringify(res.tempFilePaths),
+							name: 'file',
+							fileType: "audio",
+							formData: {
+								accept: 'audio',
+								upload_type: 'ali-oss'
+							},
+							success: (uploadFileRes) => {
+								uni.hideLoading();
+								const ret = JSON.parse(uploadFileRes.data);
+								if (ret.code == 0) {
+									_this.audioUrl = ret.data.path
+									console.log(ret);
+								}
+
+							}
+						});
+					}
+				});
+			},
+
+
+			close() {
+				this.show = false
+			},
+			close1() {
+				this.show1 = false
+			},
+			close3() {
+				this.show3 = false
+			},
+			close4() {
+				this.show4 = false
+			},
+			handleSelBg(item, index) {
+				this.selRoleItem = {}
+
+
+				this.bgItem = item
+				this.selBgPic = item.url
+				this.selBgId = item.id - 1
+				this.currTabIndexBg = index
+			},
+			handleVoiceSel(item, index) {
+				this.selVoiceItem = item
+				this.selVoiceId = item.id - 1
+				this.currTabIndexAll = index
+			},
+			handleRoleSel(item, index) {
+				this.selRoleItem = item
+				this.selRoleId = item.id - 1
+				this.currTabIndexModal = index
+			},
+			async saveDraft() {
+				let parmas = {
+					name: this.robotName,
+					content: this.textAreaValue,
+					// role: this.selRoleId,
+					// back: this.selBgId,
+					// audio: this.selVoiceId,
+					stage: this.roundRate,
+					audio_url: this.audioUrl,
+					is_draft: 1
+				}
+				if (this.selRoleId != -1) {
+					parmas['role'] = this.selRoleId
+				}
+				if (this.selBgId != -1) {
+					parmas['back'] = this.selBgId
+				}
+				if (this.selVoiceId != -1) {
+					parmas['audio'] = this.selVoiceId
+				}
+
+
+				console.log('保存数字人草稿参数:', parmas);
+				// return
+				let res = await generateWork(parmas)
+				if (res.code == 0) {
+					uni.showToast({
+						title: '保存成功!',
+						icon: 'success'
+					})
+					setTimeout(() => {
+						uni.navigateBack()
+					}, 1500)
+				} else {
+					uni.showToast({
+						title: res.msg,
+						icon: 'none'
+					})
+				}
+				console.log('保存数字人草稿返回值:', res);
+			},
+			async genRobot() {
+
+				if (this.isGenerate) {
+					uni.showToast({
+						title: '请等待上一次生成完成后提交!',
+						icon: 'none'
+					})
+					return
+				}
+
+
+				let parmas = {}
+				if (this.audioUrl) {
+					parmas = {
+						name: this.robotName,
+						// content: this.textAreaValue,
+						role: this.selRoleId,
+						back: this.selBgId,
+						// audio: this.selVoiceId,
+						// stage: this.roundRate,
+						audio_url: this.audioUrl
+					}
+				} else {
+					parmas = {
+						name: this.robotName,
+						content: this.textAreaValue,
+						role: this.selRoleId,
+						back: this.selBgId,
+						audio: this.selVoiceId,
+						stage: this.roundRate,
+						audio_url: this.audioUrl
+					}
+				}
+				console.log('创建数字人参数:', parmas);
+				// return
+				let res = await generateWork(parmas)
+				if (res.code == 0) {
+					this.isGenerate = true
+					uni.showToast({
+						title: '创建数字人成功!',
+						icon: 'success'
+					})
+					getApp().from = 'create'
+					setTimeout(() => {
+						uni.navigateBack()
+					}, 1500)
+				} else {
+					uni.showToast({
+						title: res.msg,
+						icon: 'none'
+					})
+				}
+				console.log('生成数字人返回值:', res);
+			},
+
+			filter() {
+				this.show2 = false
+			},
+			handleFilter() {
+				// this.show1 = false
+				this.show2 = true
+			},
+			handleBtnConfirm1() {
+				this.show1 = false
+			},
+			handleBtnConfirm2() {
+				this.show3 = false
+			},
+			handleBtnConfirm3() {
+				this.show4 = false
+			},
+
+			handleSetBox(item) {
+				if (item.name == '全局语速') {
+					if (this.audioUrl) {
+						return uni.showToast({
+							title: '上传音频不支持全局语速',
+							icon: 'none'
+						})
+					}
+					this.show = true
+				} else if (item.name == '声音') {
+					if (this.audioUrl) {
+						return uni.showToast({
+							title: '上传音频不支持声音选择',
+							icon: 'none'
+						})
+					}
+					this.show1 = true
+				} else if (item.name == '角色') {
+
+					this.show3 = true
+				} else if (item.name == '背景') {
+					this.show4 = true
+				}
+			},
+			handleChange(e) {
+				console.log(e);
+				this.roundRate = e.toFixed(1)
+			},
+
+			handleBtnConfirm() {
+				this.show = false
+			},
+
+			handleCreatePro() {
+				uni.navigateTo({
+					url: ''
+				})
+			},
+			handleShowMoreMenu() {
+				this.showMoreMenu = true
+			},
+			handleConfirm(e) {
+				this.showMoreMenu = false
+			},
+			open() {
+				// console.log('open() ');
+			}
+		}
+	};
+</script>
+
+<style lang="scss" scoped>
+	@import './index.scss';
+</style>

+ 37 - 17
pages/robot/index.vue

xqd xqd
@@ -244,24 +244,37 @@
 					url: '/pages/robot/generate/index'
 				})
 			},
-			async delDraft(item, index) {
-				let res = await delWork({
-					id: item.id
-				})
-				if (res.code == 0) {
-					this.draftList.splice(index, 1)
+			delDraft(item, index) {
+				let _this = this
+				uni.showModal({
+					title: '提示',
+					confirmColor: '#26b3a0',
+					content: '是否确认删除:' + item.name + '?',
+					success: async (res1) => {
+						if (res1.confirm) {
+							let res = await delWork({
+								id: item.id
+							})
+							if (res.code == 0) {
+								_this.draftList.splice(index, 1)
 
-					console.log('删除数字人草稿返回值:', res);
-					uni.showToast({
-						title: '数字人:' + item.name + '草稿删除成功!',
-						icon: 'success'
-					})
-				} else {
-					uni.showToast({
-						title: res.msg,
-						icon: 'none'
-					})
-				}
+								console.log('删除数字人草稿返回值:', res);
+								uni.showToast({
+									title: '数字人:' + item.name + '草稿删除成功!',
+									icon: 'success'
+								})
+							} else {
+								uni.showToast({
+									title: res.msg,
+									icon: 'none'
+								})
+							}
+
+						} else if (res1.cancel) {
+
+						}
+					}
+				});
 			},
 			downLoad(url) {
 				uni.downloadFile({
@@ -375,6 +388,13 @@
 				let _this = this
 				this.showMoreMenu = false
 				if (e.value[0] == '删除') {
+					if (this.delItem.state == 0) {
+						uni.showToast({
+							title: '数字人正在生成中,请稍后操作',
+							icon: 'none'
+						})
+						return
+					}
 					uni.showModal({
 						title: '提示',
 						confirmColor: '#26b3a0',

+ 1 - 1
utils/request/index.js

xqd
@@ -10,7 +10,7 @@ uni.$u.http.setConfig((config) => {
 	// 本地
 	// config.baseURL = 'http://192.168.31.102/'
 	// 线上
-	config.baseURL = 'http://meta.swdz.com/'
+	config.baseURL = 'https://meta.swdz.com/'
 
 
 	config.header = {