Your Name 2 vuotta sitten
vanhempi
commit
4922c1944b

+ 8
- 46
src/components/CoverMap.vue Näytä tiedosto

14
         <i class="iconfont icon-cc-pointer-right"></i>
14
         <i class="iconfont icon-cc-pointer-right"></i>
15
       </div>
15
       </div>
16
     </CoverBtn>
16
     </CoverBtn>
17
-    
18
-    <AudioVue :audio="scenicSpots.audio" ref="audioRef" @play="playing = true" @stop="playing = false" />
19
-
20
-    <div v-if="show" class="map-info-box" :class="{ show }" @click.stop="show = false">
21
-      <div class="map-info-container" @click.stop="">
22
-        <img class="thumb" :src="scenicSpots.thumb2" alt="">
23
-        <div class="head">
24
-          <div>{{ scenicSpots.name }}</div>
25
-          <div>
26
-            <span @click="onClickAudio">
27
-              <i class="iconfont icon-playcircle" v-if="!playing"></i>
28
-              <i class="iconfont icon-pausecircle" v-else></i>
29
-            </span>
30
-            <span @click="onClickLoc"><i class="iconfont icon-map"></i></span>            
31
-          </div>
32
-        </div>
33
-        <div class="body">{{ scenicSpots.desc }}</div>  
34
-      </div>      
35
-      <div class="action" @click.stop="show = false">
36
-        <i class="iconfont icon-roundclose"></i>
37
-      </div>
38
-    </div>
39
-  </div>
40
 
17
 
18
+    <InfoBox
19
+      :visible="show"
20
+      :resource="scenicSpots"
21
+      :thumb="scenicSpots.thumb2"
22
+      @close="show = false"
23
+    />
24
+  </div>
41
 </template>
25
 </template>
42
 
26
 
43
 <script setup>
27
 <script setup>
44
   import { ref } from 'vue';
28
   import { ref } from 'vue';
45
   import { resources } from '@/utils/resources';
29
   import { resources } from '@/utils/resources';
46
   import CoverBtn from './CoverBtn.vue';
30
   import CoverBtn from './CoverBtn.vue';
47
-  import AudioVue from './Audio.vue';
31
+  import InfoBox from './InfoBox.vue';
48
 
32
 
49
   const posList = resources.filter(x => x.mapBtnPos);
33
   const posList = resources.filter(x => x.mapBtnPos);
50
   
34
   
55
   const show = ref(false);  
39
   const show = ref(false);  
56
   const gestureHide = ref(false);
40
   const gestureHide = ref(false);
57
   const scenicSpots = ref({});
41
   const scenicSpots = ref({});
58
-  const audioRef = ref();
59
-  const playing = ref(false);
60
   const btnCenters = ref([]);
42
   const btnCenters = ref([]);
61
 
43
 
62
   const getGestureStyle = (width, height) => {
44
   const getGestureStyle = (width, height) => {
70
     scenicSpots.value = it;
52
     scenicSpots.value = it;
71
     show.value = true;
53
     show.value = true;
72
     gestureHide.value = true;
54
     gestureHide.value = true;
73
-    stopAudio();
74
-  }
75
-  const onClickAudio = () => audioRef.value.toggle();
76
-  const stopAudio = () => {
77
-    if (playing.value) {
78
-      audioRef.value.toggle();
79
-      playing.value = false;
80
-    }
81
-  }
82
-  const onClickLoc = () => {
83
-    if (wx) {
84
-      wx.openLocation({
85
-        latitude: scenicSpots.value.mapPos[1], // 纬度,浮点数,范围为90 ~ -90
86
-        longitude: scenicSpots.value.mapPos[0], // 经度,浮点数,范围为180 ~ -180。
87
-        name: scenicSpots.value.name, // 位置名
88
-        address: '', // 地址详情说明
89
-        scale: 15, // 地图缩放级别,整型值,范围从1~28。默认为最大
90
-        infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
91
-      });
92
-    }
93
   }
55
   }
94
 
56
 
