|
|
@@ -1,3 +1,5 @@ |
|
|
|
const app = getApp() |
|
|
|
import request from '../../utils/request' |
|
|
|
import { scrollToID } from '../../utils/util' |
|
|
|
Page({ |
|
|
|
|
|
|
@@ -6,6 +8,7 @@ Page({ |
|
|
|
*/ |
|
|
|
data: { |
|
|
|
chatList: [], |
|
|
|
saysContentLength: 50, |
|
|
|
message: "", |
|
|
|
waitingMessage: "", |
|
|
|
isResponing: false, |
|
|
@@ -23,11 +26,33 @@ Page({ |
|
|
|
*/ |
|
|
|
onLoad() { |
|
|
|
this.socketLink() |
|
|
|
this.chatLimit() |
|
|
|
}, |
|
|
|
|
|
|
|
chatLimit() { |
|
|
|
request.get({ |
|
|
|
url: '/api/chat/limit', |
|
|
|
}).then(res => { |
|
|
|
console.log(res, 'chatLimit'); |
|
|
|
this.setData({ |
|
|
|
saysContentLength: res.data.saysContentLength * 1 |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
console.log(err, 'err'); |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
input(e) { |
|
|
|
const msg = e.detail.value |
|
|
|
const limit = this.data.saysContentLength |
|
|
|
if (msg.length > limit) { |
|
|
|
wx.showToast({ |
|
|
|
title: `单条最长可输入字数为${limit}字!`, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
this.setData({ |
|
|
|
message: e.detail.value |
|
|
|
message: msg |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|