张延森 před 3 roky
rodič
revize
4a72d0236a

+ 1
- 0
package.json Zobrazit soubor

@@ -13,6 +13,7 @@
13 13
   "dependencies": {
14 14
     "animate.css": "^4.1.1",
15 15
     "core-js": "^3.6.4",
16
+    "dialog-polyfill": "^0.5.6",
16 17
     "lib-flexible": "^0.3.2",
17 18
     "lodash": "^4.17.15",
18 19
     "regenerator-runtime": "^0.13.5",

+ 15
- 0
src/assets/css/mixin.scss Zobrazit soubor

@@ -34,3 +34,18 @@
34 34
   flex-wrap: $fw;
35 35
   -webkit-flex-wrap: $fw;
36 36
 }
37
+
38
+@keyframes slidefade {
39
+  0% {
40
+    opacity: 0;
41
+    transform: translateX(0);
42
+  }
43
+  70% {
44
+    opacity: 1;
45
+    transform: translateX(-30%);
46
+  }
47
+  100% {
48
+    opacity: 0;
49
+    transform: translateX(-30%);
50
+  }
51
+}

binární
src/assets/images/apartment/backSign.png Zobrazit soubor


src/assets/images/apartment/户型解析页面左右滑动示意.png → src/assets/images/apartment/slideSign.png Zobrazit soubor


+ 41
- 0
src/components/Modal/index.vue Zobrazit soubor

@@ -0,0 +1,41 @@
1
+<template>
2
+  <dialog>
3
+    <slot></slot>
4
+  </dialog>
5
+</template>
6
+
7
+<script>
8
+import dialogPolyfill from 'dialog-polyfill'
9
+
10
+export default {
11
+  name: 'Modal',
12
+  // props: {
13
+  //   visible: Boolean
14
+  // },
15
+  // watch: {
16
+  //   visible(val) {
17
+  //     if (this.$el) {
18
+  //       if (val) {
19
+  //         this.$el.showModal()
20
+  //       } else {
21
+  //         this.$el.close()
22
+  //       }
23
+  //     }
24
+  //   }
25
+  // },
26
+  mounted() {
27
+    this.$nextTick(() => {
28
+      dialogPolyfill.registerDialog(this.$el)
29
+      this.$el.showModal()
30
+    })
31
+  }
32
+}
33
+</script>
34
+
35
+<style lang="scss">
36
+dialog {
37
+  margin: 0;
38
+  padding: 0;
39
+  border: none;
40
+}
41
+</style>

+ 1
- 0
src/components/Swiper/index.vue Zobrazit soubor

@@ -25,6 +25,7 @@ export default {
25 25
   mounted() {
26 26
     this.$nextTick(() => {
27 27
       this.swiper = new Swiper(this.$el, this.options)
28
+      this.$emit('inited', this.swiper)
28 29
     })
29 30
   }
30 31
 }

+ 2
- 0
src/main.js Zobrazit soubor

@@ -4,6 +4,7 @@ import 'core-js/stable'
4 4
 import 'regenerator-runtime/runtime'
5 5
 
6 6
 import Vue from 'vue'
7
+import Modal from '@/components/Modal'
7 8
 import Swiper from '@/components/Swiper'
8 9
 import SwiperSlide from '@/components/SwiperSlide'
9 10
 import App from './App.vue'
@@ -24,6 +25,7 @@ import 'lib-flexible/flexible.js'
24 25
 import './filters'
25 26
 Vue.config.productionTip = false
26 27
 
28
+Vue.component('modal', Modal)
27 29
 Vue.component('swiper', Swiper)
28 30
 Vue.component('swiper-slide', SwiperSlide)
29 31
 

+ 70
- 14
src/views/apartment.vue Zobrazit soubor

@@ -1,25 +1,37 @@
1 1
 <!-- home -->
2 2
 <template>
3
-  <swiper>
4
-    <swiper-slide v-for="item in list" :key="item.image">
5
-      <pure-image :bg-color="item.color" :bg-image="item.image"></pure-image>
6
-    </swiper-slide>
7
-  </swiper>
3
+  <div class="apartment">
4
+    <pure-image :bg-image="require('@/assets/images/apartment/1.jpg')"></pure-image>
5
+    <apartment-navi class="apartment-navi" @goto="handleGoto" />
6
+    <div v-for="(item, index) in list" :key="item.image">
7
+      <modal v-if="visible[index]" class="apartment-modal">
8
+        <pure-image :bg-image="item.image"></pure-image>
9
+        <div class="back-sign" @click="cancelShow(index)">
10
+          <img :src="require('@/assets/images/apartment/backSign.png')" alt="">
11
+        </div>
12
+      </modal>
13
+    </div>
14
+    <modal v-if="visible[5]" class="apartment-modal">
15
+      <swiper-image :list="houseList"></swiper-image>
16
+      <div class="back-sign" @click="cancelShow(5)">
17
+        <img :src="require('@/assets/images/apartment/backSign.png')" alt="">
18
+      </div>
19
+    </modal>
20
+  </div>
8 21
 </template>
