张延森 преди 3 години
родител
ревизия
643606e6b3
променени са 4 файла, в които са добавени 35 реда и са изтрити 30 реда
  1. 1
    1
      config/prod.js
  2. 1
    1
      project.config.json
  3. 32
    27
      src/pages/chat/chatDetail/index.jsx
  4. 1
    1
      src/subpackages/pages/consultant/components/StatCustomerListItem/index.jsx

+ 1
- 1
config/prod.js Целия файл

@@ -10,7 +10,7 @@ module.exports = {
10 10
     OSS_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',
11 11
     OSS_FAST_PATH: '"https://xlk-assets.oss-cn-shanghai.aliyuncs.com/"',
12 12
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',
13
-    Version: '"V0.0.62-20210824"'
13
+    Version: '"V0.0.65-20210827"'
14 14
   },
15 15
   mini: {},
16 16
   h5: {

+ 1
- 1
project.config.json Целия файл

@@ -2,7 +2,7 @@
2 2
 	"miniprogramRoot": "dist/",
3 3
 	"projectname": "miniapp",
4 4
 	"description": "",
5
-	"appid": "wxe44244d1a5ea3364",
5
+	"appid": "wxc96058d57e77f373",
6 6
 	"setting": {
7 7
 		"urlCheck": false,
8 8
 		"es6": false,

+ 32
- 27
src/pages/chat/chatDetail/index.jsx Целия файл

@@ -77,32 +77,21 @@ export default withLayout((props) => {
77 77
   }
78 78
 
79 79
   const getChatHistory = (params) => {
80
-    Taro.showLoading()
81
-    queryChatHistory({
82
-      chatWith: friend,
83
-      pageSize: 20,
84
-      ...params || {},
85
-    }).then((res) => {
86
-      const { records } = res;
87
-      Taro.hideLoading()
88
-
89
-      const lst = (records || []).reverse()
90
-
91
-      // 如果聊天对象是有身份的
92
-      if (receiver.personType !== ROLE_CODE.DRIFT && receiver.personType !== ROLE_CODE.CUSTOMER) {
93
-        const mockMessage = {
94
-          chatId: Math.random().toString(36).substring(2),
95
-          message: '',
96
-          messageType: im.MESSAGETYPE.CARD,
97
-          receivePerson: person.personId,
98
-          sendPerson: friend,
99
-          createDate: new Date(),
100
-        }
101
-        lst.push(mockMessage)
102
-      }
103
-
104
-      setPageList(lst)
105
-      scroll()
80
+    return new Promise((resovle, reject) => {
81
+      Taro.showLoading()
82
+      queryChatHistory({
83
+        chatWith: friend,
84
+        pageSize: 20,
85
+        ...params || {},
86
+      }).then((res) => {
87
+        const { records } = res;
88
+        Taro.hideLoading()
89
+  
90
+        const lst = (records || []).reverse()  
91
+        resovle(lst)
92
+      }).catch(() => {
93
+        Taro.hideLoading()
94
+      })
106 95
     })
107 96
   }
108 97
 
@@ -117,7 +106,23 @@ export default withLayout((props) => {
117 106
       im.bindReceiver(friend)
118 107
       fetch({ url: `${API_QUERY_USERINFO_BYID}/${friend}`, spin: true }).then((res) => {
119 108
         setReceiver(res)
120
-        getChatHistory({ pageNumber: 1 })
109
+        getChatHistory({ pageNumber: 1 }).then((lst) => {
110
+          // 如果聊天对象是有身份的
111
+          if (res.personType !== ROLE_CODE.DRIFT && res.personType !== ROLE_CODE.CUSTOMER) {
112
+            const mockMessage = {
113
+              chatId: Math.random().toString(36).substring(2),
114
+              message: '',
115
+              messageType: im.MESSAGETYPE.CARD,
116
+              receivePerson: person.personId,
117
+              sendPerson: friend,
118
+              createDate: new Date(),
119
+            }
120
+            lst.push(mockMessage)
121
+          }
122
+
123
+          setPageList(lst)
124
+          scroll()
125
+        })
121 126
       })
122 127
     } else {
123 128
       Taro.showToast({

+ 1
- 1
src/subpackages/pages/consultant/components/StatCustomerListItem/index.jsx Целия файл

@@ -9,7 +9,7 @@ export default function StatCustomerListItem (props) {
9 9
 
10 10
   const handleChat = () => {
11 11
     Taro.navigateTo({
12
-      url: `/pages/chat/chatDetail/index?friend=${data.id}`
12
+      url: `/pages/chat/chatDetail/index?friend=${data.personId}`
13 13
     })
14 14
   }
15 15