xujing 5 years ago
parent
commit
bc715352c9

+ 3
- 4
config/prod.js View File

@@ -5,10 +5,9 @@ module.exports = {
5 5
   defineConstants: {
6 6
     // HOST: '"http://192.168.0.218:8080"',
7 7
     // WSS_HOST: '"ws://192.168.0.218:8080"',
8
-    HOST: '"https://dev.jinchengjiaye.com"',
9
-    WSS_HOST: '"wss://dev.jinchengjiaye.com"',
10
-    // HOST: '"https://lt.pawoma.cn"',
11
-    // WSS_HOST: '"wss://lt.pawoma.cn"',
8
+    HOST: '"https://lt.pawoma.cn"',
9
+    WSS_HOST: '"wss://lt.pawoma.cn"',
10
+    Version:'V3.5.2.2_1210'
12 11
   },
13 12
   weapp: {},
14 13
   h5: {}

+ 25
- 25
src/app.js View File

@@ -189,37 +189,37 @@ class App extends Component {
189 189
     // 获取城市列表
190 190
     queryCityList().then(payload => {
191 191
       store.dispatch({ type: CITY_LIST, payload })
192
+    })
192 193
 
193
-      // 获取router参数
194
-      this.getRouterParams().then(router => {
195
-        Taro.setStorageSync('router', router)
196
-        console.info('router2:', router)
197
-        console.info('-----------')
198
-        const { query: payload } = router
194
+    // 获取router参数
195
+    this.getRouterParams().then(router => {
196
+      Taro.setStorageSync('router', router)
197
+      console.info('router2:', router)
198
+      console.info('-----------')
199
+      const { query: payload } = router
199 200
 
200
-        payload.path = router.path
201
-        payload.scene = router.scene
201
+      payload.path = router.path
202
+      payload.scene = router.scene
202 203
 
203
-        // login
204
-        login(payload, res => {
205
-          // 获取未读消息
206
-          const { person: { personId } } = res
207
-          queryUserInfo(personId).then(info => {
208
-            const { unReadNum } = info
209
-            store.dispatch({ type: ASSIGN_UNREADNUM, payload: { unReadNum } });
210
-            socket.createSocket({ id: personId });
211
-            socket.wss.onMessage(data => {
212
-              store.dispatch({ type: INCREASE_UNREADNUM })
213
-            })
204
+      // login
205
+      login(payload, res => {
206
+        // 获取未读消息
207
+        const { person: { personId } } = res
208
+        queryUserInfo(personId).then(info => {
209
+          const { unReadNum } = info
210
+          store.dispatch({ type: ASSIGN_UNREADNUM, payload: { unReadNum } });
211
+          socket.createSocket({ id: personId });
212
+          socket.wss.onMessage(data => {
213
+            store.dispatch({ type: INCREASE_UNREADNUM })
214 214
           })
215
+        })
215 216
 
216
-          const data = Object.assign({}, payload, {
217
-            event: 'start',
218
-            propertyName: '进入小程序',
219
-            data: ''
220
-          })
221
-          savePoint(data)
217
+        const data = Object.assign({}, payload, {
218
+          event: 'start',
219
+          propertyName: '进入小程序',
220
+          data: ''
222 221
         })
222
+        savePoint(data)
223 223
       })
224 224
     })
225 225
   }

+ 1
- 0
src/constants/api.js View File

@@ -37,6 +37,7 @@ export const API_CHAT_HISTORY = resolvePath('chat/history')
37 37
 export const API_CHAT_SEND = wss_host + '/wx/chat'
38 38
 export const API_CHAT_FRIENDS = resolvePath('chat/with')
39 39
 export const API_UPLOAD_IMAGE = resolvePath('image')
40
+export const API_CHAT_READED = resolvePath('chat/message')
40 41
 
41 42
 // card
42 43
 export const API_CARDS_LIST = resolvePath('cards')

+ 6
- 3
src/pages/im/index.js View File

@@ -6,7 +6,7 @@ import MsgItem from './msgItem'
6 6
 import FormIdCollector from '@components/formIdCollector'
7 7
 import BackHomeBtn from '@components/BackHomeBtn'
8 8
 
9
-import { queryChatHistory } from '@services/chat'
9
+import { queryChatHistory, setMessageReaded } from '@services/chat'
10 10
 import { uploadFiles, fetch } from '@utils/request'
11 11
 import { deepClone } from '@utils/tools'
12 12
 
@@ -193,14 +193,14 @@ export default class Chat extends Component {
193 193
 
194 194
       socket.sendNotice(payload, res => {
195 195
         console.log('发送成功')
196
-        this.appendData(payload)
196
+        // this.appendData(payload)
197 197
       })
198 198
 
199 199
       this.setState({
200 200
         nickname: chattingName,
201 201
         avatarurl: res.picture || res.avatar,
202 202
         personType: res.personType,
203
-      })
203
+      }, this.toBottom)
204 204
     })
205 205
   }
206 206
 
@@ -232,7 +232,10 @@ export default class Chat extends Component {
232 232
 
233 233
   handlerRecive = (data) => {
234 234
     // debugger
235
+
235 236
     this.appendData(data)
237
+    // 更新消息为已读
238
+    setMessageReaded(data.chatId)
236 239
   }
237 240
 
238 241
   loadList = (cb) => {

+ 3
- 2
src/pages/im/list/index.js View File

@@ -64,13 +64,14 @@ export default class Index extends Component {
64 64
     })
65 65
   }
66 66
 
67
-  handleItemClick = ({ unReadNum }) => {
67
+  handleItemClick = ({ unReadNum }) => person => {
68
+
68 69
     if (unReadNum > 0) {
69 70
       const { dispatch } = getStore()
70 71
       dispatch({ type: DECREASE_UNREADNUM, payload: unReadNum })
71 72
     }
72 73
 
73
-    return this.toChat.bind(this);
74
+    return this.toChat(person);
74 75
   }
75 76
 
76 77
   render() {

+ 7
- 5
src/pages/person/index.js View File

@@ -10,8 +10,10 @@ import * as actions from '@actions/user'
10 10
 import Authorize from '@components/authorize'
11 11
 import { transferImage } from '@utils/tools'
12 12
 import { menus } from './menus'
13
+export const version = Version
13 14
 
14 15
 @connect(({ user, city }) => ({ user, city }), { ...actions })
16
+
15 17
 export default class Person extends Component {
16 18
   config = {
17 19
     navigationBarTitleText: '我的'
@@ -24,8 +26,7 @@ export default class Person extends Component {
24 26
     consultant: false,//置业顾问
25 27
     tourist: false,//普通用户,
26 28
     menus: [],
27
-    roleName: '普通用户',
28
-
29
+    roleName: '普通用户'
29 30
   }
30 31
 
31 32
   componentDidShow () {
@@ -35,10 +36,10 @@ export default class Person extends Component {
35 36
   }
36 37
 
37 38
   loadUserInfo () {
38
-  
39
+
39 40
     queryUserInfo().then(user => {
40 41
       const [roleSetting, roleName] = this.getRoleName(user.personType)
41
-     
42
+
42 43
       this.setState({
43 44
         user,
44 45
         phone: user.phone,
@@ -92,7 +93,7 @@ export default class Person extends Component {
92 93
       }
93 94
     }
94 95
     else {
95
-      putRegisterConsultant().then(res => {    
96
+      putRegisterConsultant().then(res => {
96 97
 
97 98
         // if (res) {
98 99
           Taro.showToast({
@@ -234,6 +235,7 @@ export default class Person extends Component {
234 235
             })
235 236
           }
236 237
         </View>
238
+        <View style="text-align:center;line-height:50px;color:#cccccc;">{version}</View>
237 239
       </View>
238 240
     );
239 241
   }

+ 7
- 7
src/pages/person/index.scss View File

@@ -41,7 +41,7 @@
41 41
 
42 42
 .person {
43 43
   width: 100vw;
44
-  padding-bottom: 100px;
44
+  padding-bottom: 20px;
45 45
   position: relative;
46 46
   overflow: hidden;
47 47
 }
@@ -71,7 +71,7 @@
71 71
     }
72 72
   }
73 73
 
74
-  
74
+
75 75
   .left-icon{
76 76
     width:46px;
77 77
     height:42px;
@@ -112,7 +112,7 @@
112 112
       border:2px solid #ddd;
113 113
       border-radius: 12px;
114 114
     }
115
- 
115
+
116 116
   }
117 117
   .bg {
118 118
     width: 100%;
@@ -385,7 +385,7 @@
385 385
         border-bottom: 4px solid #EDCA73;
386 386
         line-height: 28px;
387 387
       }
388
-      
388
+
389 389
     }
390 390
     .right-icon{
391 391
       position: absolute;
@@ -433,7 +433,7 @@
433 433
       background-color: #fff;
434 434
       border-radius: 12px;
435 435
       padding: 20px 20px;
436
-      
436
+
437 437
       .scroll-con{
438 438
         height: 500px;
439 439
         width: 100%;
@@ -456,11 +456,11 @@
456 456
         }
457 457
 
458 458
       }
459
-    
459
+
460 460
     }
461 461
     .close{
462 462
       font-size: 48px;
463 463
       color: rgba(0,0,0,0.3);
464 464
       float: right;
465 465
     }
466
-}
466
+}

+ 16
- 4
src/pages/project/h5Page.js View File

@@ -108,6 +108,7 @@ export default class Index extends Component {
108 108
           console.log(res, "解析二维码返回值")
109 109
         })
110 110
       }
111
+
111 112
       console.log(this.$router, "this.$router")
112 113
       const router = Taro.getStorageSync('router')
113 114
       console.log(router, "router")
@@ -115,10 +116,21 @@ export default class Index extends Component {
115 116
       console.log(hFiveId, "hFiveId")
116 117
       // h5id 、第一个分享人ID、置业顾问ID、分享人ID 
117 118
       getHFiveDetail(hFiveId).then(res => {
118
-        // debugger
119
-        this.setState({
120
-          pageInfo: res
121
-        })
119
+        if(res.status==1){
120
+          this.setState({
121
+            pageInfo: res
122
+          })
123
+        }else{
124
+          Taro.showModal({
125
+            title: '提示',
126
+            content: '活动已下架(无法进入或者参加活动)',
127
+            showCancel:false,
128
+          }).then(()=>{
129
+            Taro.switchTab({
130
+              url: '/pages/project/index'
131
+            })
132
+          })
133
+        }
122 134
       })
123 135
       const { userInfo: { person: { avatarurl, phone } } } = this.props
124 136
       console.log(this.props, "this.propsthis.propsthis.props")

+ 7
- 2
src/services/chat.js View File

@@ -3,7 +3,8 @@ import {
3 3
   API_CHAT_SEND,
4 4
   API_CHAT_HISTORY,
5 5
   API_CHAT_FRIENDS,
6
-  API_UPLOAD_IMAGE
6
+  API_UPLOAD_IMAGE,
7
+  API_CHAT_READED,
7 8
 } from '@constants/api'
8 9
 
9 10
 
@@ -32,4 +33,8 @@ export const queryChatFriends = payload => fetch({ url: API_CHAT_FRIENDS, payloa
32 33
  */
33 34
 export const uploadImage = payload => fetch({ url: API_UPLOAD_IMAGE, payload })
34 35
 
35
-
36
+/**
37
+ * 更新消息为已读
38
+ * @param {*} payload 
39
+ */
40
+export const setMessageReaded = chatID => fetch({ url: `${API_CHAT_READED}/${chatID}`, method: 'PUT' })

+ 5
- 1
src/utils/im.js View File

@@ -116,7 +116,11 @@ class IMManager {
116 116
         }
117 117
       })
118 118
     } else {
119
-      this.socketMsgQueue.push(payload)
119
+      // this.socketMsgQueue.push(payload)
120
+          Taro.showToast({
121
+            title: '失败: 请退出小程序重试',
122
+            icon: 'none'
123
+          })
120 124
     }
121 125
   }
122 126
 }