| xqd
@@ -14,7 +14,7 @@
|
|
|
</view>
|
|
|
<view class="videoBox2" v-if="bgItem.scale==2&&selBgPic" :style="{}">
|
|
|
<image class="img16" :src="selBgPic" mode=""></image>
|
|
|
- <view class="role">
|
|
|
+ <view class="role" style="z-index: 2;">
|
|
|
<image :src="selRoleItem.url" mode=""></image>
|
|
|
</view>
|
|
|
</view>
|
| xqd
@@ -153,7 +153,7 @@
|
|
|
|
|
|
</view>
|
|
|
|
|
|
- <view class="playBox" style="" @click="playAudio(item)">
|
|
|
+ <view class="playBox" style="" @click="playAudio(item.audio_url)">
|
|
|
试听
|
|
|
</view>
|
|
|
</view>
|
| xqd
@@ -207,16 +207,16 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="content">
|
|
|
- <!-- <view class="filterBox">
|
|
|
+ <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">
|
|
|
+ @click="handleBgTabChange(item,index)">
|
|
|
{{item}}
|
|
|
</view>
|
|
|
</view>
|
|
|
- </view> -->
|
|
|
- <!-- <view class="filterBox">
|
|
|
+ </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':'']"
|
| xqd
@@ -244,9 +244,16 @@
|
|
|
<view class="des">
|
|
|
<text class="lab">尺寸:9:16</text><br>
|
|
|
背景图要求:<br>
|
|
|
- 像素:1080P<br>
|
|
|
- 文件大小:1M以内
|
|
|
+ 像素:最高3800 × 3800px<br>
|
|
|
+ 文件大小:5M以内
|
|
|
</view>
|
|
|
+ <!-- <view class="" style="color: #06C68E;">
|
|
|
+ 参考图
|
|
|
+ </view>
|
|
|
+ <view class="referImg" @click="previewImg(refImg1)">
|
|
|
+ <image class="ig1" :src="refImg1" mode="scaleToFill"
|
|
|
+ style="width: 40%;height: 250rpx;"></image>
|
|
|
+ </view> -->
|
|
|
<view class="btn" @click="uploadBg1">
|
|
|
上传背景图(9:16)
|
|
|
</view>
|
| xqd
@@ -255,9 +262,16 @@
|
|
|
<view class="des">
|
|
|
<text class="lab">尺寸:16:9</text><br>
|
|
|
背景图要求:<br>
|
|
|
- 像素:1080P<br>
|
|
|
- 文件大小:1M以内
|
|
|
+ 像素:最高3800 × 3800px<br>
|
|
|
+ 文件大小:5M以内
|
|
|
+ </view>
|
|
|
+ <!-- <view class="" style="color: #06C68E;">
|
|
|
+ 参考图
|
|
|
</view>
|
|
|
+ <view class="referImg" @click="previewImg(refImg2)">
|
|
|
+ <image class="ig2" style="width: 70%;height: 130rpx;" :src="refImg2"
|
|
|
+ mode="scaleToFill"></image>
|
|
|
+ </view> -->
|
|
|
<view class="btn" @click="uploadBg2">
|
|
|
上传背景图(16:9)
|
|
|
</view>
|
| xqd
@@ -361,10 +375,10 @@
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
|
|
|
- <!-- <audio :src="tempAudioUrl" autoplay ref="audioRef" style=""></audio> -->
|
|
|
-
|
|
|
- <!-- <wike-tabbar :onTabbar="true" :isShowAnimate="true"></wike-tabbar> -->
|
|
|
+ <!-- <view class="" style="height: 500rpx;width:300rpx !important;" :style='genResBgImg'>
|
|
|
+ </view> -->
|
|
|
</view>
|
|
|
+
|
|
|
</view>
|
|
|
</template>
|
|
|
|
| xqd
@@ -373,7 +387,9 @@
|
|
|
generateWork,
|
|
|
roleList,
|
|
|
voiceList,
|
|
|
- backList
|
|
|
+ backList,
|
|
|
+ getBg
|
|
|
+
|
|
|
} from '@/api/robot/index.js'
|
|
|
import indexVue from './index.vue';
|
|
|
|
| xqd
@@ -383,6 +399,10 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ refImg1: '',
|
|
|
+ refImg2: '',
|
|
|
+
|
|
|
+
|
|
|
testCusBgImg: '',
|
|
|
// tempAudioUrl: 'https://oaigc.oss-cn-chengdu.aliyuncs.com/20230804/90d3618dd8ae5a9ea50b932dba34f295.mp3',
|
|
|
|
| xqd
@@ -508,7 +528,14 @@
|
|
|
newBgItem: {
|
|
|
id: -1
|
|
|
},
|
|
|
- music: null
|
|
|
+ music: null,
|
|
|
+
|
|
|
+ genResBgImg: "",
|
|
|
+
|
|
|
+ // hasFirstSeledRole: false,
|
|
|
+ isFirstSelRole: true,
|
|
|
+
|
|
|
+ testCusBgScale: 1
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
| xqd
@@ -522,8 +549,6 @@
|
|
|
|
|
|
},
|
|
|
onLoad(o) {
|
|
|
-
|
|
|
-
|
|
|
if (o.type == 'create') {
|
|
|
this.isCreate = true
|
|
|
this.selRoleId = 5
|
| xqd
@@ -543,10 +568,10 @@
|
|
|
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.selBgId = getApp().draftDetail.back - 1
|
|
|
this.selBgPic = getApp().draftDetail.backs.url
|
|
|
this.bgItem = getApp().draftDetail.backs
|
|
|
|
| xqd
@@ -555,27 +580,43 @@
|
|
|
this.selRoleItem = getApp().draftDetail.roles
|
|
|
|
|
|
|
|
|
- this.audioUrl = getApp().draftDetail.audio_url
|
|
|
+ this.audioUrl = getApp().draftDetail.audio_url || ''
|
|
|
+ if (getApp().draftDetail.back_url) {
|
|
|
+ this.testCusBgImg = getApp().draftDetail.back_url
|
|
|
+ this.selBgPic = getApp().draftDetail.back_url
|
|
|
+ this.bgItem.scale = getApp().draftDetail.scale
|
|
|
+ }
|
|
|
console.log('传过来的草稿项:', this.detail);
|
|
|
},
|
|
|
async onShow() {
|
|
|
-
|
|
|
-
|
|
|
let res = await roleList({})
|
|
|
if (res.code == 0) {
|
|
|
-
|
|
|
- this.roleList = res.msg
|
|
|
-
|
|
|
+ // this.roleList = res.msg
|
|
|
this.roleList2 = 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]
|
|
|
+ this.roleList = this.roleList2.filter((item, index) => {
|
|
|
+ return item.proportion == '9:16'
|
|
|
+ })
|
|
|
+ this.selRoleItem = this.roleList2[5]
|
|
|
+ this.currTabIndexModal = 3
|
|
|
+ } else {
|
|
|
+ if (this.detail.backs.scale == 1) {
|
|
|
+ this.roleList = this.roleList2.filter((item, index) => {
|
|
|
+ return item.proportion == '9:16'
|
|
|
+ })
|
|
|
+ this.currTabIndexModal = this.roleList.findIndex((item, index) => {
|
|
|
+ return item.id == this.selRoleId + 1
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.roleList = this.roleList2.filter((item, index) => {
|
|
|
+ return item.proportion == '16:9'
|
|
|
+ })
|
|
|
+ this.currTabIndexModal = this.roleList.findIndex((item, index) => {
|
|
|
+ return item.id == this.selRoleId + 1
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
uni.showToast({
|
| xqd
@@ -607,33 +648,15 @@
|
|
|
if (res3.code == 0) {
|
|
|
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
|
|
|
- // })
|
|
|
- // }
|
|
|
-
|
|
|
-
|
|
|
|
|
|
+ this.refImg1 = res3.msg[0].url
|
|
|
+ this.refImg2 = res3.msg[3].url
|
|
|
+ console.log('数字人背景列表返回值:', res3);
|
|
|
+ if (!this.testCusBgImg) {
|
|
|
+ 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]
|
| xqd
@@ -660,6 +683,18 @@
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ previewImg(url) {
|
|
|
+ uni.previewImage({
|
|
|
+ urls: [url],
|
|
|
+ // current:[0]
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ handleBgTabChange(item, index) {
|
|
|
+ this.currTabIndex2 = index
|
|
|
+ console.log('12122', index);
|
|
|
+ if (index == 1) {} else {}
|
|
|
+ },
|
|
|
uploadBg1() {
|
|
|
let that = this;
|
|
|
uni.chooseImage({
|
| xqd
@@ -681,7 +716,24 @@
|
|
|
let a = JSON.parse(res2.data);
|
|
|
if (a.code == 0) {
|
|
|
that.testCusBgImg = a.data.path.trim()
|
|
|
- console.log('上传图片返回值:', that.testCusBgImg);
|
|
|
+ console.log('上传图片返回值----1:', that.testCusBgImg);
|
|
|
+
|
|
|
+ that.selRoleItem = {}
|
|
|
+ that.currTabIndexModal = -1
|
|
|
+ that.roleList = that.roleList2.filter((item, index) => {
|
|
|
+ return item.proportion == '9:16'
|
|
|
+
|
|
|
+ })
|
|
|
+ that.bgItem = {
|
|
|
+ id: 9999,
|
|
|
+ scale: 1,
|
|
|
+ url: a.data.path.trim()
|
|
|
+ }
|
|
|
+ that.selBgPic = a.data.path.trim()
|
|
|
+
|
|
|
+ that.currTabIndexBg = -1
|
|
|
+
|
|
|
+ that.testCusBgScale = 1
|
|
|
// that.ifimg = true
|
|
|
} else {
|
|
|
uni.showToast({
|
| xqd
@@ -716,8 +768,22 @@
|
|
|
let a = JSON.parse(res2.data);
|
|
|
if (a.code == 0) {
|
|
|
that.testCusBgImg = a.data.path.trim()
|
|
|
- console.log('上传图片返回值:', that.testCusBgImg);
|
|
|
- // that.ifimg = true
|
|
|
+ console.log('上传图片返回值---2:', that.testCusBgImg);
|
|
|
+
|
|
|
+ that.selRoleItem = {}
|
|
|
+ that.currTabIndexModal = -1
|
|
|
+ that.roleList = that.roleList2.filter((item, index) => {
|
|
|
+ return item.proportion == '16:9'
|
|
|
+ })
|
|
|
+ that.bgItem = {
|
|
|
+ id: 9999,
|
|
|
+ scale: 2,
|
|
|
+ url: a.data.path.trim()
|
|
|
+ }
|
|
|
+ that.selBgPic = a.data.path.trim()
|
|
|
+ that.currTabIndexBg = -1
|
|
|
+
|
|
|
+ that.testCusBgScale = 2
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: '上传图片失败',
|
| xqd
@@ -741,7 +807,7 @@
|
|
|
this.music = uni.createInnerAudioContext(); //创建播放器对象
|
|
|
this.music.autoplay = true;
|
|
|
this.music.src =
|
|
|
- "https://oaigc.oss-cn-chengdu.aliyuncs.com/20230804/90d3618dd8ae5a9ea50b932dba34f295.mp3"; //音频地址
|
|
|
+ item; //音频地址
|
|
|
// this.music.play();
|
|
|
},
|
|
|
|
| xqd
@@ -802,6 +868,10 @@
|
|
|
this.show4 = false
|
|
|
},
|
|
|
handleSelBg(item, index) {
|
|
|
+ this.isFirstSelRole = false
|
|
|
+ if (this.testCusBgImg) {
|
|
|
+ this.testCusBgImg = ''
|
|
|
+ }
|
|
|
|
|
|
this.bgItem = item
|
|
|
this.newBgItem = item
|
| xqd
@@ -838,17 +908,32 @@
|
|
|
this.selVoiceId = item.id - 1
|
|
|
this.currTabIndexAll = index
|
|
|
},
|
|
|
- handleRoleSel(item, index) {
|
|
|
- if (this.bgItem.id != this.newBgItem.id) {
|
|
|
- return uni.showToast({
|
|
|
- title: '请先选择背景图,再选择角色',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
+ async handleRoleSel(item, index) {
|
|
|
+ if (this.isFirstSelRole) {
|
|
|
+ this.selRoleItem = item
|
|
|
+ this.selRoleId = item.id - 1
|
|
|
+ this.currTabIndexModal = index
|
|
|
+
|
|
|
+ console.log('获取合成背景参数:', {
|
|
|
+ roleId: item.id,
|
|
|
+ backId: this.bgItem.id
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ if (this.bgItem.id != this.newBgItem.id) {
|
|
|
+ return uni.showToast({
|
|
|
+ title: '请先选择背景图,再选择角色',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.selRoleItem = item
|
|
|
+ this.selRoleId = item.id - 1
|
|
|
+ this.currTabIndexModal = index
|
|
|
+
|
|
|
+ console.log('获取合成背景参数:', {
|
|
|
+ roleId: item.id,
|
|
|
+ backId: this.bgItem.id
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
- this.selRoleItem = item
|
|
|
- this.selRoleId = item.id - 1
|
|
|
- this.currTabIndexModal = index
|
|
|
},
|
|
|
async saveDraft() {
|
|
|
let parmas = {
|
| xqd
@@ -865,13 +950,19 @@
|
|
|
parmas['role'] = this.selRoleId
|
|
|
}
|
|
|
if (this.selBgId != -1) {
|
|
|
- parmas['back'] = this.selBgId
|
|
|
+ if (this.testCusBgImg) {
|
|
|
+ parmas['back_url'] = this.testCusBgImg
|
|
|
+ parmas['scale'] = this.testCusBgScale
|
|
|
+ } else {
|
|
|
+ parmas['back'] = this.selBgId
|
|
|
+ }
|
|
|
}
|
|
|
if (this.selVoiceId != -1) {
|
|
|
parmas['audio'] = this.selVoiceId
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
console.log('保存数字人草稿参数:', parmas);
|
|
|
// return
|
|
|
let res = await generateWork(parmas)
|
| xqd
@@ -903,7 +994,7 @@
|
|
|
|
|
|
|
|
|
let parmas = {}
|
|
|
- if (this.audioUrl) {
|
|
|
+ if (this.audioUrl && !this.testCusBgImg) {
|
|
|
parmas = {
|
|
|
name: this.robotName,
|
|
|
// content: this.textAreaValue,
|
| xqd
@@ -913,6 +1004,28 @@
|
|
|
// stage: this.roundRate,
|
|
|
audio_url: this.audioUrl
|
|
|
}
|
|
|
+ } else if (this.audioUrl && this.testCusBgImg) {
|
|
|
+ parmas = {
|
|
|
+ name: this.robotName,
|
|
|
+ // content: this.textAreaValue,
|
|
|
+ role: this.selRoleId,
|
|
|
+ back: this.selBgId,
|
|
|
+ // audio: this.selVoiceId,
|
|
|
+ // stage: this.roundRate,
|
|
|
+ audio_url: this.audioUrl,
|
|
|
+ back_url: this.testCusBgImg
|
|
|
+ }
|
|
|
+ } else if (!this.audioUrl && this.testCusBgImg) {
|
|
|
+ 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,
|
| xqd
@@ -921,7 +1034,7 @@
|
|
|
back: this.selBgId,
|
|
|
audio: this.selVoiceId,
|
|
|
stage: this.roundRate,
|
|
|
- audio_url: this.audioUrl
|
|
|
+ // audio_url: this.audioUrl
|
|
|
}
|
|
|
}
|
|
|
console.log('创建数字人参数:', parmas);
|
| xqd
@@ -988,6 +1101,8 @@
|
|
|
icon: 'none'
|
|
|
})
|
|
|
}
|
|
|
+ this.music = uni.createInnerAudioContext(); //创建播放器对象
|
|
|
+ this.music.autoplay = true;
|
|
|
this.show1 = true
|
|
|
} else if (item.name == '角色') {
|
|
|
|