|
@@ -5,29 +5,17 @@ import Banner from './banner'
|
5
|
5
|
import Newsbanner from './newsbanner'
|
6
|
6
|
import Activity from './activity'
|
7
|
7
|
import BannerTwo from './swiper'
|
8
|
|
-// import ActivityItem from '../activity/item'
|
9
|
8
|
import ready from '@/utils/ready'
|
10
|
|
-import { getLocationCity } from '@/services/map'
|
11
|
|
-import { queryBanners, savePoint, updatePoint, queryExtContents, queryIndexIcons } from '@/services/common'
|
|
9
|
+import { savePoint, updatePoint, queryExtContents, queryIndexIcons } from '@/services/common'
|
12
|
10
|
import { queryHelpGroup } from '@/services/news'
|
13
|
11
|
import { getIndexShare } from '@/services/user'
|
14
|
|
-// import { queryActivityList } from '@/services/activity'
|
15
|
12
|
import { dispatchCitySelected } from '@/actions/city'
|
16
|
|
-import { ROLE_CODE, DECREASE_UNREADNUM } from '@/constants/user'
|
17
|
13
|
import { SET_SCREEN_SHOWED } from '@/constants/project'
|
18
|
14
|
import { getStore, connect } from '@tarojs/redux'
|
19
|
15
|
import * as actions from '@/actions/project'
|
20
|
16
|
import { transferImage } from '@/utils/tools'
|
21
|
17
|
import Notice from '@/components/Notice'
|
22
|
|
-import { menus } from './icons'
|
23
|
|
-import Menus from '@/components/indexMenus'
|
24
|
|
-
|
25
|
|
-const bgImg = "https://njcj.oss-cn-shanghai.aliyuncs.com/miniapp/upload/images/1578724562550-background.png"
|
26
|
|
-// import { getIndexPreloadData } from '@/utils/preload'
|
27
|
|
-// import Authorize from '@/components/authorize'
|
28
|
|
-// import * as noticeType from '@/constants/common.js'
|
29
|
|
-
|
30
|
|
-// const { miniProgram: { appId } } = wx.getAccountInfoSync();
|
|
18
|
+import NavIcons from './NavIcons'
|
31
|
19
|
|
32
|
20
|
@connect(
|
33
|
21
|
state => ({ ...state.project, ...state.city, ...state.user, system: state.system }),
|
|
@@ -57,7 +45,7 @@ export default class Index extends Component {
|
57
|
45
|
propagandaBanner: [],
|
58
|
46
|
newsShow: false,
|
59
|
47
|
city: null,
|
60
|
|
- menusList: [],
|
|
48
|
+ iconList: [],
|
61
|
49
|
}
|
62
|
50
|
|
63
|
51
|
componentWillMount() {
|
|
@@ -87,58 +75,9 @@ export default class Index extends Component {
|
87
|
75
|
}
|
88
|
76
|
|
89
|
77
|
getIndexIcons() {
|
90
|
|
-
|
91
|
78
|
queryIndexIcons().then(res => {
|
92
|
|
- if (res.length) {
|
93
|
|
- const Arr = [];
|
94
|
|
-
|
95
|
|
- res.forEach(item => {
|
96
|
|
- menus.forEach(menu => {
|
97
|
|
- if (menu.iconCode == item.iconCode) {
|
98
|
|
- Arr.push(menu);
|
99
|
|
- }
|
100
|
|
- })
|
101
|
|
- })
|
102
|
|
- const { userInfo: { person: { personType } } } = this.props
|
103
|
|
- this.setState({
|
104
|
|
- menusList: personType == ROLE_CODE['CONSULTANT'] ? Arr.filter(item => item.iconCode != 'refercustomers') : Arr
|
105
|
|
- })
|
106
|
|
- } else {
|
107
|
|
- const iconList = [
|
108
|
|
- {
|
109
|
|
- iconCode: 'integralMall',
|
110
|
|
- iconName: '赚积分',
|
111
|
|
- iconUrl: 'https://njcj.oss-cn-shanghai.aliyuncs.com/miniapp/upload/images/1580811839725-mall-icon.png'
|
112
|
|
- },
|
113
|
|
- {
|
114
|
|
- iconCode: 'refercustomers',
|
115
|
|
- iconName: '推荐客户',
|
116
|
|
- iconUrl: 'https://njcj.oss-cn-shanghai.aliyuncs.com/miniapp/upload/images/1580811691300-recommend-icon.png',
|
117
|
|
- },
|
118
|
|
- {
|
119
|
|
- iconCode: 'buyingEncyclopedia',
|
120
|
|
- iconName: '购房须知',
|
121
|
|
- iconUrl: 'https://njcj.oss-cn-shanghai.aliyuncs.com/miniapp/upload/images/1580811865979-encyclopedia-icon.png'
|
122
|
|
- },
|
123
|
|
- {
|
124
|
|
- iconCode: 'findRoom',
|
125
|
|
- iconName: '选好房',
|
126
|
|
- iconUrl: 'https://njcj.oss-cn-shanghai.aliyuncs.com/miniapp/upload/images/1580811880140-map-icon.png',
|
127
|
|
-
|
128
|
|
- },
|
129
|
|
- ]
|
130
|
|
- const newArr = [];
|
131
|
|
- iconList.forEach(item => {
|
132
|
|
- menus.forEach(menu => {
|
133
|
|
- if (menu.iconCode == item.iconCode) {
|
134
|
|
- newArr.push(menu);
|
135
|
|
- }
|
136
|
|
- })
|
137
|
|
- })
|
138
|
|
- const { userInfo: { person: { personType } } } = this.props
|
139
|
|
- this.setState({
|
140
|
|
- menusList: personType == ROLE_CODE['CONSULTANT'] ? newArr.filter(item => item.iconCode != 'refercustomers') : newArr
|
141
|
|
- })
|
|
79
|
+ if (res && res.length) {
|
|
80
|
+ this.setState({ iconList: res })
|
142
|
81
|
}
|
143
|
82
|
})
|
144
|
83
|
}
|
|
@@ -179,57 +118,6 @@ export default class Index extends Component {
|
179
|
118
|
recordId && updatePoint(recordId)
|
180
|
119
|
}
|
181
|
120
|
|
182
|
|
- // getLocation() {
|
183
|
|
- // Taro.getLocation().then(location => {
|
184
|
|
- // Taro.setStorageSync('lat', location.latitude)
|
185
|
|
- // Taro.setStorageSync('lon', location.longitude)
|
186
|
|
-
|
187
|
|
- // const payload = { location: `${location.longitude},${location.latitude}` }
|
188
|
|
-
|
189
|
|
- // getLocationCity(payload).then(res => {
|
190
|
|
- // if (!res || !res.id) {
|
191
|
|
- // Taro.showToast({
|
192
|
|
- // title: '未查询到当前城市信息, 请手动选择',
|
193
|
|
- // icon: 'none',
|
194
|
|
- // duration: 3000,
|
195
|
|
- // })
|
196
|
|
- // } else {
|
197
|
|
- // this.setState({ city: res })
|
198
|
|
- // this.loadData({ curCity: res })
|
199
|
|
- // this.updateCity(res)
|
200
|
|
- // }
|
201
|
|
- // }).catch(err => {
|
202
|
|
- // console.error(err)
|
203
|
|
-
|
204
|
|
- // Taro.showToast({
|
205
|
|
- // title: '服务错误, 请手动选择城市',
|
206
|
|
- // icon: 'none',
|
207
|
|
- // duration: 3000,
|
208
|
|
- // })
|
209
|
|
- // })
|
210
|
|
- // }).catch(err => {
|
211
|
|
- // if (err.errMsg === 'getLocation:fail auth deny') {
|
212
|
|
- // Taro.showModal({
|
213
|
|
- // content: '请同意授权您的定位功能',
|
214
|
|
- // showCancel: false,
|
215
|
|
- // duration: 3000,
|
216
|
|
- // })
|
217
|
|
- // } else {
|
218
|
|
- // Taro.showToast({
|
219
|
|
- // title: `定位失败, 请手动选择城市: ${err.errMsg}`,
|
220
|
|
- // icon: 'none',
|
221
|
|
- // duration: 3000,
|
222
|
|
- // })
|
223
|
|
- // }
|
224
|
|
-
|
225
|
|
- // console.error(err)
|
226
|
|
- // })
|
227
|
|
- // }
|
228
|
|
-
|
229
|
|
- // updateCity(payload) {
|
230
|
|
- // this.props.dispatchCitySelected(payload)
|
231
|
|
- // }
|
232
|
|
-
|
233
|
121
|
loadData(props = {}) {
|
234
|
122
|
this.loadHelpGroupList(props)
|
235
|
123
|
this.loadList(props)
|
|
@@ -606,10 +494,9 @@ export default class Index extends Component {
|
606
|
494
|
})
|
607
|
495
|
}
|
608
|
496
|
render() {
|
609
|
|
- const { curCity } = this.props
|
610
|
|
- const { achieve, helpGroupList, propagandaBanner, newsShow, menusList } = this.state
|
611
|
|
- const { userInfo: { person: { personType, phone } } } = this.props
|
612
|
|
- const { unReadNum, userInfo: { person } } = this.props
|
|
497
|
+ const { achieve, helpGroupList, propagandaBanner, newsShow, iconList } = this.state
|
|
498
|
+ const { curCity, unReadNum, userInfo: { person } } = this.props
|
|
499
|
+
|
613
|
500
|
return (
|
614
|
501
|
<Block>
|
615
|
502
|
{this.state.loaded && (
|
|
@@ -653,7 +540,7 @@ export default class Index extends Component {
|
653
|
540
|
</View>
|
654
|
541
|
</View>
|
655
|
542
|
{/* 菜单栏 */}
|
656
|
|
- <Menus menusList={menusList}></Menus>
|
|
543
|
+ <NavIcons city={curCity} person={person} iconList={iconList} ></NavIcons>
|
657
|
544
|
{/* <View style={propagandaBanner.length > 0 ? "border-bottom:20rpx solid #f5f5f5" : ''}> */}
|
658
|
545
|
<View style={(newsShow || propagandaBanner.length > 0) ? "border-bottom:20rpx solid #f5f5f5" : ''}>
|
659
|
546
|
{/* 展示位轮播图 */}
|