Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
b1620a23
Commit
b1620a23
authored
Sep 11, 2023
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
头像上传换移动云
parent
cd8246ad
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
19 deletions
+16
-19
src/pages/userInfo/index.vue
+16
-19
No files found.
src/pages/userInfo/index.vue
View file @
b1620a23
...
@@ -346,34 +346,32 @@ export default {
...
@@ -346,34 +346,32 @@ export default {
wx
.
showLoading
({
wx
.
showLoading
({
title
:
'上传中...'
,
title
:
'上传中...'
,
})
})
this
.
get_oss_config
(()
=>
{
let
fileName
=
`
${
_this
.
ossConfig
.
dir
}${
userImg
.
split
(
"/"
).
pop
()}
`
;
console
.
log
(
fileName
,
'----------fileName'
)
wx
.
uploadFile
({
wx
.
uploadFile
({
url
:
`
${
_this
.
ossConfig
.
host
}
`
,
url
:
`
${
process
.
env
.
OLSHOP_URL
}
/common/uploadFile
`
,
filePath
:
userImg
,
filePath
:
userImg
,
name
:
"file"
,
name
:
"file"
,
formData
:
{
formData
:
{},
key
:
fileName
,
OSSAccessKeyId
:
_this
.
ossConfig
.
accessid
,
policy
:
_this
.
ossConfig
.
policy
,
signature
:
_this
.
ossConfig
.
signature
,
success_action_status
:
"200"
,
},
success
(
res
)
{
success
(
res
)
{
if
(
res
.
statusCode
==
200
)
{
console
.
log
(
res
.
data
,
'--res'
)
let
host
=
try
{
_this
.
ossConfig
.
host
.
substr
(
-
1
)
==
"/"
let
data
=
res
.
data
?
JSON
.
parse
(
res
.
data
)
:
{};
?
_this
.
ossConfig
.
host
if
(
data
.
code
==
200
)
{
:
`
${
_this
.
ossConfig
.
host
}
/`
;
_this
.
userMsg
.
headPortraitUrl
=
data
.
data
.
imgUrl
;
_this
.
userMsg
.
headPortraitUrl
=
`
${
host
}${
fileName
}
`
;
console
.
log
(
_this
.
userMsg
.
headPortraitUrl
,
'---_this.userMsg.headPortraitUrl'
)
console
.
log
(
_this
.
userMsg
.
headPortraitUrl
,
'---_this.userMsg.headPortraitUrl'
)
wx
.
hideLoading
();
wx
.
hideLoading
();
}
}
}
catch
(
error
)
{
wx
.
showToast
({
title
:
"上传失败"
,
icon
:
"error"
,
duration
:
1000
,
});
}
//do something
//do something
},
},
fail
(
res
)
{
fail
(
res
)
{
console
.
log
(
res
,
"-----------------fail"
);
log
.
info
(
res
,
'---上传头像失败'
)
console
.
log
(
res
,
'---上传头像失败'
)
wx
.
showToast
({
wx
.
showToast
({
title
:
"上传失败"
,
title
:
"上传失败"
,
icon
:
"error"
,
icon
:
"error"
,
...
@@ -381,7 +379,6 @@ export default {
...
@@ -381,7 +379,6 @@ export default {
});
});
},
},
});
});
});
},
},
random_string
(
len
)
{
random_string
(
len
)
{
len
=
len
||
32
;
len
=
len
||
32
;
...
...
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