正在显示
1 个修改的文件
包含
18 行增加
和
12 行删除
| ... | ... | @@ -8,12 +8,11 @@ Page({ |
| 8 | 8 | */ |
| 9 | 9 | data: { |
| 10 | 10 | showModal: false, |
| 11 | - canTap:true, | |
| 11 | + canTap: true, | |
| 12 | 12 | inputValue: "", |
| 13 | 13 | comlist: [], |
| 14 | 14 | com_id: "", |
| 15 | 15 | choosed_index: 0, |
| 16 | - chat_idx: "Toview" + 0, | |
| 17 | 16 | chatlist: [] |
| 18 | 17 | }, |
| 19 | 18 | |
| ... | ... | @@ -115,7 +114,6 @@ Page({ |
| 115 | 114 | that.data.chatlist.push(res.data) |
| 116 | 115 | that.setData({ |
| 117 | 116 | inputValue: "", |
| 118 | - chat_idx: "Toview" + that.data.chatlist.length, | |
| 119 | 117 | chatlist: that.data.chatlist |
| 120 | 118 | }) |
| 121 | 119 | console.log("chatlist", that.data.chatlist) |
| ... | ... | @@ -132,8 +130,8 @@ Page({ |
| 132 | 130 | }, 400); |
| 133 | 131 | } |
| 134 | 132 | }, |
| 135 | - complete:function(res){ | |
| 136 | - setTimeout(function () { | |
| 133 | + complete: function(res) { | |
| 134 | + setTimeout(function() { | |
| 137 | 135 | that.setData({ |
| 138 | 136 | canTap: true |
| 139 | 137 | }) |
| ... | ... | @@ -171,10 +169,10 @@ Page({ |
| 171 | 169 | app.configOssUrl(); |
| 172 | 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 | 189 | "Authorization": Authorization |
| 192 | 190 | }, |
| 193 | 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 | 194 | that.setData({ |
| 197 | - chat_idx: "Toview" + res.data.items.length, | |
| 198 | 195 | chatlist: res.data.items.reverse() |
| 199 | 196 | }) |
| 200 | 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 | }) | ... | ... |
请
注册
或
登录
后发表评论