Yansen 2 år sedan
förälder
incheckning
fea3c240c4
6 ändrade filer med 134 tillägg och 2 borttagningar
  1. Binär
      public/mask.png
  2. Binär
      public/封面1.png
  3. 1
    1
      src/App.vue
  4. 1
    1
      src/components/CustMap.vue
  5. 130
    0
      src/components/Loader2.vue
  6. 2
    0
      src/style.css

Binär
public/mask.png Visa fil


Binär
public/封面1.png Visa fil


+ 1
- 1
src/App.vue Visa fil

@@ -1,6 +1,6 @@
1 1
 <script setup>
2 2
   import { computed, onMounted, ref } from 'vue';
3
-  import Loader from '@/components/Loader.vue';
3
+  import Loader from '@/components/Loader2.vue';
4 4
   import ScrollDown from '@/components/ScrollDown.vue';
5 5
   import Image from '@/components/Image.vue';
6 6
   import { useModel } from "@zjxpcyc/vue-tiny-store";

+ 1
- 1
src/components/CustMap.vue Visa fil

@@ -126,7 +126,7 @@
126 126
 
127 127
     const last = distance[0];
128 128
     const diff = 86;  // 86 为一个误差值, 距离大于 86 意味这没有点击景点
129
-    console.log('------last----->', last)
129
+    // console.log('------last----->', last)
130 130
     if (last.s < diff) {
131 131
       scenicSpots.value = last;
132 132
       show.value = true;

+ 130
- 0
src/components/Loader2.vue Visa fil

@@ -0,0 +1,130 @@
1
+<template>
2
+  <div 
3
+    class="loader-wrapper"
4
+    @touchmove.prevent
5
+    @mousewheel.prevent
6
+  >
7
+    <div class="loader-mask">
8
+      <img :src="maskImg" alt="" @load="onLoad">
9
+      <div class="mask-fill" :style="fillStyle"></div>
10
+    </div>
11
+    <div class="back-blank" v-if="showBack" :style="bbStyle">
12
+      <div class="back-move" :style="bmStyle"></div>
13
+    </div>
14
+    <p class="percent">{{percent}}%</p>
15
+  </div>
16
+</template>
17
+
18
+<script setup>
19
+  import { computed, reactive, ref, watch } from "vue"
20
+
21
+  const props = defineProps({
22
+    tip: {
23
+      type: String,
24
+      default: 'loading...'
25
+    },
26
+    percent: {
27
+      type: Number,
28
+      default: 0
29
+    },
30
+    loading: Boolean
31
+  })
32
+
33
+  const elRef = ref();
34
+  const showBack = ref(false);
35
+  const progressStyle = computed(() => ({ width: `${props.percent}%` }));
36
+
37
+  const maskImg = './mask.png';
38
+  const maskFontHeight = [186, 726]; // mask.png 字的高度
39
+
40
+  const fillStyle = ref({});
41
+  const bbStyle = ref({});
42
+
43
+  const bmStyle = computed(() => {
44
+    return {
45
+      top: `${0 - props.percent}%`,
46
+    }
47
+  })
48
+
49
+  const onLoad = e => {
50
+    const { height, naturalHeight } = e.target;
51
+    const yRate = height / naturalHeight;
52
+
53
+    fillStyle.value = { top: `${height}px` };
54
+    showBack.value = true;
55
+    bbStyle.value = {
56
+      height: `${yRate * (maskFontHeight[1] - maskFontHeight[0])}px`,
57
+      top: `${yRate * maskFontHeight[0]}px`,
58
+    }
59
+  }
60
+
61
+</script>
62
+
63
+
64
+<style lang="less" scoped>
65
+@tip-color: #933D33;
66
+
67
+.loader-wrapper {
68
+  position: fixed;
69
+  top: 0;
70
+  left: 0;
71
+  width: 100%;
72
+  height: 100%;
73
+  z-index: 100;
74
+  overflow: hidden;
75
+  background: transparent;
76
+  
77
+  .loader-mask {
78
+    background: transparent;
79
+    position: absolute;
80
+    top: 0;
81
+    left: 0;
82
+    width: 100%;
83
+    height: 100%;
84
+    z-index: 20;
85
+    overflow: hidden;
86
+
87
+    img {
88
+      display: block;
89
+      width: 100%;
90
+    }
91
+
92
+    .mask-fill {
93
+      background: var(--bg-color);
94
+      width: 100%;
95
+      height: 100%;
96
+      left: 0;
97
+    }
98
+  }
99
+  .percent {
100
+    position: absolute;
101
+    color: @tip-color;
102
+    text-align: center;
103
+    width: 100%;
104
+    bottom: 120px;
105
+    left: 0;
106
+    z-index: 30;
107
+    font-size: 24px;
108
+    font-weight: bold;
109
+  }
110
+
111
+  .back-blank {
112
+    position: absolute;
113
+    top: 0;
114
+    left: 0;
115
+    width: 100%;
116
+    height: 100%;
117
+
118
+    .back-move {
119
+      background: var(--bg-color);
120
+
121
+      position: absolute;
122
+      top: 0;
123
+      left: 0;
124
+      width: 100%;
125
+      height: 100%;
126
+    }
127
+  }
128
+}
129
+
130
+</style>

+ 2
- 0
src/style.css Visa fil

@@ -8,6 +8,8 @@
8 8
   -webkit-font-smoothing: antialiased;
9 9
   -moz-osx-font-smoothing: grayscale;
10 10
   -webkit-text-size-adjust: 100%;
11
+
12
+  --bg-color: #D7DDD3;
11 13
 }
12 14
 
13 15
 html, body, #app {