张延森 4 lat temu
rodzic
commit
d01d3c4280

+ 23
- 16
src/main.js Wyświetl plik

@@ -1,15 +1,15 @@
1
-import { createApp } from "vue"
2
-import App from "./App.vue"
3
-import { router } from "./router"
4
-import store from "./store"
5
-import "vant/lib/index.css"
1
+import { createApp } from 'vue'
2
+import App from './App.vue'
3
+import { router } from './router'
4
+import store from './store'
5
+import 'vant/lib/index.css'
6 6
 
7
-import { Notify, Dialog } from "vant"
8
-import GSection from "./components/GSection"
9
-import Shiro from "./components/Shiro"
10
-import XLoading from "./components/XLoading"
11
-import XField from "./components/XField"
12
-import shiro from "./utils/plugins/shiro"
7
+import { Notify, Dialog } from 'vant'
8
+import GSection from './components/GSection'
9
+import Shiro from './components/Shiro'
10
+import XLoading from './components/XLoading'
11
+import XField from './components/XField'
12
+import shiro from './utils/plugins/shiro'
13 13
 
14 14
 const app = createApp(App)
15 15
 app.use(store)
@@ -18,9 +18,16 @@ app.use(shiro)
18 18
 
19 19
 app.component(Notify.Component.name, Notify.Component)
20 20
 app.component(Dialog.Component.name, Dialog.Component)
21
-app.component("g-section", GSection)
22
-app.component("x-loading", XLoading)
23
-app.component("x-field", XField)
24
-app.component("shiro", Shiro)
21
+app.component('g-section', GSection)
22
+app.component('x-loading', XLoading)
23
+app.component('x-field', XField)
24
+app.component('shiro', Shiro)
25 25
 
26
-app.mount("#app")
26
+app.config.errorHandler = (err, vm, info) => {
27
+  console.error('VUE ERROR')
28
+  console.error(err)
29
+  console.error(vm)
30
+  console.error(info)
31
+}
32
+
33
+app.mount('#app')

+ 10
- 12
src/view/login/index.vue Wyświetl plik

@@ -43,15 +43,15 @@
43 43
 </template>
44 44
 
45 45
 <script>
46
-import { reactive } from "vue"
47
-import { Form, Button, Field, checkbox } from "vant"
48
-import { useRouter } from "vue-router"
46
+import { reactive } from 'vue'
47
+import { Form, Button, Field, checkbox } from 'vant'
48
+import { useRouter } from 'vue-router'
49 49
 
