فهرست منبع

数字人目前的bug已修改完毕8.17

李万涛 1 سال پیش
والد
کامیت
5eae34d740
4فایلهای تغییر یافته به همراه200 افزوده شده و 59 حذف شده
  1. 52 4
      pages/robot/generate/index.scss
  2. 129 47
      pages/robot/generate/index.vue
  3. 12 8
      pages/robot/index.vue
  4. 7 0
      pages/user/signin.vue

+ 52 - 4
pages/robot/generate/index.scss

xqd xqd xqd xqd xqd
@@ -103,8 +103,8 @@ page {
 			}
 			.btnBox{
 			padding: 0 40rpx;
-			// position: fixed;
-			// bottom: 0rpx;
+			position: fixed;
+			bottom: 0rpx;
 			background: #fff;
 			height: 150rpx;
 			display: flex;
@@ -264,6 +264,7 @@ page {
 			}
 				
 			.filterConList2{
+				padding: 0 20rpx;
 				.pictureBox{
 					padding-top: 30rpx;
 					padding-bottom: 50rpx;
@@ -276,7 +277,7 @@ page {
 					image{
 						width: 128rpx;
 						height: 176rpx;
-						margin:10rpx  30rpx;
+						margin:10rpx  25rpx;
 					}
 					.color{
 						width: 128rpx;
@@ -300,7 +301,7 @@ page {
 					flex-direction: column;
 					justify-content: center;
 					align-items: center;
-					margin: 0 30rpx;
+					margin: 0 25rpx;
 					margin-bottom: 20rpx;
 						image{
 							width: 128rpx;
@@ -782,4 +783,51 @@ page {
 		display: flex;
 		flex-direction: column;
 		align-items: center;
+	}
+	
+	
+	.audioOrTxtChange{
+		display: flex;
+		padding-left: 20rpx;
+		.item{
+			height: 50rpx;
+			margin-right: 20rpx;
+			padding-left: 20rpx;
+			padding-right: 20rpx;
+			display: flex;
+			justify-content: center;
+			align-items: center;
+		}
+		.item1{
+			border: 1rpx solid #26b3a0;
+			border-radius: 10rpx;
+			color:#26b3a0;
+			background: #26b3a0;
+			color: white;
+		}
+		.item2{
+			border: 1rpx solid #999;
+			border-radius: 10rpx;
+			color:#999;
+			background: #999;
+			color: white;
+		}
+	}
+	
+	
+	.uploadVideoBtn{
+		margin-top: 50rpx;
+		margin-bottom: 10rpx;
+		width: 70%;
+		border:1rpx solid #26b3a0;
+		
+		height: 100rpx;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		border-radius: 15rpx;
+		color: #26b3a0;
+		margin-left: 50%;
+		
+		transform: translateX(-50%);
 	}

+ 129 - 47
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
@@ -29,7 +29,7 @@
 				</view>
 			</view>
 			<view class="selCon">
-				<view class="item" @click="show=true" v-if="!audioUrl">
+				<view class="item" @click="show=true" v-if="curBobaoIndex==0">
 					<view class="label">
 						语速:
 					</view>
@@ -37,7 +37,7 @@
 						{{roundRate}}X
 					</view>
 				</view>
-				<view class="item" @click="show1=true" v-if="!audioUrl">
+				<view class="item" @click="show1=true" v-if="curBobaoIndex==0">
 					<view class="label">
 						声音:{{selVoiceItem.name}}
 					</view>
@@ -64,26 +64,34 @@
 				</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 class="audioOrTxtChange">
+				<view class="item " :class="[index==curBobaoIndex?'item1':'item2']"
+					v-for="(item,index) in bobaoMenuList" @click="handleChangeBobao(index)">
+					{{item}}
 				</view>
-				<view class="audioListBox">
-					<view class="con">
-						{{audioUrl}}
+			</view>
+
+			<view class="" v-if="curBobaoIndex==0">
+				<u--textarea height="" :disabled="false" border="none" :autoHeight="true" maxlength="9999"
+					v-model="textAreaValue" placeholder="请输入播报内容"></u--textarea>
+			</view>
+			<view class="" v-else style="height: 400rpx;">
+				<view class="uploadVideoBtn" @click="uploadVideo">上传录音文件</view>
+				<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>
-					<text @click="audioUrl=''" class="iconfont icon-shanchu rightIcon"
-						:style="{fontSize:isPc?'64rpx':'32rpx'}"></text>
 				</view>
 			</view>
 
@@ -175,7 +183,7 @@
 						<image src="/static/images/selected.png" mode=""></image>
 					</view>
 				</view>
-				<view class="content">
+				<view class="content" style="padding: 0 20rpx;">
 					<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="">
@@ -216,16 +224,6 @@
 							</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">
 							<view class="bgBox" v-for="(item,index) in bgPicList">
@@ -281,6 +279,7 @@
 							<view class=""
 								style="margin-left: 30rpx;margin-top: 20rpx;word-break: break-all;word-wrap: break-word;">
 								已选择的背景图:<br>
+								<!-- {{testCusBgImg1}} -->
 								{{testCusBgImg}}
 							</view>
 						</view>
@@ -399,11 +398,16 @@
 	export default {
 		data() {
 			return {
+				bobaoMenuList: ['输入播报文本', '上传播报录音文件'],
+				curBobaoIndex: 0,
+
+				localBgPicName: '',
 				refImg1: '',
 				refImg2: '',
 
 
 				testCusBgImg: '',
+				testCusBgImg1: '',
 				// tempAudioUrl: 'https://oaigc.oss-cn-chengdu.aliyuncs.com/20230804/90d3618dd8ae5a9ea50b932dba34f295.mp3',
 
 				audioUrl: '',
@@ -585,6 +589,11 @@
 				this.testCusBgImg = getApp().draftDetail.back_url
 				this.selBgPic = getApp().draftDetail.back_url
 				this.bgItem.scale = getApp().draftDetail.scale
+				this.currTabIndex2 = 1
+			}
+
+			if (this.audioUrl && !this.textAreaValue) {
+				this.curBobaoIndex = 1
 			}
 			console.log('传过来的草稿项:', this.detail);
 		},
@@ -683,6 +692,13 @@
 		},
 
 		methods: {
+			handleChangeBobao(index) {
+				this.curBobaoIndex = index
+				// if (index == 0) {
+				// 	this.audioUrl = ''
+				// }
+			},
+
 			previewImg(url) {
 				uni.previewImage({
 					urls: [url],
@@ -702,6 +718,16 @@
 					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
 					sourceType: ['album', 'camera'], //从相册选择
 					success: function(res) {
+						that.localBgPicName = res.tempFiles[0].name
+						console.log('选择图片返回值:', res, res.tempFiles[0].size, that.localBgPicName);
+						if (res.tempFiles[0].size >
+							5242880) {
+							return uni.showToast({
+								title: '图片大小最大不能超过5M',
+								icon: 'none',
+								duration: 2000
+							})
+						}
 						const tempFilePaths = res.tempFilePaths;
 						//上传服务器将服务器;
 						uni.uploadFile({
@@ -716,11 +742,16 @@
 								let a = JSON.parse(res2.data);
 								if (a.code == 0) {
 									that.testCusBgImg = a.data.path.trim()
+									that.testCusBgImg1 = that.localBgPicName
 									console.log('上传图片返回值----1:', that.testCusBgImg);
 
-									that.selRoleItem = {}
-									that.currTabIndexModal = -1
-									that.roleList = that.roleList2.filter((item, index) => {
+									if (that.selRoleItem.proportion != '9:16') {
+										that.selRoleItem = {}
+										that.currTabIndexModal = -1
+									}
+
+									that.roleList = that.roleList2.filter((item,
+										index) => {
 										return item.proportion == '9:16'
 
 									})
@@ -754,6 +785,16 @@
 					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
 					sourceType: ['album', 'camera'], //从相册选择
 					success: function(res) {
+						that.localBgPicName = res.tempFiles[0].name
+						// console.log('选择图片返回值:', res, res.tempFiles[0].size, that.localBgPicName);
+						if (res.tempFiles[0].size >
+							5242880) {
+							return uni.showToast({
+								title: '图片大小最大不能超过5M',
+								icon: 'none',
+								duration: 2000
+							})
+						}
 						const tempFilePaths = res.tempFilePaths;
 						//上传服务器将服务器;
 						uni.uploadFile({
@@ -768,11 +809,15 @@
 								let a = JSON.parse(res2.data);
 								if (a.code == 0) {
 									that.testCusBgImg = a.data.path.trim()
+									that.testCusBgImg1 = that.localBgPicName
 									console.log('上传图片返回值---2:', that.testCusBgImg);
 
-									that.selRoleItem = {}
-									that.currTabIndexModal = -1
-									that.roleList = that.roleList2.filter((item, index) => {
+									if (that.selRoleItem.proportion != '16:9') {
+										that.selRoleItem = {}
+										that.currTabIndexModal = -1
+									}
+									that.roleList = that.roleList2.filter((item,
+										index) => {
 										return item.proportion == '16:9'
 									})
 									that.bgItem = {
@@ -819,6 +864,14 @@
 					extension: ['.mp3'],
 					success: function(res) {
 						let tempFilePaths = res.tempFilePaths;
+
+						console.log('选择的音频文件返回值', res);
+						if (!res.tempFiles[0].name.endsWith('.mp3')) {
+							return uni.showToast({
+								title: "请上传mp3音频文件",
+								icon: 'none'
+							});
+						}
 						uni.showLoading({
 							title: "上传中...",
 						});
@@ -872,14 +925,25 @@
 				if (this.testCusBgImg) {
 					this.testCusBgImg = ''
 				}
+				if (this.testCusBgImg1) {
+					this.testCusBgImg1 = ''
+				}
 
 				this.bgItem = item
 				this.newBgItem = item
 				console.log('111111111', item);
 
-				// return
-				this.selRoleItem = {}
-				this.currTabIndexModal = -1
+				if (this.selRoleItem.proportion == '9:16') {
+					if (item.scale != 1) {
+						this.selRoleItem = {}
+						this.currTabIndexModal = -1
+					}
+				} else {
+					if (item.scale != 2) {
+						this.selRoleItem = {}
+						this.currTabIndexModal = -1
+					}
+				}
 
 				if (item.scale == 1) {
 					this.roleList = this.roleList2.filter((item, index) => {
@@ -919,12 +983,12 @@
 						backId: this.bgItem.id
 					});
 				} else {
-					if (this.bgItem.id != this.newBgItem.id) {
-						return uni.showToast({
-							title: '请先选择背景图,再选择角色',
-							icon: 'none'
-						})
-					}
+					// if (this.bgItem.id != this.newBgItem.id) {
+					// 	return uni.showToast({
+					// 		title: '请先选择背景图,再选择角色',
+					// 		icon: 'none'
+					// 	})
+					// }
 					this.selRoleItem = item
 					this.selRoleId = item.id - 1
 					this.currTabIndexModal = index
@@ -994,7 +1058,7 @@
 
 
 				let parmas = {}
-				if (this.audioUrl && !this.testCusBgImg) {
+				if (this.audioUrl && !this.testCusBgImg && this.curBobaoIndex == 1) {
 					parmas = {
 						name: this.robotName,
 						// content: this.textAreaValue,
@@ -1004,12 +1068,12 @@
 						// stage: this.roundRate,
 						audio_url: this.audioUrl
 					}
-				} else if (this.audioUrl && this.testCusBgImg) {
+				} else if (this.audioUrl && this.testCusBgImg && this.curBobaoIndex == 1) {
 					parmas = {
 						name: this.robotName,
 						// content: this.textAreaValue,
 						role: this.selRoleId,
-						back: this.selBgId,
+						// back: this.selBgId,
 						// audio: this.selVoiceId,
 						// stage: this.roundRate,
 						audio_url: this.audioUrl,
@@ -1026,6 +1090,24 @@
 						stage: this.roundRate,
 						// audio_url: this.audioUrl
 					}
+				} else if (!this.audioUrl && this.curBobaoIndex == 1) {
+					return uni.showToast({
+						title: '请上传录音播报文件',
+						icon: 'none',
+						duration: 1500
+					})
+
+				} else if (this.audioUrl && !this.textAreaValue) {
+					parmas = {
+						name: this.robotName,
+						content: this.textAreaValue,
+						role: this.selRoleId,
+						// back: this.selBgId,
+						back_url: this.testCusBgImg,
+						audio: this.selVoiceId,
+						stage: this.roundRate,
+						// audio_url: this.audioUrl
+					}
 				} else {
 					parmas = {
 						name: this.robotName,
@@ -1087,7 +1169,7 @@
 
 			handleSetBox(item) {
 				if (item.name == '全局语速') {
-					if (this.audioUrl) {
+					if (this.curBobaoIndex == 1) {
 						return uni.showToast({
 							title: '上传音频不支持全局语速',
 							icon: 'none'
@@ -1095,7 +1177,7 @@
 					}
 					this.show = true
 				} else if (item.name == '声音') {
-					if (this.audioUrl) {
+					if (this.curBobaoIndex == 1) {
 						return uni.showToast({
 							title: '上传音频不支持声音选择',
 							icon: 'none'

+ 12 - 8
pages/robot/index.vue

xqd xqd xqd
@@ -102,7 +102,7 @@
 				</view>
 			</u-popup>
 
-			<u-picker :defaultIndex='[0]' :closeOnClickOverlay="true" :showIcon="true" :show="showMoreMenu"
+			<u-picker ref="picker" defaultIndex='' :closeOnClickOverlay="true" :showIcon="true" :show="showMoreMenu"
 				:columns="columns" title="更多" confirmColor="" @cancel="showMoreMenu=false" @confirm="handleConfirm"
 				@close="handleClosePicker"></u-picker>
 			<wike-tabbar :onTabbar="true" :isShowAnimate="true"></wike-tabbar>
@@ -236,6 +236,7 @@
 			},
 			handleClosePicker() {
 				this.showMoreMenu = false
+
 				// this.columns = [
 				// 	['删除', '下载视频', '复制链接']
 				// ]
@@ -382,21 +383,24 @@
 				})
 			},
 			handleShowMoreMenu(item, index) {
+				this.$refs.picker.setIndexs([0])
 				this.delIndex = index
 				this.delItem = item
 				this.showMoreMenu = true
+
+
 			},
 			async handleConfirm(e) {
 				let _this = this
 				this.showMoreMenu = false
 				if (e.value[0] == '删除') {
-					if (this.delItem.state == 0) {
-						uni.showToast({
-							title: '数字人正在生成中,请稍后操作',
-							icon: 'none'
-						})
-						return
-					}
+					// if (this.delItem.state == 0) {
+					// 	uni.showToast({
+					// 		title: '数字人正在生成中,请稍后操作',
+					// 		icon: 'none'
+					// 	})
+					// 	return
+					// }
 					uni.showModal({
 						title: '提示',
 						confirmColor: '#26b3a0',

+ 7 - 0
pages/user/signin.vue

xqd xqd
@@ -314,6 +314,11 @@
 					console.log('注册返回值:', res);
 					if (res.code == 0) {
 						this.showlogon = true
+
+						uni.showToast({
+							title: '注册成功,请登录',
+							icon: 'none'
+						})
 					} else {
 						uni.showToast({
 							title: res.msg,
@@ -354,6 +359,8 @@
 
 				this.$http(this.showlogon ? 'user.login' : 'user.register', this.accountLogin).then(res => {
 					if (res.code === 0) {
+
+						// console.log('登录注册返回值:', res);
 						var z = this.showlogon ? '登录成功' : '注册登录成功'
 
 						this.$store.dispatch('getUserInfo', this.showlogon ? res.data.user.token : res.data