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