yunxing il y a 4 ans
Parent
commit
d261f16f8c
3 fichiers modifiés avec 34 ajouts et 9 suppressions
  1. 5 4
      package.json
  2. 13 5
      src/App.vue
  3. 16 0
      src/utils/crypto.js

+ 5 - 4
package.json

@@ -45,15 +45,16 @@
     "@vue/cli-plugin-vuex": "~4.5.0",
     "@vue/cli-service": "~4.5.0",
     "babel-plugin-import": "^1.13.0",
+    "crypto-js": "^4.0.0",
+    "fengmap": "^2.5.3",
     "less": "^3.0.4",
     "less-loader": "^5.0.0",
+    "node-ssh": "^6.0.0",
+    "polybooljs": "^1.2.0",
     "postcss-pxtorem": "^5.1.1",
     "terser-webpack-plugin": "^4.1.0",
     "typescript": "~3.9.3",
     "vue-template-compiler": "^2.6.11",
-    "webpack-bundle-analyzer": "^3.8.0",
-    "fengmap": "^2.5.3",
-    "polybooljs": "^1.2.0",
-    "node-ssh": "^6.0.0"
+    "webpack-bundle-analyzer": "^3.8.0"
   }
 }

+ 13 - 5
src/App.vue

@@ -58,6 +58,8 @@ Vue.use(Tabbar).use(TabbarItem).use(Loading)
 import store from './store/index'
 import NarBar from './components/Navbar'
 import { osInfo } from './utils/util'
+import { decrypted } from "./utils/crypto.js";
+
 window.fengmapData = null
 export default {
     name: 'App',
@@ -194,15 +196,21 @@ export default {
          * 处理url参数
          */
         handleUrl() {
-            let url = window.location.href
+            let href = window.location.href.split('?')[1]
+            if(!href){
+                this.urlFlag =  false 
+                return
+            }
+            // 解密url
+            let url = decrypted(href) // window.location.href
             let params = this.queryURLParams(url)
             // console.log('%c 路径参数:', 'color:blue')
             // console.log(params)
             let { username, plazaId } = params
-            if(! (username && plazaId)){
-                this.urlFlag =  false 
-                return
-            }
+            // if(! (username && plazaId)){
+            //     this.urlFlag =  false 
+            //     return
+            // }
             if (username) {
                 this.SETSSOTOKEN(`admin:${username}`)
             }

+ 16 - 0
src/utils/crypto.js

@@ -0,0 +1,16 @@
+import CryptoJS from 'crypto-js'
+import moment from 'moment'
+// 密钥
+const secretKey = 'B447B88D5AF5A99A' + moment().format('YYYYMMDD');
+
+//模拟参数
+const url = 'username=wangjintao&plazaId=1000772&time=1611108153087&assead=1231231'
+
+// 加密
+export  function encrypted (url,secretKey){
+    return CryptoJS.AES.encrypt(url, secretKey).toString();
+}
+// 解密
+export function decrypted (url) {
+    return CryptoJS.AES.decrypt(url, secretKey).toString(CryptoJS.enc.Utf8);
+}