Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
live-management-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haojie
live-management-web
Commits
599d2e2e
Commit
599d2e2e
authored
Aug 10, 2023
by
haojie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
草稿修改
parent
05fba584
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
73 additions
and
29 deletions
+73
-29
src/components/MultipleUpload/index.tsx
+20
-14
src/constants/token.ts
+3
-0
src/hooks/useScript.ts
+5
-0
src/pages/VocalCustomization/index.vue
+2
-1
src/pages/createInteract/components/AddInteractDialog.vue
+2
-1
src/pages/createLive/components/scripts.vue
+5
-2
src/pages/createLive/index.vue
+27
-2
src/utils/tool.ts
+9
-9
No files found.
src/components/MultipleUpload/index.tsx
View file @
599d2e2e
...
...
@@ -33,6 +33,10 @@ export default defineComponent({
type
:
String
,
default
:
'选择文件'
,
},
computedDuration
:
{
type
:
Boolean
,
default
:
false
,
},
},
emits
:
[
'update:modelValue'
,
'change'
,
'update:totalSize'
,
'update:audioTotolTime'
],
setup
(
props
,
{
emit
})
{
...
...
@@ -82,23 +86,25 @@ export default defineComponent({
// 是否需要计算文件总时长,音频或视频
const
computedTotalTime
=
()
=>
{
return
typeof
props
.
audioTotolTime
===
'number'
;
return
typeof
props
.
audioTotolTime
===
'number'
||
props
.
computedDuration
;
};
// 音频可以播放
const
audioCanplay
=
(
item
:
any
,
index
:
number
)
=>
{
let
dom
:
HTMLAudioElement
=
fileList
.
value
[
index
].
ref
;
if
(
dom
)
{
fileList
.
value
[
index
].
time
=
dom
.
duration
;
}
let
total
=
0
;
fileList
.
value
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
time
&&
item
.
url
)
{
total
+=
item
.
time
;
if
(
fileList
.
value
[
index
])
{
let
dom
:
HTMLAudioElement
=
fileList
.
value
[
index
].
ref
;
if
(
dom
)
{
fileList
.
value
[
index
].
duration
=
dom
.
duration
;
}
});
// 更新总时长
emit
(
'update:audioTotolTime'
,
total
);
let
total
=
0
;
fileList
.
value
.
forEach
((
item
:
any
)
=>
{
if
(
item
.
duration
&&
item
.
url
)
{
total
+=
item
.
duration
;
}
});
// 更新总时长
emit
(
'update:audioTotolTime'
,
total
);
}
};
// 文件是否上传过
...
...
@@ -279,8 +285,8 @@ export default defineComponent({
}
else
if
(
item
.
audio_url
)
{
list
.
push
(
item
.
audio_url
);
}
if
(
item
.
time
)
{
totalTime
+=
item
.
time
;
if
(
item
.
duration
)
{
totalTime
+=
item
.
duration
;
}
});
submitList
(
list
);
...
...
src/constants/token.ts
View file @
599d2e2e
...
...
@@ -129,3 +129,6 @@ export const emailReg = /^\w{3,}(\.\w+)*@[A-z0-9]+(\.[A-z]{2,8}){1,2}$/;
// 创建直播页面路由记录key
export
const
createLiveRouteKey
=
'create_live_route_key'
;
// 音频上传格式限制
export
const
audioAccept
=
'wav'
;
src/hooks/useScript.ts
View file @
599d2e2e
...
...
@@ -123,7 +123,11 @@ export const processTextCallback = () => {
old_content
:
''
,
name
:
''
,
uuid
:
v4
(),
duration
:
0
,
};
if
(
it
.
duration
)
{
params
.
duration
=
parseInt
(
it
.
duration
);
}
// 草稿类型的
if
(
type
==
'edit_drafts'
)
{
if
(
it
.
children
&&
it
.
children
.
length
>
1
)
{
...
...
@@ -212,6 +216,7 @@ export const processTextCallback = () => {
try
{
let
res
:
any
=
await
createLiveTask
(
filterFiled
());
if
(
res
.
code
==
0
)
{
console
.
log
(
'提交的参数'
,
JSON
.
stringify
(
filterFiled
()));
console
.
log
(
'创建成功-'
,
res
.
data
.
id
);
live_task_id
.
value
=
res
.
data
.
id
;
return
true
;
...
...
src/pages/VocalCustomization/index.vue
View file @
599d2e2e
<
template
>
<div
class=
""
>
<Customizable
accept=
"wav
"
:accept=
"audioAccept
"
:submit=
"submit"
:dialogInfo=
"dialogInfo"
:icon=
"getIcon()"
...
...
@@ -28,6 +28,7 @@ export default {
</
script
>
<
script
lang=
"tsx"
setup
>
import
{
audioAccept
}
from
'@/constants/token'
;
import
Record
from
'./components/Record.vue'
;
import
MyDigitalPerson
from
'./components/MyDigitalPerson.vue'
;
import
CustomTabs
from
'@/components/CustomTabs'
;
...
...
src/pages/createInteract/components/AddInteractDialog.vue
View file @
599d2e2e
...
...
@@ -102,7 +102,7 @@
v-model=
"tonesFile"
:config=
"ossConfig"
:uploadInfo=
"uploadInfo"
accept=
"wav
"
:accept=
"audioAccept
"
class=
"reset-upload-dialog"
></Upload>
</CustomTabPanel>
...
...
@@ -145,6 +145,7 @@ import { onMounted, reactive, ref, watch } from 'vue';
import
{
show_message
}
from
'@/utils/tool'
;
import
{
getUploadConfig
,
getTonesList
}
from
'@/service/Common'
;
import
{
createLiveInteraction
}
from
'@/utils/api/userApi'
;
import
{
audioAccept
}
from
'@/constants/token'
;
const
props
=
withDefaults
(
defineProps
<
{
visible
:
boolean
;
...
...
src/pages/createLive/components/scripts.vue
View file @
599d2e2e
...
...
@@ -148,8 +148,9 @@
<MultipleUpload
v-model=
"item.data"
:config=
"ossConfig"
:computedDuration=
"true"
label=
"选择音频"
accept=
"wav
"
:accept=
"audioAccept
"
@
change=
"uploadEdit"
></MultipleUpload>
</div>
...
...
@@ -161,8 +162,9 @@
<MultipleUpload
v-model=
"mp3UrlList"
:config=
"ossConfig"
:computedDuration=
"true"
label=
"选择音频"
accept=
"wav
"
:accept=
"audioAccept
"
@
change=
"createUploadFile"
></MultipleUpload>
</div>
...
...
@@ -193,6 +195,7 @@ import ScriptTemplate from '@/components/ScriptTemplate.vue';
import
Select
from
'@/components/Select.vue'
;
import
SelectionPopup
from
'@/components/SelectionPopup.vue'
;
import
{
show_message
,
isDev
,
ecursionDeepCopy
}
from
'@/utils/tool'
;
import
{
audioAccept
}
from
'@/constants/token'
;
import
{
createLiveKeys
,
scriptTypeList
,
...
...
src/pages/createLive/index.vue
View file @
599d2e2e
...
...
@@ -80,6 +80,7 @@ import {
dimensionalConvert
,
ecursionDeepCopy
,
getDurationOfAudioFile
,
getFile
,
}
from
'@/utils/tool'
;
import
{
useStore
}
from
'vuex'
;
import
{
createLiveKeys
,
scriptTypeText
,
scriptTypePhonetics
,
mergeSameAudio
}
from
'@/service/CreateLive'
;
...
...
@@ -93,8 +94,17 @@ import { processTextCallback } from '@/hooks/useScript';
import
CustomException
from
'@/utils/error'
;
import
{
v4
}
from
'uuid'
;
import
{
splitAudio
}
from
'@/utils/audio'
;
const
{
loading
,
initNum
,
currentSetp
,
live_task_id
,
openInterval
,
filterFiled
,
submitSuccessed
,
uploadToAly
}
=
processTextCallback
();
const
{
loading
,
initNum
,
currentSetp
,
live_task_id
,
audioStart
,
openInterval
,
filterFiled
,
submitSuccessed
,
uploadToAly
,
}
=
processTextCallback
();
const
[
commitInfo
]
=
useLiveInfoSubmit
();
// 音频切割时长
...
...
@@ -448,6 +458,21 @@ const audioSplit = async () => {
// 编辑时没有修改参数
continue
;
}
if
(
row
.
duration
&&
row
.
duration
>
audioSplitNum
&&
row
.
content
&&
row
.
content
.
indexOf
(
'|'
)
==
-
1
&&
row
.
old_content
&&
!
row
.
file
?.
raw
)
{
console
.
log
(
'大于5分钟,开始下载文件'
);
// 没有文件时,下载
let
file
=
await
getFile
(
row
.
old_content
);
row
.
file
=
{};
row
.
file
.
raw
=
file
;
console
.
log
(
row
.
file
);
}
if
(
row
.
file
&&
row
.
file
.
raw
)
{
// 文件时长
let
fileDuration
=
await
getDurationOfAudioFile
(
row
.
file
.
raw
);
...
...
src/utils/tool.ts
View file @
599d2e2e
...
...
@@ -406,10 +406,12 @@ export const getDurationOfAudioFile = (file: File) => {
// 从二维数组中合并同类
export
const
mergedArray
=
(
arr
:
any
[],
key
:
string
=
'uuid'
,
first
:
string
=
'is_old'
)
=>
{
const
list
=
arr
.
reduce
((
result
,
subArray
)
=>
{
let
newSubArray
=
ecursionDeepCopy
(
subArray
);
let
newList
=
[];
arr
.
forEach
((
item
:
any
)
=>
{
let
result
=
[];
let
newSubArray
=
ecursionDeepCopy
(
item
);
// 先找出first
const
existingObj
=
newSubArray
.
filter
((
it
em
)
=>
item
[
first
]);
const
existingObj
=
newSubArray
.
filter
((
it
)
=>
it
[
first
]);
existingObj
.
forEach
((
item
:
any
)
=>
{
item
.
children
=
[];
});
...
...
@@ -417,17 +419,15 @@ export const mergedArray = (arr: any[], key: string = 'uuid', first: string = 'i
result
.
push
(...
existingObj
);
}
newSubArray
.
forEach
((
obj
)
=>
{
const
existingIndex
=
result
.
findIndex
((
item
)
=>
item
.
uuid
===
obj
.
uuid
&&
!
obj
[
first
]
&&
!
obj
.
removed
);
// console.log(obj, 'obj');
// console.log(existingIndex, 'index');
const
existingIndex
=
result
.
findIndex
((
it
)
=>
it
.
uuid
===
obj
.
uuid
&&
!
obj
[
first
]
&&
!
obj
.
removed
);
if
(
existingIndex
!==
-
1
)
{
// 标记
obj
.
removed
=
true
;
result
[
existingIndex
].
children
.
push
(
obj
);
}
});
return
result
;
}
,
[]
);
newList
.
push
(
result
)
;
});
// 防止对象引用重复
return
ecursionDeepCopy
(
[
list
]
);
return
ecursionDeepCopy
(
newList
);
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment