Commit 3d05de31 by 冒粤蓉

'add

1 parent cf0f2547
......@@ -18,7 +18,7 @@
<!-- 设置按钮 -->
<!-- <setting-button></setting-button> -->
<!-- 全屏按钮 -->
<!-- <full-screen></full-screen> -->
<full-screen></full-screen>
<!-- 用户按钮 -->
<user-button></user-button>
</div>
......
......@@ -10,6 +10,7 @@ import {
FullscreenExitOutlined
} from '@ant-design/icons-vue';
import { reactive, toRefs, onMounted } from 'vue';
import { useStore } from 'vuex';
export default {
name: 'SettingButton',
......@@ -23,41 +24,46 @@ export default {
FullscreenOutlined
},
setup() {
const store = useStore();
const state = reactive({
fullscreen: true,
fullarea: ''
});
const checkFull = () => {
var isFull = window.fullScreen || document.webkitIsFullScreen || document.msFullscreenEnabled;
//to fix : false || undefined == undefined
if (isFull === undefined) {isFull = false;}
return isFull;
}
onMounted(() => {
state.fullarea = document.getElementById('sub-system-frame');
//监听退出全屏事件
window.onresize = function() {
const fullStatus = checkFull();
store.dispatch('app/setFullscreen', fullStatus);
}
})
// 登出操作
const fullScreen = (isFull) => {
let { fullarea } = state;
if (isFull) { // 进入全屏
if (fullarea.requestFullscreen) {
fullarea.requestFullscreen();
} else if (fullarea.webkitRequestFullScreen) {
fullarea.webkitRequestFullScreen();
} else if (fullarea.mozRequestFullScreen) {
fullarea.mozRequestFullScreen();
} else if (fullarea.msRequestFullscreen) {
// IE11
fullarea.msRequestFullscreen();
}
} else { // 退出全屏
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
let { fullarea: element } = state;
// 判断各种浏览器,找到正确的方法
var requestMethod = element.requestFullScreen || //W3C
element.webkitRequestFullScreen || //FireFox
element.mozRequestFullScreen || //Chrome等
element.msRequestFullScreen; //IE11
if (requestMethod) {
requestMethod.call(element);
} else if (typeof window.ActiveXObject !== "undefined") { //for Internet Explorer
var wscript = new ActiveXObject("WScript.Shell");
if (wscript !== null) {
wscript.SendKeys("{F11}");
}
}
}
return {
...toRefs(state),
fullScreen
......@@ -73,5 +79,4 @@ export default {
font-size: 20px;
color: @defaultThemeColor;
}
</style>
</style>
\ No newline at end of file
<template>
<a-layout-footer class="home-footer">
Copyright ©2012-2015 粤ICP备12034057号 深圳广联赛讯有限公司 版权所有
Copyright ©2012-2021 粤ICP备12034057号 深圳广联赛讯有限公司 版权所有
</a-layout-footer>
</template>
......
......@@ -5,9 +5,10 @@ const getters = {
userInfo: state => state.app.userInfo,
baseURL: state => state.app.baseURL,
showLoading: state => state.app.showLoading,
commonData: state => state.app.commonData,
fullscreen: state => state.app.fullscreen,
menu: state => state.menu.menu,
curBreadCrumb: state => state.menu.curBreadCrumb,
commonData: state => state.app.commonData,
updateMenu: state => state.menu.updateMenu
}
......
......@@ -8,7 +8,8 @@ let state = {
showLoading: false,
commonData: {
showEmpty: false
}
},
fullscreen: false
};
try {
......@@ -53,6 +54,9 @@ export default {
},
SHOW_LOADING(state, data) {
state.showLoading = data;
},
SET_FULLSCREEN(state, data) {
state.fullscreen = data;
}
},
actions: {
......@@ -80,5 +84,8 @@ export default {
setCollapsed({ commit }, data) {
commit('SET_COLLAPSED', data)
},
setFullscreen({ commit }, data) {
commit('SET_FULLSCREEN', data)
},
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!