Merge remote-tracking branch 'origin/weather'

This commit is contained in:
plightfield 2024-09-29 15:21:10 +08:00
commit 5c3bd6b7b3
13 changed files with 138 additions and 28 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -155,6 +155,23 @@ export default defineComponent(() => {
>
</Item>
<Item
onClick={() => {
menu.dismiss()
const idx = layout.currentPage.list.findIndex((el) => el.id === block.id)
if (idx < 0) return
layout.state.dir[id].list.forEach(val => {
layout.addBlock(val, layout.state.currentPage)
})
layout.currentPage.list.splice(idx, 1)
delete layout.state.dir[id]
menu.dismiss()
}}
>
</Item>
<Item
alert
onClick={() => {

View File

@ -7,9 +7,12 @@ import { DownloadOutlined, EyeInvisibleOutlined, SwapOutlined } from '@ant-desig
import SettingItem from '@/settings/SettingItem'
import useSettingsStore from '@/settings/useSettingsStore'
import { v4 as uuid } from 'uuid'
import useRouterStore from '@/useRouterStore'
export default defineComponent(() => {
const layout = useLayoutStore()
const router = useRouterStore()
const selected = ref(0)
watch(
() => layout.state.current,
@ -55,7 +58,11 @@ export default defineComponent(() => {
)}
</div>
<div class="flex justify-between items-center py-4">
<Button type="primary" icon={<SwapOutlined />}>
<Button type="primary" icon={<SwapOutlined />}
onClick={()=> {
router.path = ''
router.path = 's2-background'
}}>
</Button>
<Button

View File

@ -0,0 +1,11 @@
import { defineComponent } from "vue";
export default defineComponent({
setup() {
return (
<div>
</div>
)
}
})

View File

@ -1,6 +1,7 @@
import AvatarCircle from '@/user/AvatarCircle'
import useRouterStore from '@/useRouterStore'
import asyncLoader from '@/utils/asyncLoader'
import { OhVueIcon } from 'oh-vue-icons'
import { computed, defineComponent, Transition } from 'vue'
const Content = asyncLoader(() => import('./SettingsOverlayContent'))
@ -51,31 +52,45 @@ export default defineComponent(() => {
<Transition name="settings">
{show.value && (
<div class="absolute left-6 bottom-20 w-[600px] h-[480px] rounded-lg overflow-hidden shadow-2xl flex">
<div class="w-[200px] p-4 h-full bg-white/60 backdrop-blur flex flex-col">
<div
class={
'w-full h-0 flex-grow mb-4 rounded-lg hover:bg-white/70 transition-all cursor-pointer flex justify-center items-center ' +
(router.path === 'settings-user' ? 'bg-white/70 shadow-lg' : '')
}
onClick={() => {
router.path = 'settings-user'
}}
>
<div class="w-12 h-12 relative">
<AvatarCircle />
</div>
</div>
<SettingsTab label="壁纸" path="settings-background" />
<SettingsTab label="图标" path="settings-block" />
<SettingsTab label="搜索" path="settings-search" />
<SettingsTab label="时间" path="settings-time" />
<SettingsTab label="侧边栏" path="settings-sider" />
<SettingsTab label="AI助手" path="settings-ai" />
<SettingsTab label="快捷栏" path="settings-dock" />
<SettingsTab label="重置" path="settings-reset" />
<SettingsTab label="问题反馈" path="settings-fallback" />
</div>
<Content />
{
router.path.startsWith('settings-') ?
<>
<div class="w-[200px] p-4 h-full bg-white/60 backdrop-blur flex flex-col">
<div
class={
'w-full h-0 flex-grow mb-4 rounded-lg hover:bg-white/70 transition-all cursor-pointer flex justify-center items-center ' +
(router.path === 'settings-user' ? 'bg-white/70 shadow-lg' : '')
}
onClick={() => {
router.path = 'settings-user'
}}
>
<div class="w-12 h-12 relative">
<AvatarCircle />
</div>
</div>
<SettingsTab label="壁纸" path="settings-background" />
<SettingsTab label="图标" path="settings-block" />
<SettingsTab label="搜索" path="settings-search" />
<SettingsTab label="时间" path="settings-time" />
<SettingsTab label="侧边栏" path="settings-sider" />
<SettingsTab label="AI助手" path="settings-ai" />
<SettingsTab label="快捷栏" path="settings-dock" />
<SettingsTab label="重置" path="settings-reset" />
<SettingsTab label="问题反馈" path="settings-fallback" />
</div>
<Content />
</>
:
router.path.startsWith('s2') ?
<>
<div class="w-full h-full flex justify-center items-center bg-red-300">
</div>
</>
: ''
}
</div>
)}
</Transition>

8
src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
declare module '*.vue' {
import type { DefineComponent } from 'vue'
import Vue from 'vue'
const component: DefineComponent<{}, {}, any> | Vue
export default component
}

View File

@ -1,6 +1,6 @@
import type { Component } from 'vue'
import calendar from './calendar'
import weather from './weather'
export interface Widget {
name: string // 小组件类型唯一标识
label: string // 小组件名称
@ -15,4 +15,4 @@ export interface Widget {
}[] // 不同尺寸小组件块
}
export default [calendar] as Widget[]
export default [calendar, weather] as Widget[]

View File

@ -0,0 +1,5 @@
import { defineComponent } from 'vue'
export default defineComponent(() => {
return () => <div class="w-full h-full bg-red-50"></div>
})

View File

@ -0,0 +1,5 @@
import { defineComponent } from 'vue'
export default defineComponent(() => {
return () => <div class="w-full h-full bg-red-50"></div>
})

View File

@ -0,0 +1,5 @@
import { defineComponent } from 'vue'
export default defineComponent(() => {
return () => <div class="w-full h-full bg-red-50"></div>
})

View File

@ -0,0 +1,5 @@
import { defineComponent } from 'vue'
export default defineComponent(() => {
return () => <div class="w-full h-full bg-red-50"></div>
})

View File

@ -0,0 +1,29 @@
import type { Widget } from '..'
export default {
name: 'calendar',
label: '天气',
description: '天气资讯',
icon: '/icons/weatherIcon.png',
modal: () => import('./Modal'),
list: [
{
w: 2,
h: 1,
label: '小',
component: () => import('./Small')
},
{
w: 2,
h: 2,
label: '中',
component: () => import('./Middle')
},
{
w: 4,
h: 2,
label: '大',
component: () => import('./Large')
}
]
} as Widget

View File

@ -7,5 +7,8 @@
{
"path": "./tsconfig.app.json"
}
],
"exclude": [
"src/utils/UploadAndCut.tsx",
]
}