Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xinrenli-app
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
郑云飞
xinrenli-app
Commits
dcb62df5
Commit
dcb62df5
authored
Apr 10, 2023
by
honghong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
头像
parent
32134905
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
38 deletions
+39
-38
pages/my/index.vue
+39
-38
No files found.
pages/my/index.vue
View file @
dcb62df5
...
@@ -5,7 +5,8 @@
...
@@ -5,7 +5,8 @@
<view
class=
"content-in"
>
<view
class=
"content-in"
>
<view
class=
"content-in-info baiyin-flex baiyin-flex-c-b"
>
<view
class=
"content-in-info baiyin-flex baiyin-flex-c-b"
>
<button
class=
"content-in-info-l"
type=
"balanced"
open-type=
"chooseAvatar"
@
chooseavatar=
"onChooseavatar"
>
<button
class=
"content-in-info-l"
type=
"balanced"
open-type=
"chooseAvatar"
@
chooseavatar=
"onChooseavatar"
>
<image
src=
"@/static/icon/my03.png"
mode=
""
></image>
<image
v-if=
"!headImgUrl"
src=
"@/static/icon/my03.png"
mode=
""
></image>
<image
v-else
:src=
"headImgUrl"
mode=
""
></image>
</button>
</button>
<view
v-if=
"token"
class=
"content-in-info-r"
>
<view
v-if=
"token"
class=
"content-in-info-r"
>
<view
class=
"content-in-info-r-t baiyin-flex"
>
<view
class=
"content-in-info-r-t baiyin-flex"
>
...
@@ -125,16 +126,19 @@ export default {
...
@@ -125,16 +126,19 @@ export default {
}
}
],
],
token
:
''
,
token
:
''
,
userParams
:{
uploadUrl
:
apiBaseConfig
.
upload
,
nickname
:
''
,
headImgUrl
:
''
headImgUrl
:
''
,
}
};
};
},
},
onLoad
()
{
onLoad
()
{
let
that
=
this
let
that
=
this
if
(
that
.
$store
.
state
.
login
.
userInfo
&&
that
.
$store
.
state
.
login
.
userInfo
.
user
){
console
.
log
(
that
.
$store
.
state
.
login
.
userInfo
.
user
,
'打死你'
)
if
(
that
.
$store
.
state
.
login
.
userInfo
&&
that
.
$store
.
state
.
login
.
userInfo
.
user
&&
that
.
$store
.
state
.
login
.
userInfo
.
user
.
nickname
){
that
.
nickname
=
that
.
$store
.
state
.
login
.
userInfo
.
user
.
nickname
that
.
nickname
=
that
.
$store
.
state
.
login
.
userInfo
.
user
.
nickname
}
if
(
that
.
$store
.
state
.
login
.
userInfo
&&
that
.
$store
.
state
.
login
.
userInfo
.
user
&&
that
.
$store
.
state
.
login
.
userInfo
.
user
.
headImgUrl
){
that
.
headImgUrl
=
that
.
$store
.
state
.
login
.
userInfo
.
user
.
headImgUrl
}
}
let
token
=
uni
.
getStorageSync
(
'token'
)
let
token
=
uni
.
getStorageSync
(
'token'
)
console
.
log
(
'token'
,
token
)
console
.
log
(
'token'
,
token
)
...
@@ -150,43 +154,40 @@ export default {
...
@@ -150,43 +154,40 @@ export default {
// return;
// return;
let
that
=
this
;
let
that
=
this
;
const
{
avatarUrl
}
=
e
.
detail
;
const
{
avatarUrl
}
=
e
.
detail
;
that
.
fdsa
=
avatarUrl
;
that
.
fdsa
=
avatarUrl
;
wx
.
getFileSystemManager
().
readFile
({
that
.
uploadFilePromise
(
avatarUrl
)
filePath
:
avatarUrl
,
//选择图片返回的相对路径
},
// encoding: 'base64', //编码格式
uploadFilePromise
(
url
)
{
success
:
res
=>
{
let
that
=
this
//成功的回调
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
res
,
'返回值,'
);
let
a
=
uni
.
uploadFile
({
console
.
log
(
res
.
data
,
'的撒胡'
);
url
:
this
.
uploadUrl
,
// 仅为示例,非真实的接口地址
filePath
:
url
,
// that.$set(that.userParams,'headImgUrl',res.data)
name
:
'file'
,
// userUpdatePOST({
header
:
{
// headImgUrl: res.data
'Authorization'
:
`Bearer
${
uni
.
getStorageSync
(
'token'
)}
`
// }).then(res => {
},
// console.log(res.code, 'pppppppppppp');
success
:
(
res
)
=>
{
// if (res.code === 200) {
const
{
// uni.showToast({
data
// title: '修改成功',
}
=
JSON
.
parse
(
res
.
data
);
// icon: 'none'
that
.
updateUser
({
headImgUrl
:
data
.
url
})
// });
// console.log(111111111111);
setTimeout
(()
=>
{
// }
resolve
(
data
.
url
)
// });
},
1000
)
},
}
fail
:
err
=>
{
});
console
.
log
(
err
,
'啊hi吧I'
)
})
}
});
},
},
inputNameConfirm
(
e
)
{
inputNameConfirm
(
e
)
{
console
.
log
(
'======inputNameConfirm:'
,
e
.
detail
.
value
);
console
.
log
(
'======inputNameConfirm:'
,
e
.
detail
.
value
);
let
that
=
this
let
that
=
this
that
.
$set
(
that
.
userParams
,
'nickname'
,
e
.
detail
.
value
)
this
.
updateUser
({
nickname
:
e
.
detail
.
value
})
this
.
updateUser
()
},
},
async
updateUser
(){
async
updateUser
(
data
){
let
that
=
this
let
that
=
this
const
back_data
=
await
updateUserMsg
(
that
.
userParams
)
const
back_data
=
await
updateUserMsg
(
data
)
console
.
log
(
back_data
)
console
.
log
(
back_data
)
const
{
code
}
=
back_data
const
{
code
}
=
back_data
if
(
code
===
200
){
if
(
code
===
200
){
...
...
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