|
@@ -1,56 +1,157 @@
|
1
|
|
-import React, { useState, useEffect } from 'react'
|
2
|
|
-import withLayout from '@/layout'
|
3
|
|
-import './index.scss'
|
4
|
|
-import { ScrollView, Image } from '@tarojs/components'
|
5
|
|
-import '@/assets/css/iconfont.css'
|
6
|
|
-import Taro from '@tarojs/taro'
|
|
1
|
+import React, { useState, useEffect } from "react";
|
|
2
|
+import withLayout from "@/layout";
|
|
3
|
+import "./index.scss";
|
|
4
|
+import { useSelector } from "react-redux";
|
|
5
|
+import { ScrollView, Image } from "@tarojs/components";
|
|
6
|
+import "@/assets/css/iconfont.css";
|
|
7
|
+import Taro from "@tarojs/taro";
|
|
8
|
+import { fetch } from "@/utils/request";
|
|
9
|
+import { queryPolicyTypeList, queryPolicyList } from "@/services/policy";
|
7
|
10
|
|
8
|
|
-export default withLayout((props) => {
|
|
11
|
+const EncyItem = (props) => {
|
|
12
|
+ const city = useSelector(state => state.city)
|
|
13
|
+
|
|
14
|
+ const { item, index } = props;
|
|
15
|
+ const [list, setList] = useState([]);
|
|
16
|
+
|
|
17
|
+ useEffect(() => {
|
|
18
|
+ if (item.policyTypeId) {
|
|
19
|
+ getPolicyListByType(item.policyTypeId);
|
|
20
|
+ }
|
|
21
|
+ }, [item,city]);
|
9
|
22
|
|
|
23
|
+ const getPolicyListByType = policyTypeId => {
|
|
24
|
+ queryPolicyList({ pageSize: 100,policyTypeId,cityId: city?.curCity?.id }).then((res) => {
|
|
25
|
+ setList(res.records);
|
|
26
|
+ });
|
|
27
|
+ };
|
|
28
|
+
|
|
29
|
+ return (
|
|
30
|
+ <view key={`ListItem-${index}`}>
|
|
31
|
+ <view className="Title">
|
|
32
|
+ <text>{index + 1 > 9 ? index + 1 : `0${index + 1}`}</text>
|
|
33
|
+ <text>/{item.policyTypeName}</text>
|
|
34
|
+ {/* <Image mode="heightFix" src={item.icon}></Image> */}
|
|
35
|
+ </view>
|
|
36
|
+ <view className="List">
|
|
37
|
+ {list.map((subItem, subIndex) => (
|
|
38
|
+ <view
|
|
39
|
+ key={`subItem-${subIndex}`}
|
|
40
|
+ onClick={() => {
|
|
41
|
+ Taro.navigateTo({
|
|
42
|
+ url: `/pages/index/encyDetail/index?id=${subItem.policyId}`,
|
|
43
|
+ });
|
|
44
|
+ }}
|
|
45
|
+ >
|
|
46
|
+ <text className="Name">{subItem.title}</text>
|
|
47
|
+ {subItem.isHot === 1 && (
|
|
48
|
+ <text className="Tips" style={{ background: "#FF0000" }}>
|
|
49
|
+ {/* {subItem.tips} */}
|
|
50
|
+ HOT
|
|
51
|
+ </text>
|
|
52
|
+ )}
|
|
53
|
+ {/* {subItem.icon !== "" && (
|
|
54
|
+ <Image mode="heightFix" src={subItem.icon}></Image>
|
|
55
|
+ )} */}
|
|
56
|
+ </view>
|
|
57
|
+ ))}
|
|
58
|
+ </view>
|
|
59
|
+ </view>
|
|
60
|
+ );
|
|
61
|
+};
|
|
62
|
+
|
|
63
|
+export default withLayout((props) => {
|
10
|
64
|
// const [PageProps] = useState(props)
|
11
|
|
- const [PageList] = useState([
|
12
|
|
- {name: '准备买房', icon: require('@/assets/ency-icon3.png'), list: [{name: '买房资质查询', id: 1, tips: 'HOT', tipsColor: '#FF0000', icon: ''}, {name: '22个房产名词', id: 2, tips: 'NEW', tipsColor: '#30CFCF', icon: ''}]},
|
13
|
|
- {name: '看房选房', icon: require('@/assets/ency-icon4.png'), list: [{name: '热门楼盘地图', id: 3, tips: '', icon: ''}, {name: '选户型攻略', id: 4, tips: '实用', tipsColor: '#62D547', icon: ''}, {name: '期房新房怎么选', id: 5, tips: '', icon: ''}]},
|
14
|
|
- {name: '认筹签约', icon: require('@/assets/ency-icon5.png'), list: [{name: '买房签约流程', id: 6, tips: '哇!', tipsColor: '#FF396C', icon: require('@/assets/ency-icon2.png')}, {name: '契税征收标准', id: 7, tips: '', icon: ''}, {name: '公司名义买房', id: 8, tips: '', icon: ''}]},
|
15
|
|
- {name: '贷款买房', icon: require('@/assets/ency-icon6.png'), list: [{name: '新房贷政策', id: 9, tips: '', icon: ''}, {name: '贷款查征信', id: 10, tips: '', icon: require('../../../assets/ency-icon1.png')}]}
|
16
|
|
- ])
|
17
|
65
|
|
|
66
|
+ const [PageList, setPageList] = useState([
|
|
67
|
+ {
|
|
68
|
+ name: "准备买房",
|
|
69
|
+ icon: require("@/assets/ency-icon3.png"),
|
|
70
|
+ list: [
|
|
71
|
+ {
|
|
72
|
+ name: "买房资质查询",
|
|
73
|
+ id: 1,
|
|
74
|
+ tips: "HOT",
|
|
75
|
+ tipsColor: "#FF0000",
|
|
76
|
+ icon: "",
|
|
77
|
+ },
|
|
78
|
+ {
|
|
79
|
+ name: "22个房产名词",
|
|
80
|
+ id: 2,
|
|
81
|
+ tips: "NEW",
|
|
82
|
+ tipsColor: "#30CFCF",
|
|
83
|
+ icon: "",
|
|
84
|
+ },
|
|
85
|
+ ],
|
|
86
|
+ },
|
|
87
|
+ {
|
|
88
|
+ name: "看房选房",
|
|
89
|
+ icon: require("@/assets/ency-icon4.png"),
|
|
90
|
+ list: [
|
|
91
|
+ { name: "热门楼盘地图", id: 3, tips: "", icon: "" },
|
|
92
|
+ {
|
|
93
|
+ name: "选户型攻略",
|
|
94
|
+ id: 4,
|
|
95
|
+ tips: "实用",
|
|
96
|
+ tipsColor: "#62D547",
|
|
97
|
+ icon: "",
|
|
98
|
+ },
|
|
99
|
+ { name: "期房新房怎么选", id: 5, tips: "", icon: "" },
|
|
100
|
+ ],
|
|
101
|
+ },
|
|
102
|
+ {
|
|
103
|
+ name: "认筹签约",
|
|
104
|
+ icon: require("@/assets/ency-icon5.png"),
|
|
105
|
+ list: [
|
|
106
|
+ {
|
|
107
|
+ name: "买房签约流程",
|
|
108
|
+ id: 6,
|
|
109
|
+ tips: "哇!",
|
|
110
|
+ tipsColor: "#FF396C",
|
|
111
|
+ icon: require("@/assets/ency-icon2.png"),
|
|
112
|
+ },
|
|
113
|
+ { name: "契税征收标准", id: 7, tips: "", icon: "" },
|
|
114
|
+ { name: "公司名义买房", id: 8, tips: "", icon: "" },
|
|
115
|
+ ],
|
|
116
|
+ },
|
|
117
|
+ {
|
|
118
|
+ name: "贷款买房",
|
|
119
|
+ icon: require("@/assets/ency-icon6.png"),
|
|
120
|
+ list: [
|
|
121
|
+ { name: "新房贷政策", id: 9, tips: "", icon: "" },
|
|
122
|
+ {
|
|
123
|
+ name: "贷款查征信",
|
|
124
|
+ id: 10,
|
|
125
|
+ tips: "",
|
|
126
|
+ icon: require("../../../assets/ency-icon1.png"),
|
|
127
|
+ },
|
|
128
|
+ ],
|
|
129
|
+ },
|
|
130
|
+ ]);
|
|
131
|
+
|
|
132
|
+ const getPageList = () => {
|
|
133
|
+ queryPolicyTypeList({ pageSize: 100 }).then((res) => {
|
|
134
|
+ setPageList(res.records);
|
|
135
|
+ });
|
|
136
|
+ };
|
|
137
|
+ // GET /api/{plat}/taPolicyType
|
|
138
|
+
|
|
139
|
+ useEffect(() => {
|
|
140
|
+ getPageList();
|
|
141
|
+ }, []);
|
18
|
142
|
return (
|
19
|
|
- <view className='Page encyclopediasOfBuyHouse'>
|
20
|
|
-
|
21
|
|
- <ScrollView scroll-y={true} refresher-enabled={false} refresher-background='#fff'>
|
22
|
|
- <view className='PageContent'>
|
23
|
|
- {
|
24
|
|
- PageList.map((item, index) => (
|
25
|
|
- <view key={`ListItem-${index}`}>
|
26
|
|
- <view className='Title'>
|
27
|
|
- <text>{index + 1 > 9 ? index + 1 : `0${index + 1}`}</text>
|
28
|
|
- <text>/{item.name}</text>
|
29
|
|
- <Image mode='heightFix' src={item.icon}></Image>
|
30
|
|
- </view>
|
31
|
|
- <view className='List'>
|
32
|
|
- {
|
33
|
|
- item.list.map((subItem, subIndex) => (
|
34
|
|
- <view key={`subItem-${subIndex}`} onClick={() => { Taro.navigateTo({ url: `/pages/index/encyDetail/index?id=${subItem.id}` }) }}>
|
35
|
|
- <text className='Name'>{subItem.name}</text>
|
36
|
|
- {
|
37
|
|
- subItem.tips !== '' &&
|
38
|
|
- <text className='Tips' style={{background: subItem.tipsColor}}>{subItem.tips}</text>
|
39
|
|
- }
|
40
|
|
- {
|
41
|
|
- subItem.icon !== '' &&
|
42
|
|
- <Image mode='heightFix' src={subItem.icon}></Image>
|
43
|
|
- }
|
44
|
|
- </view>
|
45
|
|
- ))
|
46
|
|
- }
|
47
|
|
- </view>
|
48
|
|
- </view>
|
49
|
|
- ))
|
50
|
|
- }
|
|
143
|
+ <view className="Page encyclopediasOfBuyHouse">
|
|
144
|
+ <ScrollView
|
|
145
|
+ scroll-y={true}
|
|
146
|
+ refresher-enabled={false}
|
|
147
|
+ refresher-background="#fff"
|
|
148
|
+ >
|
|
149
|
+ <view className="PageContent">
|
|
150
|
+ {PageList.map((item, index) => (
|
|
151
|
+ <EncyItem item={item} key={index} index={index}></EncyItem>
|
|
152
|
+ ))}
|
51
|
153
|
</view>
|
52
|
154
|
</ScrollView>
|
53
|
|
-
|
54
|
155
|
</view>
|
55
|
|
- )
|
56
|
|
-})
|
|
156
|
+ );
|
|
157
|
+});
|