正在显示
3 个修改的文件
包含
30 行增加
和
15 行删除
| ... | ... | @@ -12,7 +12,7 @@ Page({ |
| 12 | 12 | comlist:"", |
| 13 | 13 | com_id:"", |
| 14 | 14 | choosed_index:0, |
| 15 | - datas: ["", "", "", "", ""] | |
| 15 | + chatlist: [] | |
| 16 | 16 | }, |
| 17 | 17 | |
| 18 | 18 | /** |
| ... | ... | @@ -68,9 +68,15 @@ Page({ |
| 68 | 68 | |
| 69 | 69 | sendMsg: function() { |
| 70 | 70 | var that = this; |
| 71 | + if (this.data.inputValue == "" || this.data.inputValue.replace(/(^\s*)|(\s*$)/g, "")==""){ | |
| 72 | + wx.showToast({ | |
| 73 | + title: '请输入内容', | |
| 74 | + }) | |
| 75 | + return | |
| 76 | + } | |
| 71 | 77 | var Authorization = app.globalData.Authorization; |
| 72 | 78 | wx.request({ |
| 73 | - url: baseUrl + 'callbot/v1/chats', | |
| 79 | + url: baseUrl + 'chatbot/v1/chats', | |
| 74 | 80 | data: { |
| 75 | 81 | text: that.data.inputValue |
| 76 | 82 | }, |
| ... | ... | @@ -81,8 +87,11 @@ Page({ |
| 81 | 87 | }, |
| 82 | 88 | success: function(res) { |
| 83 | 89 | if (res && res.data) { |
| 84 | - console.log("res", res) | |
| 85 | - | |
| 90 | + console.log("res", res) | |
| 91 | + that.setData({ | |
| 92 | + inputValue:"" | |
| 93 | + }) | |
| 94 | + that.getChatinfo() | |
| 86 | 95 | } |
| 87 | 96 | } |
| 88 | 97 | }) |
| ... | ... | @@ -147,7 +156,7 @@ Page({ |
| 147 | 156 | var that = this; |
| 148 | 157 | var Authorization = app.globalData.Authorization; |
| 149 | 158 | wx.request({ |
| 150 | - url: baseUrl + 'callbot/v1/chats', | |
| 159 | + url: baseUrl + 'chatbot/v1/chats', | |
| 151 | 160 | data: {}, |
| 152 | 161 | method: "GET", |
| 153 | 162 | header: { |
| ... | ... | @@ -157,7 +166,9 @@ Page({ |
| 157 | 166 | success: function (res) { |
| 158 | 167 | if (res && res.data) { |
| 159 | 168 | console.log("res", res) |
| 160 | - | |
| 169 | + that.setData({ | |
| 170 | + chatlist: res.data.items.reverse() | |
| 171 | + }) | |
| 161 | 172 | } |
| 162 | 173 | } |
| 163 | 174 | }) | ... | ... |
| 1 | 1 | <!--pages/main/smartchat/chat.wxml--> |
| 2 | 2 | <view hidden='{{showModal}}'> |
| 3 | 3 | <scroll-view style='background:#fff;margin-bottom:150rpx'> |
| 4 | - <view wx:for="{{datas}}"> | |
| 5 | - <view style='margin:50rpx 60rpx 0 36rpx;display:flex;flex-direction:row'> | |
| 6 | - <image style='width:136rpx;height:92rpx' src="/images/icon_robot.png"></image> | |
| 4 | + <view wx:for="{{chatlist}}" wx:for-item="item" style='display:flex;flex-direction:column'> | |
| 5 | + <view style='margin:50rpx 60rpx 0 36rpx;display:flex;flex-direction:row' wx:if="{{item.type=='0'}}"> | |
| 6 | + <image style='width:102rpx;height:92rpx' src="/images/icon_robot.png"></image> | |
| 7 | 7 | <view class='receive_bg'> |
| 8 | - <text class='text_receive_wrap'>您要计算工资薪金的还是劳务报酬的个您要计算工资薪金的还是劳务报酬的</text> | |
| 8 | + <text class='text_receive_wrap'>{{item.text}}</text> | |
| 9 | 9 | </view> |
| 10 | - | |
| 11 | 10 | </view> |
| 12 | - <view style='margin:50rpx 36rpx 0 60rpx;display:flex;flex-direction:row'> | |
| 11 | + <view style='margin:50rpx 36rpx 0 60rpx;display:flex;justify-content:flex-end;' wx:if="{{item.type=='1'}}"> | |
| 13 | 12 | <view class='send_bg'> |
| 14 | - <text class='text_send_wrap'>您要计算工资薪金的还是劳务报酬的个您要计算工资薪金的还是劳务报酬的</text> | |
| 13 | + <text class='text_send_wrap'>{{item.text}}</text> | |
| 15 | 14 | </view> |
| 16 | - <view style='width:136rpx;height:92rpx'> | |
| 15 | + <view style='width:92rpx;height:92rpx;'> | |
| 17 | 16 | <open-data type="userAvatarUrl"></open-data> |
| 18 | 17 | </view> |
| 19 | 18 | </view> |
| 20 | 19 | </view> |
| 21 | 20 | </scroll-view> |
| 22 | 21 | <view class='bottom_wrap'> |
| 23 | - <input class='input_wrap' placeholder-class='input_placeholder_wrap' confirm-type="send" bindinput="bindKeyInput" placeholder='请输入您要咨询的问题'></input> | |
| 22 | + <input class='input_wrap' placeholder-class='input_placeholder_wrap' confirm-type="send" bindinput="bindKeyInput" placeholder='请输入您要咨询的问题' value='{{inputValue}}'></input> | |
| 24 | 23 | <view class='btn_send_wrap' bindtap='sendMsg'>发送</view> |
| 25 | 24 | </view> |
| 26 | 25 | </view> | ... | ... |
| ... | ... | @@ -118,6 +118,8 @@ |
| 118 | 118 | padding: 0 20rpx; |
| 119 | 119 | border: 1px solid #e7e7e7; |
| 120 | 120 | border-radius: 4px; |
| 121 | + font-size: 16px; | |
| 122 | + color: #333; | |
| 121 | 123 | } |
| 122 | 124 | |
| 123 | 125 | .receive_bg { |
| ... | ... | @@ -132,6 +134,7 @@ |
| 132 | 134 | font-size: 14px; |
| 133 | 135 | color: #4a4a4a; |
| 134 | 136 | letter-spacing: 0; |
| 137 | + word-break:break-all; | |
| 135 | 138 | } |
| 136 | 139 | |
| 137 | 140 | .send_bg { |
| ... | ... | @@ -139,6 +142,7 @@ |
| 139 | 142 | border-radius: 8px; |
| 140 | 143 | padding: 24rpx 28rpx; |
| 141 | 144 | margin-right: 28rpx; |
| 145 | + max-width: 500rpx; | |
| 142 | 146 | } |
| 143 | 147 | |
| 144 | 148 | .text_send_wrap { |
| ... | ... | @@ -146,6 +150,7 @@ |
| 146 | 150 | font-size: 14px; |
| 147 | 151 | color: #4a4a4a; |
| 148 | 152 | letter-spacing: 0; |
| 153 | + word-break:break-all; | |
| 149 | 154 | } |
| 150 | 155 | |
| 151 | 156 | .input_placeholder_wrap { | ... | ... |
请
注册
或
登录
后发表评论