Commit 2e764604 authored by hewenhao's avatar hewenhao

feat: replace audio

parent 37b89ea9
No preview for this file type
...@@ -116,7 +116,7 @@ export default { ...@@ -116,7 +116,7 @@ export default {
}, },
async saveHandler () { async saveHandler () {
const { beginValue, bgValue, resultValue } = this const { beginValue, bgValue, resultValue } = this
if (!beginValue || !bgValue || !resultValue) { if (!beginValue && !bgValue && !resultValue) {
return this.$message.error('请选择音频') return this.$message.error('请选择音频')
} }
const id1 = BG_AUDIO_ID const id1 = BG_AUDIO_ID
...@@ -128,40 +128,34 @@ export default { ...@@ -128,40 +128,34 @@ export default {
database.get(DB_STORE_NAME, id3) database.get(DB_STORE_NAME, id3)
]) ])
const param1 = { const list = [
id: id1, {
value: bgValue id: id1,
} value: bgValue,
pre: Data1
const param2 = { },
id: id2, {
value: beginValue id: id2,
} value: beginValue,
pre: Data2
const param3 = { },
id: id3, {
value: resultValue id: id3,
} value: resultValue,
pre: Data3
}
]
Promise.all([ Promise.all(list
database[Data1 ? 'edit' : 'add']( .filter(c => c.value)
DB_STORE_NAME, .map(({ pre, ...rest }) => database[(pre ? 'edit' : 'add')](
Data1 ? id1 : param1,
Data1 ? param1 : null
),
database[Data2 ? 'edit' : 'add'](
DB_STORE_NAME, DB_STORE_NAME,
Data2 ? id2 : param2, pre ? rest.id : rest,
Data2 ? param2 : null pre ? rest : null
), ))
database[Data3 ? 'edit' : 'add']( )
DB_STORE_NAME, .then((list) => {
Data3 ? id3 : param3, if (list.every(Boolean)) {
Data3 ? param3 : null
)
])
.then(([res1, res2, res3]) => {
if (res1 && res2 && res3) {
this.bgValue = '' this.bgValue = ''
this.beginValue = '' this.beginValue = ''
this.resultValue = '' this.resultValue = ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment