张延森 il y a 3 ans
Parent
révision
4ed3bb3e1f

BIN
src/assets/perjectImages/backButton-2.png Voir le fichier


BIN
src/assets/perjectImages/backButton.png Voir le fichier


+ 5
- 5
src/views/apartment.vue Voir le fichier

118
   position: relative;
118
   position: relative;
119
 
119
 
120
   .apartment-modal {
120
   .apartment-modal {
121
-    position: absolute;
122
-    width: 100vw;
123
-    height: 100vh;
124
-    bottom: 0;
125
-    left: 0;
121
+    // position: absolute;
122
+    // width: 100vw;
123
+    // height: 100vh;
124
+    // bottom: 0;
125
+    // left: 0;
126
   }
126
   }
127
 
127
 
128
   .apartment-navi {
128
   .apartment-navi {

+ 46
- 0
src/views/components/ProjectSwiper.vue Voir le fichier

1
+<template>
2
+  <swiper>
3
+    <swiper-slide v-for="(item, index) in list" :key="item.image" @click.native="$emit('clickItem', index)">
4
+        <pure-image :bg-image="item.image"></pure-image>
5
+    </swiper-slide>
6
+  </swiper>
7
+</template>
8
+
9
+<script>
10
+export default {
11
+  name: 'ProjectSwiper',
12
+  components: {
13
+    PureImage: () => import('./PureImage.vue')
14
+  },
15
+  data() {
16
+    return {
17
+      list: [
18
+        {
19
+          image: require('@/assets/perjectImages/1.png')
20
+        },
21
+        {
22
+          image: require('@/assets/perjectImages/2.png')
23
+        },
24
+        {
25
+          image: require('@/assets/perjectImages/3.png')
26
+        },
27
+        {
28
+          image: require('@/assets/perjectImages/4.png')
29
+        },
30
+        {
31
+          image: require('@/assets/perjectImages/5.png')
32
+        },
33
+        {
34
+          image: require('@/assets/perjectImages/6.png')
35
+        },
36
+        {
37
+          image: require('@/assets/perjectImages/7.png')
38
+        },
39
+        {
40
+          image: require('@/assets/perjectImages/8.png')
41
+        }
42
+      ]
43
+    }
44
+  }
45
+}
46
+</script>

+ 99
- 28
src/views/projectIndex.vue Voir le fichier

1
 <!-- home -->
1
 <!-- home -->
2
 <template>
2
 <template>
3
-  <div class="apartment">
3
+  <div class="project-index">
4
     <img src="@/assets/perjectImages/langbgm.jpg" width="100%" class="bgiclass" @load="handleImageLoad"/>
4
     <img src="@/assets/perjectImages/langbgm.jpg" width="100%" class="bgiclass" @load="handleImageLoad"/>
5
     <div class="index-pos-hander" :style="handleStyle">
5
     <div class="index-pos-hander" :style="handleStyle">
6
         <img :src="require('@/assets/perjectImages/swiperButton.png')" alt="">
6
         <img :src="require('@/assets/perjectImages/swiperButton.png')" alt="">
7
       </div>
7
       </div>
8
-    <swiper>
9
-      <swiper-slide v-for="item in houseList" :key="item.image">
10
-        <pure-image :bg-color="item.color" :bg-image="item.image"></pure-image>
11
-      </swiper-slide>
12
-    </swiper>
8
+    <div class="index-project-swiper" :style="swiperStyle" ref="swiperRef">
9
+      <project-swiper v-if="swiperShow" @clickItem="handleShow"></project-swiper>
10
+    </div>
11
+    <div v-for="(item, index) in list" :key="item.image">
12
+      <yz-modal :visible="visible[index]" class="project-modal" @touchmove.native="handleMove">
13
+        <div class="modal-inner">
14
+          <pure-image :bg-image="item.image"></pure-image>
15
+          <div class="back-sign" @click="cancelShow(index)">
16
+            <img :src="item.backSign" alt="">
17
+          </div>
18
+        </div>
19
+      </yz-modal>
20
+    </div>
13
   </div>
21
   </div>
14
 </template>
22
 </template>
15
 
23
 
16
 <script>
24
 <script>
17
 
25
 
26
+const backSignImg = require('@/assets/perjectImages/backButton.png')
27
+const backSignImg2 = require('@/assets/perjectImages/backButton-2.png')
28
+
18
 export default {
29
 export default {
30
+  components: {
31
+    PureImage: () => import('./components/PureImage.vue'),
32
+    ProjectSwiper: () => import('./components/ProjectSwiper.vue')
33
+  },
19
   data() {
34
   data() {
20
     return {
35
     return {
21
       handleStyle: {},
36
       handleStyle: {},
22
-      houseList: [
37
+      swiperStyle: {},
38
+      swiperShow: false,
39
+      visible: Array(8).fill(false),
40
+      list: [
23
         {
41
         {
24
-          image: require('@/assets/images/apartment/7-1.jpg'),
25
-          color: '#f0f0f0'
42
+          image: require('@/assets/perjectImages/1-1.jpg'),
43
+          backSign: backSignImg
26
         },
44
         },
27
         {
45
         {
28
-          image: require('@/assets/images/apartment/7-2.jpg'),
29
-          color: '#f0f0f0'
46
+          image: require('@/assets/perjectImages/2-1.jpg'),
47
+          backSign: backSignImg2
30
         },
48
         },
31
         {
49
         {
32
-          image: require('@/assets/images/apartment/7-3.jpg'),
33
-          color: '#f0f0f0'
50
+          image: require('@/assets/perjectImages/3-1.jpg'),
51
+          backSign: backSignImg
34
         },
52
         },
35
         {
53
         {
36
-          image: require('@/assets/images/apartment/7-4.jpg'),
37
-          color: '#f0f0f0'
54
+          image: require('@/assets/perjectImages/4-1.jpg'),
55
+          backSign: backSignImg
38
         },
56
         },
39
         {
57
         {
40
-          image: require('@/assets/images/apartment/7-5.jpg'),
41
-          color: '#f0f0f0'
58
+          image: require('@/assets/perjectImages/5-1.jpg'),
59
+          backSign: backSignImg2
42
         },
60
         },
43
         {
61
         {
44
-          image: require('@/assets/images/apartment/7-6.jpg'),
45
-          color: '#f0f0f0'
62
+          image: require('@/assets/perjectImages/6-1.jpg'),
63
+          backSign: backSignImg
46
         },
64
         },
47
         {
65
         {
48
-          image: require('@/assets/images/apartment/7-7.jpg'),
49
-          color: '#f0f0f0'
66
+          image: require('@/assets/perjectImages/7-1.jpg'),
67
+          backSign: backSignImg
50
         },
68
         },
51
         {
69
         {
52
-          image: require('@/assets/images/apartment/7-8.jpg'),
53
-          color: '#f0f0f0'
70
+          image: require('@/assets/perjectImages/8-1.jpg'),
71
+          backSign: backSignImg
54
         }
72
         }
55
       ]
73
       ]
56
     }
74
     }
57
   },
75
   },
76
+  mounted() {
77
+    this.$nextTick(() => {
78
+      const { offsetWidth } = this.$refs.swiperRef
79
+      this.swiperStyle = {
80
+        height: `${offsetWidth * 0.6667}px`
81
+      }
82
+      this.swiperShow = true
83
+    })
84
+  },
58
   methods: {
85
   methods: {
59
-    handleImageLoad(e) {
60
-      const { height } = e.target
86
+    handleImageLoad() {
87
+      const { scrollHeight } = this.$el
61
 
88
 
62
       this.handleStyle = {
89
       this.handleStyle = {
63
-        top: `${height - 400}px`
90
+        top: `${scrollHeight - 400}px`
64
       }
91
       }
92
+    },
93
+    handleShow(index) {
94
+      this.$set(this.visible, index, true)
95
+    },
96
+    cancelShow(index) {
97
+      this.$set(this.visible, index, false)
98
+    },
99
+    handleMove(e) {
100
+      console.log(e)
101
+      e.preventDefault()
102
+      e.stopPropagation()
65
     }
103
     }
66
   }
104
   }
67
 }
105
 }
68
 </script>
106
 </script>
69
 
107
 
70
 <style lang="scss" scoped>
108
 <style lang="scss" scoped>
71
-.apartment {
72
-  height: 100%;
109
+.project-index {
110
+  background: #f0f0f0;
73
   position: relative;
111
   position: relative;
112
+
74
   .index-pos-hander {
113
   .index-pos-hander {
75
     position: absolute;
114
     position: absolute;
76
     z-index: 200;
115
     z-index: 200;
84
       height: 100%;
123
       height: 100%;
85
     }
124
     }
86
   }
125
   }
126
+
127
+  .index-project-swiper {
128
+    position: relative;
129
+    box-sizing: border-box;
130
+    margin: 0 15px;
131
+    width: calc(100vw - 30px);
132
+  }
133
+
134
+  .project-modal {
135
+    overscroll-behavior: contain
136
+  }
137
+
138
+  .modal-inner {
139
+    position: relative;
140
+    width: 100vw;
141
+    height: 100vh;
142
+    overflow: hidden;
143
+
144
+    .back-sign {
145
+      position: absolute;
146
+      z-index: 500;
147
+      right: 10px;
148
+      bottom: -24px;
149
+      width: 96px;
150
+      height: 88px;
151
+
152
+      img {
153
+        width: 100%;
154
+        height: 100%;
155
+      }
156
+    }
157
+  }
87
 }
158
 }
88
 </style>
159
 </style>