mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-27 13:08:13 +00:00
Merge commit 'f328a5a43934ce720c50f9ebd155c11e1277a065' into pro
This commit is contained in:
commit
ff64a1a510
@ -150,7 +150,7 @@ services:
|
||||
|
||||
approve:
|
||||
container_name: "dootask-approve-${APP_ID}"
|
||||
image: "hitosea2020/go-approve:0.1.1"
|
||||
image: "hitosea2020/go-approve:0.1.2"
|
||||
environment:
|
||||
TZ: "Asia/Shanghai"
|
||||
MYSQL_HOST: "${DB_HOST}"
|
||||
|
||||
@ -652,9 +652,18 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.msgSubscribe = Store.subscribe('dialogMsgUpdate', this.updateMsg);
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
this.$store.dispatch('forgetInDialog', this._uid)
|
||||
this.$store.dispatch('closeDialog', this.dialogId)
|
||||
//
|
||||
if (this.msgSubscribe) {
|
||||
this.msgSubscribe.unsubscribe();
|
||||
this.msgSubscribe = null;
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
@ -1334,6 +1343,17 @@ export default {
|
||||
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() {
|
||||
return this.tempId++
|
||||
},
|
||||
|
||||
18
resources/assets/js/store/actions.js
vendored
18
resources/assets/js/store/actions.js
vendored
@ -2852,14 +2852,22 @@ export default {
|
||||
streamDialogMsg({state, dispatch}, streamUrl) {
|
||||
const sse = new EventSource(streamUrl)
|
||||
sse.addEventListener("update", e => {
|
||||
const item = state.dialogMsgs.find(({type, id}) => type == "text" && id == e.lastEventId)
|
||||
if (item) {
|
||||
item.msg.text = e.data
|
||||
}
|
||||
Store.set('dialogMsgUpdate', {
|
||||
id: e.lastEventId,
|
||||
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()
|
||||
})
|
||||
state.dialogSseList.push({sse, time: $A.Time()})
|
||||
if (state.dialogSseList.length > 10) {
|
||||
state.dialogSseList.shift().sse.close()
|
||||
}
|
||||
},
|
||||
|
||||
/** *****************************************************************************************/
|
||||
|
||||
1
resources/assets/js/store/state.js
vendored
1
resources/assets/js/store/state.js
vendored
@ -110,6 +110,7 @@ export default {
|
||||
dialogHistory: [],
|
||||
dialogDraftTimer: {},
|
||||
dialogMsgTransfer: {time: 0},
|
||||
dialogSseList: [],
|
||||
|
||||
// 搜索关键词(主要用于移动端判断滑动返回)
|
||||
messengerSearchKey: {dialog: '', contacts: ''},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user