lhl 4 years ago
parent
commit
e177ed026a
1 changed files with 10 additions and 1 deletions
  1. 10 1
      utils/newRequest.js

+ 10 - 1
utils/newRequest.js

@@ -1,4 +1,6 @@
 import store from '../store'
+import md5 from './md5.js'
+import sha1 from './sha1.js'
 let service = {
 	// baseURL: store.state.baseURL, // 请求头
 	baseURL: '', // 请求头
@@ -119,12 +121,19 @@ let service = {
 						uni.showLoading({
 							title: '上传中'
 						})
+						let timestamp = new Date().getTime();
+						let appSecret = '55dc12c813b6131578780dcd9cfd9d90';
+						let Appid = 'wx9e9cda4611521ed4';
+						let Sign = md5(sha1(Appid + timestamp + appSecret + timestamp + Appid + appSecret))
 						uni.uploadFile({
 							url: config.upload_img_url, //仅为示例,非真实的接口地址
 							filePath: path,
 							name: 'file',
 							header: {
-								"Authori-zation": 'Bearer ' + uni.getStorageSync('token')
+								"Authori-zation": 'Bearer ' + uni.getStorageSync('token'),
+								"App-id": Appid,
+								"Sign": Sign,
+								"Sign-time": timestamp
 							},
 							success: (uploadFileRes) => {
 								if ("string" === typeof uploadFileRes.data) {