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
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
44 deletions
+97
-44
mineSubPackage/pages/userInfo/index.vue
+74
-26
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 @@
</view>
<view
class=
"page"
:style=
"
{'padding-top':(systemBarHeight.statusBarHeight+systemBarHeight.navigationBarHeight)+'px'}">
<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
class=
"infoBox"
>
<view
class=
"infoItem name"
>
<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>
<view
class=
"infoItem phone"
>
...
...
@@ -150,7 +152,7 @@ export default {
},
async
onLoad
(
option
)
{
const
{
info
}
=
option
if
(
info
){
//
if(info){
const
{
avatarUrl
,
gender
=
0
,
nickName
=
'点点'
}
=
info
?
JSON
.
parse
(
decodeURIComponent
(
info
)):{}
const
{
data
}
=
await
Mine
.
getUserInfo
()
const
{
birthday
,
createTime
,
id
,
phone
,
sex
,
userName
}
=
data
.
data
...
...
@@ -174,17 +176,17 @@ export default {
canEditBirthday
:
this
.
canEditBirthday
}
Store
.
commit
(
'setUserInfo'
,
sendData
);
this
.
save
(
false
)
}
else
{
const
{
avatarUrl
,
birthday
,
id
,
phone
,
sex
,
customerName
,
canEditBirthday
}
=
this
.
userInfoStorage
this
.
canEditBirthday
=
canEditBirthday
this
.
userInfo
.
avatarUrl
=
avatarUrl
this
.
userInfo
.
sex
=
sex
?
1
:
0
this
.
userInfo
.
name
=
customerName
this
.
userInfo
.
birthday
=
birthday
this
.
userInfo
.
id
=
id
this
.
userInfo
.
phone
=
phone
}
//
this.save(false)
//
}else{
//
const { avatarUrl,birthday, id, phone, sex, customerName, canEditBirthday } = this.userInfoStorage
//
this.canEditBirthday = canEditBirthday
//
this.userInfo.avatarUrl = avatarUrl
//
this.userInfo.sex = sex?1:0
//
this.userInfo.name = customerName
//
this.userInfo.birthday = birthday
//
this.userInfo.id = id
//
this.userInfo.phone = phone
//
}
},
methods
:{
...
...
@@ -202,21 +204,58 @@ export default {
}
this
.
timerShow
=
false
},
editAvatar
(
e
)
{
wx
.
getUserProfile
({
desc
:
'用于完善用户资料'
,
success
:(
res
)
=>
{
const
{
userInfo
}
=
res
const
Info
=
{
avatarUrl
:
userInfo
.
avatarUrl
,
nickName
:
userInfo
.
nickName
}
this
.
userInfo
.
avatarUrl
=
Info
.
avatarUrl
this
.
userInfo
.
name
=
Info
.
nickName
this
.
save
(
false
)
// editAvatar(e) {
// console.log(123)
// wx.getUserProfile({
// desc:'用于完善用户资料',
// success:(res)=>{
// const {userInfo} = res
// const Info = {
// avatarUrl:userInfo.avatarUrl,
// nickName:userInfo.nickName
// }
// this.userInfo.avatarUrl = Info.avatarUrl
// 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
()
{
this
.
birthdayModalShow
=
false
this
.
timerShow
=
true
...
...
@@ -308,6 +347,10 @@ export default {
display
:
flex
;
align-items
:
center
;
background
:
#FFFFFF
;
.avatarBtn
{
border
:
0px
;
background
:
white
;
height
:
200
rpx
;
.avatar
{
width
:
200
rpx
;
...
...
@@ -316,6 +359,11 @@ export default {
margin
:
0
auto
;
}
}
.avatarBtn
::after
{
border
:
none
;
}
}
.infoBox
{
z-index
:
1
;
...
...
pages/menu/menu.vue
View file @
546e7ac8
...
...
@@ -214,9 +214,9 @@ export default {
},
methods
:
{
getShareData
(
type
)
{
let
title
=
"
HL快乐咖啡,高品高效高性价比
"
;
let
title
=
"
随手一杯好咖啡
"
;
let
path
=
`/pages/menu/menu`
;
let
imageUrl
=
"../../static/imgs/
wodezhanweitu
.png"
;
let
imageUrl
=
"../../static/imgs/
shareImg
.png"
;
return
{
title
,
imageUrl
,
...
...
pages/mine/mine.vue
View file @
546e7ac8
...
...
@@ -133,7 +133,7 @@ export default {
loginInfo
:
""
,
img
:
''
,
tickNum
:
0
,
dayTitle
:
''
dayTitle
:
''
,
}
},
computed
:
{
...
...
@@ -146,9 +146,9 @@ export default {
},
methods
:
{
getShareData
(
type
)
{
let
title
=
"
HL快乐咖啡,高品高效高性价比
"
;
let
title
=
"
随手一杯好咖啡
"
;
let
path
=
`/pages/menu/menu`
;
let
imageUrl
=
"../../static/imgs/
wodezhanweitu
.png"
;
let
imageUrl
=
"../../static/imgs/
shareImg
.png"
;
return
{
title
,
imageUrl
,
...
...
@@ -179,23 +179,26 @@ export default {
page
==
'order'
&&
uni
.
switchTab
({
url
:
'/pages/order/order'
})
page
==
'msg'
&&
uni
.
navigateTo
({
url
:
'/mineSubPackage/pages/msg/index'
})
if
(
page
==
'userInfo'
){
if
(
this
.
userInfo
.
avatarUrl
){
uni
.
navigateTo
({
url
:
'/mineSubPackage/pages/userInfo/index'
})
}
else
{
wx
.
getUserProfile
({
desc
:
'用于完善用户资料'
,
success
:(
res
)
=>
{
const
{
userInfo
}
=
res
// console.log(this.userInfo,'this.userInfo')
// if(this.userInfo.avatarUrl){
// uni.navigateTo({ url: '/mineSubPackage/pages/userInfo/index'})
// }else{
// wx.getUserProfile({
// desc:'用于完善用户资料',
// 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
({
avatarUrl
:
userInfo
.
avatarUrl
,
avatarUrl
:
userInfo
.
avatarUrl
||
defaultImg
,
gender
:
userInfo
.
gender
,
nickName
:
userInfo
.
nick
Name
nickName
:
userInfo
.
customer
Name
})
// console.log(res)
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 {
.
catch
((
err
)
=>
{
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