Browse Source

请求头

hwq 4 years ago
parent
commit
98c90811bd
3 changed files with 14261 additions and 7 deletions
  1. 14254 1
      package-lock.json
  2. 1 0
      package.json
  3. 6 6
      src/request/request.js

File diff suppressed because it is too large
+ 14254 - 1
package-lock.json


+ 1 - 0
package.json

@@ -11,6 +11,7 @@
     "axios": "^0.21.1",
     "core-js": "^2.6.5",
     "element-ui": "^2.15.2",
+    "js-md5": "^0.7.3",
     "md5": "^2.3.0",
     "vue": "^2.6.10",
     "vue-router": "^3.0.3",

+ 6 - 6
src/request/request.js

@@ -25,18 +25,18 @@ service.interceptors.request.use(
 		var Appid = 'wx9e9cda4611521ed4';
 		console.log(md5,sha1)
 		let Sign = md5(sha1(Appid + timestamp + appSecret + timestamp + Appid + appSecret))
-		
-		if (!config.header) {
-			config.header = {
+		console.log(config)
+		if (!config.headers) {
+			config.headers = {
 				"App-id": Appid,
 				"Sign": Sign,
 				"Sign-time": timestamp
 			}
 		} else {
 			// 添加key请求头
-			config.header["App-id"] = Appid;
-			config.header['Sign-time'] = timestamp;
-			config.header['Sign'] = Sign;
+			config.headers["App-id"] = Appid;
+			config.headers['Sign-time'] = timestamp;
+			config.headers['Sign'] = Sign;
 		}
 		return config
 	},

Some files were not shown because too many files changed in this diff