正在显示
1 个修改的文件
包含
18 行增加
和
12 行删除
| @@ -8,12 +8,11 @@ Page({ | @@ -8,12 +8,11 @@ Page({ | ||
| 8 | */ | 8 | */ |
| 9 | data: { | 9 | data: { |
| 10 | showModal: false, | 10 | showModal: false, |
| 11 | - canTap:true, | 11 | + canTap: true, |
| 12 | inputValue: "", | 12 | inputValue: "", |
| 13 | comlist: [], | 13 | comlist: [], |
| 14 | com_id: "", | 14 | com_id: "", |
| 15 | choosed_index: 0, | 15 | choosed_index: 0, |
| 16 | - chat_idx: "Toview" + 0, | ||
| 17 | chatlist: [] | 16 | chatlist: [] |
| 18 | }, | 17 | }, |
| 19 | 18 | ||
| @@ -115,7 +114,6 @@ Page({ | @@ -115,7 +114,6 @@ Page({ | ||
| 115 | that.data.chatlist.push(res.data) | 114 | that.data.chatlist.push(res.data) |
| 116 | that.setData({ | 115 | that.setData({ |
| 117 | inputValue: "", | 116 | inputValue: "", |
| 118 | - chat_idx: "Toview" + that.data.chatlist.length, | ||
| 119 | chatlist: that.data.chatlist | 117 | chatlist: that.data.chatlist |
| 120 | }) | 118 | }) |
| 121 | console.log("chatlist", that.data.chatlist) | 119 | console.log("chatlist", that.data.chatlist) |
| @@ -132,8 +130,8 @@ Page({ | @@ -132,8 +130,8 @@ Page({ | ||
| 132 | }, 400); | 130 | }, 400); |
| 133 | } | 131 | } |
| 134 | }, | 132 | }, |
| 135 | - complete:function(res){ | ||
| 136 | - setTimeout(function () { | 133 | + complete: function(res) { |
| 134 | + setTimeout(function() { | ||
| 137 | that.setData({ | 135 | that.setData({ |
| 138 | canTap: true | 136 | canTap: true |
| 139 | }) | 137 | }) |
| @@ -171,10 +169,10 @@ Page({ | @@ -171,10 +169,10 @@ Page({ | ||
| 171 | app.configOssUrl(); | 169 | app.configOssUrl(); |
| 172 | that.getChatinfo(); | 170 | that.getChatinfo(); |
| 173 | }, | 171 | }, |
| 174 | - complete:function(res){ | ||
| 175 | - wx.showLoading({ | ||
| 176 | - title: '', | ||
| 177 | - }) | 172 | + complete: function(res) { |
| 173 | + wx.showLoading({ | ||
| 174 | + title: '', | ||
| 175 | + }) | ||
| 178 | } | 176 | } |
| 179 | }) | 177 | }) |
| 180 | }, | 178 | }, |
| @@ -191,13 +189,21 @@ Page({ | @@ -191,13 +189,21 @@ Page({ | ||
| 191 | "Authorization": Authorization | 189 | "Authorization": Authorization |
| 192 | }, | 190 | }, |
| 193 | success: function(res) { | 191 | success: function(res) { |
| 194 | - if (res && res.data) { | ||
| 195 | - console.log("getChatinfo", res) | 192 | + console.log("getChatinfo", res) |
| 193 | + if (res.data && res.data.items && res.data.items.length > 0) { | ||
| 196 | that.setData({ | 194 | that.setData({ |
| 197 | - chat_idx: "Toview" + res.data.items.length, | ||
| 198 | chatlist: res.data.items.reverse() | 195 | chatlist: res.data.items.reverse() |
| 199 | }) | 196 | }) |
| 200 | that.bottom() | 197 | that.bottom() |
| 198 | + }else{ | ||
| 199 | + var orilist = [] | ||
| 200 | + var oribean = {} | ||
| 201 | + oribean.type = "0" | ||
| 202 | + oribean.text = "Hi,我是社税小助手,请问您需要什么帮助?我知道的可多了,税法、政策、资讯,帮您计算个税、查询您的工资明细,只要告诉我就可以了" | ||
| 203 | + orilist.push(oribean) | ||
| 204 | + that.setData({ | ||
| 205 | + chatlist: orilist | ||
| 206 | + }) | ||
| 201 | } | 207 | } |
| 202 | }, | 208 | }, |
| 203 | }) | 209 | }) |
请
注册
或
登录
后发表评论