9 22
 
10 23
 <script>
11 24
 
12 25
 export default {
13 26
   components: {
14
-    PureImage: () => import('./components/PureImage.vue')
27
+    PureImage: () => import('./components/PureImage.vue'),
28
+    SwiperImage: () => import('./components/SwiperImage.vue'),
29
+    ApartmentNavi: () => import('./components/ApartmentNavi.vue')
15 30
   },
16 31
   data() {
17 32
     return {
33
+      visible: Array(6).fill(false),
18 34
       list: [
19
-        {
20
-          image: require('@/assets/images/apartment/1.jpg'),
21
-          color: '#f0f0f0'
22
-        },
23 35
         {
24 36
           image: require('@/assets/images/apartment/2-2.jpg'),
25 37
           color: '#f0f0f0'
@@ -33,13 +45,15 @@ export default {
33 45
           color: '#f0f0f0'
34 46
         },
35 47
         {
36
-          image: require('@/assets/images/apartment/5-1.jpg'),
48
+          image: require('@/assets/images/apartment/6-1.jpg'),
37 49
           color: '#f0f0f0'
38 50
         },
39 51
         {
40
-          image: require('@/assets/images/apartment/6-1.jpg'),
52
+          image: require('@/assets/images/apartment/5-1.jpg'),
41 53
           color: '#f0f0f0'
42
-        },
54
+        }
55
+      ],
56
+      houseList: [
43 57
         {
44 58
           image: require('@/assets/images/apartment/7-1.jpg'),
45 59
           color: '#f0f0f0'
@@ -76,9 +90,51 @@ export default {
76 90
     }
77 91
   },
78 92
 
79
-  methods: {}
93
+  methods: {
94
+    handleGoto(inx) {
95
+      // inx 是从1开始的
96
+      this.$set(this.visible, inx - 1, true)
97
+    },
98
+    cancelShow(inx) {
99
+      this.$set(this.visible, inx, false)
100
+    }
101
+  }
80 102
 }
81 103
 </script>
82 104
 
83 105
 <style lang="scss" scoped>
106
+.apartment {
107
+  height: 100%;
108
+  position: relative;
109
+
110
+  .apartment-modal {
111
+    position: absolute;
112
+    width: 100%;
113
+    height: 100%;
114
+    bottom: 0;
115
+    left: 0;
116
+  }
117
+
118
+  .apartment-navi {
119
+    position: absolute;
120
+    width: 100%;
121
+    height: 40%;
122
+    bottom: 0;
123
+    left: 0;
124
+  }
125
+
126
+  .back-sign {
127
+    position: absolute;
128
+    z-index: 500;
129
+    right: 10px;
130
+    bottom: 20px;
131
+    width: 96px;
132
+    height: 78px;
133
+
134
+    img {
135
+      width: 100%;
136
+      height: 100%;
137
+    }
138
+  }
139
+}
84 140
 </style>

+ 56
- 0
src/views/components/ApartmentNavi.vue Zobrazit soubor

@@ -0,0 +1,56 @@
1
+<template>
2
+  <div>
3
+    <div class="flex-box">
4
+      <div class="flex-box-item">
5
+        <img :src="require('@/assets/images/apartment/1-2.png')" style="height: 64px; display: block; margin: 0 auto" alt="">
6
+      </div>
7
+    </div>
8
+    <div class="flex-box" style="margin-top: 10px">
9
+      <div class="flex-box-item">
10
+        <img :src="require('@/assets/images/apartment/2-1.png')" style="height: 78px" alt="" @click="handleClick(1)">
11
+      </div>
12
+      <div class="flex-box-item">
13
+        <img :src="require('@/assets/images/apartment/3.png')" style="height: 78px" alt="" @click="handleClick(2)">
14
+      </div>
15
+      <div class="flex-box-item">
16
+        <img :src="require('@/assets/images/apartment/4.png')" style="height: 78px" alt="" @click="handleClick(3)">
17
+      </div>
18
+    </div>
19
+    <div class="flex-box" style="margin-top: 20px">
20
+      <div class="flex-box-item">
21
+        <img :src="require('@/assets/images/apartment/5.png')" style="height: 78px" alt="" @click="handleClick(4)">
22
+      </div>
23
+      <div class="flex-box-item">
24
+        <img :src="require('@/assets/images/apartment/6.png')" style="height: 78px" alt="" @click="handleClick(5)">
25
+      </div>
26
+      <div class="flex-box-item">
27
+        <img :src="require('@/assets/images/apartment/7.png')" style="height: 78px" alt="" @click="handleClick(6)">
28
+      </div>
29
+    </div>
30
+  </div>
31
+</template>
32
+
33
+<script>
34
+export default {
35
+  name: 'ApartmentNavi',
36
+  methods: {
37
+    handleClick(inx) {
38
+      this.$emit('goto', inx)
39
+    }
40
+  }
41
+}
42
+</script>
43
+
44
+<style lang="scss" scoped>
45
+.flex-box {
46
+  display: flex;
47
+  justify-content: center;
48
+  align-items: center;
49
+  box-sizing: border-box;
50
+  padding: 0 20px;
51
+
52
+  &-item {
53
+    flex: 1;
54
+  }
55
+}
56
+</style>

+ 5
- 24
src/views/components/IndexImage.vue Zobrazit soubor

@@ -1,18 +1,18 @@
1 1
 <template>
2 2
   <div class="index-image">
3
-    <img :src="image" class="bg-image" @load="loadBg" />
3
+    <img :src="require('@/assets/images/index.png')" class="bg-image" @load="loadBg" />
4 4
     <div class="index-inner-swiper" :style="swiperItemStyle">
5 5
       <swiper v-if="showSwiper">
6 6
         <swiper-slide class="index-inner-slide">
7
-          <img :src="btn1" alt="" @click="$router.push({ name: 'Apartment' })">
7
+          <img :src="require('@/assets/images/按钮-1.png')" alt="" @click="$router.push({ name: 'Apartment' })">
8 8
         </swiper-slide>
9 9
         <swiper-slide class="index-inner-slide">
10
-          <img :src="btn2" alt="" @click="$router.push({ name: 'Office' })">
10
+          <img :src="require('@/assets/images/按钮-2.png')" alt="" @click="$router.push({ name: 'Office' })">
11 11
         </swiper-slide>
12 12
       </swiper>
13 13
     </div>
14 14
     <div class="index-pos-hander" :style="handerStyle">
15
-      <img :src="hander" alt="">
15
+      <img :src="require('@/assets/images/toLeft.png')" alt="">
16 16
     </div>
17 17
   </div>
18 18
 </template>
@@ -23,10 +23,6 @@ export default {
23 23
   name: 'IndexImage',
24 24
   data() {
25 25
     return {
26
-      image: require('@/assets/images/index.png'),
27
-      btn1: require('@/assets/images/按钮-1.png'),
28
-      btn2: require('@/assets/images/按钮-2.png'),
29
-      hander: require('@/assets/images/toLeft.png'),
30 26
       showSwiper: false,
31 27
       swiperItemStyle: {},
32 28
       handerStyle: {}
@@ -90,27 +86,12 @@ export default {
90 86
     z-index: 200;
91 87
     width: 64px;
92 88
     height: 56px;
93
-    animation: leftfade 2s infinite;
89
+    animation: slidefade 2s infinite;
94 90
 
95 91
     img {
96 92
       width: 100%;
97 93
       height: 100%;
98 94
     }
99 95
   }
100
-
101
-  @keyframes leftfade {
102
-    0% {
103
-      opacity: 0;
104
-      transform: translateX(0);
105
-    }
106
-    70% {
107
-      opacity: 1;
108
-      transform: translateX(-30%);
109
-    }
110
-    100% {
111
-      opacity: 0;
112
-      transform: translateX(-30%);
113
-    }
114
-  }
115 96
 }
116 97
 </style>

+ 2
- 2
src/views/components/PureImage.vue Zobrazit soubor

@@ -1,6 +1,6 @@
1 1
 <template>
2
-  <div class="pure-image" :style="custStyle">
3
-    <p></p>
2
+  <div class="pure-image" :style="custStyle" @click="$emit('click')">
3
+    <div />
4 4
   </div>
5 5
 </template>
6 6
 

+ 50
- 0
src/views/components/SwiperImage.vue Zobrazit soubor

@@ -0,0 +1,50 @@
1
+<template>
2
+  <div class="swiper-image">
3
+    <swiper v-if="list.length > 0">
4
+      <swiper-slide v-for="item in list" :key="item.image">
5
+        <pure-image :bg-color="item.color" :bg-image="item.image"></pure-image>
6
+      </swiper-slide>
7
+    </swiper>
8
+    <div class="slide-sign">
9
+      <img :src="require('@/assets/images/apartment/slideSign.png')" alt="">
10
+    </div>
11
+  </div>
12
+</template>
13
+
14
+<script>
15
+export default {
16
+  name: 'SwiperImage',
17
+  components: {
18
+    PureImage: () => import('./PureImage.vue')
19
+  },
20
+  props: {
21
+    list: {
22
+      type: Array,
23
+      default: () => []
24
+    }
25
+  }
26
+}
27
+</script>
28
+
29
+<style lang="scss" scoped>
30
+.swiper-image {
31
+  position: relative;
32
+  width: 100%;
33
+  height: 100%;
34
+
35
+  .slide-sign {
36
+    position: absolute;
37
+    z-index: 100;
38
+    right: 20px;
39
+    top: 50%;
40
+    width: 64px;
41
+    height: 56px;
42
+    animation: slidefade 2s infinite;
43
+
44
+    img {
45
+      width: 100%;
46
+      height: 100%;
47
+    }
48
+  }
49
+}
50
+</style>