弹窗自动退出时关闭
continuous-integration/drone/push Build is passing Details

uat_us
DESKTOP-6C3NK6N\WXS 2024-08-22 13:19:45 +08:00
parent 85c4cf89f6
commit fa2519cba4
4 changed files with 39 additions and 4 deletions

View File

@ -2,12 +2,13 @@ import Vue from "vue";
import MFACOMP from "./index.vue";
const MFAConstructor = Vue.extend(MFACOMP);
let MFAINSTANCELIST = [];
const MFA = options => {
const { UserId, username, EMail, callBack, cancelBack, status = 'login' } = options;
if (!UserId) throw `UserId is requred.but ${UserId}`
const id = `MFA${new Date().getTime()}`;
const instance = new MFAConstructor();
MFAINSTANCELIST.push(instance)
instance.id = id;
instance.vm = instance.$mount();
if (instance.vm.visible) return;
@ -20,7 +21,17 @@ const MFA = options => {
if (cancelBack) cancelBack();
document.body.removeChild(instance.vm.$el);
instance.vm.$destroy();
let index = MFAINSTANCELIST.findIndex(item => item.id === id);
MFAINSTANCELIST.splice(index, 1)
});
return instance.vm;
}
MFA.close = () => {
if (MFAINSTANCELIST.length <= 0) return;
MFAINSTANCELIST.forEach(item => {
document.body.removeChild(item.vm.$el);
item.vm.$destroy();
})
MFAINSTANCELIST = [];
}
export default MFA;

View File

@ -1,17 +1,17 @@
import Vue from "vue";
import FEEDBACKCOMP from "./index.vue";
const FBConstructor = Vue.extend(FEEDBACKCOMP);
let FBCINSTANCELIST = [];
const FB = options => {
const { type, callBack, cancelBack, trialId = null, Id = null, visitTaskId = null, SubjectVisitId = null } = options;
if (!type) throw `type is requred.but ${type}`
const id = `FB${new Date().getTime()}`;
const instance = new FBConstructor();
FBCINSTANCELIST.push(instance);
instance.id = id;
instance.vm = instance.$mount();
if (instance.vm.visible) return;
document.body.appendChild(instance.vm.$el);
console.log(type);
instance.vm.open({ type, trialId, Id, visitTaskId, SubjectVisitId });
instance.vm.$on("success", (Id) => {
if (callBack) callBack();
@ -20,8 +20,18 @@ const FB = options => {
instance.vm.$on("closed", () => {
document.body.removeChild(instance.vm.$el);
instance.vm.$destroy();
let index = FBCINSTANCELIST.findIndex(item => item.id === id);
FBCINSTANCELIST.splice(index, 1)
if (cancelBack) cancelBack()
});
return instance.vm;
}
FB.close = () => {
if (FBCINSTANCELIST.length <= 0) return;
FBCINSTANCELIST.forEach(item => {
document.body.removeChild(item.vm.$el);
item.vm.$destroy();
})
FBCINSTANCELIST = [];
}
export default FB;

View File

@ -1,12 +1,13 @@
import Vue from "vue";
import FEEDBACKCOMP from "./index.vue";
const FBConstructor = Vue.extend(FEEDBACKCOMP);
let FBCTABLEINSTANCELIST = [];
const FBT = (options = {}) => {
const { data = {}, callBack } = options;
// if (!UserId) throw `UserId is requred.but ${UserId}`
const id = `FB${new Date().getTime()}`;
const instance = new FBConstructor();
FBCTABLEINSTANCELIST.push(instance);
instance.id = id;
instance.vm = instance.$mount();
if (instance.vm.visible) return;
@ -18,7 +19,17 @@ const FBT = (options = {}) => {
instance.vm.$on("closed", () => {
document.body.removeChild(instance.vm.$el);
instance.vm.$destroy();
let index = FBCTABLEINSTANCELIST.findIndex(item => item.id === id);
FBCTABLEINSTANCELIST.splice(index, 1)
});
return instance.vm;
}
FBT.close = () => {
if (FBCTABLEINSTANCELIST.length <= 0) return;
FBCTABLEINSTANCELIST.forEach(item => {
document.body.removeChild(item.vm.$el);
item.vm.$destroy();
})
FBCTABLEINSTANCELIST = [];
}
export default FBT;

View File

@ -381,6 +381,9 @@ async function VueInit() {
if (_vm.$msgbox) {
_vm.$msgbox.close();
}
_vm.$FB.close();
_vm.$FBT.close();
_vm.$MFA.close();
isOpen = false
isLock = null
zzSessionStorage.removeItem('isLock')