50
-import usericon from "./../../assets/user.png"
51
-import passwordicon from "./../../assets/password.png"
52
-import request from "../../utils/request"
50
+import usericon from './../../assets/user.png'
51
+import passwordicon from './../../assets/password.png'
52
+import request from '../../utils/request'
53 53
 export default {
54
-  name: "login",
54
+  name: 'login',
55 55
   components: {
56 56
     [Form.name]: Form,
57 57
     [Button.name]: Button,
@@ -73,15 +73,13 @@ export default {
73 73
     const state = reactive({})
74 74
     const router = useRouter()
75 75
     const onSubmit = (values) => {
76
-      console.log(values.loginName && values.password, "submit", values)
76
+      console.log(values.loginName && values.password, 'submit', values)
77 77
       if (values.loginName && values.password) {
78 78
         request({
79
-          url: "/login",
79
+          url: '/login',
80 80
           params: values,
81 81
         }).then((res) => {
82
-          console.log(res, "res")
83
-
84
-          router.push("/home")
82
+          router.replace('/home')
85 83
         })
86 84
       }
87 85
     }

+ 30
- 23
src/view/secondhand/detail/components/Base.vue Wyświetl plik

@@ -5,42 +5,42 @@
5 5
     </x-field>
6 6
 
7 7
     <x-field label="朝向">
8
-      {{ getDictLabel(roomInfo.aspect, "aspect") }}
8
+      {{ getDictLabel(roomInfo.aspect, 'aspect') }}
9 9
     </x-field>
10 10
 
11 11
     <x-field label="装修">
12
-      {{ getDictLabel(roomInfo.decoration, "decoration") }}
12
+      {{ getDictLabel(roomInfo.decoration, 'decoration') }}
13 13
     </x-field>
14 14
 
15 15
     <x-field label="房屋用途">
16
-      {{ getDictLabel(roomInfo.purpose, "purpose") }}
16
+      {{ getDictLabel(roomInfo.purpose, 'purpose') }}
17 17
     </x-field>
18 18
 
19 19
     <x-field label="建筑类型">
20
-      {{ getDictLabel(roomInfo.buildType, "build_type") }}
20
+      {{ getDictLabel(roomInfo.buildType, 'build_type') }}
21 21
     </x-field>
22 22
 
23 23
     <x-field label="配备电梯">
24
-      {{ getDictLabel(roomInfo.elevator, "elevator") }}
24
+      {{ getDictLabel(roomInfo.elevator, 'elevator') }}
25 25
     </x-field>
26 26
 
27 27
     <x-field label="抵押信息">
28
-      {{ getDictLabel(roomInfo.isMortgage, "mortgage") || "无" }}
28
+      {{ getDictLabel(roomInfo.isMortgage, 'mortgage') || '无' }}
29 29
     </x-field>
30 30
 
31 31
     <x-field label="税费">
32
-      {{ getDictLabel(roomInfo.buildTime, "build_time") || "未知" }}
32
+      {{ getDictLabel(roomInfo.buildTime, 'build_time') || '未知' }}
33 33
     </x-field>
34 34
 
35 35
     <x-field label="来源">
36
-      {{ getDictLabel(roomInfo.sourceFrom, "sourceFrom") }}
36
+      {{ getDictLabel(roomInfo.sourceFrom, 'sourceFrom') }}
37 37
     </x-field>
38 38
   </div>
39 39
 </template>
40 40
 
41 41
 <script>
42
-import { computed } from "vue"
43
-import { useModel } from "@zjxpcyc/vue-tiny-store"
42
+import { computed, watch } from 'vue'
43
+import { useModel } from '@zjxpcyc/vue-tiny-store'
44 44
 
45 45
 export default {
46 46
   props: {
@@ -50,51 +50,58 @@ export default {
50 50
     },
51 51
   },
52 52
   setup(props) {
53
-    const { dicts, getDict } = useModel("dicts")
53
+    const { dicts, getDict } = useModel('dicts')
54
+
55
+    watch(
56
+      () => props.roomInfo,
57
+      () => {
58
+        console.log('------Base-------->')
59
+      }
60
+    )
54 61
 
55 62
     // 朝向
56 63
     if (!dicts.aspect || !dicts.aspect.length) {
57
-      getDict("aspect")
64
+      getDict('aspect')
58 65
     }
59 66
 
60 67
     // 装修
61 68
     if (!dicts.decoration || !dicts.decoration.length) {
62
-      getDict("decoration")
69
+      getDict('decoration')
63 70
     }
64 71
 
65 72
     // 房屋用途
66 73
     if (!dicts.purpose || !dicts.purpose.length) {
67
-      getDict("purpose")
74
+      getDict('purpose')
68 75
     }
69 76
 
70 77
     // 建筑类型
71
-    if (!dicts["build_type"] || !dicts["build_type"].length) {
72
-      getDict("build_type")
78
+    if (!dicts['build_type'] || !dicts['build_type'].length) {
79
+      getDict('build_type')
73 80
     }
74 81
 
75 82
     // 电梯
76 83
     if (!dicts.elevator || !dicts.elevator.length) {
77
-      getDict("elevator")
84
+      getDict('elevator')
78 85
     }
79 86
 
80 87
     // 抵押信息
81 88
     if (!dicts.mortgage || !dicts.mortgage.length) {
82
-      getDict("mortgage")
89
+      getDict('mortgage')
83 90
     }
84 91
 
85 92
     // 税费
86
-    if (!dicts["build_time"] || !dicts["build_time"].length) {
87
-      getDict("build_time")
93
+    if (!dicts['build_time'] || !dicts['build_time'].length) {
94
+      getDict('build_time')
88 95
     }
89 96
 
90 97
     // 来源
91 98
     if (!dicts.sourceFrom || !dicts.sourceFrom.length) {
92
-      getDict("sourceFrom")
99
+      getDict('sourceFrom')
93 100
     }
94 101
 
95 102
     const roomType = computed(() => {
96
-      const [a, b, c, d] = (props.roomInfo.roomType || "").split(",")
97
-      return `${a || ""}室 ${b || "0"}厅 ${c || "0"}厨 ${d || "0"}卫`
103
+      const [a, b, c, d] = (props.roomInfo.roomType || '').split(',')
104
+      return `${a || ''}室 ${b || '0'}厅 ${c || '0'}厨 ${d || '0'}卫`
98 105
     })
99 106
 
100 107
     // 获取字典对应名称

src/view/secondhand/detail/components/Main.vue → src/view/secondhand/detail/components/Profile.vue Wyświetl plik

@@ -3,15 +3,15 @@
3 3
     <x-field label="房源ID"> {{ roomInfo.roomCode }}{{ roomInfo.id }} </x-field>
4 4
 
5 5
     <x-field label="所属楼盘">
6
-      {{ otherData.building.buildingName }}
6
+      {{ otherData.building?.buildingName }}
7 7
     </x-field>
8 8
 
9 9
     <x-field label="所属区县">
10
-      {{ otherData.roomCity.areaName }}
10
+      {{ otherData.roomCity?.areaName }}
11 11
     </x-field>
12 12
 
13 13
     <x-field label="所属商圈">
14
-      {{ otherData.roomBusi.areaName }}
14
+      {{ otherData.roomBusi?.areaName }}
15 15
     </x-field>
16 16
 
17 17
     <x-field label="楼层">
@@ -21,7 +21,7 @@
21 21
     <x-field label="面积"> {{ roomInfo.acreage }} ㎡ </x-field>
22 22
 
23 23
     <x-field label="价格">
24
-      {{ roomInfo.totalPrice }} 万元 / {{ avgPrice }} 元/㎡
24
+      {{ price }}
25 25
     </x-field>
26 26
 
27 27
     <x-field label="创建方式">
@@ -71,11 +71,11 @@
71 71
 </template>
72 72
 
73 73
 <script>
74
-import { computed, ref } from 'vue'
74
+import { computed, ref, watch } from 'vue'
75 75
 import { useRouter } from 'vue-router'
76
-import { Button, Dialog } from 'vant'
76
+import { Button } from 'vant'
77 77
 import request from '@/utils/request'
78
-import { showDanger } from '@/utils'
78
+import { showDanger, alert } from '@/utils'
79 79
 
80 80
 const getSecurity = (roomId) => {
81 81
   return request({
@@ -100,7 +100,14 @@ export default {
100 100
       type: Object,
101 101
       default: () => ({}),
102 102
     },
103
-    otherData: Object,
103
+    building: {
104
+      type: Object,
105
+      default: () => ({}),
106
+    },
107
+    otherData: {
108
+      type: Object,
109
+      default: () => ({}),
110
+    },
104 111
   },
105 112
   setup(props) {
106 113
     const router = useRouter()
@@ -108,14 +115,19 @@ export default {
108 115
     const unfollowRoom = ref()
109 116
 
110 117
     const floor = computed(() => {
111
-      const [a, b, c] = (props.roomInfo.roomFloor || '').split(',')
118
+      const [a, b, c] = (props.roomInfo?.roomFloor || '').split(',')
112 119
       return `${a || ''}/${b || ''}(${c || ''})`
113 120
     })
114 121
 
115
-    const avgPrice = computed(() => {
116
-      return Number(
117
-        (props.roomInfo.totalPrice * 10000) / props.roomInfo.acreage
118
-      ).toFixed(2)
122
+    const price = computed(() => {
123
+      const total = props.roomInfo?.totalPrice
124
+      const acreage = props.roomInfo?.acreage
125
+      const avg =
126
+        total && acreage
127
+          ? Number((total * 10000) / acreage).toFixed(2)
128
+          : undefined
129
+
130
+      return `${total || ''} 万元 / ${avg || ''} 元/㎡`
119 131
     })
120 132
 
121 133
     const goToAddFollow = () =>
@@ -135,7 +147,7 @@ export default {
135 147
             if ('1003' === e.code) {
136 148
               unfollowRoom.value = JSON.parse(e.message)
137 149
 
138
-              Dialog.alert({
150
+              alert({
139 151
                 title: '去跟进',
140 152
                 message: `您存在未跟进的房源,房源编号: ${unfollowRoom.value.id}`,
141 153
               }).then(() => {
@@ -149,9 +161,16 @@ export default {
149 161
       }
150 162
     }
151 163
 
164
+    watch(
165
+      () => props.roomInfo,
166
+      () => {
167
+        console.log('------Main-------->')
168
+      }
169
+    )
170
+
152 171
     return {
153 172
       floor,
154
-      avgPrice,
173
+      price,
155 174
       securityInfo,
156 175
       handleSecurityClick,
157 176
       unfollowRoom,

+ 21
- 18
src/view/secondhand/detail/index.vue Wyświetl plik

@@ -7,13 +7,19 @@
7 7
       </div>
8 8
 
9 9
       <div class="title">
10
-        <p class="body">{{ detail.roomInfo?.title }}</p>
11
-
10
+        <div class="body">
11
+          <div>{{ detail.roomInfo.title }}</div>
12
+          <div><RoomTag :room-info="detail.roomInfo" /></div>
13
+        </div>
12 14
         <MoreActions v-if="isNormalStatus" :room-info="detail.roomInfo" />
13 15
       </div>
14 16
 
15 17
       <van-cell-group title="房源信息">
16
-        <RoomMain :room-info="detail.roomInfo" :other-data="roomOtherData" />
18
+        <RoomProfile
19
+          :room-info="detail.roomInfo"
20
+          :building="detail.building"
21
+          :other-data="roomOtherData"
22
+        />
17 23
       </van-cell-group>
18 24
 
19 25
       <van-cell-group title="其他信息">
@@ -110,8 +116,9 @@ import {
110 116
   CollapseItem,
111 117
 } from 'vant'
112 118
 import { useModel } from '@zjxpcyc/vue-tiny-store'
119
+import RoomTag from '@/components/RoomTag'
113 120
 import MoreActions from './components/MoreActions'
114
-import RoomMain from './components/Main'
121
+import RoomProfile from './components/Profile'
115 122
 import RoomBase from './components/Base'
116 123
 import RoomEstate from './components/Estate'
117 124
 import RoomRole from './components/Role'
@@ -119,8 +126,6 @@ import RoomAuth from './components/Auth'
119 126
 import RoomKey from './components/Key'
120 127
 import RoomFollow from './components/Follow'
121 128
 import RoomLook from './components/Look'
122
-// import Contextc from "../../../components/contextC"
123
-// import { router } from "../../../router";
124 129
 
125 130
 export default {
126 131
   name: 'secondhanddetail',
@@ -141,8 +146,9 @@ export default {
141 146
     [Dialog.Component.name]: Dialog.Component,
142 147
 
143 148
     Swiper,
149
+    RoomTag,
144 150
     MoreActions,
145
-    RoomMain,
151
+    RoomProfile,
146 152
     RoomBase,
147 153
     RoomEstate,
148 154
     RoomRole,
@@ -151,9 +157,6 @@ export default {
151 157
     RoomFollow,
152 158
     RoomLook,
153 159
   },
154
-  data() {
155
-    return {}
156
-  },
157 160
 
158 161
   setup() {
159 162
     const router = useRouter()
@@ -183,11 +186,6 @@ export default {
183 186
         .map((x) => ({ image: x.url, text: getRescType(x.imgType) }))
184 187
     })
185 188
 
186
-    onMounted(() => {
187
-      getDetail(roomId)
188
-      getDict('roomResc_type')
189
-    })
190
-
191 189
     const shareOptions = [
192 190
       { name: '微信', icon: 'wechat' },
193 191
       { name: '微博', icon: 'weibo' },
@@ -204,12 +202,16 @@ export default {
204 202
     const roomOtherData = computed(() => {
205 203
       return {
206 204
         leftSecurityNum: detail.leftSecurityNum,
207
-        roomCity: detail.roomCity || {},
208
-        roomBusi: detail.roomBusiness || {},
209
-        building: detail.building || {},
205
+        roomCity: detail.roomCity,
206
+        roomBusi: detail.roomBusiness,
210 207
       }
211 208
     })
212 209
 
210
+    onMounted(() => {
211
+      getDetail(roomId)
212
+      getDict('roomResc_type')
213
+    })
214
+
213 215
     return {
214 216
       phone,
215 217
       imageList,
@@ -240,6 +242,7 @@ export default {
240 242
 
241 243
     .body {
242 244
       flex: auto;
245
+      padding-top: 1em;
243 246
     }
244 247
 
245 248
     .action {

+ 13
- 11
src/view/secondhand/index.vue Wyświetl plik

@@ -85,18 +85,20 @@ export default {
85 85
     }
86 86
 
87 87
     onMounted(() => {
88
-      const loadInst = Toast.loading({
89
-        message: '请稍候...',
90
-        forbidClick: true,
91
-        overlay: true,
92
-        duration: 0,
93
-      })
94
-
95
-      onLoad()
96
-        .then(() => {
97
-          loadInst.clear()
88
+      if (page.pageNo !== 1) {
89
+        const loadInst = Toast.loading({
90
+          message: '请稍候...',
91
+          forbidClick: true,
92
+          overlay: true,
93
+          duration: 0,
98 94
         })
99
-        .catch(() => loadInst.clear())
95
+
96
+        onLoad()
97
+          .then(() => {
98
+            loadInst.clear()
99
+          })
100
+          .catch(() => loadInst.clear())
101
+      }
100 102
     })
101 103
 
102 104
     const toDetail = (item) => {