Merge commit 'f328a5a43934ce720c50f9ebd155c11e1277a065' into pro

This commit is contained in:
Pang 2023-07-27 07:04:47 +08:00
commit ff64a1a510
4 changed files with 35 additions and 6 deletions

View File

@ -150,7 +150,7 @@ services:
approve: approve:
container_name: "dootask-approve-${APP_ID}" container_name: "dootask-approve-${APP_ID}"
image: "hitosea2020/go-approve:0.1.1" image: "hitosea2020/go-approve:0.1.2"
environment: environment:
TZ: "Asia/Shanghai" TZ: "Asia/Shanghai"
MYSQL_HOST: "${DB_HOST}" MYSQL_HOST: "${DB_HOST}"

View File

@ -652,9 +652,18 @@ export default {
} }
}, },
mounted() {
this.msgSubscribe = Store.subscribe('dialogMsgUpdate', this.updateMsg);
},
beforeDestroy() { beforeDestroy() {
this.$store.dispatch('forgetInDialog', this._uid) this.$store.dispatch('forgetInDialog', this._uid)
this.$store.dispatch('closeDialog', this.dialogId) this.$store.dispatch('closeDialog', this.dialogId)
//
if (this.msgSubscribe) {
this.msgSubscribe.unsubscribe();
this.msgSubscribe = null;
}
}, },
computed: { computed: {
@ -1334,6 +1343,17 @@ export default {
this.sendMsg(`<p><span data-quick-key="${item.key}">${item.label}</span></p>`) this.sendMsg(`<p><span data-quick-key="${item.key}">${item.label}</span></p>`)
}, },
updateMsg(data) {
const item = this.allMsgs.find(({type, id}) => type == "text" && id == data.id)
if (item) {
const {tail} = this.scrollInfo()
item.msg.text = data.text
if (tail <= 45) {
this.onToBottom()
}
}
},
getTempId() { getTempId() {
return this.tempId++ return this.tempId++
}, },

View File

@ -2852,14 +2852,22 @@ export default {
streamDialogMsg({state, dispatch}, streamUrl) { streamDialogMsg({state, dispatch}, streamUrl) {
const sse = new EventSource(streamUrl) const sse = new EventSource(streamUrl)
sse.addEventListener("update", e => { sse.addEventListener("update", e => {
const item = state.dialogMsgs.find(({type, id}) => type == "text" && id == e.lastEventId) Store.set('dialogMsgUpdate', {
if (item) { id: e.lastEventId,
item.msg.text = e.data text: e.data
} });
}) })
sse.addEventListener("done", e => { sse.addEventListener("done", _ => {
const index = state.dialogSseList.findIndex(item => sse === item.sse)
if (index > -1) {
state.dialogSseList.splice(index, 1)
}
sse.close() sse.close()
}) })
state.dialogSseList.push({sse, time: $A.Time()})
if (state.dialogSseList.length > 10) {
state.dialogSseList.shift().sse.close()
}
}, },
/** *****************************************************************************************/ /** *****************************************************************************************/

View File

@ -110,6 +110,7 @@ export default {
dialogHistory: [], dialogHistory: [],
dialogDraftTimer: {}, dialogDraftTimer: {},
dialogMsgTransfer: {time: 0}, dialogMsgTransfer: {time: 0},
dialogSseList: [],
// 搜索关键词(主要用于移动端判断滑动返回) // 搜索关键词(主要用于移动端判断滑动返回)
messengerSearchKey: {dialog: '', contacts: ''}, messengerSearchKey: {dialog: '', contacts: ''},