Compare commits

..

8 Commits
master ... dev

Author SHA1 Message Date
expdsn f369a51043 Merge commit '7e68ebb5057275db12d7275f5df53b5a58961178' into dev 2024-12-03 14:51:03 +08:00
expdsn a1d97e0c10 优化合并文件夹,需要300毫秒 2024-12-03 14:49:58 +08:00
expdsn 7e68ebb505 save 2024-12-02 18:30:50 +08:00
expdsn 303e1166a8 save 2024-12-02 13:00:10 +08:00
expdsn 7b0e992c98 save 2024-11-28 19:21:06 +08:00
expdsn 3a40fa7a25 ai配置 2024-11-28 16:44:29 +08:00
expdsn f20e662bfa save 2024-11-27 18:52:35 +08:00
expdsn db9089c799 save 2024-11-25 16:48:42 +08:00
13 changed files with 178 additions and 112 deletions

BIN
public/fox.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@ -31,7 +31,7 @@ const router = useRouterStore()
const layout = useLayoutStore()
</script>
<template>
<!-- <ConfigProvider :locale="zhCN"> -->
<ConfigProvider :locale="zhCN">
<div class="fixed left-0 top-0 w-full h-screen style-root" @contextmenu.prevent>
<Header />
<Background
@ -78,7 +78,7 @@ const layout = useLayoutStore()
<BackupRecovery v-if="router.path === 'global-backup'"></BackupRecovery>
</div>
<ModalPgae />
<!-- </ConfigProvider> -->
</ConfigProvider>
</template>
<style lang="less">

View File

@ -14,9 +14,12 @@ export const ossCdnBase = import.meta.env.PROD
: 'https://oss.goosetab.com'
// 后端地址
// export const apiBase = import.meta.env.PROD
// ? 'https://goosetab.com/api'
// : 'http://192.168.110.28:8300'
export const apiBase = import.meta.env.PROD
? 'https://goosetab.com/api'
: 'http://192.168.110.28:8300'
: 'https://goosetab.com/api'
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2NzJkYjg5OGUxMjY5NDc1ODYwMmYwMTgifQ.8fpdr_HPgxyU0yr-8f6nGdbHYjsFRlBa2lvjc0Zhe-A
// 图片后缀名
export const imgArr = [

View File

@ -9,6 +9,8 @@ import useRouterStore from '@/useRouterStore'
import useSearchStore from '@/layout/header/search/useSearchStore'
import useLayoutStore from '@/layout/useLayoutStore'
import { sendParent } from '@/utils/parent'
import FoxImg from '~/fox.jpg'
import clsx from 'clsx'
const stageStrList = [
'dazhaohu',
@ -122,15 +124,26 @@ export default defineComponent(() => {
}
)
return () => (
<canvas
ref={(el) => (container = el as any)}
onMouseenter={() => {
run('dianji')
}}
onClick={() => {
run('aixin')
sendParent(['openSide'])
}}
/>
<>
<img
src={FoxImg}
onClick={() => {
run('aixin')
sendParent(['openSide'])
}}
class={clsx('cursor-pointer fixed w-[40px] right-0 bottom-10 ', layout.isCompact ? 'block' : 'hidden')}
></img>
<canvas
class={clsx(layout.isCompact ? 'hidden' : 'block')}
ref={(el) => (container = el as any)}
onMouseenter={() => {
run('dianji')
}}
onClick={() => {
run('aixin')
sendParent(['openSide'])
}}
/>
</>
)
})

View File