95
   const onLoad = e => {
57
   const onLoad = e => {

+ 89
- 2
src/components/InfoBox.vue Näytä tiedosto

1
 <template>
1
 <template>
2
   <OverLay :visible="visible" @close="emit('close')">
2
   <OverLay :visible="visible" @close="emit('close')">
3
-    1234
3
+    <div class="info-container" @click.stop="">
4
+      <img class="thumb" :src="thumb" alt="">
5
+      <div class="head">
6
+        <div>{{ resource.name }}</div>
7
+        <div>
8
+          <span @click="onClickAudio">
9
+            <i class="iconfont icon-playcircle" v-if="!playing"></i>
10
+            <i class="iconfont icon-pausecircle" v-else></i>
11
+          </span>
12
+          <span @click="onClickLoc"><i class="iconfont icon-map"></i></span>            
13
+        </div>
14
+      </div>
15
+      <div class="body">{{ resource.desc }}</div>  
16
+    </div>
17
+    <AudioVue :audio="resource.audio" ref="audioRef" @play="playing = true" @stop="playing = false" />
4
   </OverLay>
18
   </OverLay>
5
 </template>
19
 </template>
6
 
20
 
7
 <script setup>
21
 <script setup>
8
-  import { ref } from 'vue';
22
+  import { ref, watch } from 'vue';
9
   import OverLay from './OverLay.vue';
23
   import OverLay from './OverLay.vue';
24
+  import AudioVue from './Audio.vue';
25
+
10
   
26
   
11
   const props = defineProps({
27
   const props = defineProps({
12
     visible: Boolean,
28
     visible: Boolean,
29
+    thumb: String,
30
+    resource: {
31
+      type: Object,
32
+      default: () => ({}),
33
+    }
13
   });
34
   });
14
   
35
   
15
   const emit = defineEmits(['close']);
36
   const emit = defineEmits(['close']);
37
+
38
+  const audioRef = ref();
39
+  const playing = ref(false);
40
+
41
+  const onClickAudio = () => audioRef.value.toggle();
42
+  const stopAudio = () => {
43
+    if (playing.value) {
44
+      audioRef.value.toggle();
45
+      playing.value = false;
46
+    }
47
+  }
48
+  const onClickLoc = () => {
49
+    if (wx) {
50
+      wx.openLocation({
51
+        latitude: props.resource.mapPos[1], // 纬度,浮点数,范围为90 ~ -90
52
+        longitude: props.resource.mapPos[0], // 经度,浮点数,范围为180 ~ -180。
53
+        name: props.resource.name, // 位置名
54
+        address: '', // 地址详情说明
55
+        scale: 15, // 地图缩放级别,整型值,范围从1~28。默认为最大
56
+        infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
57
+      });
58
+    }
59
+  }
60
+
61
+  watch(() => props.visible, (val) => {
62
+    if (val) {
63
+      stopAudio();
64
+    }
65
+  })
16
   
66
   
17
 </script>
67
 </script>
68
+
69
+<style lang="less" scoped>
70
+  .info-container {
71
+    width: 60vw;
72
+    max-height: 60vh;
73
+    overflow-y: auto;
74
+
75
+    .thumb {
76
+          width: 100%;
77
+        }
78
+
79
+    .head {
80
+      box-sizing: border-box;
81
+      padding: 1em 0;
82
+      border-bottom: 1px solid #f5f5f5;
83
+      display: flex;
84
+      justify-content: space-between;
85
+
86
+      .iconfont {
87
+        display: inline-block;
88
+        font-size: 24px;
89
+        padding: 0 4px;
90
+      }
91
+
92
+      & > div {
93
+        flex: none;
94
+      }
95
+    }
96
+
97
+    .body {
98
+      box-sizing: border-box;
99
+      padding: 1em 0;
100
+      line-height: 1.6em;
101
+      text-indent: 2em;
102
+    }
103
+  }
104
+</style>

+ 1
- 2
src/components/OverLay.vue Näytä tiedosto

65
 
65
 
66
     &.hidden {
66
     &.hidden {
67
       opacity: 0;
67
       opacity: 0;
68
+      visibility: hidden;
68
     }
69
     }
69
 
70
 
70
     .mask {
71
     .mask {
94
         box-shadow:2px 2px 3px #aaaaaa;
95
         box-shadow:2px 2px 3px #aaaaaa;
95
         box-sizing: border-box;
96
         box-sizing: border-box;
96
         background: #fff;
97
         background: #fff;
97
-        overflow-y: auto;
98
-        overflow-x: hidden;
99
       }
98
       }
100
 
99
 
101
       .close {
100
       .close {

+ 2
- 5
src/components/ScenicDetail.vue Näytä tiedosto

5
     :height="height"
5
     :height="height"
6
     @click="onShowInfoBtn"
6
     @click="onShowInfoBtn"
7
   />
7
   />
8
-  <PopUpVue :show="showInfo" :info="resource" :onClose="onCloseInfoBtn" />
8
+  <InfoBox :visible="showInfo" :resource="resource" :thumb="resource.thumb1" @close="showInfo = false" />
9
   <div v-if="resource.showGesture" class="gesture2" :class="{ hidden: gestureHide }" :style="gestureStyle">
9
   <div v-if="resource.showGesture" class="gesture2" :class="{ hidden: gestureHide }" :style="gestureStyle">
10
     <i class="iconfont icon-cc-pointer-right"></i>
10
     <i class="iconfont icon-cc-pointer-right"></i>
11
   </div>
11
   </div>
14
 <script setup>  
14
 <script setup>  
15
   import { computed, ref, watch } from "vue";
15
   import { computed, ref, watch } from "vue";
16
   import CoverBtn from "./CoverBtn.vue";
16
   import CoverBtn from "./CoverBtn.vue";
17
-  import PopUpVue from "./PopUp.vue";
17
+  import InfoBox from './InfoBox.vue';
18
 
18
 
19
   const props = defineProps({
19
   const props = defineProps({
20
     center: Array,
20
     center: Array,
45
     showInfo.value = true
45
     showInfo.value = true
46
   };
46
   };
47
 
47
 
48
-  const onCloseInfoBtn = () => {
49
-    showInfo.value=false
50
-  };
51
 </script>
48
 </script>
52
 
49
 
53
 <style lang="less" scoped>
50
 <style lang="less" scoped>