83 lines
2.4 KiB
Vue
83 lines
2.4 KiB
Vue
|
<template>
|
||
|
<div class="jointRoomMenu">
|
||
|
<pop-menu ref="popMenu" :menu="menu"></pop-menu>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import PopMenu from '@/components/PopMenu';
|
||
|
import { DeviceMenu } from '@/scripts/ConstDic';
|
||
|
import { putJointTrainingUserkicked } from '@/api/chat';
|
||
|
|
||
|
export default {
|
||
|
name: 'TrainingOperateMenu',
|
||
|
components: {
|
||
|
PopMenu,
|
||
|
},
|
||
|
props: {
|
||
|
point: {
|
||
|
type: Object,
|
||
|
required: true
|
||
|
},
|
||
|
clickUserId: {
|
||
|
type: String,
|
||
|
required: true
|
||
|
}
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
menu: [],
|
||
|
menuShow: [
|
||
|
{
|
||
|
label: '踢出房间',
|
||
|
handler: this.kicked
|
||
|
},
|
||
|
],
|
||
|
userId: '',
|
||
|
}
|
||
|
},
|
||
|
watch: {
|
||
|
'$store.state.menuOperation.menuCount': function (val) {
|
||
|
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.JointRoom)) {
|
||
|
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||
|
} else {
|
||
|
this.doClose();
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
mounted() {
|
||
|
this.userId = this.$store.state.user.id;
|
||
|
this.closeEvent();
|
||
|
},
|
||
|
methods: {
|
||
|
closeEvent() {
|
||
|
let self = this;
|
||
|
window.onclick = function (e) {
|
||
|
self.doClose();
|
||
|
}
|
||
|
},
|
||
|
doShow(point) {
|
||
|
this.closeEvent();
|
||
|
if (this.userId != this.clickUserId) {
|
||
|
this.menu = this.menuShow;
|
||
|
if (this.$refs && this.$refs.popMenu) {
|
||
|
this.$refs.popMenu.resetShowPosition(point);
|
||
|
}
|
||
|
} else {
|
||
|
this.menu = [];
|
||
|
}
|
||
|
|
||
|
},
|
||
|
doClose() {
|
||
|
if (this.$refs && this.$refs.popMenu) {
|
||
|
this.$refs.popMenu.close();
|
||
|
}
|
||
|
},
|
||
|
async kicked() {
|
||
|
try {
|
||
|
let res = await putJointTrainingUserkicked(this.clickUserId, this.$route.query.group);
|
||
|
} catch (error) { }
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|