Forráskód Böngészése

Merge branch 'fix_dw'

jwyu 11 hónapja
szülő
commit
b6ad9f65ed
5 módosított fájl, 16 hozzáadás és 12 törlés
  1. 0 1
      index.html
  2. 5 5
      src/api/crypto.js
  3. 1 1
      src/api/http.js
  4. 6 4
      src/utils/parseData.js
  5. 4 1
      src/views/Login.vue

+ 0 - 1
index.html

@@ -12,7 +12,6 @@
 	<link rel="icon" type="image/x-icon" href="./static/fa.ico" id="icon"/>
 	<script src="./static/js/vue.js"></script>  <!-- 开发版,开发过程中使用此方案-->
 	<script src="./static/js/main.js"></script>  <!-- 生产版,打包的时候使用此方案 -->
-	<script src="./static/base_config.js"></script>  <!-- key -->
 	<!-- 引入组件库 -->
 	
 	<!-- oss SDK -->

+ 5 - 5
src/api/crypto.js

@@ -1,16 +1,16 @@
-const key = window.key||'6WpHp4vSvLVQK8SLioNZ7WMq'; //eta
-// const key = 'cJ3b1I4YBlTc85vnxy36xip2'; //逸诺
-// const key = 'bvS3kVp7QIZoD70fPk1wk41n'; //试用
+let key = ''; //eta
 
 class CryptoJS {
 	// 3DES加密,CBC/PKCS5Padding
-	static Des3Encrypt (input) {
+	static Des3Encrypt (input,keyVal) {
+		key=keyVal
 		let genKey = genkey(key, 0, 24);
 		return base64encode(des(genKey.key, input, 1, 1, key.substr(0, 8), 1));
 	}
 
 	// 3DES解密,CBC/PKCS5Padding
-	static Des3Decrypt (input) {
+	static Des3Decrypt (input,keyVal) {
+		key=keyVal
 		let genKey = genkey(key, 0, 24);
 		return des(genKey.key, base64decode(input), 0, 1, key.substr(0, 8), 1);
 	}

+ 1 - 1
src/api/http.js

@@ -44,7 +44,7 @@ function checkStatus(response) {
   //处理响应数据
   if (response && response.status === 200) {
     // loading,如果http状态码正常,则直接返回数据
-    let res = bus.$parseData(response.data);
+    let res = bus.$parseData(response);
     if (!res) {
       bus.$message.error("服务器开了个小差");
       return false;

+ 6 - 4
src/utils/parseData.js

@@ -1,8 +1,10 @@
 import ParserData from '@/api/crypto.js';
 /* 解密数据处理 */
-export function parseData(res) {
-  let result = process.env.NODE_ENV === "production"
-  ? JSON.parse(ParserData.Des3Decrypt(res))
-  : res;
+export function parseData(response) {
+  const headKeyStr=response.headers.dk
+  const desKey=ParserData.Des3Decrypt(headKeyStr,'JMCqSoUrTAmyNNIRb0TtlrPk')
+  let result = process.env.NODE_ENV == "production"
+  ? JSON.parse(ParserData.Des3Decrypt(response.data,desKey))
+  : response.data;
   return result
 }

+ 4 - 1
src/views/Login.vue

@@ -355,10 +355,13 @@ export default {
         },
         ordinaryModelLogin(){
             const {account,checkPass,checked} = this.$refs.ordinaryModel.form
+            const t=new Date().getTime()
+            const md5key='MiQM9yusNA9T2uIH'
             departInterence.userLogin({
                 LoginType:1,
                 Username:account,
-                Password:md5.hex_md5(checkPass)
+                Password: `${md5.hex_md5(md5.hex_md5(checkPass)+md5key+t)}`,
+                ReqTime:`${t}`
             }).then(res=>{
                 //this.logining = false
                 //账号异常 将accountCheck置为true