|
@@ -2,7 +2,7 @@ import Taro, { Component } from '@tarojs/taro';
|
2
|
2
|
import ListView from '@components/ListView'
|
3
|
3
|
import { connect } from '@tarojs/redux'
|
4
|
4
|
import './index.scss'
|
5
|
|
-// import { getConsulantVisitRecord} from '@services/person'
|
|
5
|
+import { getSharePersonList } from '@services/person'
|
6
|
6
|
import { savePoint, updatePoint } from '@services/common'
|
7
|
7
|
import dayjs from 'dayjs';
|
8
|
8
|
|
|
@@ -41,61 +41,126 @@ export default class Person extends Component {
|
41
|
41
|
}
|
42
|
42
|
|
43
|
43
|
componentDidShow() {
|
44
|
|
- // Taro.showLoading()
|
45
|
|
- // this.loadList(1)
|
46
|
|
- }
|
47
|
|
- // loadList(pageNumber) {
|
48
|
|
- // console.log(this.props, "this.props")
|
49
|
|
- // const { userInfo: { person } } = this.props
|
50
|
|
-
|
51
|
|
- // let payload
|
52
|
|
- // if(person.userId){
|
53
|
|
- // payload = {
|
54
|
|
- // userId: person.userId,
|
55
|
|
- // pageNumber,
|
56
|
|
- // pageSize: 5
|
57
|
|
- // }
|
58
|
|
- // }else{
|
59
|
|
- // payload = {
|
60
|
|
- // userId: Taro.getStorageSync('userId'),
|
61
|
|
- // pageNumber,
|
62
|
|
- // pageSize: 5
|
63
|
|
- // }
|
64
|
|
- // }
|
65
|
|
- // getConsulantVisitRecord(payload).then(res => {
|
66
|
|
-
|
67
|
|
- // const { records, list, total, current, pages } = res || {}
|
68
|
|
- // const _list = records || list || []
|
69
|
|
- // const newList = current <= 1 ? _list : this.state.recordList.concat(_list)
|
70
|
|
- // this.setState({
|
71
|
|
- // recordList: newList,
|
72
|
|
- // isEmpty: total == 0 || !res,
|
73
|
|
- // hasMore: current < pages,
|
74
|
|
- // pageIndex: current >= pages ? pages : current
|
75
|
|
- // })
|
76
|
|
- // Taro.hideLoading()
|
77
|
|
- // })
|
78
|
|
- // }
|
79
|
|
- // onScrollToLower = async (fn) => {
|
80
|
|
- // const { pageIndex } = this.state;
|
81
|
|
- // this.loadList(pageIndex + 1)
|
82
|
|
- // fn && fn();
|
83
|
|
- // }
|
84
|
|
- // onPullDownRefresh = (rest) => {
|
85
|
|
- // // debugger
|
86
|
|
- // if (this.refreshing) return
|
87
|
|
- // this.refreshing = true
|
88
|
|
- // this.loadList(1)
|
89
|
|
- // rest && rest()
|
90
|
|
- // this.refreshing = false
|
91
|
|
- // }
|
92
|
|
-
|
93
|
|
- handleItemClick() {
|
|
44
|
+ Taro.showLoading()
|
|
45
|
+ this.loadList(1)
|
|
46
|
+ }
|
|
47
|
+ loadList(pageNumber) {
|
|
48
|
+ console.log(this.props, "this.props")
|
|
49
|
+ const { userInfo: { person } } = this.props
|
|
50
|
+
|
|
51
|
+ let payload
|
|
52
|
+ if (person.userId) {
|
|
53
|
+ payload = {
|
|
54
|
+ userId: person.userId,
|
|
55
|
+ pageNumber,
|
|
56
|
+ pageSize: 5
|
|
57
|
+ }
|
|
58
|
+ } else {
|
|
59
|
+ payload = {
|
|
60
|
+ userId: Taro.getStorageSync('userId'),
|
|
61
|
+ pageNumber,
|
|
62
|
+ pageSize: 5
|
|
63
|
+ }
|
|
64
|
+ }
|
|
65
|
+ getSharePersonList(payload).then(res => {
|
|
66
|
+
|
|
67
|
+ const { records, list, total, current, pages } = res || {}
|
|
68
|
+ const _list = records || list || []
|
|
69
|
+ const newList = current <= 1 ? _list : this.state.recordList.concat(_list)
|
|
70
|
+
|
|
71
|
+ this.setState({
|
|
72
|
+ recordList: newList,
|
|
73
|
+ isEmpty: total == 0 || !res,
|
|
74
|
+ hasMore: current < pages,
|
|
75
|
+ pageIndex: current >= pages ? pages : current
|
|
76
|
+ })
|
|
77
|
+ Taro.hideLoading()
|
|
78
|
+ })
|
|
79
|
+ }
|
|
80
|
+ onScrollToLower = async (fn) => {
|
|
81
|
+ const { pageIndex } = this.state;
|
|
82
|
+ this.loadList(pageIndex + 1)
|
|
83
|
+ fn && fn();
|
|
84
|
+ }
|
|
85
|
+ onPullDownRefresh = (rest) => {
|
|
86
|
+ // debugger
|
|
87
|
+ if (this.refreshing) return
|
|
88
|
+ this.refreshing = true
|
|
89
|
+ this.loadList(1)
|
|
90
|
+ rest && rest()
|
|
91
|
+ this.refreshing = false
|
|
92
|
+ }
|
|
93
|
+
|
|
94
|
+ handleItemClick(targetId) {
|
94
|
95
|
Taro.navigateTo({
|
95
|
|
- url: `/pages/person/myShare/accessRecord`
|
|
96
|
+ url: `/pages/person/myShare/accessRecord?targetId=` + targetId
|
96
|
97
|
})
|
97
|
98
|
}
|
98
|
99
|
|
|
100
|
+
|
|
101
|
+ renderBuilding(item) {
|
|
102
|
+ return (
|
|
103
|
+ <View className="share-item" onClick={this.handleItemClick.bind(this, item.targetId)}>
|
|
104
|
+ <Image className="img" src={item.drainageImg}></Image>
|
|
105
|
+ <View className="name">{item.buildingName}</View>
|
|
106
|
+ <View className="price"> {item.price ? item.price : ''} </View>
|
|
107
|
+ <View className="num"> {item.buildingNum?item.buildingNum:'0'}人查看了分享 </View>
|
|
108
|
+ <View className="address"> {item.address} </View>
|
|
109
|
+ </View>
|
|
110
|
+ )
|
|
111
|
+ }
|
|
112
|
+
|
|
113
|
+ renderH5(item) {
|
|
114
|
+ return (
|
|
115
|
+ <View className="share-item" onClick={this.handleItemClick.bind(this, item.targetId)}>
|
|
116
|
+ <Image className="img" src={item.drainageImg}></Image>
|
|
117
|
+ <View className="name">{item.drainageName}</View>
|
|
118
|
+ <View className="num"> {item.drainageShareNum?item.drainageShareNum:'0'}人查看了分享 </View>
|
|
119
|
+ </View>
|
|
120
|
+ )
|
|
121
|
+ }
|
|
122
|
+
|
|
123
|
+ renderGroup(item) {
|
|
124
|
+ return (
|
|
125
|
+ <View className="share-item" onClick={this.handleItemClick.bind(this, item.targetId)}>
|
|
126
|
+ <Image className="img" src={item.groupActivityImg}></Image>
|
|
127
|
+ <View className="name">{item.groupActivityName}</View>
|
|
128
|
+ <View className="num"> {item.groupActivityShareNum?item.groupActivityShareNum:'0'}人查看了分享 </View>
|
|
129
|
+ </View>
|
|
130
|
+ )
|
|
131
|
+ }
|
|
132
|
+
|
|
133
|
+ renderHelp(item) {
|
|
134
|
+ return (
|
|
135
|
+ <View className="share-item" onClick={this.handleItemClick.bind(this, item.targetId)}>
|
|
136
|
+ <Image className="img" src={item.helpActivityImg}></Image>
|
|
137
|
+ <View className="name">{item.helpActivityName}</View>
|
|
138
|
+ <View className="num"> {item.helpActivityShareNum?item.helpActivityShareNum:'0'}人查看了分享 </View>
|
|
139
|
+ </View>
|
|
140
|
+ )
|
|
141
|
+ }
|
|
142
|
+
|
|
143
|
+ renderNews(item) {
|
|
144
|
+ return (
|
|
145
|
+ <View className="share-item" onClick={this.handleItemClick.bind(this, item.targetId)}>
|
|
146
|
+ <Image className="img" src={item.newsImg}></Image>
|
|
147
|
+ <View className="name">{item.newsName}</View>
|
|
148
|
+ <View className="num"> {item.newsNum?item.newsNum:'0'}人查看了分享 </View>
|
|
149
|
+ </View>
|
|
150
|
+ )
|
|
151
|
+ }
|
|
152
|
+
|
|
153
|
+ renderActivity(item) {
|
|
154
|
+ return (
|
|
155
|
+ <View className="share-item" onClick={this.handleItemClick.bind(this, item.targetId)}>
|
|
156
|
+ <Image className="img" src={item.activityImg}></Image>
|
|
157
|
+ <View className="name">{item.activityName}</View>
|
|
158
|
+ <View className="num"> {item.activityShareNum?item.activityShareNum:'0'}人查看了分享 </View>
|
|
159
|
+ </View>
|
|
160
|
+ )
|
|
161
|
+ }
|
|
162
|
+
|
|
163
|
+
|
99
|
164
|
render() {
|
100
|
165
|
const { isEmpty, hasMore, recordList } = this.state
|
101
|
166
|
return (
|
|
@@ -108,17 +173,19 @@ export default class Person extends Component {
|
108
|
173
|
onPullDownRefresh={fn => this.onPullDownRefresh(fn)}
|
109
|
174
|
onScrollToLower={fn => this.onScrollToLower(fn)}
|
110
|
175
|
>
|
111
|
|
- <View className='share-page'>
|
112
|
|
- <View className="share-item" onClick={this.handleItemClick}>
|
113
|
|
- <Image className="img" src={require('@assets/default-avatar.png')}></Image>
|
114
|
|
- <View className="name">鱼嘴润府</View>
|
115
|
|
- <View className="price"> 均价35000元/m² </View>
|
116
|
|
- <View className="num"> 5人查看了分享 </View>
|
117
|
|
- <View className="address"> 南京市锦创广场水西门大街2号 </View>
|
118
|
|
- </View>
|
119
|
|
- </View>
|
|
176
|
+ {
|
|
177
|
+ recordList.map(item => (
|
|
178
|
+ <View taroKey={String(item.targetId)} className='share-page'>
|
|
179
|
+ {item.shareType == 'building' && this.renderBuilding(item)}
|
|
180
|
+ {item.shareType == 'h5' && this.renderH5(item)}
|
|
181
|
+ {item.shareType == 'group' && this.renderGroup(item)}
|
|
182
|
+ {item.shareType == 'help' && this.renderHelp(item)}
|
|
183
|
+ {item.shareType == 'news' && this.renderNews(item)}
|
|
184
|
+ {item.shareType == 'activity' && this.renderActivity(item)}
|
|
185
|
+ </View>
|
|
186
|
+ ))
|
|
187
|
+ }
|
120
|
188
|
</ListView>
|
121
|
|
-
|
122
|
189
|
)
|
123
|
190
|
}
|
124
|
191
|
}
|