feat: feat
This commit is contained in:
@@ -97,7 +97,9 @@ watch(() => formData.value.rowCount, () => {
|
||||
formErr.value.rowCount = err.issues[0].message
|
||||
})
|
||||
})
|
||||
|
||||
watch(topTitleValue,(val)=>{
|
||||
globalConfig.setTopTitle(val)
|
||||
}),
|
||||
|
||||
watch(themeValue, (val: any) => {
|
||||
const selectedThemeDetail = daisyuiThemeList.value[val]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang='ts'>
|
||||
import { ref, onMounted, watch } from 'vue'
|
||||
import { readImage } from '@/utils/file'
|
||||
import { IImage } from '@/types/storeType'
|
||||
import { readFileData } from '@/utils/file'
|
||||
import localforage from 'localforage'
|
||||
import useStore from '@/store'
|
||||
import { storeToRefs } from 'pinia'
|
||||
@@ -14,14 +15,14 @@ const imgUploadToast = ref(0) //0是不显示,1是成功,2是失败,3是不
|
||||
const imageDbStore = localforage.createInstance({
|
||||
name: 'imgStore'
|
||||
})
|
||||
const handleFileChange = async (e: any) => {
|
||||
const isImage= /image*/.test(e.target.files[0].type)
|
||||
const handleFileChange = async (e: Event) => {
|
||||
const isImage= /image*/.test(((e.target as HTMLInputElement).files as FileList)[0].type)
|
||||
if (!isImage) {
|
||||
imgUploadToast.value = 3
|
||||
|
||||
return
|
||||
}
|
||||
let { dataUrl, fileName } = await readImage(e.target.files[0])
|
||||
let { dataUrl, fileName } = await readFileData(((e.target as HTMLInputElement).files as FileList)[0])
|
||||
imageDbStore.setItem(new Date().getTime().toString() + '+' + fileName, dataUrl)
|
||||
.then(() => {
|
||||
imgUploadToast.value = 1
|
||||
@@ -45,7 +46,7 @@ const getImageDbStore =async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const removeImage=(item:any)=>{
|
||||
const removeImage=(item:IImage)=>{
|
||||
if(item.url=='Storage'){
|
||||
imageDbStore.removeItem(item.id).then(() => {
|
||||
globalConfig.removeImage(item.id)
|
||||
@@ -91,8 +92,8 @@ watch(() => imgUploadToast.value, (val) => {
|
||||
<div class="flex items-center gap-8">
|
||||
<div class="avatar h-14">
|
||||
<div class="w-12 h-12 mask mask-squircle hover:w-14 hover:h-14">
|
||||
<img v-if="item.url!=='Storage'" :src="item.url" alt="Avatar Tailwind CSS Component" />
|
||||
<ImageSync v-else :imgItem="item"></ImageSync>
|
||||
<!-- <img v-if="item.url!=='Storage'" :src="item.url" alt="Avatar Tailwind CSS Component" /> -->
|
||||
<ImageSync :imgItem="item"></ImageSync>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-64">
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<script setup lang='ts'>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import {storeToRefs } from 'pinia'
|
||||
import { readMusic } from '@/utils/file'
|
||||
import { IMusic } from '@/types/storeType';
|
||||
import { readFileData } from '@/utils/file'
|
||||
import useStore from '@/store';
|
||||
|
||||
import localforage from 'localforage'
|
||||
@@ -15,11 +16,11 @@ const globalConfig = useStore().globalConfig
|
||||
const { getMusicList: localMusicList } = storeToRefs(globalConfig);
|
||||
const limitType = ref('audio/*')
|
||||
const localMusicListValue = ref(localMusicList)
|
||||
const play = async (item: any) => {
|
||||
const play = async (item: IMusic) => {
|
||||
globalConfig.setCurrentMusic(item,false)
|
||||
}
|
||||
|
||||
const deleteMusic = (item: any) => {
|
||||
const deleteMusic = (item: IMusic) => {
|
||||
globalConfig.removeMusic(item.id)
|
||||
audioDbStore.removeItem(item.name)
|
||||
// setTimeout(()=>{
|
||||
@@ -46,14 +47,14 @@ const getMusicDbStore = async () => {
|
||||
})
|
||||
}
|
||||
}
|
||||
const handleFileChange = async (e: any) => {
|
||||
const isAudio = /audio*/.test(e.target.files[0].type)
|
||||
const handleFileChange = async (e: Event) => {
|
||||
const isAudio = /audio*/.test(((e.target as HTMLInputElement).files as FileList)[0].type)
|
||||
if (!isAudio) {
|
||||
audioUploadToast.value = 3
|
||||
|
||||
return
|
||||
}
|
||||
let { dataUrl, fileName } = await readMusic(e.target.files[0])
|
||||
let { dataUrl, fileName } = await readFileData(((e.target as HTMLInputElement).files as FileList)[0])
|
||||
audioDbStore.setItem(new Date().getTime().toString() + '+' + fileName, dataUrl)
|
||||
.then(() => {
|
||||
audioUploadToast.value = 1
|
||||
|
||||
Reference in New Issue
Block a user