林凡 5 år sedan
förälder
incheckning
9c809d89d2

+ 4
- 4
config/dev.js Visa fil

@@ -5,12 +5,12 @@ module.exports = {
5 5
   defineConstants: {
6 6
     // HOST: '"http://47.101.36.130:8085"',//测试
7 7
     // WSS_HOST: '"wss://47.101.36.130:8085"',
8
-    HOST: '"https://dev.jinchengjiaye.com"',//测试
9
-    WSS_HOST: '"wss://dev.jinchengjiaye.com"',
8
+    // HOST: '"https://dev.jinchengjiaye.com"',//测试
9
+    // WSS_HOST: '"wss://dev.jinchengjiaye.com"',
10 10
     // HOST: '"https://lt.pawoma.cn"',
11 11
     // WSS_HOST: '"wss://lt.pawoma.cn"',
12
-    // HOST: '"http://127.0.0.1:8080"',
13
-    // WSS_HOST: '"ws://127.0.0.1:8080"',
12
+    HOST: '"http://192.168.2.51:8080"',
13
+    WSS_HOST: '"http://192.168.2.51:8080"',
14 14
     Version: 'V3.5.3'
15 15
   },
16 16
   weapp: {},

+ 2
- 1
src/constants/api.js Visa fil

@@ -184,6 +184,7 @@ export const API_ECHERTS_MONTH = resolvePath('customerStatisticMonthly')
184 184
 export const API_BUILDING_TYPE = resolvePath('getByBuildingIdSelectBuildingProjectType')
185 185
 export const API_CONSULTANT_VISIT_RECORD = resolvePath('visitRecord')
186 186
 export const API_MORE_ACTIVITY = resolvePath('visitRecord/activity')
187
-
187
+export const API_SHARE_LIST = resolvePath('shareRecords')
188
+export const API_SHARE_INFOLIST = resolvePath('sharePersonInfoList')
188 189
 // 消息模板
189 190
 export const API_TEMPLATE_TYPE = resolvePath('template/of/')

+ 29
- 21
src/pages/person/myShare/accessRecord.js Visa fil

@@ -2,8 +2,9 @@ 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 { getSharePersonInfoList } from '@services/person'
6 6
 import { savePoint, updatePoint } from '@services/common'
7
+import '@constants/common.js'
7 8
 import dayjs from 'dayjs';
8 9
 
9 10
 @connect(state => state.user)
@@ -22,7 +23,6 @@ export default class Person extends Component {
22 23
   }
23 24
 
24 25
   componentWillMount() {
25
-
26 26
     savePoint({
27 27
       event: 'list',
28 28
       eventType: 'activity',
@@ -40,32 +40,28 @@ export default class Person extends Component {
40 40
     recordId && updatePoint(recordId)
41 41
   }
42 42
   componentDidShow() {
43
+
43 44
     Taro.showLoading()
44 45
     this.loadList(1)
45 46
   }
46 47
   loadList(pageNumber) {
47 48
     console.log(this.props, "this.props")
49
+    const { targetId } = this.$router.params
48 50
     const { userInfo: { person } } = this.props
49
-
50
-    let payload
51
-    if(person.userId){
52
-      payload = {
53
-        userId: person.userId,
54
-        pageNumber,
55
-        pageSize: 5
56
-      }
57
-    }else{
58
-     payload = {
59
-       userId: Taro.getStorageSync('userId'),
60
-       pageNumber,
61
-       pageSize: 5
62
-     }
51
+    console.log(targetId)
52
+    const payload = {
53
+      userId: person.userId,
54
+      targetId: targetId,
55
+      pageNumber,
56
+      pageSize: 5
63 57
     }
64
-    getConsulantVisitRecord(payload).then(res => {
58
+
59
+    getSharePersonInfoList(payload).then(res => {
65 60
 
66 61
       const { records, list, total, current, pages } = res || {}
67 62
       const _list = records || list || []
68 63
       const newList = current <= 1 ? _list : this.state.recordList.concat(_list)
64
+      console.log(newList)
69 65
       this.setState({
70 66
         recordList: newList,
71 67
         isEmpty: total == 0 || !res,
@@ -90,9 +86,21 @@ export default class Person extends Component {
90 86
   }
91 87
   handleChatClick(item, e) {
92 88
     e.stopPropagation()
93
-    const { userInfo: { person: { personId, nickname, name } } } = this.props
94
-    Taro.navigateTo({
95
-      url: `/pages/im/index?sendId=${personId}&sendName=${encodeURIComponent(name || nickname)}&receiverId=${item.personId}&receiverName=${encodeURIComponent(item.name || item.nickname)}`
89
+    const { userInfo: { person: { personId, nickname, name }}} = this.props
90
+    const { userInfo: {miniApp:{tpls}}} = this.props
91
+    const tplId=(tpls.filter(x => x.tplType == TPL_NOTICE&&isSubscribe == true))[0].tplId
92
+    wx.requestSubscribeMessage({
93
+      tmplIds: [tplId],
94
+      success (res) {
95
+        Taro.navigateTo({
96
+          url: `/pages/im/index?sendId=${personId}&sendName=${encodeURIComponent(name || nickname)}&receiverId=${item.personId}&receiverName=${encodeURIComponent(item.name || item.nickname)}`
97
+        })
98
+      },
99
+      fail(res){
100
+        Taro.navigateTo({
101
+          url: `/pages/im/index?sendId=${personId}&sendName=${encodeURIComponent(name || nickname)}&receiverId=${item.personId}&receiverName=${encodeURIComponent(item.name || item.nickname)}`
102
+        })
103
+      }
96 104
     })
97 105
   }
98 106
 
@@ -113,7 +121,7 @@ export default class Person extends Component {
113 121
           <View className='access-page'>
114 122
             {
115 123
               recordList.map(item => (
116
-                <View className='item' key={item + 'more'}>
124
+                <View className='item' key={String(item + 'more')}>
117 125
                   {item.myCustomer == 1 && <View className="tag">我的客户</View>}
118 126
                   <Image className="touxiang" src={item.avatarurl || require('@assets/default-avatar.png')}></Image>
119 127
                   <View className="info-top">

+ 129
- 62
src/pages/person/myShare/index.js Visa fil

@@ -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
 }

+ 2
- 2
src/pages/person/myShare/index.scss Visa fil

@@ -91,10 +91,10 @@
91 91
           margin: 0 10px;
92 92
         }
93 93
         .goutong{
94
-          font-size: 38px;
94
+          font-size: 34px;
95 95
           color: $primary-color;
96 96
           border-bottom: 4px solid #EDCA73;
97
-          line-height: 28px;
97
+          line-height: 34px;
98 98
         }
99 99
   
100 100
       }

+ 16
- 2
src/pages/project/index.js Visa fil

@@ -20,6 +20,7 @@ import * as actions from '@actions/project'
20 20
 import { transferImage } from '@utils/tools'
21 21
 import Notice from '@components/Notice'
22 22
 import Authorize from '@components/authorize'
23
+import * as noticeType from '@constants/common.js'
23 24
 
24 25
 
25 26
 const { miniProgram: { appId } } = wx.getAccountInfoSync();
@@ -114,8 +115,21 @@ export default class Index extends Component {
114 115
   toChatList() {
115 116
     // const { dispatch } = getStore()
116 117
     // dispatch({ type: DECREASE_UNREADNUM })
117
-    Taro.navigateTo({
118
-      url: '/pages/im/list/index'
118
+    const { userInfo: {miniApp:{tpls}}} = this.props
119
+    const tplId=(tpls.filter(x => x.tplType == noticeType.TPL_NOTICE&&x.isSubscribe == true))[0].tplId
120
+    
121
+    wx.requestSubscribeMessage({
122
+      tmplIds: [tplId],
123
+      success (res) {
124
+        Taro.navigateTo({
125
+          url: '/pages/im/list/index'
126
+        })
127
+      },
128
+      fail(res){
129
+        Taro.navigateTo({
130
+          url: '/pages/im/list/index'
131
+        })
132
+      }
119 133
     })
120 134
   }
121 135
   componentDidShow() {

+ 13
- 2
src/services/person.js Visa fil

@@ -11,7 +11,9 @@ import {
11 11
   API_ECHERTS_MONTH,
12 12
   API_BUILDING_TYPE,
13 13
   API_CONSULTANT_VISIT_RECORD,
14
-  API_MORE_ACTIVITY
14
+  API_MORE_ACTIVITY,
15
+  API_SHARE_LIST,
16
+  API_SHARE_INFOLIST
15 17
 } from '@constants/api'
16 18
 
17 19
 
@@ -88,7 +90,16 @@ export const getConsulantVisitRecord = (payload) => fetch({ url: API_CONSULTANT_
88 90
  * @param {*} payload  
89 91
  */
90 92
 export const getMoreVisitRecord = (payload) => fetch({ url: API_MORE_ACTIVITY, payload })
91
-
93
+/**
94
+ * 获取分享记录
95
+ * @param {*} payload  
96
+ */
97
+export const getSharePersonList = (payload) => fetch({ url: API_SHARE_LIST, payload })
98
+/**
99
+ * 获取访问人列表
100
+ * @param {*} payload  
101
+ */
102
+export const getSharePersonInfoList = (payload) => fetch({ url: API_SHARE_INFOLIST, payload })
92 103
 
93 104
 
94 105