<template>
<div class="app">
<transition>
<router-view v-if="$store.state.appStatus=='success'" />
</transition>
<transition>
<div
v-if="$store.state.appStatus!='success'"
class="loader"
>
<div class="pl-logo-lg fadeInUp animated">
<img
:src="logoSrc"
v-if="logoSrc!=''"
>
</div>
<span class="txt">
<span v-for="(str,index) in loadTexts" :key="index">{{str}}</span>
<span class="msgInfo" v-if="$store.state.appStatus=='loading'">{{$t('hivuiMain_sysLoading')}}</span>
<span class="msgInfo"
v-if="$store.state.appStatus!='loading'&&!mainPageInitErrorJump"
style="color:red"
@click="handleReload"
>{{$store.state.appStatusMsg||$t('hivuiMain_loadedFailClickRefresh')}}</span>
</span>
</div>
</transition>
</div>
</template>
<script>
import Cookies from 'js-cookie'
import LoginPic from "@main/assets/logo_max.png"
import { getUrlValue, setUrlValue,getUrlSearch } from "@main/utils";
import { getToken } from '@main/utils/auth'
export default {
data() {
return {
loadTexts: "",
logoSrc: "",
mainPageInitErrorJump:window.mainPageInitErrorJump,
};
},
methods: {
handleReload() {
window.location.reload();
},
detectZoom (){
var ratio = 0,
screen = window.screen,
ua = navigator.userAgent.toLowerCase();
if (window.devicePixelRatio !== undefined) {
ratio = window.devicePixelRatio;
}
else if (~ua.indexOf('msie')) {
if (screen.deviceXDPI && screen.logicalXDPI) {
ratio = screen.deviceXDPI / screen.logicalXDPI;
}
}
else if (window.outerWidth !== undefined && window.innerWidth !== undefined) {
ratio = window.outerWidth / window.innerWidth;
}
if (ratio){
ratio = Math.round(ratio * 100);
}
return ratio;
},
checkZoom(){
let ratio = this.detectZoom();
if(ratio!=100){
// this.$message.error('警告,浏览器没有按正常比例显示会影响部份功能!')
}
},
},
mounted() {
// this.checkZoom();
// window.addEventListener('resize',()=>{
// this.checkZoom();
// });
let me=this;
// 设置任务中心刷新状态
top.window.__setRefreshTaskcenter = function (state) {
if(state==undefined){
state = true;
}
top.window.__refreshTaskcenter = state;
}
let urlPn=getUrlValue(location.search,"pn");
if(urlPn){
if(!getUrlValue(window.HIVUI_SETTING.loginUrl,"pn")){
window.HIVUI_SETTING.loginUrl+="?pn="+urlPn;
}
if(!getUrlValue(window.HIVUI_SETTING.mainPageUrl,"pn")){
window.HIVUI_SETTING.mainPageUrl+="?pn="+urlPn;
}
if(!getUrlValue(window.HIVUI_SETTING.customLoginUrl,"pn")){
window.HIVUI_SETTING.customLoginUrl+="?pn="+urlPn;
}
}
//如果token不一致,替换掉然后重新载入
let urlToken=getUrlValue(location.href,"access_token");
let nowToken=getToken();
if(false&&!window._global&&urlToken&&nowToken&&(urlToken!=nowToken)){//正式环境
let newUrl=setUrlValue(decodeURIComponent(location.href),"access_token",nowToken);
location=newUrl;
location.reload();
}
//系统间跳转,将ticket去除
if(!window._global&&getUrlValue(decodeURIComponent(location.href),"ticket")){
let newUrl=setUrlValue(decodeURIComponent(location.href),"ticket","");
location=newUrl.replace("&ticket=","")+(location.hash?location.hash:"#/");
//location.reload();
}
window.Scp = {
User: {
id: "admin",
name: "管理员",
deptId: "",
deptName: "",
positionId: "GLY",
postionName: "管理员",
bzId: "admin_3",
bzName: "管理员岗位3",
bzDeptId: ".WLDJT.DGS",
bzDeptName: "D公司",
bzPositionId: "HQRY",
bzPositionName: "后勤人员",
orgId: "admin_3",
defOrgId: "admin_3"
}
}
//customSysCofig默认值
window.customSysCofig=_.merge({
showMiniLogin:true,
},window.customSysCofig);
if(!window.localStorage.getItem("locale")){
window.localStorage.setItem("locale",JSON.stringify({
desc:"中文",
name:"zh-CN",
}));
Cookies.set("locale","zh-CN");
}
window.__guid = new Date().valueOf();
//window.customSysCofig=_.merge(window.default_customSysCfg,window.customSysCofig||{});
window==top&&window.customSysCofig&&window.customSysCofig.thirdParty&&window.customSysCofig.thirdParty.forEach((item)=>{//第三方脚本样式资源引用
let _dom;
switch(item.type){
case "js":
_dom=document.createElement("script");
_dom.type="text/javascript";
_dom.src=item.link;
if(item.callback){
_dom.onload=()=>{
item.callback();
}
}
break;
case "css":
_dom=document.createElement("link");
_dom.rel="stylesheet";
_dom.href=item.link;
break;
}
document.querySelector("head").appendChild(_dom);
});
setTimeout(()=>{
window.__sysConfig = _.merge({
events: {
onLoad1: function () {
}
},
projectName: "eaptpl",
/*sysProjectMange: {
id: __guid++,
name: '工程树',
iconClass: 'icon-tree',
uri: 'amreport/designer/tree/design.do',
url: '/amrept-web/amreport/designer/tree/design.do'
},*/
sysList: [
],
langList:{
id: __guid++,
name: (window.localStorage.getItem("locale")?(JSON.parse(window.localStorage.getItem("locale")).desc):"中文"),
type: 'lang',
iconClass: 'icon-edit',
children: [
{
id: __guid++,
name:"中文",
handler:function(){
window.localStorage.setItem("locale",JSON.stringify({
desc:"中文",
name:"zh-CN",
}));
Cookies.set("locale","zh-CN");
window.location.reload();
},
}, {
id: __guid++,
name:"English",
handler:function(){
window.localStorage.setItem("locale",JSON.stringify({
desc:"English",
name:"en",
}));
Cookies.set("locale","en");
window.location.reload();
},
},
]
},
userInfo:{
id: __guid++,
name: '${fusername}',
type: 'userInfo',
iconClass: 'icon-user',
children: [
{
id: __guid++,
name:me.$t('hivuiMain_app_user')+':${fusername}/${fuserid}',
iconClass:'icon-user',
},
{
id: __guid++,
name:me.$t('hivuiMain_app_orgbz')+':${fbzname}/${fbzid}',
iconClass:'icon-user',
type:"orgBz",
},
{
id: __guid++,
name:me.$t('hivuiMain_app_orgname')+':${forgname}/${forgid}',
iconClass:'icon-user',
},
{
id: __guid++,
name:me.$t('hivuiMain_app_rolename')+':${frolename}/${froleid}',
iconClass:'icon-user',
},
{
id: __guid++,
name:me.$t('hivuiMain_app_personal_Center'),
iconClass:'icon-user',
type: "personalCenter"
},
/*{
id: __guid++,
iconClass:'icon-edit',
name:'修改用户信息',
type:'modifyUserInfo',
},*/
{
id: __guid++,
iconClass:'icon-edit',
name:me.$t('hivuiMain_app_modifyPw'),
type:'modifyPw',
},
]
},
},window.customSysCofig);
this.$store.dispatch("app/getSysConfig").then(res=>{
let cfg = this.$store.state.app.config || {};
let loadText = (cfg.sysLoadLogo && cfg.sysLoadLogo.title) || "";
let logoSrc = (cfg.sysLoadLogo && cfg.sysLoadLogo.src) || "";
this.loadTexts=loadText.split("");
this.logoSrc=logoSrc||LoginPic;
});
},0);
}
};
</script>
<style scoped>
.app {
height: 100%;
background: linear-gradient(
rgb(255, 255, 255) 0px,
rgb(243, 248, 253) 50%,
rgb(229, 240, 250)
);
}
.animated {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
@-webkit-keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
to {
opacity: 1;
-webkit-transform: translateZ(0);
transform: translateZ(0);
}
}
@keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
to {
opacity: 1;
-webkit-transform: translateZ(0);
transform: translateZ(0);
}
}
.fadeInUp {
-webkit-animation-name: fadeInUp;
animation-name: fadeInUp;
}
@-webkit-keyframes fadeInDown {
0% {
opacity: 0;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
to {
opacity: 1;
-webkit-transform: translateZ(0);
transform: translateZ(0);
}
}
@keyframes fadeInDown {
0% {
opacity: 0;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
to {
opacity: 1;
-webkit-transform: translateZ(0);
transform: translateZ(0);
}
}
.fadeInDown {
-webkit-animation-name: fadeInDown;
animation-name: fadeInDown;
}
.loader {
position: absolute;
top: 50%;
left: 50%;
margin-top: -50px;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-mos-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: default;
}
.loader .txt {
display: inline-block;
word-break: normal;
white-space: nowrap;
margin: auto;
text-shadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9,
0 5px 0 #aaa, 0 6px 1px rgba(0, 0, 0, 0.1), 0 0 5px rgba(0, 0, 0, 0.1),
0 1px 3px rgba(0, 0, 0, 0.1), 0 3px 5px rgba(0, 0, 0, 0.1),
0 5px 10px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.1),
0 20px 20px rgba(0, 0, 0, 0.15);
}
.loader .txt span {
display: inline-block;
font-size: 68px !important;
padding: 0 5px;
-webkit-animation: text cubic-bezier(0.75, 0, 0.5, 1) 1.2s infinite;
-moz-animation: text cubic-bezier(0.75, 0, 0.5, 1) 1.2s infinite;
-moz-animation: text cubic-bezier(0.75, 0, 0.5, 1) 1.2s infinite;
-ms-animation: text cubic-bezier(0.75, 0, 0.5, 1) 1.2s infinite;
-o-animation: text cubic-bezier(0.75, 0, 0.5, 1) 1.2s infinite;
animation: text cubic-bezier(0.75, 0, 0.5, 1) 1.2s infinite;
color: #0066cc;
}
.loader .txt span:nth-child(1) {
-webkit-animation-delay: 0ms;
-moz-animation-delay: 0ms;
-ms-animation-delay: 0ms;
-o-animation-delay: 0ms;
animation-delay: 0ms;
}
.loader .txt span:nth-child(2) {
-webkit-animation-delay: 100ms;
-moz-animation-delay: 100ms;
-ms-animation-delay: 100ms;
-o-animation-delay: 100ms;
animation-delay: 100ms;
}
.loader .txt span:nth-child(3) {
-webkit-animation-delay: 200ms;
-moz-animation-delay: 200ms;
-ms-animation-delay: 200ms;
-o-animation-delay: 200ms;
animation-delay: 200ms;
}
.loader .txt span:nth-child(4) {
-webkit-animation-delay: 300ms;
-moz-animation-delay: 300ms;
-ms-animation-delay: 300ms;
-o-animation-delay: 300ms;
animation-delay: 300ms;
}
.loader .txt span:nth-child(5) {
-webkit-animation-delay: 400ms;
-moz-animation-delay: 400ms;
-ms-animation-delay: 400ms;
-o-animation-delay: 400ms;
animation-delay: 400ms;
}
.loader .txt span:nth-child(6) {
-webkit-animation-delay: 500ms;
-moz-animation-delay: 500ms;
-ms-animation-delay: 500ms;
-o-animation-delay: 500ms;
animation-delay: 500ms;
}
.loader .txt span:nth-child(7) {
-webkit-animation-delay: 600ms;
-moz-animation-delay: 600ms;
-ms-animation-delay: 600ms;
-o-animation-delay: 600ms;
animation-delay: 600ms;
}
.loader .txt span:nth-child(8) {
-webkit-animation-delay: 700ms;
-moz-animation-delay: 700ms;
-ms-animation-delay: 700ms;
-o-animation-delay: 700ms;
animation-delay: 700ms;
}
.loader .txt span:nth-child(9) {
-webkit-animation-delay: 800ms;
-moz-animation-delay: 800ms;
-ms-animation-delay: 800ms;
-o-animation-delay: 800ms;
animation-delay: 800ms;
}
.loader .txt span:nth-child(10) {
-webkit-animation-delay: 900ms;
-moz-animation-delay: 900ms;
-ms-animation-delay: 900ms;
-o-animation-delay: 900ms;
animation-delay: 900ms;
}
.loader .txt span:nth-child(11) {
-webkit-animation-delay: 1000ms;
-moz-animation-delay: 1000ms;
-ms-animation-delay: 1000ms;
-o-animation-delay: 1000ms;
animation-delay: 1000ms;
}
.loader .txt span:nth-child(12) {
-webkit-animation-delay: 1100ms;
-moz-animation-delay: 1100ms;
-ms-animation-delay: 1100ms;
-o-animation-delay: 1100ms;
animation-delay: 1100ms;
}
.loader .txt span:nth-child(13) {
-webkit-animation-delay: 1200ms;
-moz-animation-delay: 1200ms;
-ms-animation-delay: 1200ms;
-o-animation-delay: 1200ms;
animation-delay: 1200ms;
}
.loader .txt span.msgInfo {
display: block;
padding-top: 15px;
font-size: 16px !important;
text-shadow: none;
color: #0272bd;
text-shadow: none;
animation: none;
-webkit-animation: none;
}
@-webkit-keyframes text {
0% {
color: #0066cc;
}
40% {
color: #fff;
}
70%,
100% {
color: #0066cc;
}
}
@-moz-keyframes text {
0% {
color: #0066cc;
}
40% {
color: #fff;
}
70%,
100% {
color: #0066cc;
}
}
@-mos-keyframes text {
0% {
color: #0066cc;
}
40% {
color: #fff;
}
70%,
100% {
color: #0066cc;
}
}
@-o-keyframes text {
0% {
color: #0066cc;
}
40% {
color: #fff;
}
70%,
100% {
color: #0066cc;
}
}
@keyframes text {
0% {
color: #0066cc;
}
40% {
color: #fff;
}
70%,
100% {
color: #0066cc;
}
}
</style>