张延森 4 年之前
父節點
當前提交
d01d3c4280

+ 23
- 16
src/main.js 查看文件

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
 const app = createApp(App)
14
 const app = createApp(App)
15
 app.use(store)
15
 app.use(store)
18
 
18
 
19
 app.component(Notify.Component.name, Notify.Component)
19
 app.component(Notify.Component.name, Notify.Component)
20
 app.component(Dialog.Component.name, Dialog.Component)
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 查看文件

43
 </template>
43
 </template>
44
 
44
 
45
 <script>
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
 export default {
53
 export default {
54
-  name: "login",
54
+  name: 'login',
55
   components: {
55
   components: {
56
     [Form.name]: Form,
56
     [Form.name]: Form,
57
     [Button.name]: Button,
57
     [Button.name]: Button,
73
     const state = reactive({})
73
     const state = reactive({})
74
     const router = useRouter()
74
     const router = useRouter()
75
     const onSubmit = (values) => {
75
     const onSubmit = (values) => {
76
-      console.log(values.loginName && values.password, "submit", values)
76
+      console.log(values.loginName && values.password, 'submit', values)
77
       if (values.loginName && values.password) {
77
       if (values.loginName && values.password) {
78
         request({
78
         request({
79
-          url: "/login",
79
+          url: '/login',
80
           params: values,
80
           params: values,
81
         }).then((res) => {
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 查看文件

5
     </x-field>
5
     </x-field>
6
 
6
 
7
     <x-field label="朝向">
7
     <x-field label="朝向">
8
-      {{ getDictLabel(roomInfo.aspect, "aspect") }}
8
+      {{ getDictLabel(roomInfo.aspect, 'aspect') }}
9
     </x-field>
9
     </x-field>
10
 
10
 
11
     <x-field label="装修">
11
     <x-field label="装修">
12
-      {{ getDictLabel(roomInfo.decoration, "decoration") }}
12
+      {{ getDictLabel(roomInfo.decoration, 'decoration') }}
13
     </x-field>
13
     </x-field>
14
 
14
 
15
     <x-field label="房屋用途">
15
     <x-field label="房屋用途">
16
-      {{ getDictLabel(roomInfo.purpose, "purpose") }}
16
+      {{ getDictLabel(roomInfo.purpose, 'purpose') }}
17
     </x-field>
17
     </x-field>
18
 
18
 
19
     <x-field label="建筑类型">
19
     <x-field label="建筑类型">
20
-      {{ getDictLabel(roomInfo.buildType, "build_type") }}
20
+      {{ getDictLabel(roomInfo.buildType, 'build_type') }}
21
     </x-field>
21
     </x-field>
22
 
22
 
23
     <x-field label="配备电梯">
23
     <x-field label="配备电梯">
24
-      {{ getDictLabel(roomInfo.elevator, "elevator") }}
24
+      {{ getDictLabel(roomInfo.elevator, 'elevator') }}
25
     </x-field>
25
     </x-field>
26
 
26
 
27
     <x-field label="抵押信息">
27
     <x-field label="抵押信息">
28
-      {{ getDictLabel(roomInfo.isMortgage, "mortgage") || "无" }}
28
+      {{ getDictLabel(roomInfo.isMortgage, 'mortgage') || '无' }}
29
     </x-field>
29
     </x-field>
30
 
30
 
31
     <x-field label="税费">
31
     <x-field label="税费">
32
-      {{ getDictLabel(roomInfo.buildTime, "build_time") || "未知" }}
32
+      {{ getDictLabel(roomInfo.buildTime, 'build_time') || '未知' }}
33
     </x-field>
33
     </x-field>
34
 
34
 
35
     <x-field label="来源">
35
     <x-field label="来源">
36
-      {{ getDictLabel(roomInfo.sourceFrom, "sourceFrom") }}
36
+      {{ getDictLabel(roomInfo.sourceFrom, 'sourceFrom') }}
37
     </x-field>
37
     </x-field>
38
   </div>
38
   </div>
39
 </template>
39
 </template>
40
 
40
 
41
 <script>
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
 export default {
45
 export default {
46
   props: {
46
   props: {
50
     },
50
     },
51
   },
51
   },
52
   setup(props) {
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
     if (!dicts.aspect || !dicts.aspect.length) {
63
     if (!dicts.aspect || !dicts.aspect.length) {
57
-      getDict("aspect")
64
+      getDict('aspect')
58
     }
65
     }
59
 
66
 
60
     // 装修
67
     // 装修
61
     if (!dicts.decoration || !dicts.decoration.length) {
68
     if (!dicts.decoration || !dicts.decoration.length) {
62
-      getDict("decoration")
69
+      getDict('decoration')
63
     }
70
     }
64
 
71
 
65
     // 房屋用途
72
     // 房屋用途
66
     if (!dicts.purpose || !dicts.purpose.length) {
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
     if (!dicts.elevator || !dicts.elevator.length) {
83
     if (!dicts.elevator || !dicts.elevator.length) {
77
-      getDict("elevator")
84
+      getDict('elevator')
78
     }
85
     }
79
 
86
 
80
     // 抵押信息
87
     // 抵押信息
81
     if (!dicts.mortgage || !dicts.mortgage.length) {
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
     if (!dicts.sourceFrom || !dicts.sourceFrom.length) {
98
     if (!dicts.sourceFrom || !dicts.sourceFrom.length) {
92
-      getDict("sourceFrom")
99
+      getDict('sourceFrom')
93
     }
100
     }
94
 
101
 
95
     const roomType = computed(() => {
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 查看文件

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

+ 21
- 18
src/view/secondhand/detail/index.vue 查看文件

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

+ 13
- 11
src/view/secondhand/index.vue 查看文件

85
     }
85
     }
86
 
86
 
87
     onMounted(() => {
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
     const toDetail = (item) => {
104
     const toDetail = (item) => {