From a1d97e0c105bec1f7f36b6fe78b9a62a2822d49b Mon Sep 17 00:00:00 2001
From: expdsn <18111002318@163.com>
Date: Tue, 3 Dec 2024 14:49:58 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=88=E5=B9=B6=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=E5=A4=B9=EF=BC=8C=E9=9C=80=E8=A6=81300=E6=AF=AB?=
=?UTF-8?q?=E7=A7=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/config.ts | 5 +-
src/layout/grid/BlockWrapper.tsx | 129 +++++++++++++++++++------------
src/user/useUserStore.ts | 35 +++++----
3 files changed, 105 insertions(+), 64 deletions(-)
diff --git a/src/config.ts b/src/config.ts
index 560c33a..9c19e58 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -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 = [
diff --git a/src/layout/grid/BlockWrapper.tsx b/src/layout/grid/BlockWrapper.tsx
index f307622..139d182 100644
--- a/src/layout/grid/BlockWrapper.tsx
+++ b/src/layout/grid/BlockWrapper.tsx
@@ -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 () => (
{
+ 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 && (
-
{
- 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 && (
+
{
+ 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'
- }}
- >
- )}
+ 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'
+ }}
+ >
+ )
+ }
-
- {props.block.link ? (
- props.block.link.startsWith('id:') ? (
- // 文件夹
-
+ {
+ props.block.link ? (
+ props.block.link.startsWith('id:') ? (
+ // 文件夹
+
+ ) : (
+ // 链接
+
+ )
) : (
- // 链接
-
+ // 小组件
+
)
- ) : (
- // 小组件
-
- )}
-
- {settings.state.showBlockLabel && (
-
- {layout.getLabel(props.block)}
-
- )}
-
+ }
+
+ {
+ settings.state.showBlockLabel && (
+