diff --git a/src/layout/background/BackgroundSwtich.tsx b/src/layout/background/BackgroundSwtich.tsx index 27a78ea..5e4a32a 100644 --- a/src/layout/background/BackgroundSwtich.tsx +++ b/src/layout/background/BackgroundSwtich.tsx @@ -165,6 +165,7 @@ export default defineComponent(() => {
{ layout.changeBackground(item.url) + background.state.isCustom = false }} class="h-[156px] relative cursor-pointer group w-full flex-grow-0 rounded-xl overflow-hidden" > diff --git a/src/layout/background/CustomWallpaper.tsx b/src/layout/background/CustomWallpaper.tsx index 2fa0844..b6560d2 100644 --- a/src/layout/background/CustomWallpaper.tsx +++ b/src/layout/background/CustomWallpaper.tsx @@ -1,16 +1,18 @@ import upload, { localPrefix, uploadLocal } from '@/utils/upload' import clsx from 'clsx' -import { defineComponent, ref, toRef } from 'vue' +import { computed, defineComponent, ref, toRef } from 'vue' import useBackgroundStore from './useBackgroundStore' import useResource from './useResource' import useLayoutStore from '../useLayoutStore' import { message } from 'ant-design-vue' +import { BgContent } from '.' export default defineComponent(() => { const dragging = ref(false) const fileInput = ref(null) const backgroundStore = useBackgroundStore() const tempFile = ref(null) + const layout = useLayoutStore() const tempBackground = ref('') const handleDrop = (e: DragEvent) => { e.preventDefault() @@ -21,6 +23,15 @@ export default defineComponent(() => { tempBackground.value = URL.createObjectURL(file) tempFile.value = file } + const showImg = computed(() => { + if (tempBackground.value) { + return tempBackground.value + } + if (backgroundStore.state.isCustom) { + return layout.background.video? layout.background.video: layout.background.image + } + return '' + }) return () => (
@@ -47,16 +58,28 @@ export default defineComponent(() => { dragging.value ? 'border-[#3f80ff] bg-[#6b9dff1a]' : 'border-transparent bg-[#ebebeb]' )} - style={ - tempBackground.value - ? { - backgroundImage: `url(${tempBackground.value})`, - backgroundSize: 'cover', - backgroundRepeat: 'no-repeat' - } - : {} - } + // style={ + // tempBackground.value + // ? { + // backgroundImage: `url(${tempBackground.value})`, + // backgroundSize: 'cover', + // backgroundRepeat: 'no-repeat' + // } + // : backgroundStore.state.isCustom + // ? { + // backgroundImage: `url(${backgroundStore.tag})`, + // backgroundSize: 'cover', + // backgroundRepeat: 'no-repeat' + // } + // : null + // } > +
+ +
{ if (tempFile.value) { uploadLocal(tempFile.value).then((res) => { useLayoutStore().changeBackground(res) - + backgroundStore.state.isCustom = true tempFile.value = null tempBackground.value = '' message.success('应用成功') diff --git a/src/layout/background/index.tsx b/src/layout/background/index.tsx index 0f0d7ac..1766224 100644 --- a/src/layout/background/index.tsx +++ b/src/layout/background/index.tsx @@ -2,7 +2,7 @@ import { defineComponent, nextTick, reactive, ref, Transition, watch } from 'vue import useLayoutStore from '../useLayoutStore' import useSettingsStore from '@/settings/useSettingsStore' -const BgContent = defineComponent({ +export const BgContent = defineComponent({ props: { image: { type: String, diff --git a/src/layout/background/useBackgroundStore.ts b/src/layout/background/useBackgroundStore.ts index 760a97c..1a4743b 100644 --- a/src/layout/background/useBackgroundStore.ts +++ b/src/layout/background/useBackgroundStore.ts @@ -3,6 +3,9 @@ import { reactive, ref, watch } from 'vue' export default defineStore('background', () => { const tag = ref(localStorage.getItem('backgroundTag') || '') + const state = reactive({ + isCustom: false, + }) const resource = reactive({ type: 'image', brief: '', @@ -29,6 +32,9 @@ export default defineStore('background', () => { ) return { tag, - resource + resource, + state } +}, { + persist: true }) diff --git a/src/layout/grid/Feedback.tsx b/src/layout/grid/Feedback.tsx index 29f6ad9..3c6dab6 100644 --- a/src/layout/grid/Feedback.tsx +++ b/src/layout/grid/Feedback.tsx @@ -81,7 +81,9 @@ export default defineComponent(() => { { title: '问题描述', customRender: ({ record }) => ( -
{record.description}
+
+ {record.description} +
) }, { @@ -169,9 +171,11 @@ export default defineComponent(() => { { )} > - 轻闲 + 轻娱
{ // eslint-disable-next-line @typescript-eslint/no-unused-vars store.state.list.filter(val => val.title.includes(searchText.value)).sort((a, _) => { return !a.isCompleted ? -1 : 1 - }).map((item, idx) => ( + }).map((item, _) => (
{ @@ -47,7 +47,11 @@ export default defineComponent(() => { )} onClick={(e) => { e.stopPropagation() - store.state.list[idx].isCompleted = !item.isCompleted + const idx = store.state.list.findIndex(val => val.id === item.id) + if (idx !== -1) { + store.state.list[idx].isCompleted = !item.isCompleted + + } }}> { !item.isCompleted && diff --git a/src/widgets/work/useTomatoStore.ts b/src/widgets/work/useTomatoStore.ts index d15513d..8243cf6 100644 --- a/src/widgets/work/useTomatoStore.ts +++ b/src/widgets/work/useTomatoStore.ts @@ -53,7 +53,7 @@ export default defineStore("work", () => { const time = useTimeStore() const remainingTime = computed(() => { - return dayjs(state.beginTime).add(1, 'minute').diff(dayjs(time.date), 'second') + return dayjs(state.beginTime).add(15, 'minute').diff(dayjs(time.date), 'second') }) const stopTomatoTime = () => {