diff --git a/src/views/Config/Global/MusicConfig/components/UploadDialog.vue b/src/views/Config/Global/MusicConfig/components/UploadDialog.vue
new file mode 100644
index 0000000..f04b939
--- /dev/null
+++ b/src/views/Config/Global/MusicConfig/components/UploadDialog.vue
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/Config/Global/MusicConfig.vue b/src/views/Config/Global/MusicConfig/index.vue
similarity index 62%
rename from src/views/Config/Global/MusicConfig.vue
rename to src/views/Config/Global/MusicConfig/index.vue
index 2b83151..6e878fd 100644
--- a/src/views/Config/Global/MusicConfig.vue
+++ b/src/views/Config/Global/MusicConfig/index.vue
@@ -2,22 +2,21 @@
import type { IMusic } from '@/types/storeType'
import localforage from 'localforage'
import { storeToRefs } from 'pinia'
-import { onMounted, ref } from 'vue'
+import { ref } from 'vue'
import { useI18n } from 'vue-i18n'
import PageHeader from '@/components/PageHeader/index.vue'
import useStore from '@/store'
-import { readFileData } from '@/utils/file'
+import UploadDialog from './components/UploadDialog.vue'
const { t } = useI18n()
-const audioUploadToast = ref(0) // 0是不显示,1是成功,2是失败,3是不是图片
const audioDbStore = localforage.createInstance({
name: 'audioStore',
})
const globalConfig = useStore().globalConfig
const { getMusicList: localMusicList } = storeToRefs(globalConfig)
-const limitType = ref('audio/*')
const localMusicListValue = ref(localMusicList)
+const uploadVisible = ref(false)
async function play(item: IMusic) {
globalConfig.setCurrentMusic(item, false)
}
@@ -37,42 +36,10 @@ function deleteAll() {
globalConfig.clearMusicList()
audioDbStore.clear()
}
-async function getMusicDbStore() {
- const keys = await audioDbStore.keys()
- if (keys.length > 0) {
- audioDbStore.iterate((value: string, key: string) => {
- globalConfig.addMusic({
- id: key + new Date().getTime().toString(),
- name: key,
- url: 'Storage',
- })
- })
- }
-}
-async function handleFileChange(e: Event) {
- const isAudio = /audio*/.test(((e.target as HTMLInputElement).files as FileList)[0].type)
- if (!isAudio) {
- audioUploadToast.value = 3
-
- return
- }
- const { dataUrl, fileName } = await readFileData(((e.target as HTMLInputElement).files as FileList)[0])
- audioDbStore.setItem(`${new Date().getTime().toString()}+${fileName}`, dataUrl)
- .then(() => {
- audioUploadToast.value = 1
- getMusicDbStore()
- })
- .catch(() => {
- audioUploadToast.value = 2
- })
-}
-
-onMounted(() => {
- getMusicDbStore()
-})
+
-
-
- -
+
-
-
+
{{ t('table.isDone') }}
-
+
{{ t('table.image') }}
-
-
+
{{ t('table.onceNumber') }}
@@ -274,16 +261,16 @@ watch(() => prizeList.value, (val: IPrizeConfig[]) => {
-