瀏覽代碼

帮我找房必选项

1002884655 3 年之前
父節點
當前提交
7ef85483c0

+ 2
- 2
project.config.json 查看文件

2
 	"miniprogramRoot": "dist/",
2
 	"miniprogramRoot": "dist/",
3
 	"projectname": "miniapp",
3
 	"projectname": "miniapp",
4
 	"description": "",
4
 	"description": "",
5
-	"appid": "wxc96058d57e77f373",
5
+	"appid": "wxe44244d1a5ea3364",
6
 	"setting": {
6
 	"setting": {
7
 		"urlCheck": false,
7
 		"urlCheck": false,
8
 		"es6": false,
8
 		"es6": false,
27
 			"outputPath": ""
27
 			"outputPath": ""
28
 		},
28
 		},
29
 		"useIsolateContext": true,
29
 		"useIsolateContext": true,
30
-		"useCompilerModule": true,
30
+		"useCompilerModule": false,
31
 		"userConfirmedUseCompilerModuleSwitch": false
31
 		"userConfirmedUseCompilerModuleSwitch": false
32
 	},
32
 	},
33
 	"compileType": "miniprogram",
33
 	"compileType": "miniprogram",

+ 28
- 13
src/pages/index/addedValueService/index.jsx 查看文件

4
 import { fetch } from '@/utils/request'
4
 import { fetch } from '@/utils/request'
5
 import { API_HELP_FIND_HOUSE_SUBMIT } from '@/constants/api'
5
 import { API_HELP_FIND_HOUSE_SUBMIT } from '@/constants/api'
6
 import { useSelector } from 'react-redux'
6
 import { useSelector } from 'react-redux'
7
+import Taro from '@tarojs/taro'
7
 import './index.scss'
8
 import './index.scss'
8
 import questions from './formData'
9
 import questions from './formData'
9
 import SubmitBuyHouseResult from '../helpToFindHouse/components/SubmitBuyHouseResult/index'
10
 import SubmitBuyHouseResult from '../helpToFindHouse/components/SubmitBuyHouseResult/index'
90
   }
91
   }
91
 
92
 
92
   const NextStep = () => {
93
   const NextStep = () => {
93
-    if (StepId < 4) {
94
-      setStepId(StepId + 1)
95
-    } else {
96
-      let Arr = [...FormData]
97
-      Arr.map((item) => {
98
-        if (item.type === 'checkboxs') {
99
-          item.options.map((subItem) => {
100
-            if (subItem.selected) {
101
-              item.result.push(subItem.name)
102
-            }
103
-          })
94
+    let Bool = true
95
+    let IndexArr = []
96
+    FormData.map((item, index) => {
97
+      if(index >= StepRange[0] && index < StepRange[1]) {
98
+        if(!!item.required && item.result === '') {
99
+          Bool = false
100
+          IndexArr.push(index)
104
         }
101
         }
105
-      })
106
-      SubmitForm(Arr)
102
+      }
103
+    })
104
+    if(Bool) {
105
+      if (StepId < 4) {
106
+        setStepId(StepId + 1)
107
+      } else {
108
+        let Arr = [...FormData]
109
+        Arr.map((item) => {
110
+          if (item.type === 'checkboxs') {
111
+            item.options.map((subItem) => {
112
+              if (subItem.selected) {
113
+                item.result.push(subItem.name)
114
+              }
115
+            })
116
+          }
117
+        })
118
+        SubmitForm(Arr)
119
+      }
120
+    } else {
121
+      Taro.showToast({title: `请选择${FormData[IndexArr[0]].question}`, icon: 'none'})
107
     }
122
     }
108
   }
123
   }
109
 
124
 

+ 6
- 2
src/pages/index/helpToFindHouse/components/BuyHouse/formData.js 查看文件

3
     question: '你的购房预算是多少?',
3
     question: '你的购房预算是多少?',
4
     key: 'budget',
4
     key: 'budget',
5
     type: 'range',
5
     type: 'range',
6
-    result: '300',
6
+    result: 300,
7
     resultId: null,
7
     resultId: null,
8
-    options: [100, 1000]
8
+    required: true,
9
+    options: [100, 2000]
9
   },
