Commit 879b2edc authored by 肖健's avatar 肖健

Merge remote-tracking branch 'origin/dev_cd' into dev_jd

parents 6d9718d6 9ecba1f5
...@@ -246,7 +246,7 @@ export default { ...@@ -246,7 +246,7 @@ export default {
success: function (res) { success: function (res) {
const tempFilePaths = res.tempFilePaths; const tempFilePaths = res.tempFilePaths;
uni.uploadFile({ uni.uploadFile({
url: that.http.baseUrl + '/common/upload', url: that.http.baseUrl + '/app/user/upload',
//url: 'http://192.168.2.21:7001/upload',//仅为示例,非真实的接口地址 //url: 'http://192.168.2.21:7001/upload',//仅为示例,非真实的接口地址
method: 'POST', method: 'POST',
filePath: tempFilePaths[0], filePath: tempFilePaths[0],
...@@ -256,7 +256,8 @@ export default { ...@@ -256,7 +256,8 @@ export default {
}, },
// 请求头一定要加,否则 iOS 图片上传会失败 // 请求头一定要加,否则 iOS 图片上传会失败
header: { header: {
'content-type': 'multipart/form-data' 'content-type': 'multipart/form-data',
'Authorization': 'Bearer ' + uni.getStorageSync('userToken')
}, },
success: (res) => { success: (res) => {
let uploadData = JSON.parse(res.data) let uploadData = JSON.parse(res.data)
...@@ -266,12 +267,12 @@ export default { ...@@ -266,12 +267,12 @@ export default {
}; };
let userInfoItem = { let userInfoItem = {
type: 1, type: 1,
val: uploadData.data.fileName val: uploadData.data.url
}; };
that.http.httpTokenRequest(opts, userInfoItem).then(response => { that.http.httpTokenRequest(opts, userInfoItem).then(response => {
if (response.data.code == 200) { if (response.data.code == 200) {
that.$nextTick(() => { that.$nextTick(() => {
that.image = that.http.baseUrl + uploadData.data.fileName that.image = uploadData.data.url
}) })
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment