|
@@ -19,24 +19,24 @@
|
|
|
<text class="form-area-item-text">视频名称</text>
|
|
|
<input type="text" v-model="videoName" placeholder="请输入视频名称">
|
|
|
</view>
|
|
|
- <view class="form-area-item" :key="timeStamp">
|
|
|
+ <!-- <view class="form-area-item" :key="timeStamp">
|
|
|
<text class="form-area-item-text">选择您的形象</text>
|
|
|
<button @click="chooseFile" class="cu-btn bg-red">选择文件</button>
|
|
|
<text class="file-name" v-if="fileInfo.name">{{fileInfo.name}}</text>
|
|
|
<text class="none-file" v-if="!showPerson">未选择文件</text>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
<view class="form-area-item">
|
|
|
- <text class="form-area-item-text">选择视频背景</text>
|
|
|
+ <text class="form-area-item-text">选择您的形象</text>
|
|
|
<button @click="chooseImage" class="cu-btn bg-red">选择图片</button>
|
|
|
<text class="none-file" v-if="!imagePath">未选择图片</text>
|
|
|
<image :src="imagePath" v-else mode="aspectFit" style="width: 30px; height: 30px;margin-left:10px" />
|
|
|
</view>
|
|
|
- <view class="form-area-item">
|
|
|
+ <!-- <view class="form-area-item">
|
|
|
<text class="form-area-item-text">选择模板</text>
|
|
|
<uni-data-select v-model="modelIndex" :localdata="array" @change="bindPickerChange"></uni-data-select>
|
|
|
<CustomModal :visible="isModalVisible" :message="modalMessage" :imageSrc="modalImageSrc" @confirm="onConfirm"
|
|
|
@cancel="onCancel" />
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
<view class="form-area-item">
|
|
|
<text class="form-area-item-text">视频内容</text>
|
|
|
<uni-data-checkbox selectedColor="#BD3124" selectedTextColor="#BD3124" v-model="current"
|
|
@@ -45,6 +45,11 @@
|
|
|
<view class="form-area-item" v-if="current=='text'">
|
|
|
<textarea v-model="videoText" placeholder="请输入视频中的文字内容" />
|
|
|
</view>
|
|
|
+ <view class="form-area-item" v-if="current=='text'">
|
|
|
+ <text class="form-area-item-text">音色选择</text>
|
|
|
+ <uni-data-checkbox selectedColor="#BD3124" selectedTextColor="#BD3124" v-model="timbre"
|
|
|
+ :localdata="timbreContent" />
|
|
|
+ </view>
|
|
|
<view class="form-area-item" v-if="current=='record'">
|
|
|
<button @click="toggleRecording">{{ isRecording ? '停止录音' : '开始录音' }}</button>
|
|
|
<!-- <view v-if="audioPath" class="audio-bar" @click="playAudio">
|
|
@@ -57,38 +62,41 @@
|
|
|
<view class="btn-area">
|
|
|
<button @click="jumpToList" class="bg-red lg round create-project">生成数字人视频</button>
|
|
|
<uni-popup ref="alertDialog" type="dialog">
|
|
|
- <uni-popup-dialog type="warning" cancelText="关闭" title="提示" :content="missingContent"
|
|
|
+ <uni-popup-dialog type="warning" cancelText="确定" title="提示" :content="missingContent"
|
|
|
@close="dialogClose"></uni-popup-dialog>
|
|
|
- </uni-popup>
|
|
|
+ </uni-popup>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import CustomModal from '../components/CustomModal.vue';
|
|
|
+ // import CustomModal from '../components/CustomModal.vue';
|
|
|
+ import {
|
|
|
+ uploadPerson
|
|
|
+ } from "@/api/system/user"
|
|
|
const recorderManager = uni.getRecorderManager();
|
|
|
const innerAudioContext = uni.createInnerAudioContext();
|
|
|
innerAudioContext.autoplay = true;
|
|
|
export default {
|
|
|
- components: {
|
|
|
- CustomModal
|
|
|
- },
|
|
|
+ // components: {
|
|
|
+ // CustomModal
|
|
|
+ // },
|
|
|
data() {
|
|
|
return {
|
|
|
videoName: '',
|
|
|
fileInfo: {},
|
|
|
- array: [{
|
|
|
- value: 'ceshi1',
|
|
|
- text: 'demo1'
|
|
|
- },
|
|
|
- {
|
|
|
- value: 'ceshi2',
|
|
|
- text: 'demo3'
|
|
|
- },
|
|
|
- ],
|
|
|
- modelIndex: undefined,
|
|
|
- isModalVisible: false,
|
|
|
- modalMessage: '',
|
|
|
- modalImageSrc: '',
|
|
|
+ // array: [{
|
|
|
+ // value: 'ceshi1',
|
|
|
+ // text: 'demo1'
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // value: 'ceshi2',
|
|
|
+ // text: 'demo3'
|
|
|
+ // },
|
|
|
+ // ],
|
|
|
+ // modelIndex: undefined,
|
|
|
+ // isModalVisible: false,
|
|
|
+ // modalMessage: '',
|
|
|
+ // modalImageSrc: '',
|
|
|
videoContent: [{
|
|
|
value: 'text',
|
|
|
text: '文字输入'
|
|
@@ -110,7 +118,17 @@
|
|
|
method: 'pause'
|
|
|
},
|
|
|
videoText: '',
|
|
|
- missingContent: []
|
|
|
+ missingContent: [],
|
|
|
+ timbre:'a',
|
|
|
+ timbreContent: [{
|
|
|
+ value: 'a',
|
|
|
+ text: 'timbre1'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'b',
|
|
|
+ text: 'timbre2'
|
|
|
+ }
|
|
|
+ ],
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
@@ -140,11 +158,11 @@
|
|
|
if (this.fileInfo.name) this.showPerson = true
|
|
|
},
|
|
|
methods: {
|
|
|
- chooseFile() {
|
|
|
+ /* chooseFile() {
|
|
|
uni.navigateTo({
|
|
|
url: "/pages/root-filelist/root-filelist",
|
|
|
});
|
|
|
- },
|
|
|
+ }, */
|
|
|
async chooseImage() {
|
|
|
const that = this;
|
|
|
uni.chooseImage({
|
|
@@ -163,8 +181,7 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- bindPickerChange(e) {
|
|
|
- console.log(e)
|
|
|
+/* bindPickerChange(e) {
|
|
|
const tempOption = this.array.find(item => item.value == e).text;
|
|
|
this.modalMessage = `您选择的是: ${tempOption}`;
|
|
|
this.modalImageSrc = '../static/images/xijiao/avator.png';
|
|
@@ -176,7 +193,7 @@
|
|
|
},
|
|
|
onCancel() {
|
|
|
this.isModalVisible = false;
|
|
|
- },
|
|
|
+ }, */
|
|
|
radioChange(evt) {
|
|
|
for (let i = 0; i < this.videoContent.length; i++) {
|
|
|
if (this.videoContent[i].value === evt.detail.value) {
|
|
@@ -200,8 +217,8 @@
|
|
|
sampleRate: 44100,
|
|
|
numberOfChannels: 1,
|
|
|
encodeBitRate: 192000,
|
|
|
- format: 'mp3',
|
|
|
- frameSize: 50
|
|
|
+ format: 'wav',
|
|
|
+ // frameSize: 50
|
|
|
});
|
|
|
this.isRecording = true;
|
|
|
}
|
|
@@ -217,37 +234,45 @@
|
|
|
// this.innerAudioContext.src = this.audioPath;
|
|
|
// this.innerAudioContext.play();
|
|
|
// },
|
|
|
-
|
|
|
- jumpToList() {
|
|
|
- let missingFields = [];
|
|
|
- if (!this.videoName.trim()) {
|
|
|
- missingFields.push('视频名称');
|
|
|
- }
|
|
|
- if (!this.fileInfo.path) {
|
|
|
- missingFields.push('人物形象');
|
|
|
- }
|
|
|
- if (!this.imagePath) {
|
|
|
- missingFields.push('视频背景');
|
|
|
+ uploadImagePath() {
|
|
|
+ let data = {
|
|
|
+ // name: 'personimage',
|
|
|
+ // filePath: this.imagePath,
|
|
|
+ file: this.imagePath
|
|
|
}
|
|
|
- if (!this.modelIndex) {
|
|
|
- missingFields.push('视频模板');
|
|
|
- }
|
|
|
- const hasContent = this.videoText.trim() !== '';
|
|
|
- const hasVoice = this.audioPath;
|
|
|
- if (!hasContent && !hasVoice) {
|
|
|
- missingFields.push('文字内容或语音输入');
|
|
|
- }
|
|
|
- if (missingFields.length > 0) {
|
|
|
- this.missingContent = `请确定:${missingFields.join('、')}是否填写完整!`
|
|
|
- this.$refs.alertDialog.open()
|
|
|
- // return;
|
|
|
- }
|
|
|
- uni.navigateTo({
|
|
|
- url: 'list/index'
|
|
|
- });
|
|
|
+ uploadPerson(data).then(response => {
|
|
|
+ store.commit('SET_PERSON', baseUrl + response.data.url)
|
|
|
+ uni.navigateBack()
|
|
|
+ })
|
|
|
},
|
|
|
- dialogConfirm() {
|
|
|
- console.log('点击确认')
|
|
|
+ jumpToList() {
|
|
|
+ let missingFields = [];
|
|
|
+ if (!this.videoName.trim()) {
|
|
|
+ missingFields.push('视频名称');
|
|
|
+ }
|
|
|
+ // if (!this.fileInfo.path) {
|
|
|
+ // missingFields.push('人物形象');
|
|
|
+ // }
|
|
|
+ if (!this.imagePath) {
|
|
|
+ missingFields.push('人物形象');
|
|
|
+ }
|
|
|
+ // if (!this.modelIndex) {
|
|
|
+ // missingFields.push('视频模板');
|
|
|
+ // }
|
|
|
+ const hasContent = this.videoText.trim() !== '' && this.timbre;
|
|
|
+ const hasVoice = this.audioPath;
|
|
|
+ if (!hasContent && !hasVoice) {
|
|
|
+ missingFields.push('文字内容或语音输入');
|
|
|
+ }
|
|
|
+ if (missingFields.length > 0) {
|
|
|
+ this.missingContent = `请确定:${missingFields.join('、')}是否填写完整!`
|
|
|
+ this.$refs.alertDialog.open()
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // this.uploadImagePath()
|
|
|
+ uni.navigateTo({
|
|
|
+ url: 'list/creatingVideo/creatingVideo',
|
|
|
+ });
|
|
|
},
|
|
|
dialogClose() {
|
|
|
console.log('点击关闭')
|
|
@@ -345,9 +370,8 @@
|
|
|
.btn-area {
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
- margin: 0 auto;
|
|
|
+ margin: 20px auto;
|
|
|
width: 100%;
|
|
|
- margin-bottom: 10px;
|
|
|
}
|
|
|
|
|
|
.audio-bar {
|
|
@@ -355,4 +379,7 @@
|
|
|
display: block;
|
|
|
margin-top: 10px;
|
|
|
}
|
|
|
+ /deep/ .uni-border-left{
|
|
|
+ display:none;
|
|
|
+ }
|
|
|
</style>
|