10
   },
10
   {
11
   {
11
     question: '你想购买的是新房还是二手房?',
12
     question: '你想购买的是新房还是二手房?',
13
     type: 'checkbox',
14
     type: 'checkbox',
14
     result: '',
15
     result: '',
15
     resultId: null,
16
     resultId: null,
17
+    required: true,
16
     options: [
18
     options: [
17
       { name: '新房', id: 1 },
19
       { name: '新房', id: 1 },
18
       { name: '二手房', id: 2 },
20
       { name: '二手房', id: 2 },
50
     type: 'checkbox',
52
     type: 'checkbox',
51
     result: '',
53
     result: '',
52
     resultId: null,
54
     resultId: null,
55
+    required: true,
53
     options: [
56
     options: [
54
       { name: '刚需', id: 1 },
57
       { name: '刚需', id: 1 },
55
       { name: '结婚', id: 2 },
58
       { name: '结婚', id: 2 },
138
     type: 'checkbox',
141
     type: 'checkbox',
139
     result: '',
142
     result: '',
140
     resultId: null,
143
     resultId: null,
144
+    required: true,
141
     options: [
145
     options: [
142
       { name: '5年以内', id: 1 },
146
       { name: '5年以内', id: 1 },
143
       { name: '10年以内', id: 2 },
147
       { name: '10年以内', id: 2 },

+ 19
- 4
src/pages/index/helpToFindHouse/components/BuyHouse/index.jsx 查看文件

1
 import { useState, useEffect } from 'react'
1
 import { useState, useEffect } from 'react'
2
 import '@/assets/css/iconfont.css'
2
 import '@/assets/css/iconfont.css'
3
 import { Image, Slider, Textarea } from '@tarojs/components'
3
 import { Image, Slider, Textarea } from '@tarojs/components'
4
+import Taro from '@tarojs/taro'
4
 import './index.scss'
5
 import './index.scss'
5
 import questions from './formData'
6
 import questions from './formData'
6
 
7
 
7
 export default function BuyHouse (props) {
8
 export default function BuyHouse (props) {
8
-  const { change = () => { }, toSubmit = () => { }, AreaInfo = {}, selectArea = () => {} } = props
9
+  const { change = () => { }, toSubmit = () => { }, AreaInfo = {}, selectArea = () => { } } = props
9
 
10
 
10
   const [FormData, setFormData] = useState(questions)
11
   const [FormData, setFormData] = useState(questions)
11
   const [StepId, setStepId] = useState(1)
12
   const [StepId, setStepId] = useState(1)
52
   }
53
   }
53
 
54
 
54
   const NextStep = () => {
55
   const NextStep = () => {
55
-    if (StepId < 4) {
56
-      setStepId(StepId + 1)
56
+    let Bool = true
57
+    let IndexArr = []
58
+    FormData.map((item, index) => {
59
+      if (index >= StepRange[0] && index < StepRange[1]) {
60
+        if (!!item.required && item.result === '') {
61
+          Bool = false
62
+          IndexArr.push(index)
63
+        }
64
+      }
65
+    })
66
+    if (Bool) {
67
+      if (StepId < 4) {
68
+        setStepId(StepId + 1)
69
+      } else {
70
+        toSubmit(FormData)
71
+      }
57
     } else {
72
     } else {
58
-      toSubmit(FormData)
73
+      Taro.showToast({ title: `请选择${FormData[IndexArr[0]].question}`, icon: 'none' })
59
     }
74
     }
60
   }
75
   }
61
 
76
 

+ 1
- 1
src/pages/index/helpToFindHouse/components/HousePurchasing/formData.js 查看文件

12
     type: 'range',
12
     type: 'range',
13
     result: '',
13
     result: '',
14
     resultId: null,
14
     resultId: null,
15
-    options: [100, 1000]
15
+    options: [100, 2000]
16
   },
16
   },
17
   {
17
   {
18
     question: '优先选择的房屋类型是?',
18
     question: '优先选择的房屋类型是?',

+ 18
- 3
src/pages/index/helpToFindHouse/components/HousePurchasing/index.jsx 查看文件

1
 import { useState, useEffect } from 'react'
1
 import { useState, useEffect } from 'react'
2
 import '@/assets/css/iconfont.css'
2
 import '@/assets/css/iconfont.css'
3
 import { Image, Slider, Textarea } from '@tarojs/components'
3
 import { Image, Slider, Textarea } from '@tarojs/components'
4
+import Taro from '@tarojs/taro'
4
 import './index.scss'
5
 import './index.scss'
5
 import questions from './formData'
6
 import questions from './formData'
6
 
7
 
47
   }
48
   }
48
 
49
 
49
   const NextStep = () => {
50
   const NextStep = () => {
50
-    if (StepId < 1) {
51
-      setStepId(StepId + 1)
51
+    let Bool = true
52
+    let IndexArr = []
53
+    FormData.map((item, index) => {
54
+      if(index >= StepRange[0] && index < StepRange[1]) {
55
+        if(!!item.required && item.result === '') {
56
+          Bool = false
57
+          IndexArr.push(index)
58
+        }
59
+      }
60
+    })
61
+    if(Bool) {
62
+      if (StepId < 4) {
63
+        setStepId(StepId + 1)
64
+      } else {
65
+        toSubmit(FormData)
66
+      }
52
     } else {
67
     } else {
53
-      toSubmit(FormData)
68
+      Taro.showToast({title: `请选择${FormData[IndexArr[0]].question}`, icon: 'none'})
54
     }
69
     }
55
   }
70
   }
56
 
71
 

+ 1
- 1
src/pages/index/helpToFindHouse/components/RentingHouse/formData.js 查看文件

5
     type: 'range',
5
     type: 'range',
6
     result: '',
6
     result: '',
7
     resultId: null,
7
     resultId: null,
8
-    options: [500, 4500]
8
+    options: [500, 20000]
9
   },
9
   },
10
   {
10
   {
11
     question: '你的租房偏好?',
11
     question: '你的租房偏好?',

+ 28
- 13
src/pages/index/helpToFindHouse/components/RentingHouse/index.jsx 查看文件

1
 import { useState, useEffect } from 'react'
1
 import { useState, useEffect } from 'react'
2
 import '@/assets/css/iconfont.css'
2
 import '@/assets/css/iconfont.css'
3
 import { Image, Slider, Textarea } from '@tarojs/components'
3
 import { Image, Slider, Textarea } from '@tarojs/components'
4
+import Taro from '@tarojs/taro'
4
 import './index.scss'
5
 import './index.scss'
5
 import questions from './formData'
6
 import questions from './formData'
6
 
7
 
57
   }
58
   }
58
 
59
 
59
   const NextStep = () => {
60
   const NextStep = () => {
60
-    if (StepId < 2) {
61
-      setStepId(StepId + 1)
62
-    } else {
63
-      let Arr = [...FormData]
64
-      Arr.map((item) => {
65
-        if (item.type === 'checkbox') {
66
-          item.options.map((subItem) => {
67
-            if (subItem.selected) {
68
-              item.result.push(subItem.name)
69
-            }
70
-          })
61
+    let Bool = true
62
+    let IndexArr = []
63
+    FormData.map((item, index) => {
64
+      if(index >= StepRange[0] && index < StepRange[1]) {
65
+        if(!!item.required && item.result === '') {
66
+          Bool = false
67
+          IndexArr.push(index)
71
         }
68
         }
72
-      })
73
-      toSubmit(Arr)
69
+      }
70
+    })
71
+    if(Bool) {
72
+      if (StepId < 2) {
73
+        setStepId(StepId + 1)
74
+      } else {
75
+        let Arr = [...FormData]
76
+        Arr.map((item) => {
77
+          if (item.type === 'checkbox') {
78
+            item.options.map((subItem) => {
79
+              if (subItem.selected) {
80
+                item.result.push(subItem.name)
81
+              }
82
+            })
83
+          }
84
+        })
85
+        toSubmit(Arr)
86
+      }
87
+    } else {
88
+      Taro.showToast({title: `请选择${FormData[IndexArr[0]].question}`, icon: 'none'})
74
     }
89
     }
75
   }
90
   }
76
 
91