Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jd-vx-app
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
jd-vx-app
Commits
f5072243
Commit
f5072243
authored
May 27, 2022
by
fwz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
头像上传
parent
593338a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
personal.vue
pages/personal.vue
+1
-1
userInfo.vue
pagesD/pages/personal/userInfo.vue
+6
-5
No files found.
pages/personal.vue
View file @
f5072243
...
@@ -227,7 +227,7 @@ export default {
...
@@ -227,7 +227,7 @@ export default {
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
this
.
userInfo
=
res
.
data
.
data
this
.
userInfo
=
res
.
data
.
data
if
(
this
.
userInfo
.
avatar
){
if
(
this
.
userInfo
.
avatar
){
this
.
avatar
=
this
.
http
.
baseUrl
+
this
.
userInfo
.
avatar
this
.
avatar
=
this
.
userInfo
.
avatar
}
}
}
}
...
...
pagesD/pages/personal/userInfo.vue
View file @
f5072243
...
@@ -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
})
})
}
}
})
})
...
@@ -328,7 +329,7 @@ export default {
...
@@ -328,7 +329,7 @@ export default {
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
this
.
userInfo
=
res
.
data
.
data
this
.
userInfo
=
res
.
data
.
data
if
(
this
.
userInfo
.
avatar
){
if
(
this
.
userInfo
.
avatar
){
this
.
image
=
this
.
http
.
baseUrl
+
this
.
userInfo
.
avatar
this
.
image
=
this
.
userInfo
.
avatar
}
}
this
.
formData
.
forEach
(
element
=>
{
this
.
formData
.
forEach
(
element
=>
{
if
(
element
.
label
===
'手机号'
)
{
if
(
element
.
label
===
'手机号'
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment