张延森 4 vuotta sitten
vanhempi
commit
12e18b6478

+ 4
- 4
src/components/XLoading/index.vue Näytä tiedosto

@@ -12,9 +12,9 @@
12 12
 </template>
13 13
 
14 14
 <script>
15
-import { computed } from "vue"
16
-import { Loading } from "vant"
17
-import { useModel } from "@zjxpcyc/vue-tiny-store"
15
+import { computed } from 'vue'
16
+import { Loading } from 'vant'
17
+import { useModel } from '@zjxpcyc/vue-tiny-store'
18 18
 // import store from '../../store'
19 19
 
20 20
 export default {
@@ -27,7 +27,7 @@ export default {
27 27
     xId: String,
28 28
   },
29 29
   setup(props) {
30
-    const { loading } = useModel("loading")
30
+    const { loading } = useModel('loading')
31 31
 
32 32
     const show = computed(() => loading[props.xId])
33 33
 

+ 46
- 21
src/components/detailCompents/swiper/index.vue Näytä tiedosto

@@ -1,11 +1,22 @@
1 1
 <template>
2 2
   <div class="swiper">
3 3
     <van-swipe :autoplay="3000" @change="onChange" ref="swipe">
4
-      <van-swipe-item v-for="(image, index) in images" :key="index">
5
-        <van-image height="300" :src="image.image" @click="onPerView(index)" />
4
+      <van-swipe-item v-for="(item, index) in images" :key="index">
5
+        <van-image height="300" :src="item.image" @click="onPerView(index)" />
6 6
       </van-swipe-item>
7
+      <template #indicator>
8
+        <div class="swiper-indicator" ref="indicator">
9
+          <span
10
+            v-for="(item, index) in images"
11
+            :key="index"
12
+            :class="{ active: current === index }"
13
+          >
14
+            {{ item.text }}
15
+          </span>
16
+        </div>
17
+      </template>
7 18
     </van-swipe>
8
-    <div class="swiper-tabs">
19
+    <!-- <div class="swiper-tabs">
9 20
       <van-tabs
10 21
         v-model:active="current"
11 22
         background="rgba(0, 0, 0, 0.69)"
@@ -14,19 +25,16 @@
14 25
         title-active-color="#d75e3a"
15 26
         @click="onClickTab"
16 27
       >
17
-        <van-tab
18
-          v-for="(image, index) in images"
19
-          :key="index"
20
-          :title="image.text"
21
-        >
22
-        </van-tab>
28
+        <template v-for="(item, index) in images" :key="index">
29
+          <van-tab :title="item.text" />
30
+        </template>
23 31
       </van-tabs>
24
-    </div>
32
+    </div> -->
25 33
   </div>
26 34
 </template>
27 35
 
28 36
 <script>
29
-import { ref } from "vue"
37
+import { ref } from 'vue'
30 38
 import {
31 39
   Swipe,
32 40
   SwipeItem,
@@ -34,10 +42,10 @@ import {
34 42
   ImagePreview,
35 43
   Tabs,
36 44
   Tab,
37
-} from "vant"
45
+} from 'vant'
38 46
 
39 47
 export default {
40
-  name: "swiper",
48
+  name: 'swiper',
41 49
   components: {
42 50
     [Swipe.name]: Swipe,
43 51
     [SwipeItem.name]: SwipeItem,
@@ -55,9 +63,11 @@ export default {
55 63
   setup(props) {
56 64
     const current = ref(0)
57 65
     const swipe = ref()
66
+    const indicator = ref()
58 67
 
59 68
     const onChange = (index) => {
60 69
       current.value = index
70
+      // indicator.value.scrollTo({ left: 1000 })
61 71
     }
62 72
     const onPerView = (index) => {
63 73
       ImagePreview({
@@ -70,14 +80,15 @@ export default {
70 80
       swipe.value.swipeTo(index)
71 81
       swipe.value.resize()
72 82
 
73
-      console.log(index, "ongchawng")
83
+      console.log(index, 'ongchawng')
74 84
     }
75 85
 
76 86
     // refs.checkbox.toggle();
77
-    onPerView
87
+
78 88
     return {
79 89
       swipe,
80 90
       current,
91
+      indicator,
81 92
       onChange,
82 93
       onPerView,
83 94
       onClickTab,
@@ -101,11 +112,25 @@ export default {
101 112
     width: 100%;
102 113
   }
103 114
 }
104
-.swiper .van-swipe-item {
105
-  /* color: #fff;
106
-  font-size: 20px;
107
-  line-height: 150px;
108
-  text-align: center;
109
-  background-color: #39a9ed; */
115
+
116
+.swiper-indicator {
117
+  position: absolute;
118
+  bottom: 0;
119
+  left: 0;
120
+  background: rgba(0, 0, 0, 0.69);
121
+  color: #aaa;
122
+  display: flex;
123
+  flex-wrap: nowrap;
124
+  font-size: 0.85em;
125
+
126
+  span {
127
+    display: inline-block;
128
+    padding: 0.8em;
129
+    flex: none;
130
+
131
+    &.active {
132
+      color: #d75e3a;
133
+    }
134
+  }
110 135
 }
111 136
 </style>

+ 0
- 1
src/view/secondhand/detail/components/Follow.vue Näytä tiedosto

@@ -17,7 +17,6 @@
17 17
       block
18 18
       size="small"
19 19
       type="warning"
20
-      v-if="roomInfo.status === '0'"
21 20
       v-shiro="'room:info:addFollow'"
22 21
       @click="goToAddFollow"
23 22
     >

+ 12
- 12
src/view/secondhand/detail/index.vue Näytä tiedosto

@@ -16,8 +16,8 @@
16 16
 
17 17
       <van-cell-group title="房源信息">
18 18
         <RoomProfile
19
-          :room-info="roomInfo"
20
-          :building="building"
19
+          :room-info="detail.roomInfo"
20
+          :building="detail.building"
21 21
           :other-data="roomOtherData"
22 22
         />
23 23
       </van-cell-group>
@@ -95,7 +95,7 @@
95 95
 </template>
96 96
 
97 97
 <script>
98
-import { ref, onMounted, computed, watch } from 'vue'
98
+import { ref, onMounted, computed } from 'vue'
99 99
 import { useRouter } from 'vue-router'
100 100
 import { Swiper } from '@/components/detailCompents'
101 101
 import {
@@ -169,15 +169,15 @@ export default {
169 169
 
170 170
     const { detail, getDetail } = useModel('room')
171 171
 
172
-    const roomInfo = ref({})
173
-    const building = ref({})
174
-    watch(detail, (nw) => {
175
-      roomInfo.value = nw.roomInfo
176
-      building.value = nw.building
177
-      // console.log('--------->', nw.building)
178
-    })
179
-    // const roomInfo = computed(() => detail.roomInfo || {})
180
-    // const building = computed(() => detail.building || {})
172
+    // const roomInfo = ref({})
173
+    // const building = ref({})
174
+    // watch(detail, (nw) => {
175
+    //   roomInfo.value = nw.roomInfo
176
+    //   building.value = nw.building
177
+    //   // console.log('--------->', nw.building)
178
+    // })
179
+    const roomInfo = computed(() => detail.roomInfo || {})
180
+    const building = computed(() => detail.building || {})
181 181
 
182 182
     const isNormalStatus = computed(() => {
183 183
       return detail.roomInfo?.status === '0'

+ 13
- 19
src/view/secondhand/edithouse/index.vue Näytä tiedosto

@@ -11,15 +11,15 @@
11 11
 </template>
12 12
 
13 13
 <script>
14
-import { watch } from "vue"
15
-import { useModel } from "@zjxpcyc/vue-tiny-store"
16
-import { useRoute, useRouter } from "vue-router"
17
-import { alert, showDanger } from "@/utils"
18
-import RoomBasic from "./components/Basic"
19
-import RoomForm from "./components/Form"
14
+import { onMounted } from 'vue'
15
+import { useModel } from '@zjxpcyc/vue-tiny-store'
16
+import { useRoute, useRouter } from 'vue-router'
17
+import { alert, showDanger } from '@/utils'
18
+import RoomBasic from './components/Basic'
19
+import RoomForm from './components/Form'
20 20
 
21 21
 export default {
22
-  name: "secondhanddetail",
22
+  name: 'secondhanddetail',
23 23
   components: {
24 24
     RoomBasic,
25 25
     RoomForm,
@@ -28,22 +28,12 @@ export default {
28 28
   setup() {
29 29
     const route = useRoute()
30 30
     const router = useRouter()
31
-    const { detail, getDetail, houseEdit } = useModel("room")
32
-
33
-    watch(
34
-      () => route.query.roomId,
35
-      (nw, od) => {
36
-        if (nw != od && nw) {
37
-          getDetail(nw)
38
-        }
39
-      },
40
-      { immediate: true }
41
-    )
31
+    const { detail, getDetail, houseEdit } = useModel('room')
42 32
 
43 33
     const handleSumbit = (values) => {
44 34
       houseEdit(values)
45 35
         .then(() => {
46
-          alert("编辑成功").then(() => {
36
+          alert('编辑成功').then(() => {
47 37
             router.go(-1)
48 38
           })
49 39
         })
@@ -52,6 +42,10 @@ export default {
52 42
         })
53 43
     }
54 44
 
45
+    onMounted(() => {
46
+      getDetail(route.query.roomId)
47
+    })
48
+
55 49
     return {
56 50
       handleSumbit,
57 51
       detail,