diff --git a/src/components/fab/FabButton.vue b/src/components/fab/FabButton.vue
index 03fa26a..b94f71c 100644
--- a/src/components/fab/FabButton.vue
+++ b/src/components/fab/FabButton.vue
@@ -6,11 +6,7 @@
@touchend.stop="endDrag"
:style="{ right: position.x + 'px', bottom: position.y + 'px' }"
>
-
+
@@ -31,28 +27,73 @@ const props = defineProps({
const systemInfo = uni.getSystemInfoSync()
const position = ref({ x: props.initialX, y: props.initialY })
const startPosition = ref({ x: 0, y: 0 })
+const startTime = ref(0)
+const longPressTimer = ref(null)
+const canDrag = ref(false)
+const moveDistance = ref(0)
const startDrag = (event: TouchEvent) => {
startPosition.value = { x: event.touches[0].clientX, y: event.touches[0].clientY }
+ startTime.value = Date.now()
+ canDrag.value = false
+ moveDistance.value = 0
+
+ // 设置长按定时器,300ms后允许拖动
+ longPressTimer.value = setTimeout(() => {
+ if (!canDrag.value) {
+ canDrag.value = true
+ }
+ }, 300) as unknown as number
}
const onDrag = (event: TouchEvent) => {
const deltaX = event.touches[0].clientX - startPosition.value.x
const deltaY = event.touches[0].clientY - startPosition.value.y
+
+ // 计算移动距离
+ moveDistance.value = Math.sqrt(deltaX * deltaX + deltaY * deltaY)
+
+ // 如果移动距离超过阈值,立即允许拖动
+ if (moveDistance.value > 10 && !canDrag.value) {
+ canDrag.value = true
+ if (longPressTimer.value) {
+ clearTimeout(longPressTimer.value)
+ longPressTimer.value = null
+ }
+ }
+
+ if (!canDrag.value) return
+
position.value = { x: position.value.x - deltaX, y: position.value.y - deltaY }
startPosition.value = { x: event.touches[0].clientX, y: event.touches[0].clientY }
}
const endDrag = () => {
- const windowWidth = systemInfo.windowWidth
- const windowHeight = systemInfo.windowHeight
- const buttonWidth = 128 // 按钮宽度
- const buttonHeight = 128 // 按钮高度
+ // 清除长按定时器
+ if (longPressTimer.value) {
+ clearTimeout(longPressTimer.value)
+ longPressTimer.value = null
+ }
- if (position.value.x < 0) position.value.x = 0
- if (position.value.y < 0) position.value.y = 0
- if (position.value.x + buttonWidth > windowWidth) position.value.x = windowWidth - buttonWidth
- if (position.value.y + buttonHeight > windowHeight) position.value.y = windowHeight - buttonHeight
+ // 如果移动距离小于阈值且触摸时间小于300ms,则触发点击事件
+ if (!canDrag.value && moveDistance.value < 10 && Date.now() - startTime.value < 300) {
+ handleClick()
+ return
+ }
+
+ // 如果是拖动结束,处理边界
+ if (canDrag.value) {
+ const windowWidth = systemInfo.windowWidth
+ const windowHeight = systemInfo.windowHeight
+ const buttonWidth = 128 // 按钮宽度
+ const buttonHeight = 128 // 按钮高度
+
+ if (position.value.x < 0) position.value.x = 0
+ if (position.value.y < 0) position.value.y = 0
+ if (position.value.x + buttonWidth > windowWidth) position.value.x = windowWidth - buttonWidth
+ if (position.value.y + buttonHeight > windowHeight)
+ position.value.y = windowHeight - buttonHeight
+ }
}
const handleClick = () => {
diff --git a/src/login-sub/components/LoginMask.vue b/src/login-sub/components/LoginMask.vue
index 7d7f275..c0cc6bf 100644
--- a/src/login-sub/components/LoginMask.vue
+++ b/src/login-sub/components/LoginMask.vue
@@ -1,7 +1,8 @@
-
+
{{ phone ? '申请使用您的手机号' : '申请获取您的个人信息' }}
-
手机号快捷登录
-
+
@@ -31,14 +33,13 @@
-
-
+
diff --git a/src/login-sub/components/Overlay.vue b/src/login-sub/components/Overlay.vue
new file mode 100644
index 0000000..bb9c6a3
--- /dev/null
+++ b/src/login-sub/components/Overlay.vue
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/login-sub/components/navbar/Navbar.vue b/src/login-sub/components/navbar/Navbar.vue
new file mode 100644
index 0000000..726f11d
--- /dev/null
+++ b/src/login-sub/components/navbar/Navbar.vue
@@ -0,0 +1,190 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/login-sub/components/navbar/left.jpg b/src/login-sub/components/navbar/left.jpg
new file mode 100644
index 0000000..69b166b
Binary files /dev/null and b/src/login-sub/components/navbar/left.jpg differ
diff --git a/src/login-sub/index.vue b/src/login-sub/index.vue
index 93f03ac..9687771 100644
--- a/src/login-sub/index.vue
+++ b/src/login-sub/index.vue
@@ -9,11 +9,17 @@
-
+
新高考选科
-
+
import LoginMask from './components/LoginMask.vue'
+import Navbar from './components/navbar/Navbar.vue'
+
const show = ref(false)
const handleLogin = () => {
diff --git a/src/pages-sub/components/navbar/Navbar.vue b/src/pages-sub/components/navbar/Navbar.vue
new file mode 100644
index 0000000..726f11d
--- /dev/null
+++ b/src/pages-sub/components/navbar/Navbar.vue
@@ -0,0 +1,190 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages-sub/components/navbar/left.jpg b/src/pages-sub/components/navbar/left.jpg
new file mode 100644
index 0000000..69b166b
Binary files /dev/null and b/src/pages-sub/components/navbar/left.jpg differ
diff --git a/src/pages-sub/customerService/index/index.vue b/src/pages-sub/customerService/index/index.vue
index 01e3278..c4f632c 100644
--- a/src/pages-sub/customerService/index/index.vue
+++ b/src/pages-sub/customerService/index/index.vue
@@ -9,14 +9,11 @@
-
+
在线客服
-
-
-
-
+
@@ -62,6 +59,8 @@