Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
crisis-event-miniprogram
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
liangyuhang
crisis-event-miniprogram
Commits
dc94002c
Commit
dc94002c
authored
Jul 06, 2022
by
liangyuhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户登录退出
parent
219f1d76
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
3 deletions
+90
-3
pages/report/report.json
+4
-1
pages/usercenter/usercenter.js
+86
-2
No files found.
pages/
crisisrep/crisisrep
.json
→
pages/
report/report
.json
View file @
dc94002c
{
{
"usingComponents"
:
{}
"usingComponents"
:
{
"reportList"
:
"/components/reportList/reportList"
}
}
}
\ No newline at end of file
pages/
crisisrep/crisisrep
.js
→
pages/
usercenter/usercenter
.js
View file @
dc94002c
// pages/crisisrep/crisisrep.js
// pages/usercenter/usercenter.js
const
app
=
getApp
()
var
http
=
require
(
'../../utils/http'
)
Page
({
Page
({
/**
/**
* 页面的初始数据
* 页面的初始数据
*/
*/
data
:
{
data
:
{
isLogin
:
wx
.
getStorageSync
(
'isLogin'
),
userName
:
wx
.
getStorageSync
(
'userName'
),
headUrl
:
wx
.
getStorageSync
(
'headUrl'
),
roleId
:
wx
.
getStorageSync
(
'roleId'
)
},
// onGetPhoneNumber(e){
// console.log(e);
// console.log("encryptedData:"+e.detail.encryptedData);
// console.log("iv:"+e.detail.iv);
// },
onGetPhoneNumber
(
e
){
wx
.
showLoading
({
title
:
'正在登录...'
})
if
(
e
.
detail
.
iv
)
{
wx
.
login
({
success
:
res
=>
{
// console.log(res)
let
data
=
{
encryptedData
:
e
.
detail
.
encryptedData
,
iv
:
e
.
detail
.
iv
,
code
:
res
.
code
}
http
.
postRequest
(
'/mobile/login'
,
data
).
then
(
res
=>
{
wx
.
hideLoading
()
if
(
res
){
console
.
log
(
res
)
wx
.
setStorageSync
(
'token'
,
res
.
data
.
data
.
token
)
wx
.
setStorageSync
(
'userName'
,
res
.
data
.
data
.
userName
)
wx
.
setStorageSync
(
'headUrl'
,
res
.
data
.
data
.
headUrl
)
wx
.
setStorageSync
(
'roleId'
,
res
.
data
.
data
.
roleId
)
wx
.
setStorageSync
(
'isLogin'
,
true
)
this
.
setData
({
token
:
res
.
data
.
data
.
token
,
userName
:
res
.
data
.
data
.
userName
,
headUrl
:
res
.
data
.
data
.
headUrl
,
roleId
:
res
.
data
.
data
.
roleId
,
isLogin
:
true
})
}
})
},
},
fail
:
err
=>
{
// console.log('登录失败!')
wx
.
showToast
({
title
:
'登录失败!'
,
icon
:
'none'
})
}
})
}
else
{
wx
.
showToast
({
title
:
'您已拒绝授权'
,
icon
:
'none'
})
}
},
getUserProfile
(
e
){
wx
.
getUserProfile
({
desc
:
'用于完善会员资料'
,
// 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success
:
(
res
)
=>
{
// this.setData({
// userInfo: res.userInfo,
// hasUserInfo: true
// })
console
.
log
(
res
.
userInfo
)
}
})
},
logout
(
e
){
wx
.
setStorageSync
(
'token'
,
''
)
wx
.
setStorageSync
(
'userName'
,
''
)
wx
.
setStorageSync
(
'headUrl'
,
''
)
wx
.
setStorageSync
(
'roleId'
,
''
)
wx
.
setStorageSync
(
'isLogin'
,
false
)
this
.
setData
({
token
:
''
,
userName
:
''
,
headUrl
:
''
,
roleId
:
''
,
isLogin
:
false
})
},
/**
/**
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
...
...
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