ymy hace 1 año
padre
commit
a35b3e7ec9

BIN
public/favicon2.ico


+ 1 - 0
src/benyun/components/byArea/byArea.vue

@@ -124,6 +124,7 @@ export default class ByArea extends VueViews {
     }
   }
   setAllValue(data:any){
+    if(!data) return
     if(this.attrs.province){
       this.province=data[this.attrs.province];
     }

+ 1 - 1
src/benyun/components/moduleView/moduleView.vue

@@ -265,7 +265,7 @@ export default class ModuleView extends ModuleViewHandle {
       width: 100%;
     }
     .search-btn{
-      width: 120px;
+      width: 200px;
       display: flex;
       flex-shrink: 0;
       justify-content: flex-end;

+ 2 - 2
src/benyun/utils/auth.ts

@@ -1,8 +1,8 @@
 import Cookies from 'js-cookie'
 
-const TokenKey = 'Admin-Token'
+const TokenKey = 'AdminOMS-Token'
 
-const ExpiresInKey = 'Admin-Expires-In'
+const ExpiresInKey = 'AdminOMS-Expires-In'
 
 export function getToken() {
   return Cookies.get(TokenKey)

+ 56 - 10
src/main.ts

@@ -11,6 +11,7 @@ import plugins from '@/benyun/plugins'
 import directive from './directive' // directive
 import {getDicts} from "@/api/system/dict/data";
 import {getToken} from '@/benyun/utils/auth'
+import {getQueryObject} from '@/benyun/utils'
 
 import '@/assets/styles/index.scss' // global css
 import '@/assets/styles/benyuntech.scss' // young css
@@ -20,7 +21,7 @@ import './permission' // permission control
 
 import Element from 'element-ui'
 import './assets/styles/element-variables.scss'
-import { Message } from 'element-ui';
+import { Message,MessageBox } from 'element-ui';
 
 // import VXETable from 'vxe-table'
 import XEUtils from 'xe-utils'
@@ -123,14 +124,59 @@ function importJS() { // 引入 "天地图"
   })
 }
 
-Promise.all([importJS()]).then(result => {
-  new Vue({
-    router,
-    store,
-    render: h => h(App),
-    data: {
-      eventHub: new Vue()
+function omsLogin() {
+  let params = getQueryObject();
+  const ticket = params.ticket;
+  const ssoToken = params.ssoToken;
+  if(ticket || ssoToken){
+    let data:any = {}
+    const url = ticket ? '/sso/doLoginByTicket' : '/sso/doLoginByToken'
+    if(ticket) {
+      data.ticket = ticket
     }
-  }).$mount('#app')
-})
+    if(ssoToken) {
+      data.token = ssoToken
+    }
+    store.dispatch('GetToken',{
+      url,data
+    }).then(() => {
+      unitVue()
+    }).catch((err:any) => {
+      let msg = '未知错误,请联系管理员!'
+      if(err && err.msg) {
+        msg = err.msg
+      }
+      MessageBox.alert(msg, '提示', {
+        confirmButtonText: '确定',
+        callback: () => {
+          const redirect = location.origin
+          location.href = `${process.env.VUE_APP_LOGIN_URL}?&redirect=${encodeURIComponent(redirect)}`
+        }
+      });
+      
+    })
+  }else if(getToken()){
+    unitVue()
+  }else{
+    const redirect = location.origin;
+    location.href = `${process.env.VUE_APP_LOGIN_URL}?&redirect=${encodeURIComponent(redirect)}`
+  }
+}
+
+function unitVue() {
+  Promise.all([importJS()]).then(result => {
+    new Vue({
+      router,
+      store,
+      render: h => h(App),
+      data: {
+        eventHub: new Vue()
+      }
+    }).$mount('#app')
+  })
+}
+
+omsLogin()
+
+
 

+ 41 - 41
src/permission.ts

@@ -6,7 +6,7 @@ import 'nprogress/nprogress.css'
 import {getToken} from '@/benyun/utils/auth'
 import {isRelogin} from '@/benyun/utils/request'
 // import {getQueryString} from "@/benyun/utils/benyuntech";
-import {getQueryObject} from '@//benyun/utils'
+// import {getQueryObject} from '@/benyun/utils'
 
 NProgress.configure({ showSpinner: false })
 
@@ -37,7 +37,12 @@ const infoHandle = (to:any, next:any) => {
 }
 
 router.beforeEach((to:any, from:any, next:any) => {
+  // console.log(to,from,next)
   NProgress.start()
+  // let params = getQueryObject();
+  // const ticket = params.ticket;
+  // const ssoToken = params.ssoToken;
+
   if (getToken()) {
     to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
     /* has token*/
@@ -52,47 +57,42 @@ router.beforeEach((to:any, from:any, next:any) => {
       }
     // }
   } else {
-    let params = getQueryObject();
-    const ticket = params.ticket;
-    const ssoToken = params.ssoToken;
-    // const ticket = getQueryString('ticket')
-    // const ssoToken = getQueryString('ssoToken')
-
-    if(!ticket && !ssoToken){
-      const redirect = location.origin
-      // const redirect = location.href.replace(/\??ticket=[^&]*&?/g, '')
-      location.href = `${process.env.VUE_APP_LOGIN_URL}?&redirect=${encodeURIComponent(redirect)}`
-    }else{
-      const url = ticket ? '/sso/doLoginByTicket' : '/sso/doLoginByToken'
-      let data:any = {}
-      if(ticket) {
-        data.ticket = ticket
-      }
-      if(ssoToken) {
-        data.token = ssoToken
-      }
-      store.dispatch('GetToken',{
-        url,data
-      }).then(() => {
-        infoHandle(to,next)
-        // location.href = '/index';
-      }).catch((err:any) => {
-        let msg = '未知错误,请联系管理员!'
-        if(err && err.msg) {
-         msg = err.msg
-          // Message.error(err.msg);
-        }
-        MessageBox.alert(msg, '提示', {
-          confirmButtonText: '确定',
-          callback: () => {
-            const redirect = location.origin
-            location.href = `${process.env.VUE_APP_LOGIN_URL}?&redirect=${encodeURIComponent(redirect)}`
-          }
-        });
+    const redirect = location.origin
+    location.href = `${process.env.VUE_APP_LOGIN_URL}?&redirect=${encodeURIComponent(redirect)}`
+    // if(!ticket && !ssoToken){
+    //   const redirect = location.origin
+    //   location.href = `${process.env.VUE_APP_LOGIN_URL}?&redirect=${encodeURIComponent(redirect)}`
+    // }else{
+    //   const url = ticket ? '/sso/doLoginByTicket' : '/sso/doLoginByToken'
+    //   let data:any = {}
+    //   if(ticket) {
+    //     data.ticket = ticket
+    //   }
+    //   if(ssoToken) {
+    //     data.token = ssoToken
+    //   }
+    //   store.dispatch('GetToken',{
+    //     url,data
+    //   }).then(() => {
+    //     infoHandle(to,next)
+    //     // location.href = '/index';
+    //   }).catch((err:any) => {
+    //     let msg = '未知错误,请联系管理员!'
+    //     if(err && err.msg) {
+    //      msg = err.msg
+    //       // Message.error(err.msg);
+    //     }
+    //     MessageBox.alert(msg, '提示', {
+    //       confirmButtonText: '确定',
+    //       callback: () => {
+    //         const redirect = location.origin
+    //         location.href = `${process.env.VUE_APP_LOGIN_URL}?&redirect=${encodeURIComponent(redirect)}`
+    //       }
+    //     });
         
-      })
-      // next()
-    }
+    //   })
+    //   // next()
+    // }
     
 
     // 没有token

+ 9 - 0
vue.config.js

@@ -56,6 +56,15 @@ module.exports = defineConfig({
       }
     }
   },
+  pwa: {
+    iconPaths: {
+      favicon32     : 'favicon.ico',
+      favicon16     : 'favicon.ico',
+      appleTouchIcon: 'favicon.ico',
+      maskIcon      : 'favicon.ico',
+      msTileImage   : 'favicon.ico'
+    }
+  },
   configureWebpack: {
     name: name,
     resolve: {