Merge commit 'c1b63af5f5408d5ce9c1d45560480a6fd4bd52a9' into pro

This commit is contained in:
Pang 2024-01-13 23:54:59 +08:00
commit 170473fb2d

View File

@ -579,7 +579,7 @@ export default {
this.$emit("on-show-emoji-user", item) this.$emit("on-show-emoji-user", item)
}, },
onWordChain(){ onWordChain() {
this.$store.state.dialogDroupWordChain = { this.$store.state.dialogDroupWordChain = {
type: 'participate', type: 'participate',
dialog_id: this.msgData.dialog_id, dialog_id: this.msgData.dialog_id,
@ -587,27 +587,27 @@ export default {
} }
}, },
unfoldWordChain(e){ unfoldWordChain(e) {
e.target.parentNode?.parentNode?.classList.add('expand') e.target.parentNode?.parentNode?.classList.add('expand')
}, },
onVote(type,msgData){ onVote(type, msgData) {
if(type != 'vote'){ if (type != 'vote') {
$A.modalConfirm({ $A.modalConfirm({
content: type == 'finish' ? '确定结束投票?': '再次发送投票?', content: type == 'finish' ? '确定结束投票?' : '再次发送投票?',
cancelText: '取消', cancelText: '取消',
okText: '确定', okText: '确定',
onOk: () => { onOk: () => {
this.vote(type,msgData); this.vote(type, msgData);
} }
}); });
return; return;
} }
this.vote(type,msgData); this.vote(type, msgData);
}, },
vote(type,msgData){ vote(type, msgData) {
this.$set(msgData.msg,'_loadIng',1) this.$set(msgData.msg, '_loadIng', 1)
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'dialog/msg/vote', url: 'dialog/msg/vote',
method: 'post', method: 'post',
@ -617,27 +617,24 @@ export default {
vote: msgData.msg._vote || [], vote: msgData.msg._vote || [],
type: type type: type
} }
}).then(({data}) => { }).then(({ data }) => {
if(type == 'again'){ if (type == 'again') {
$A.messageSuccess("已发送"); $A.messageSuccess("已发送");
} }
data.forEach(d => { data.forEach(d => {
this.$store.dispatch("saveDialogMsg", d ); this.$store.dispatch("saveDialogMsg", d);
}); });
}).catch(({msg}) => { }).catch(({ msg }) => {
$A.modalError(msg); $A.modalError(msg);
}).finally(_ => { }).finally(_ => {
this.$set(msgData.msg,'_loadIng',0) this.$set(msgData.msg, '_loadIng', 0)
}); });
}, },
getVoteProgress(msgData, id){ getVoteProgress(msgData, id) {
const num = msgData.votes.filter(h=>(h.votes || '').indexOf(id) != -1).length const num = msgData.votes.filter(h => (h.votes || '').indexOf(id) != -1).length
let progress = '0.00'; const progress = !num ? '0.00' : (num / msgData.votes.length * 100).toFixed(2);
if(num){ return { num, progress };
progress = (msgData.votes.length / num * 100).toFixed(2)
}
return {num, progress};
} }
} }
} }