完善小组件:修复bug 原创

This commit is contained in:
expdsn 2024-10-10 19:10:55 +08:00
parent 5e145b83ad
commit 13b628904a
106 changed files with 1473 additions and 46 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
public/weather_img/0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
public/weather_img/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/weather_img/11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/weather_img/12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/weather_img/13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
public/weather_img/14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
public/weather_img/17.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

BIN
public/weather_img/18.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/weather_img/19.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/weather_img/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
public/weather_img/20.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
public/weather_img/21.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/weather_img/22.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/weather_img/23.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/weather_img/25.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/26.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/weather_img/27.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

BIN
public/weather_img/28.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/weather_img/29.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
public/weather_img/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/weather_img/30.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
public/weather_img/31.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
public/weather_img/32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
public/weather_img/33.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/34.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/weather_img/35.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/weather_img/36.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
public/weather_img/37.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/weather_img/38.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
public/weather_img/39.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
public/weather_img/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/40.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
public/weather_img/41.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/weather_img/42.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/43.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/weather_img/44.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/weather_img/45.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/46.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
public/weather_img/47.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
public/weather_img/48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/weather_img/49.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/weather_img/51.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
public/weather_img/52.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
public/weather_img/53.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/54.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/weather_img/55.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/weather_img/56.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/weather_img/57.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
public/weather_img/58.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/59.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/weather_img/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
public/weather_img/60.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/61.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/62.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
public/weather_img/63.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/weather_img/64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
public/weather_img/65.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/66.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/weather_img/67.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/weather_img/68.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/weather_img/69.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/weather_img/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/weather_img/70.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
public/weather_img/71.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/weather_img/72.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/weather_img/8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/weather_img/9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
public/weather_img/sun.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -10,7 +10,7 @@ export const ossCdnBase = import.meta.env.PROD ? ossBase : ossBase
// 后端地址 // 后端地址
export const apiBase = import.meta.env.PROD export const apiBase = import.meta.env.PROD
? 'http://192.168.110.28:8300' ? 'http://106.15.37.113:8300'
: 'http://192.168.110.28:8300' : 'http://192.168.110.28:8300'
// 后端 cdn 加速地址 // 后端 cdn 加速地址

View File

