移动端消息窗口使用全局模式弹窗

This commit is contained in:
kuaifan 2022-06-06 00:11:04 +08:00
parent ab24af6e79
commit ce88fe426b
9 changed files with 117 additions and 19 deletions

View File

@ -97,6 +97,14 @@ Vue.prototype.goForward = function(location, isReplace) {
if (typeof location === 'string') { if (typeof location === 'string') {
location = {name: location}; location = {name: location};
} }
// 打开聊天窗口(移动端)
if (app.$store.state.windowMax768
&& location.name === 'manage-messenger'
&& /\d+/.test(location.params.dialogId)) {
app.$store.state.dialogModalId = location.params.dialogId;
return
}
//
if (app.$store.state.routeHistorys.length === 0) { if (app.$store.state.routeHistorys.length === 0) {
app.$store.state.routeHistorys.push(app.$route) app.$store.state.routeHistorys.push(app.$route)
} }

View File

@ -322,6 +322,9 @@
</div> </div>
</Modal> </Modal>
<!--聊天窗口移动端-->
<DialogModal/>
<!--工作报告--> <!--工作报告-->
<DrawerOverlay <DrawerOverlay
v-model="workReportShow" v-model="workReportShow"
@ -385,9 +388,11 @@ import TaskMenu from "./manage/components/TaskMenu";
import MobileNotification from "../components/Mobile/Notification"; import MobileNotification from "../components/Mobile/Notification";
import MeetingManager from "./manage/components/MeetingManager"; import MeetingManager from "./manage/components/MeetingManager";
import longpress from "../directives/longpress"; import longpress from "../directives/longpress";
import DialogModal from "./manage/components/DialogModal";
export default { export default {
components: { components: {
DialogModal,
MeetingManager, MeetingManager,
MobileNotification, MobileNotification,
TaskMenu, TaskMenu,

View File

@ -0,0 +1,80 @@
<template>
<Modal
v-model="show"
:mask="false"
:mask-closable="false"
:footer-hide="true"
:transition-names="['mobile-dialog', '']"
:beforeClose="onBeforeClose"
class-name="dialog-modal"
fullscreen>
<transition name="mobile-dialog">
<DialogWrapper v-if="dialogModalId > 0" :dialogId="dialogModalId" :beforeBack="onBeforeClose"/>
</transition>
</Modal>
</template>
<style lang="scss">
body {
.ivu-modal-wrap {
&.dialog-modal {
overflow: hidden;
.ivu-modal {
margin: 0;
padding: 0;
.ivu-modal-content {
.ivu-modal-close {
display: none;
}
.ivu-modal-body {
padding: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
}
}
}
}
}
</style>
<script>
import {mapState} from "vuex";
import DialogWrapper from "./DialogWrapper";
export default {
name: "DialogModal",
components: {DialogWrapper},
data() {
return {
show: false
}
},
computed: {
...mapState(['dialogModalId'])
},
watch: {
dialogModalId: {
handler(id) {
this.show = id > 0;
},
immediate: true
}
},
methods: {
onBeforeClose() {
return new Promise(_ => {
this.$store.state.dialogModalId = 0;
})
},
}
}
</script>

View File

@ -297,6 +297,7 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
beforeBack: Function
}, },
data() { data() {
@ -853,6 +854,20 @@ export default {
}, },
onBack() { onBack() {
if (!this.beforeBack) {
return this.handleBack();
}
const before = this.beforeBack();
if (before && before.then) {
before.then(() => {
this.handleBack();
});
} else {
this.handleBack();
}
},
handleBack() {
const {name, params} = this.$store.state.routeHistoryLast; const {name, params} = this.$store.state.routeHistoryLast;
if (name === this.$route.name && /\d+/.test(params.dialogId)) { if (name === this.$route.name && /\d+/.test(params.dialogId)) {
this.goForward({name: this.$route.name}); this.goForward({name: this.$route.name});

View File

@ -1117,7 +1117,6 @@ export default {
this.msgFile = []; this.msgFile = [];
this.msgText = ""; this.msgText = "";
this.goForward({name: 'manage-messenger', params: {dialogId: data.dialog_id}, query: {_: $A.randomString(6)}}); this.goForward({name: 'manage-messenger', params: {dialogId: data.dialog_id}, query: {_: $A.randomString(6)}});
this.$store.dispatch('openTask', 0);
} else { } else {
this.sendDialogMsg(); this.sendDialogMsg();
} }

View File

@ -132,16 +132,13 @@
</div> </div>
</div> </div>
<transition :name="windowMax768 ? 'mobile-dialog' : ''"> <div class="messenger-msg">
<div v-if="dialogId || !windowMax768" class="messenger-msg">
<div class="msg-dialog-bg"> <div class="msg-dialog-bg">
<div class="msg-dialog-bg-icon"><Icon type="ios-chatbubbles" /></div> <div class="msg-dialog-bg-icon"><Icon type="ios-chatbubbles" /></div>
<div class="msg-dialog-bg-text">{{$L('选择一个会话开始聊天')}}</div> <div class="msg-dialog-bg-text">{{$L('选择一个会话开始聊天')}}</div>
</div> </div>
<DialogWrapper v-if="dialogId > 0" :dialogId="dialogId" @on-active="scrollIntoActive" desktop-auto-focus/> <DialogWrapper v-if="dialogId > 0" :dialogId="dialogId" @on-active="scrollIntoActive" desktop-auto-focus/>
</div> </div>
</transition>
</div> </div>
</div> </div>
</template> </template>

View File

@ -66,8 +66,9 @@ const stateData = {
// 会话聊天 // 会话聊天
dialogMsgs: [], dialogMsgs: [],
dialogMsgTransfer: {time: 0},
dialogInputCache: $A.getStorageArray("cacheDialogInput"), dialogInputCache: $A.getStorageArray("cacheDialogInput"),
dialogMsgTransfer: {time: 0},
dialogModalId: 0,
// 文件 // 文件
files: [], files: [],

View File

@ -245,9 +245,6 @@
.mobile-dialog-leave-active { .mobile-dialog-leave-active {
transition: all 0.3s ease; transition: all 0.3s ease;
.dialog-wrapper {
bottom: -60px;
}
} }
.mobile-dialog-enter, .mobile-dialog-enter,

View File

@ -511,12 +511,8 @@
} }
} }
.messenger-msg { .messenger-msg {
z-index: 49;
background-color: #f8f8f8;
.msg-dialog-bg {
display: none; display: none;
} }
} }
} }
} }
}