Ver Código Fonte

Merge branch 'master' of http://39.164.159.226:3000/hnsh-smart-steward/smart-steward-mobile

闪电 2 semanas atrás
pai
commit
c7807c3f00
2 arquivos alterados com 117 adições e 38 exclusões
  1. 51 3
      src/App.ku.vue
  2. 66 35
      src/pages/schedule/view/index.vue

+ 51 - 3
src/App.ku.vue

@@ -20,6 +20,12 @@ const helloKuRoot = ref('Hello AppKuVue')
20 20
 
21 21
 const exposeRef = ref('this is form app.Ku.vue')
22 22
 
23
+const isDragging = ref(false)
24
+const startX = ref(0)
25
+const startY = ref(0)
26
+const aiIconLeft = ref(20)
27
+const aiIconTop = ref(110)
28
+
23 29
 const handleAIClick = () => {
24 30
   console.log('点击了')
25 31
   uni.navigateTo({
@@ -27,6 +33,40 @@ const handleAIClick = () => {
27 33
   })
28 34
 }
29 35
 
36
+const handleTouchStart = (e: any) => {
37
+  isDragging.value = true
38
+  startX.value = e.touches[0].clientX
39
+  startY.value = e.touches[0].clientY
40
+}
41
+
42
+const handleTouchMove = (e: any) => {
43
+  if (!isDragging.value) return
44
+  const dx = e.touches[0].clientX - startX.value
45
+  const dy = e.touches[0].clientY - startY.value
46
+  const newLeft = aiIconLeft.value + dx * 2
47
+  const newTop = aiIconTop.value - dy * 2
48
+  
49
+  // 限制在屏幕范围内
50
+  const screenWidth = uni.getSystemInfoSync().windowWidth
51
+  const screenHeight = uni.getSystemInfoSync().windowHeight
52
+  
53
+  const minLeft = 0
54
+  const maxLeft = screenWidth * 2 - 120 // 120是AI图标的宽度
55
+  const minTop = 0
56
+  const maxTop = screenHeight * 2 - 120 // 120是AI图标的高度
57
+  
58
+  aiIconLeft.value = Math.max(minLeft, Math.min(maxLeft, newLeft))
59
+  aiIconTop.value = Math.max(minTop, Math.min(maxTop, newTop))
60
+  
61
+  startX.value = e.touches[0].clientX
62
+  startY.value = e.touches[0].clientY
63
+}
64
+
65
+// 结束拖动
66
+const handleTouchEnd = () => {
67
+  isDragging.value = false
68
+}
69
+
30 70
 defineExpose({
31 71
   exposeRef,
32 72
 })
@@ -40,7 +80,17 @@ defineExpose({
40 80
     </view>
41 81
     <KuRootView />
42 82
     <FgTabbar v-if="isCurrentPageTabbar" />
43
-    <view class="ai-icon" @click="handleAIClick">
83
+    <view 
84
+      class="ai-icon" 
85
+      @click="handleAIClick"
86
+      @touchstart="handleTouchStart"
87
+      @touchmove="handleTouchMove"
88
+      @touchend="handleTouchEnd"
89
+      :style="{
90
+        left: aiIconLeft + 'rpx',
91
+        bottom: aiIconTop + 'rpx'
92
+      }"
93
+    >
44 94
       <image src="/src/assets/AIimgs.gif" mode="aspectFit" />
45 95
     </view>
46 96
   </view>
@@ -49,8 +99,6 @@ defineExpose({
49 99
 <style lang="scss" scoped>
50 100
 .ai-icon {
51 101
   position: fixed;
52
-  bottom: 110rpx;
53
-  left: 20rpx;
54 102
   z-index: 9999;
55 103
   width: 120rpx;
56 104
   height: 120rpx;

+ 66 - 35
src/pages/schedule/view/index.vue

@@ -27,6 +27,7 @@ const mainloing = ref(false)
27 27
 const GasStationId = ref('')
28 28
 const currentMonth = ref(new Date())
29 29
 const isExpanded = ref(false)
30
+const isBoxExpanded = ref(true) // 控制悬浮框展开/折叠状态
30 31
 const radioActive = ref('日')
31 32
 const selectedDate = ref(new Date())
32 33
 const overduedaylist = ref([]) as any // 逾期任务列表
@@ -371,44 +372,64 @@ const handletabs = async (val) => {
371 372
       </view>
372 373
     </view>
373 374
     <view class="box-rigth-fixed">
374
-      <view
375
-        @click="addtodoaskslistfn('油站')"
376
-        style="
377
-          display: flex;
378
-          gap: 14rpx;
379
-          flex-direction: column;
380
-          align-items: center;
381
-          color: #31373d;
382
-        "
383
-      >
384
-        <wd-icon name="add1" size="22px"></wd-icon>
385
-        <text style="font-size: 24rpx; font-weight: 400">油站</text>
386
-      </view>
387
-      <view
388
-        @click="addtodoaskslistfn('访客')"
375
+      <!-- 展开/折叠按钮 -->
376
+      <view 
377
+        class="toggle-btn" 
378
+        @click="isBoxExpanded = !isBoxExpanded"
389 379
         style="
390 380
           display: flex;
391
-          gap: 14rpx;
392
-          flex-direction: column;
381
+          justify-content: center;
393 382
           align-items: center;
394
-          color: #31373d;
383
+          padding-top: 16rpx;
395 384
         "
396 385
       >
397
-        <wd-icon name="user" size="22px"></wd-icon>
398
-        <text style="font-size: 24rpx; font-weight: 400">访客</text>
386
+        <wd-icon :name="isBoxExpanded ? 'arrow-up' : 'arrow-down'" size="20px" />
399 387
       </view>
400
-      <view
401
-        style="
402
-          display: flex;
403
-          gap: 14rpx;
404
-          flex-direction: column;
405
-          align-items: center;
406
-          color: #31373d;
407
-        "
408
-        @click="navigateToCreateOrder"
409
-      >
410
-        <wd-icon name="list" size="22px"></wd-icon>
411
-        <text style="font-size: 24rpx; font-weight: 400">工单</text>
388
+      
389
+      <!-- 悬浮框内容 -->
390
+      <view v-if="isBoxExpanded" class="box-content">
391
+        <view
392
+          @click="addtodoaskslistfn('油站')"
393
+          style="
394
+            display: flex;
395
+            gap: 14rpx;
396
+            flex-direction: column;
397
+            align-items: center;
398
+            color: #31373d;
399
+            padding: 10rpx 0;
400
+          "
401
+        >
402
+          <wd-icon name="add1" size="22px"></wd-icon>
403
+          <text style="font-size: 24rpx; font-weight: 400">油站</text>
404
+        </view>
405
+        <view
406
+          @click="addtodoaskslistfn('访客')"
407
+          style="
408
+            display: flex;
409
+            gap: 14rpx;
410
+            flex-direction: column;
411
+            align-items: center;
412
+            color: #31373d;
413
+            padding: 10rpx 0;
414
+          "
415
+        >
416
+          <wd-icon name="user" size="22px"></wd-icon>
417
+          <text style="font-size: 24rpx; font-weight: 400">访客</text>
418
+        </view>
419
+        <view
420
+          style="
421
+            display: flex;
422
+            gap: 14rpx;
423
+            flex-direction: column;
424
+            align-items: center;
425
+            color: #31373d;
426
+            padding: 10rpx 0;
427
+          "
428
+          @click="navigateToCreateOrder"
429
+        >
430
+          <wd-icon name="list" size="22px"></wd-icon>
431
+          <text style="font-size: 24rpx; font-weight: 400">工单</text>
432
+        </view>
412 433
       </view>
413 434
     </view>
414 435
     <view class="Calendar-content">
@@ -560,7 +581,7 @@ body {
560 581
   }
561 582
   .box-rigth-fixed {
562 583
     width: 96rpx;
563
-    height: 364rpx;
584
+    min-height: 60rpx;
564 585
     background-color: #ffffff;
565 586
     // border: 1px solid red;
566 587
     position: fixed;
@@ -569,11 +590,21 @@ body {
569 590
     z-index: 100;
570 591
     display: flex;
571 592
     flex-direction: column;
572
-    justify-content: space-around;
573 593
     border: 1px solid #ebeef5;
574 594
     border-radius: 12px;
575 595
     box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
576
-    // align-items: center;
596
+    overflow: hidden;
597
+  }
598
+  
599
+  .box-content {
600
+    display: flex;
601
+    flex-direction: column;
602
+    justify-content: space-around;
603
+    padding: 10rpx 0;
604
+  }
605
+  
606
+  .toggle-btn {
607
+    cursor: pointer;
577 608
   }
578 609
   .Calendar-content {
579 610
     padding-top: 346rpx;