@ -21,10 +21,7 @@ export default defineComponent(() => {
}, },
{ immediate: true } { immediate: true }
) )
const resource = useResource(
computed(() => layout.state.content[selected.value].background),
'background'
)
const settings = useSettingsStore() const settings = useSettingsStore()
return () => ( return () => (
<div class="absolute left-0 top-0 w-full h-full p-4 overflow-y-auto"> <div class="absolute left-0 top-0 w-full h-full p-4 overflow-y-auto">
@ -46,13 +43,13 @@ export default defineComponent(() => {
</SettingItem> </SettingItem>
<div class="px-4"> <div class="px-4">
<div class="h-[180px]"> <div class="h-[180px]">
{resource.video && resource.type !== 'own' ? ( {layout.background.video && layout.background.type !== 'own' ? (
<video class="w-full h-full" src={resource.video} autoplay={false} controls /> <video class="w-full h-full" src={layout.background.video} autoplay={false} controls />
) : ( ) : (
<div <div
class="w-full h-full bg-center bg-no-repeat bg-cover" class="w-full h-full bg-center bg-no-repeat bg-cover"
style={{ style={{
backgroundImage: `url('${resource.image}')` backgroundImage: `url('${layout.background.image}')`
}} }}
></div> ></div>
)} )}
@ -71,7 +68,7 @@ export default defineComponent(() => {
type="text" type="text"
icon={<DownloadOutlined />} icon={<DownloadOutlined />}
onClick={() => { onClick={() => {
window.open(resource.video || resource.image, '_blank') window.open(layout.background.video || layout.background.image, '_blank')
}} }}
> >

View File

@ -47,6 +47,7 @@ export type WallpaperItem = {
} }
export default defineComponent(() => { export default defineComponent(() => {
const layout = useLayoutStore() const layout = useLayoutStore()
const background = useBackgroundStore()
const router = useRouterStore() const router = useRouterStore()
const isGame = computed(() => layout.state.current === 0) const isGame = computed(() => layout.state.current === 0)
const selectType = ref('') const selectType = ref('')
@ -102,10 +103,18 @@ export default defineComponent(() => {
'flex w-full justify-between items-center border-b-[1px] border-solid pb-2', 'flex w-full justify-between items-center border-b-[1px] border-solid pb-2',
isGame.value ? 'border-white/[.2]' : 'dark:border-black/[.2]' isGame.value ? 'border-white/[.2]' : 'dark:border-black/[.2]'
)} )}
>
<div
onClick={() => {
router.back()
}}
> >
<OhVueIcon name={BiChevronLeft.name} scale={1.4} class="cursor-pointer"></OhVueIcon> <OhVueIcon name={BiChevronLeft.name} scale={1.4} class="cursor-pointer"></OhVueIcon>
</div>
<span class="font-bold text-[14px] "></span> <span class="font-bold text-[14px] "></span>
<button class="hover:bg-slate-50/60 px-3 py-2 rounded-xl text-white/[.9]"></button> <div></div>
{/* <button class="hover:bg-slate-50/60 px-3 py-2 rounded-xl text-white/[.9]">我的壁纸</button> */}
</div> </div>
<div class="flex-1 h-0 relative"> <div class="flex-1 h-0 relative">
{selectAttr.value !== 2 ? ( {selectAttr.value !== 2 ? (
@ -128,7 +137,7 @@ export default defineComponent(() => {
<button <button
class={clsx( class={clsx(
'px-5 py-1 items-center justify-center duration-75 shrink-0 flex rounded-xl ', 'px-5 py-1 items-center justify-center duration-75 shrink-0 flex rounded-xl ',
isGame.value ? 'bg-white/30 text-white' : 'text-[#000] hover:bg-[#f0ecec]' isGame.value ? ' text-white' : 'text-[#000] hover:bg-[#f0ecec]'
)} )}
> >
{text} {text}
@ -176,6 +185,10 @@ export default defineComponent(() => {
<div <div
onClick={() => { onClick={() => {
layout.changeBackground(item.url) layout.changeBackground(item.url)
background.bgTrriger = false
setTimeout(() => {
background.bgTrriger = true
}, 0)
}} }}
class="h-[156px] relative cursor-pointer group w-full flex-grow-0 rounded-xl overflow-hidden" class="h-[156px] relative cursor-pointer group w-full flex-grow-0 rounded-xl overflow-hidden"
> >

View File

@ -1,24 +1,18 @@
import { defineComponent, ref, Transition, watch } from 'vue' import { defineComponent, ref, Transition, watch } from 'vue'
import useLayoutStore from '../useLayoutStore' import useLayoutStore from '../useLayoutStore'
import useSettingsStore from '@/settings/useSettingsStore' import useSettingsStore from '@/settings/useSettingsStore'
import useBackgroundStore from './useBackgroundStore'
export default defineComponent({ export default defineComponent({
setup() { setup() {
const layout = useLayoutStore() const layout = useLayoutStore()
const background = useBackgroundStore()
const settings = useSettingsStore() const settings = useSettingsStore()
const trriger = ref(true)
watch(layout.background, () => {
trriger.value = false
setTimeout(() => {
trriger.value = true
},0)
})
return () => (
return () => (
<div class="absolute left-0 top-0 w-full h-screen z-0"> <div class="absolute left-0 top-0 w-full h-screen z-0">
<Transition name="background"> <Transition name="background">
{ {background.bgTrriger && (
trriger.value &&
<> <>
{layout.background.video ? ( {layout.background.video ? (
<video src={layout.background.video} class="w-full h-full" /> <video src={layout.background.video} class="w-full h-full" />
@ -31,9 +25,7 @@ export default defineComponent({
></div> ></div>
)} )}
</> </>
)}
}
</Transition> </Transition>
<div <div
class="absolute left-0 top-0 w-full h-full bg-black" class="absolute left-0 top-0 w-full h-full bg-black"
@ -44,9 +36,6 @@ export default defineComponent({
}} }}
></div> ></div>
</div> </div>
) )
} }
}) })

View File

@ -3,6 +3,7 @@ import { reactive, ref, watch } from 'vue'
export default defineStore('background', () => { export default defineStore('background', () => {
const tag = ref(localStorage.getItem('backgroundTag') || '') const tag = ref(localStorage.getItem('backgroundTag') || '')
const bgTrriger = ref(true)
const resource = reactive({ const resource = reactive({
type: 'image', type: 'image',
brief: '', brief: '',
@ -29,6 +30,7 @@ export default defineStore('background', () => {
) )
return { return {
tag, tag,
resource resource,
bgTrriger
} }
}) })

View File

@ -33,7 +33,7 @@ export default defineComponent({
const layout = useLayoutStore() const layout = useLayoutStore()
return () => ( return () => (
<div <div
class="absolute z-20 shadow-text tracking-widest font-mono font-bold h-[110px] transition-all" class="absolute z-20 shadow-text tracking-widest font-bold h-[110px] transition-all"
style={{ style={{
color: layout.isCompact ? 'white' : 'rgba(255,255,255,.8)', color: layout.isCompact ? 'white' : 'rgba(255,255,255,.8)',
transitionDuration: '.4s', transitionDuration: '.4s',

View File

@ -8,6 +8,7 @@
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
font-family: font-family:
SourceHanSans,
-apple-system, -apple-system,
BlinkMacSystemFont, BlinkMacSystemFont,
Helvetica Neue, Helvetica Neue,
@ -18,6 +19,12 @@
WenQuanYi Micro Hei, WenQuanYi Micro Hei,
sans-serif; sans-serif;
} }
@font-face {
font-family: 'SourceHanSans';
src: url('/fonts/SourceHanSansCN-Regular.subset.otf') format('truetype');
font-weight: normal;
font-style: normal;
}
body { body {
/* ! 全局禁用鼠标选择,需要在其他位置放开 */ /* ! 全局禁用鼠标选择,需要在其他位置放开 */
user-select: none; user-select: none;
@ -185,9 +192,8 @@ body {
} }
} }
.background-enter-active { .background-enter-active {
animation: bounce-in .8s; animation: bounce-in 0.8s;
} }
@keyframes bounce-in { @keyframes bounce-in {
@ -199,6 +205,5 @@ body {
} }
100% { 100% {
transform: scale(1); transform: scale(1);
} }
} }

View File

@ -43,7 +43,7 @@ export default defineComponent(() => {
<div <div
class="w-full h-screen" class="w-full h-screen"
onClick={() => { onClick={() => {
router.back() router.replace('')
}} }}
></div> ></div>
)} )}

View File

@ -32,9 +32,13 @@ export default defineStore('router', () => {
const path = computed(() => { const path = computed(() => {
return his.value[0] || '' return his.value[0] || ''
}) })
const replace = (path: RouteStr) => {
his.value = [path]
}
return { return {
path, path,
go, go,
back back,
replace
} }
}) })

View File

@ -1,5 +1,36 @@
import { defineComponent } from 'vue' import { defineComponent } from 'vue'
import dayjs from 'dayjs'
import { Lunar } from 'lunar-typescript'
export default defineComponent(() => { export default defineComponent(() => {
return () => <div class="w-full h-full bg-red-50"></div> return () => (
<div class="w-full h-full p-1 flex gap-x-2 items-center bg-[#f0f0f0] px-3">
<div class={'h-[48px] w-[48px] flex flex-col rounded-lg overflow-hidden '}>
<div
class={
'w-full h-[18px] text-[10px] text-white flex items-center justify-center font-bold font-din'
}
style={{
background: '#ffffff linear-gradient(225deg,#76d7f2 0%,#5aebb0 100%)'
}}
>
{dayjs().format('ddd')}
</div>
<div
class={
'h-0 flex-1 bg-white flex items-center justify-center text-[#333] font-bold text-[22px] font-din'
}
>
{dayjs().format('DD')}
</div>
</div>
<div class={'flex flex-col'}>
<span class={"text-[14px] text-[#333] tracking-tight"}>{dayjs().format('YYYY年MM月')}</span>
<span class={"text-[12px] text-[#999]"}>
{Lunar.fromDate(dayjs().toDate()).getMonthInChinese() +
'月' +
Lunar.fromDate(dayjs().toDate()).getDayInChinese()}
</span>
</div>
</div>
)
}) })

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,84 @@
import { defineStore } from 'pinia'
import { computed, reactive } from 'vue'
import dayjs from 'dayjs'
import { Lunar } from 'lunar-typescript'
import HolidayData from './holiday.json'
export type DateInfo = {
day: dayjs.Dayjs
label: string
lunar: Lunar
type: 1 | 0 | -1 //下月,本月,上月
hType: 0 | 1 | 2 //无,休,班
tag: string
}
export const useCalendarStore = defineStore('calendar', () => {
const state = reactive({
select: dayjs(),
index: 0
})
const jumpMonth = (m: number) => {
state.select = state.select.add(m, 'month')
}
const recentHoliday = (datetime: dayjs.Dayjs, isHoliday: boolean) => {
if (!HolidayData) return {}
for (let i = 0; i < HolidayData.length; i++) {
const item = HolidayData[i]
if (
datetime.toDate().getTime() < dayjs(item.data.date).toDate().getTime() &&
item.data.name !== '班' &&
item.data.name !== '休'
) {
if (!isHoliday) return { name: item.data.name, date: item.data.date }
if (item.data.isOffDay) return { name: item.data.name, date: item.data.date }
}
}
return {}
}
const dayList = computed(() => {
const _arr = [] as DateInfo[]
const firstDayInMonth = dayjs(state.select).startOf('month')
const lastDayInMonth = dayjs(state.select).endOf('month')
for (let i = 0; i < 42; i++) {
let _day: dayjs.Dayjs
let type: 0 | 1 | -1 = 0
let hType: 0 | 1 | 2 = 0
if (i < firstDayInMonth.day()) {
_day = firstDayInMonth.subtract(firstDayInMonth.day() - i, 'day')
type = -1
} else if (i >= lastDayInMonth.date() + firstDayInMonth.day()) {
_day = firstDayInMonth.add(i - firstDayInMonth.day(), 'day')
type = 1
} else {
_day = firstDayInMonth.add(i - firstDayInMonth.day(), 'day')
}
const _holiday = HolidayData.find((val) => val.data.date === _day.format('YYYY-MM-DD'))
if (_holiday) {
if (_holiday.data.isOffDay) {
hType = 1
} else {
hType = 2
}
}
_arr.push({
day: _day,
label: _day.format('DD'),
lunar: Lunar.fromDate(_day.toDate()),
type: type,
hType: hType,
tag: _holiday?.data.name || ''
})
}
return _arr
})
return {
state,
jumpMonth,
recentHoliday,
dayList
}
})

Some files were not shown because too many files have changed in this diff Show More