Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 33e23bc5
authored
Nov 26, 2022
by
luyt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:授权昵称弹框
1 parent
1fa9c5ee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
4 deletions
pages/viewProd/index.js
pages/viewProd/index.scss
pages/viewProd/index.wxml
pages/viewProd/index.js
View file @
33e23bc
...
@@ -14,16 +14,26 @@ Page({
...
@@ -14,16 +14,26 @@ Page({
data
:
{
data
:
{
IMG_URL
,
IMG_URL
,
senceData
,
senceData
,
isShare
:
false
,
//是否是分享出去的
actNum
:
0
,
actNum
:
0
,
tabAct
:
0
,
tabAct
:
0
,
showLeft
:
false
,
//更多按钮显示的内容
showLeft
:
false
,
//更多按钮显示的内容
scrollTop
:
0
scrollTop
:
0
,
img_version
:
0.1
,
// 是否授权昵称
hasUserInfo
:
false
,
phone
:
''
,
//授权手机号
},
},
// 计算属性
// 计算属性
computed
:
{
computed
:
{
showLeftFlag
(
data
)
{
showLeftFlag
(
data
)
{
return
data
.
showLeft
return
data
.
showLeft
}
},
// // 授权昵称弹框显示
// authNcknameShow(){
// }
},
},
/**
/**
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
...
@@ -188,7 +198,7 @@ Page({
...
@@ -188,7 +198,7 @@ Page({
if (confirm) this.init()
if (confirm) this.init()
})
})
},
},
// 获取用户信息
// 获取用户信息
(手机号)
getUserInfo({ detail }) {
getUserInfo({ detail }) {
// console.log(detail);
// console.log(detail);
...
@@ -221,6 +231,36 @@ Page({
...
@@ -221,6 +231,36 @@ Page({
// this.setBtnLoading(false)
// this.setBtnLoading(false)
});
});
},
},
// 获取用户昵称(昵称头像)
getUserProfile(e) {
this.setData({
hasUserInfo: true
})
let _this = this
// 推荐使用 wx.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
// 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({
desc: '用于完善资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: res => {
// console.log('res: ', res.userInfo.nickName);
// userInfo.nickName
this.setData({
userInfo: res.userInfo
})
let wx_user_info = wx.$storage.get('wx_user_info')
// console.log('wx_user_info: ', wx_user_info);
let obj = {
...wx_user_info,
nickName: res.userInfo.nickName,
avatarUrl: res.userInfo.avatarUrl
}
// console.log('obj',obj)
wx.$storage.set('wx_user_info', obj)
_this.onLoad(null)
}
})
},
/**
/**
* 生命周期函数--监听页面显示
* 生命周期函数--监听页面显示
*/
*/
...
...
pages/viewProd/index.scss
View file @
33e23bc
...
@@ -183,3 +183,14 @@ page {
...
@@ -183,3 +183,14 @@ page {
}
}
}
}
}
}
/* 用户授权 */
.user-profile
{
position
:
fixed
;
top
:
0
;
left
:
0
;
right
:
0
;
bottom
:
0
;
z-index
:
3
;
background-color
:
transparent
;
}
pages/viewProd/index.wxml
View file @
33e23bc
...
@@ -49,4 +49,6 @@
...
@@ -49,4 +49,6 @@
</view>
</view>
</view>
</view>
<!-- 申请按钮 -->
<!-- 申请按钮 -->
<apply-button downShow="{{false}}"></apply-button>
\ No newline at end of file
\ No newline at end of file
<apply-button downShow="{{false}}"></apply-button>
<!-- 授权昵称 -->
<view wx:if="{{!hasUserInfo}}" class="user-profile" bindtap="getUserProfile"></view>
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment