Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
user
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hooloo
mp
user
Commits
546e7ac8
Commit
546e7ac8
authored
Oct 19, 2022
by
宋冰琦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改头像修改方式
parent
9a2f1321
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
51 deletions
+104
-51
mineSubPackage/pages/userInfo/index.vue
+81
-33
pages/menu/menu.vue
+2
-2
pages/mine/mine.vue
+18
-15
request/mine/index.js
+3
-1
static/imgs/shareImg.png
+0
-0
No files found.
mineSubPackage/pages/userInfo/index.vue
View file @
546e7ac8
...
@@ -6,12 +6,14 @@
...
@@ -6,12 +6,14 @@
</view>
</view>
<view
class=
"page"
:style=
"
{'padding-top':(systemBarHeight.statusBarHeight+systemBarHeight.navigationBarHeight)+'px'}">
<view
class=
"page"
:style=
"
{'padding-top':(systemBarHeight.statusBarHeight+systemBarHeight.navigationBarHeight)+'px'}">
<view
class=
"avatarBox"
>
<view
class=
"avatarBox"
>
<image
class=
"avatar"
@
click=
"editAvatar"
:src=
"userInfo.avatarUrl"
/>
<button
class=
"avatarBtn"
open-type=
"chooseAvatar"
@
chooseavatar=
"onChooseAvatar"
>
<image
class=
"avatar"
:src=
"userInfo.avatarUrl"
/>
</button>
</view>
</view>
<view
class=
"infoBox"
>
<view
class=
"infoBox"
>
<view
class=
"infoItem name"
>
<view
class=
"infoItem name"
>
<view
class=
"label"
>
昵称
</view>
<view
class=
"label"
>
昵称
</view>
<view
class=
"input"
><input
type=
"
text
"
v-model=
"userInfo.name"
></view>
<view
class=
"input"
><input
type=
"
nickname
"
v-model=
"userInfo.name"
></view>
<view
class=
"tip"
v-if=
"valate"
>
{{
valateText
}}
</view>
<view
class=
"tip"
v-if=
"valate"
>
{{
valateText
}}
</view>
</view>
</view>
<view
class=
"infoItem phone"
>
<view
class=
"infoItem phone"
>
...
@@ -150,7 +152,7 @@ export default {
...
@@ -150,7 +152,7 @@ export default {
},
},
async
onLoad
(
option
)
{
async
onLoad
(
option
)
{
const
{
info
}
=
option
const
{
info
}
=
option
if
(
info
){
//
if(info){
const
{
avatarUrl
,
gender
=
0
,
nickName
=
'点点'
}
=
info
?
JSON
.
parse
(
decodeURIComponent
(
info
)):{}
const
{
avatarUrl
,
gender
=
0
,
nickName
=
'点点'
}
=
info
?
JSON
.
parse
(
decodeURIComponent
(
info
)):{}
const
{
data
}
=
await
Mine
.
getUserInfo
()
const
{
data
}
=
await
Mine
.
getUserInfo
()
const
{
birthday
,
createTime
,
id
,
phone
,
sex
,
userName
}
=
data
.
data
const
{
birthday
,
createTime
,
id
,
phone
,
sex
,
userName
}
=
data
.
data
...
@@ -174,17 +176,17 @@ export default {
...
@@ -174,17 +176,17 @@ export default {
canEditBirthday
:
this
.
canEditBirthday
canEditBirthday
:
this
.
canEditBirthday
}
}
Store
.
commit
(
'setUserInfo'
,
sendData
);
Store
.
commit
(
'setUserInfo'
,
sendData
);
this
.
save
(
false
)
//
this.save(false)
}
else
{
//
}else{
const
{
avatarUrl
,
birthday
,
id
,
phone
,
sex
,
customerName
,
canEditBirthday
}
=
this
.
userInfoStorage
//
const { avatarUrl,birthday, id, phone, sex, customerName, canEditBirthday } = this.userInfoStorage
this
.
canEditBirthday
=
canEditBirthday
//
this.canEditBirthday = canEditBirthday
this
.
userInfo
.
avatarUrl
=
avatarUrl
//
this.userInfo.avatarUrl = avatarUrl
this
.
userInfo
.
sex
=
sex
?
1
:
0
//
this.userInfo.sex = sex?1:0
this
.
userInfo
.
name
=
customerName
//
this.userInfo.name = customerName
this
.
userInfo
.
birthday
=
birthday
//
this.userInfo.birthday = birthday
this
.
userInfo
.
id
=
id
//
this.userInfo.id = id
this
.
userInfo
.
phone
=
phone
//
this.userInfo.phone = phone
}
//
}
},
},
methods
:{
methods
:{
...
@@ -202,20 +204,57 @@ export default {
...
@@ -202,20 +204,57 @@ export default {
}
}
this
.
timerShow
=
false
this
.
timerShow
=
false
},
},
editAvatar
(
e
)
{
// editAvatar(e) {
wx
.
getUserProfile
({
// console.log(123)
desc
:
'用于完善用户资料'
,
// wx.getUserProfile({
success
:(
res
)
=>
{
// desc:'用于完善用户资料',
const
{
userInfo
}
=
res
// success:(res)=>{
const
Info
=
{
// const {userInfo} = res
avatarUrl
:
userInfo
.
avatarUrl
,
// const Info = {
nickName
:
userInfo
.
nickName
// avatarUrl:userInfo.avatarUrl,
}
// nickName:userInfo.nickName
this
.
userInfo
.
avatarUrl
=
Info
.
avatarUrl
// }
this
.
userInfo
.
name
=
Info
.
nickName
// this.userInfo.avatarUrl = Info.avatarUrl
this
.
save
(
false
)
// this.userInfo.name = Info.nickName
}
// this.save(false)
})
// }
// })
// },
async
onChooseAvatar
(
e
)
{
const
{
detail
}
=
e
const
{
avatarUrl
}
=
detail
this
.
userInfo
.
avatarUrl
=
avatarUrl
let
Authorization
=
uni
.
getStorageSync
(
`Authorization`
);
// await Mine.upLoadImg(formData)
// 上传头像接口
uni
.
uploadFile
({
url
:
`
${
this
.
getBaseUrl
()}
/common/uploadOss`
,
filePath
:
avatarUrl
,
name
:
'file'
,
header
:
{
'Authorization'
:
Authorization
},
success
:
(
uploadFileRes
)
=>
{
const
{
data
}
=
uploadFileRes
this
.
userInfo
.
avatarUrl
=
data
}
})
},
getBaseUrl
()
{
let
path
=
process
.
env
.
ENV_PATH
==
undefined
?
require
(
'../../../env/dev.js'
):
require
(
process
.
env
.
ENV_PATH
)
// #ifdef MP-WEIXIN
// ---------------- 根据微信开发环境配置请求地址 --------------------
// 获取当前帐号信息
const
accountInfo
=
wx
.
getAccountInfoSync
();
// env类型 develop:开发版、trial:体验版、release:正式版
const
envWx
=
accountInfo
.
miniProgram
.
envVersion
;
if
(
envWx
===
'release'
){
path
=
'https://api.ihaoin.com'
}
else
{
path
=
'https://hooloo-dev-api.gdatac.com'
}
// #endif
return
path
},
},
openTimer
()
{
openTimer
()
{
this
.
birthdayModalShow
=
false
this
.
birthdayModalShow
=
false
...
@@ -308,13 +347,22 @@ export default {
...
@@ -308,13 +347,22 @@ export default {
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
background
:
#FFFFFF
;
background
:
#FFFFFF
;
.avatarBtn
{
.avatar
{
border
:
0px
;
width
:
200
rpx
;
background
:
white
;
height
:
200
rpx
;
height
:
200
rpx
;
border-radius
:
50%
;
margin
:
0
auto
;
.avatar
{
width
:
200
rpx
;
height
:
200
rpx
;
border-radius
:
50%
;
margin
:
0
auto
;
}
}
}
.avatarBtn
::after
{
border
:
none
;
}
}
}
.infoBox
{
.infoBox
{
...
...
pages/menu/menu.vue
View file @
546e7ac8
...
@@ -214,9 +214,9 @@ export default {
...
@@ -214,9 +214,9 @@ export default {
},
},
methods
:
{
methods
:
{
getShareData
(
type
)
{
getShareData
(
type
)
{
let
title
=
"
HL快乐咖啡,高品高效高性价比
"
;
let
title
=
"
随手一杯好咖啡
"
;
let
path
=
`/pages/menu/menu`
;
let
path
=
`/pages/menu/menu`
;
let
imageUrl
=
"../../static/imgs/
wodezhanweitu
.png"
;
let
imageUrl
=
"../../static/imgs/
shareImg
.png"
;
return
{
return
{
title
,
title
,
imageUrl
,
imageUrl
,
...
...
pages/mine/mine.vue
View file @
546e7ac8
...
@@ -133,7 +133,7 @@ export default {
...
@@ -133,7 +133,7 @@ export default {
loginInfo
:
""
,
loginInfo
:
""
,
img
:
''
,
img
:
''
,
tickNum
:
0
,
tickNum
:
0
,
dayTitle
:
''
dayTitle
:
''
,
}
}
},
},
computed
:
{
computed
:
{
...
@@ -146,9 +146,9 @@ export default {
...
@@ -146,9 +146,9 @@ export default {
},
},
methods
:
{
methods
:
{
getShareData
(
type
)
{
getShareData
(
type
)
{
let
title
=
"
HL快乐咖啡,高品高效高性价比
"
;
let
title
=
"
随手一杯好咖啡
"
;
let
path
=
`/pages/menu/menu`
;
let
path
=
`/pages/menu/menu`
;
let
imageUrl
=
"../../static/imgs/
wodezhanweitu
.png"
;
let
imageUrl
=
"../../static/imgs/
shareImg
.png"
;
return
{
return
{
title
,
title
,
imageUrl
,
imageUrl
,
...
@@ -179,23 +179,26 @@ export default {
...
@@ -179,23 +179,26 @@ export default {
page
==
'order'
&&
uni
.
switchTab
({
url
:
'/pages/order/order'
})
page
==
'order'
&&
uni
.
switchTab
({
url
:
'/pages/order/order'
})
page
==
'msg'
&&
uni
.
navigateTo
({
url
:
'/mineSubPackage/pages/msg/index'
})
page
==
'msg'
&&
uni
.
navigateTo
({
url
:
'/mineSubPackage/pages/msg/index'
})
if
(
page
==
'userInfo'
){
if
(
page
==
'userInfo'
){
if
(
this
.
userInfo
.
avatarUrl
){
// console.log(this.userInfo,'this.userInfo')
uni
.
navigateTo
({
url
:
'/mineSubPackage/pages/userInfo/index'
})
// if(this.userInfo.avatarUrl){
}
else
{
// uni.navigateTo({ url: '/mineSubPackage/pages/userInfo/index'})
wx
.
getUserProfile
({
// }else{
desc
:
'用于完善用户资料'
,
// wx.getUserProfile({
success
:(
res
)
=>
{
// desc:'用于完善用户资料',
const
{
userInfo
}
=
res
// success:(res)=>{
const
{
userInfo
}
=
this
console
.
log
(
userInfo
,
'userInfo'
)
let
defaultImg
=
"https://hooloo-mp.oss-cn-shanghai.aliyuncs.com/resources/touxiang.png"
;
const
Info
=
JSON
.
stringify
({
const
Info
=
JSON
.
stringify
({
avatarUrl
:
userInfo
.
avatarUrl
,
avatarUrl
:
userInfo
.
avatarUrl
||
defaultImg
,
gender
:
userInfo
.
gender
,
gender
:
userInfo
.
gender
,
nickName
:
userInfo
.
nick
Name
nickName
:
userInfo
.
customer
Name
})
})
// console.log(res)
// console.log(res)
page
==
'userInfo'
&&
uni
.
navigateTo
({
url
:
'/mineSubPackage/pages/userInfo/index?info='
+
encodeURIComponent
(
Info
)
})
page
==
'userInfo'
&&
uni
.
navigateTo
({
url
:
'/mineSubPackage/pages/userInfo/index?info='
+
encodeURIComponent
(
Info
)
})
}
//
}
})
//
})
}
//
}
}
}
}
}
}
}
...
...
request/mine/index.js
View file @
546e7ac8
...
@@ -86,5 +86,7 @@ export default {
...
@@ -86,5 +86,7 @@ export default {
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
});
});
}
},
};
};
static/imgs/shareImg.png
0 → 100644
View file @
546e7ac8
5.59 KB
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