@ -97,7 +97,6 @@ export const LinkItem = defineComponent({
w: 1,
h: 1
})
globalToast.success('添加成功')
} else {
layout.addBlock(
{
@ -118,6 +117,7 @@ export const LinkItem = defineComponent({
layout.state.currentPage = addTo?.value
}
}
globalToast.success('添加成功')
}}
>

View File

@ -5,6 +5,7 @@ import clsx from 'clsx'
import { AddToToken } from './AdderPage'
import { v4 as uuid } from 'uuid'
import useAdderPageStore from './useAdderPageStore'
import { globalToast } from '@/main'
export const WidgetItem = defineComponent({
props: {
@ -105,6 +106,8 @@ export const WidgetItem = defineComponent({
},
addTo?.value
)
globalToast.success('添加成功')
}}
>

View File

@ -9,22 +9,28 @@ import { sendParent } from '@/utils/parent'
export default defineComponent({
setup() {
const settings = useSettingsStore()
const layout = useLayoutStore()
watch(
() => ({
autoSearch: settings.state.autoUseAi === 'show',
autoSearch: settings.state.autoUseAi === 'auto',
showTabButton: settings.state.showPetOnTab,
isSearch: settings.state.autoUseAi === ''
ifSearch: settings.state.autoUseAi !== ''
}),
(val) => {
sendParent([
'configAI',
{
autoSearch: val.autoSearch,
showTabButton: val.showTabButton,
isSearch: val.isSearch
ifSearch: val.ifSearch
}
])
console.log({
autoSearch: val.autoSearch,
showTabButton: val.showTabButton,
ifSearch: val.ifSearch
});
},
{
immediate: true
@ -57,6 +63,21 @@ export default defineComponent({
>
</span>
<SettingItem
v-slots={{
label: () => <div></div>
}}
desc="浏览其它网页时的侧边栏功能"
noRoundedT
>
<Switch
checked={settings.state.showPetOnTab}
onUpdate:checked={(e) => {
if (e) settings.state.showPetOnTab = true
else settings.state.showPetOnTab = false
}}
/>
</SettingItem>
<SettingItem
v-slots={{
label: () => <div></div>
@ -72,21 +93,7 @@ export default defineComponent({
}}
/>
</SettingItem>
<SettingItem
v-slots={{
label: () => <div></div>
}}
desc="fatfox标签页内的小助手"
noRoundedT
>
<Switch
checked={settings.state.showPetOnTab}
onUpdate:checked={(e) => {
if (e) settings.state.showPetOnTab = true
else settings.state.showPetOnTab = false
}}
/>
</SettingItem>
<span
class={clsx(
'text-[14px] font-bold my-2',
@ -110,7 +117,7 @@ export default defineComponent({
/>
</SettingItem>
<div
{/* <div
class={clsx('flex w-full py-2 px-3 rounded-lg flex-col', {
'bg-black/5': useLayoutStore().state.current !== 0,
'bg-white/10': useLayoutStore().state.current === 0
@ -125,14 +132,11 @@ export default defineComponent({
desc="每次搜索直接询问fatfox"
>
<Radio
checked={settings.state.autoUseAi === 'show'}
checked={settings.state.autoUseAi === 'auto'}
onClick={() => {
settings.state.autoUseAi = 'show'
}}
onUpdate:checked={(e) => {
if (e) settings.state.showSider = 'auto'
else settings.state.showSider = 'show'
settings.state.autoUseAi = 'auto'
}}
/>
</SettingItem>
<SettingItem
@ -143,13 +147,13 @@ export default defineComponent({
desc="每次搜索,提示您进行手动查询"
>
<Radio
checked={settings.state.autoUseAi === 'auto'}
checked={settings.state.autoUseAi === 'show'}
onClick={() => {
settings.state.autoUseAi = 'auto'
settings.state.autoUseAi = 'show'
}}
/>
</SettingItem>
</div>
</div> */}
</div>
)
}

View File

@ -10,6 +10,7 @@ import useSettingsStore from '@/settings/useSettingsStore'
import { useMenuStore } from '../GlobalMenu'
import { block } from '@milkdown/kit/plugin/block'
import clsx from 'clsx'
import dayjs from 'dayjs'
export default defineComponent({
props: {
@ -28,6 +29,8 @@ export default defineComponent({
const menu = useMenuStore()
let it: any = 0
const hover = ref(false)
const canPut = ref(false)
let enterTime: any = null;
return () => (
<div
class={clsx(
@ -42,19 +45,40 @@ export default defineComponent({
transition: 'border .3s, transform .2s'
// border: hover.value ? '2px solid rgba(255,255,255,.5)' : '2px solid rgba(255,255,255,0)'
}}
onDblclick={e=> {
onDblclick={e => {
e.stopPropagation()
}}
data-transportable={props.block.link && !props.block.link.startsWith('id:') ? '1' : ''}
onDragenter={() => {
enterTime = Date.now()
}}
onDragover={(e) => {
e.preventDefault()
clearTimeout(it)
hover.value = true
if (enterTime && (Date.now() - enterTime >= 300)) {
// 在这里执行你想要的操作,比如改变目标元素的样式或者触发其他函数
canPut.value = true
}else {
canPut.value = false
}
it = setTimeout(() => {
hover.value = false
canPut.value = false
}, 300)
}}
onDrop={() => {
canPut.value = false
if (enterTime && (Date.now() - enterTime < 300)) {
// 在这里执行你想要的操作,比如改变目标元素的样式或者触发其他函数
return
}
enterTime = null;
// 处理移入
if (!dragging.id) return
if (dragging.type === 'dock') {
@ -126,37 +150,42 @@ export default defineComponent({
layout.checkDir(dragging.type)
resetDragging()
}
}}
}
}
>
{menu.isEditPage && (
<div
v-outside-click={() => {
menu.isEditPage = false
}}
onClick={(e) => {
e.stopPropagation()
const idx = layout.state.content[layout.state.current].pages[
layout.state.currentPage
].list.findIndex((val) => val.id === props.block.id)
{
menu.isEditPage && (
<div
v-outside-click={() => {
menu.isEditPage = false
}}
onClick={(e) => {
e.stopPropagation()
const idx = layout.state.content[layout.state.current].pages[
layout.state.currentPage
].list.findIndex((val) => val.id === props.block.id)
if (idx < 0) return
if (idx < 0) return
layout.state.content[layout.state.current].pages[
layout.state.currentPage
].list.splice(idx, 1)
}}
class={
'rounded-full cursor-pointer backdrop-blur-md absolute w-[20px] h-[20px] top-[8px] right-[12px] z-10 '
}
style={{
backgroundImage: `url('/tab/bg/del_icon_img.png')`,
backgroundSize: 'cover'
}}
></div>
)}
layout.state.content[layout.state.current].pages[
layout.state.currentPage
].list.splice(idx, 1)
}}
class={
'rounded-full cursor-pointer backdrop-blur-md absolute w-[20px] h-[20px] top-[8px] right-[12px] z-10 '
}
style={{
backgroundImage: `url('/tab/bg/del_icon_img.png')`,
backgroundSize: 'cover'
}}
></div>
)
}
<div
class="w-full h-full overflow-hidden relative cursor-pointer shadow-lg hover-move "
< div
class={clsx("w-full h-full overflow-hidden relative cursor-pointer shadow-lg hover-move ",
canPut.value ? "border-[#ddd]/80 border-[4px]" : "border-transparent"
)}
style={{
borderRadius: `calc(var(--block-radius) * var(--block-size))`,
transition: 'transform 0.2s'
@ -166,28 +195,32 @@ export default defineComponent({
e.preventDefault()
}}
>
{props.block.link ? (
props.block.link.startsWith('id:') ? (
// 文件夹
<DirBlock block={props.block} big={props.block.w !== 1 || props.block.h !== 1} />
{
props.block.link ? (
props.block.link.startsWith('id:') ? (
// 文件夹
<DirBlock block={props.block} big={props.block.w !== 1 || props.block.h !== 1} />
) : (
// 链接
<LinkBlock block={props.block} />
)
) : (
// 链接
<LinkBlock block={props.block} />
// 小组件
<WidgetBlock block={props.block} />
)
) : (
// 小组件
<WidgetBlock block={props.block} />
)}
</div>
{settings.state.showBlockLabel && (
<div
class="absolute left-1/2 -translate-x-1/2 -bottom-3 text-sm text-white text-center w-[172px] overflow-hidden text-ellipsis whitespace-nowrap break-all font-bold"
style="text-shadow: 0 0 4px rgba(0,0,0,.6)"
>
{layout.getLabel(props.block)}
</div>
)}
</div>
}
</div >
{
settings.state.showBlockLabel && (
<div
class="absolute left-1/2 -translate-x-1/2 -bottom-3 text-sm text-white text-center w-[172px] overflow-hidden text-ellipsis whitespace-nowrap break-all font-bold"
style="text-shadow: 0 0 4px rgba(0,0,0,.6)"
>
{layout.getLabel(props.block)}
</div>
)
}
</div >
)
}
})

View File

@ -27,10 +27,10 @@ export default function useSortable(list: Ref<any[]>, type: Ref<string>) {
scrollSpeed: 10,
...(type.value === 'page'
? {
invertSwap: true,
invertedSwapThreshold: 1,
filter: '.operation-button'
}
invertSwap: true,
invertedSwapThreshold: 1,
filter: '.operation-button'
}
: {}),
ghostClass: 'opacity-0',
onStart: (e: any) => {

View File

@ -85,9 +85,24 @@ export default defineStore('user', () => {
},
{ immediate: true }
)
const comineData = () => {
if (!remoteAddList.value) return
remoteAddList.value.map((item) => {
if (item.link)
layout.state.content[layout.state.current].pages[layout.state.currentPage].list.push(item)
})
}
const coverageData = () => {
if (!remoteData.value) return
Object.assign(layout.state.content, remoteData.value.content)
Object.assign(layout.state.dock, remoteData.value.dock)
Object.assign(layout.state.dir, remoteData.value.dir)
}
watch(() => profile.username, async (val) => {
console.log(val);
watch(token, async (val) => {
if (!val) return
console.log('开始比较');
const data = await request<Layout>('GET', '/api/backup')
if (!data) {
@ -113,27 +128,16 @@ export default defineStore('user', () => {
// TODO: 交给张阳
// remoteAddList.value = addList
remoteData.value = data
coverageData()
useRouterStore().go('global-backup')
}
}, {
immediate: true
})
const logout = () => {
token.value = ''
Object.assign(profile, { ...defaultUserInfo })
}
const comineData = () => {
if (!remoteAddList.value) return
remoteAddList.value.map((item) => {
if (item.link)
layout.state.content[layout.state.current].pages[layout.state.currentPage].list.push(item)
})
}
const coverageData = () => {
if (!remoteData.value) return
Object.assign(layout.state.content, remoteData.value.content)
Object.assign(layout.state.dock, remoteData.value.dock)
Object.assign(layout.state.dir, remoteData.value.dir)
}
const updateProfile = () => {
request('PUT', '/api/profile', {
returnType: 'text',

View File

@ -9,9 +9,10 @@ export function sendParent(
{
autoSearch: boolean
showTabButton: boolean
isSearch: boolean
ifSearch: boolean
}
]
| ['information', string]
) {
parent.window.postMessage(
{

View File

@ -26,7 +26,7 @@ export default defineComponent(() => {
'w-full bg-white/20 text-center rounded text-[14px] overflow-hidden text-ellipsis whitespace-nowrap'
}
>
{store.state.list ? store.state.list.filter((val) => !val.isCompleted).pop()?.title : '无目标'}
{store.state.list.length !== 0 ? store.state.list.filter((val) => !val.isCompleted).pop()?.title : '无目标'}
</div>
<span class={'text-[42px] mb-1'}>
{store.state.beginTime < 0 ? '15:00' : formatSeconds(store.remainingTime)}

View File

@ -1,3 +1,5 @@
import { sendParent } from "@/utils/parent";
import { generateRandomString } from "@/utils/tool";
import useTimeStore from "@/utils/useTimeStore";
import dayjs from "dayjs";
import { defineStore } from "pinia";
@ -97,10 +99,13 @@ export default defineStore("work", () => {
stopTomatoTime()
}
// sendParent(['information', '恭喜你完成了一个番茄钟' + generateRandomString(4)])
if (remainingTime.value === 0) {
state.timeList.push(
dayjs().valueOf()
)
sendParent(['information', '恭喜你完成了一个番茄钟'])
}
})
const openShowModel = ref<undefined | null | TomatoTarget>()