采购详情支持手动修改
This commit is contained in:
@@ -109,7 +109,7 @@ async function openPurchasePage(roomId) {
|
||||
|
||||
async function openChatFromPurchase() {
|
||||
if (!Store.currentRoom) return;
|
||||
openChat(Store.currentRoom);
|
||||
await openChat(Store.currentRoom, true);
|
||||
}
|
||||
|
||||
function backToPurchase() {
|
||||
@@ -119,7 +119,7 @@ function backToPurchase() {
|
||||
loadPurchases();
|
||||
}
|
||||
|
||||
async function openChat(roomId) {
|
||||
async function openChat(roomId, fromPurchase = false) {
|
||||
Store.currentRoom = roomId;
|
||||
clearTempBubble();
|
||||
document.getElementById('list-page').classList.add('hidden');
|
||||
@@ -128,10 +128,20 @@ async function openChat(roomId) {
|
||||
const room = Store.rooms.find(r => r.id === roomId);
|
||||
document.getElementById('current-chat-name').textContent = room?.name || '';
|
||||
const token = Store.getToken();
|
||||
const res = await fetch('/api/rooms/' + roomId + '/messages', { headers: { 'Authorization': `Bearer ${token}` } });
|
||||
const res = await fetch('/api/rooms/' + roomId + '/messages', { headers: { 'Authorization': 'Bearer ' + token } });
|
||||
const msgs = await res.json();
|
||||
renderAllMessages(msgs);
|
||||
if (Store.ws && Store.ws.readyState === WebSocket.OPEN) Store.ws.send(JSON.stringify({ type: 'join', roomId }));
|
||||
|
||||
// 从采购页跳转过来时,自动发送缓存的文本
|
||||
if (fromPurchase && Store.pendingPurchaseText) {
|
||||
const text = Store.pendingPurchaseText;
|
||||
Store.pendingPurchaseText = '';
|
||||
document.getElementById('msg-input').value = text;
|
||||
document.getElementById('msg-input').style.height = 'auto';
|
||||
document.getElementById('msg-input').style.height = document.getElementById('msg-input').scrollHeight + 'px';
|
||||
setTimeout(() => sendMessage(), 300);
|
||||
}
|
||||
}
|
||||
|
||||
function showList() {
|
||||
|
||||
Reference in New Issue
Block a user