Commit bc54895b authored by 庄总's avatar 庄总

new v

parent dd56bd52
......@@ -2685,6 +2685,53 @@ export default class Index extends Component<Props, State, HomeState, AppContext
uid: this.state.liveRoomUid
}).then((data) => {
console.log('uploadImage', data);
const {uid, channelId, text} = data;
let list = this.state.list;
let chatMsg = {};
let nickname = this.state.teacherName;
if (this.state.teacherUid !== uid) {
// 学生发送图片
let students = this.state.students;
for (let i = 0; i < students.length; i ++) {
if (parseInt(students[i].liveRoomUid) === parseInt(uid)) {
nickname = students[i].studentName;
break;
}
}
}
let width = Constants.unitWidth * parseInt(text.message.width);
let height = Constants.unitWidth * parseInt(text.message.height);
if (width > Constants.unitWidth * 190) {
height = Constants.unitWidth * 190 / width * height;
width = Constants.unitWidth * 190;
}
chatMsg = {
dateTime: this.getFormattedDatetime(new Date()),
uid: uid,
file: text.message.file,
nickname: nickname,
type: 'image',
width: width,
height: height,
widthOrg: Constants.unitWidth * parseInt(text.message.width),
heightOrg: Constants.unitWidth * parseInt(text.message.height)
};
list.push(chatMsg);
let hasNewMsg = this.state.hasNewMsg;
if (!this.state.showChat) {
hasNewMsg = true;
}
this.setState({
list: list,
hasNewMsg: hasNewMsg
});
Constants.storeData('chatData-' + this.state.channelId, JSON.stringify(list));
setTimeout(() => {
if (this.msgList) {
this.msgList.scrollToEnd();
}
}, 150);
});
})
}}>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment