Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
ec-report-refactor
Project
Project
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
lihuizhen
ec-report-refactor
Commits
f75eddbb
Commit
f75eddbb
authored
Jan 14, 2022
by
peco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:完善登录 增加修改密码
parent
81339469
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
285 additions
and
10 deletions
+285
-10
http.api.js
common/http.api.js
+7
-1
pages.json
pages.json
+18
-0
index.vue
pages/center/index.vue
+88
-2
password.vue
pages/center/password.vue
+97
-0
customer.vue
pages/customer/customer.vue
+22
-0
index.vue
pages/index/index.vue
+2
-2
authorized.vue
pages/login/authorized.vue
+51
-5
No files found.
common/http.api.js
View file @
f75eddbb
...
...
@@ -13,13 +13,19 @@ const install = (Vue, vm) => {
const
dataSetPreview
=
params
=>
vm
.
$u
.
post
(
`
${
reportUrl
}
/report/dataset/preview`
,
params
)
// 检查授权状态
const
getAuthorized
=
params
=>
vm
.
$u
.
get
(
`
${
baseUrl
}
/report/user/getAuthorized`
,
params
)
// 获取用户数据
const
getUserListCount
=
params
=>
vm
.
$u
.
get
(
`
${
baseUrl
}
/report/user/getUserListCount`
,
params
)
// 修改密码
const
changePassword
=
params
=>
vm
.
$u
.
post
(
`
${
baseUrl
}
/report/user/changePassword`
,
params
)
vm
.
$u
.
api
=
{
quickLogin
,
register
,
getReportList
,
dataSetPreview
,
getAuthorized
getAuthorized
,
getUserListCount
,
changePassword
}
}
...
...
pages.json
View file @
f75eddbb
...
...
@@ -32,6 +32,24 @@
}
}
,{
"path"
:
"pages/center/password"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
}
}
,{
"path"
:
"pages/customer/customer"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
}
}
],
"globalStyle"
:
{
"navigationBarTextStyle"
:
"black"
,
...
...
pages/center/index.vue
View file @
f75eddbb
<
template
>
<view>
<view
class=
"item-list"
>
<block
v-for=
"(item,index) in itemList"
>
<view
class=
"item-cell"
@
tap=
"selectCell(index)"
>
<view
class=
"item-cell-text"
>
{{
item
.
text
}}
</view>
<view
class=
"item-cell-list-count"
v-if=
"item.show"
>
(
{{
item
.
count
}}
)人
</view>
</view>
</block>
</view>
<u-button
class=
"my-u-block u-m-t-80"
type=
"warning"
...
...
@@ -14,13 +22,69 @@
export
default
{
data
()
{
return
{
itemList
:
[],
admin
:
false
}
},
async
onLoad
()
{
var
admin
=
uni
.
getStorageSync
(
'admin'
)
if
(
admin
)
{
this
.
$data
.
admin
=
admin
}
},
onShow
()
{
this
.
getUserCount
()
},
methods
:
{
// 获取用户信息
getUserCount
()
{
var
userId
=
uni
.
getStorageSync
(
'userId'
)
var
param
=
{
id
:
userId
,
authorized
:
false
}
var
itemList
=
[{
'text'
:
'修改密码'
,
'show'
:
false
,
'count'
:
'0'
},
{
'text'
:
'待授权'
,
'show'
:
true
,
'count'
:
'0'
},
{
'text'
:
'已授权'
,
'show'
:
true
,
'count'
:
'0'
}];
this
.
$u
.
api
.
getUserListCount
({
param
}).
then
(
res
=>
{
const
{
Status
,
Result
}
=
res
.
data
if
(
Status
===
'true'
)
{
itemList
[
1
].
count
=
Result
.
no_authorized
;
itemList
[
2
].
count
=
Result
.
authorized
;
}
this
.
$data
.
itemList
=
itemList
})
},
// item 点击
selectCell
(
index
)
{
switch
(
index
)
{
case
0
:
uni
.
navigateTo
({
url
:
'./password'
})
break
;
case
1
:
if
(
this
.
$data
.
admin
)
{
uni
.
navigateTo
({
url
:
'../customer/customer?confirmed=false'
})
}
else
{
this
.
$u
.
toast
(
'您没有操作权限'
)
}
break
;
case
2
:
if
(
this
.
$data
.
admin
)
{
uni
.
navigateTo
({
url
:
'../customer/customer?confirmed=true'
})
}
else
{
this
.
$u
.
toast
(
'您没有操作权限'
)
}
break
;
}
},
// 退出登录
logout
()
{
uni
.
removeStorageSync
(
'userId'
);
...
...
@@ -41,4 +105,26 @@
</
script
>
<
style
lang=
"scss"
scoped
>
.item-list
{
display
:
flex
;
flex-direction
:
column
;
}
.item-cell
{
display
:
flex
;
position
:
relative
;
width
:
100%
;
height
:
100rpx
;
align-items
:
center
;
border-bottom
:
0
.1rpx
solid
#cccccc
;
}
.item-cell-text
{
margin-left
:
20rpx
;
font-size
:
24rpx
;
}
.item-cell-list-count
{
margin-left
:
300rpx
;
font-size
:
24rpx
;
}
</
style
>
\ No newline at end of file
pages/center/password.vue
0 → 100644
View file @
f75eddbb
<
template
>
<view
class=
"wrap"
>
<view
class=
"content"
>
<u-form
ref=
"uForm"
:model=
"params"
:error-type=
"['toast']"
:label-width=
"120"
>
<u-form-item
label=
"新密码"
prop=
"password1"
>
<u-input
v-model=
"params.password1"
placeholder=
"请输入新密码"
type=
"password"
:password-icon=
"true"
/>
</u-form-item>
<u-form-item
label=
"确认密码"
prop=
"password2"
>
<u-input
v-model=
"params.password2"
placeholder=
"请确认新密码"
type=
"password"
:password-icon=
"true"
/>
</u-form-item>
</u-form>
<u-button
class=
"my-u-block u-m-t-80"
type=
"warning"
shape=
"square"
:ripple=
"true"
@
click=
"submit()"
:disabled=
"!submitDisabled"
>
确认
</u-button>
</view>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
params
:
{
appId
:
wx
.
getAccountInfoSync
().
miniProgram
.
appId
,
password1
:
''
,
password2
:
''
},
rules
:
{
password1
:
[
{
required
:
true
,
message
:
'请输入新密码'
,
trigger
:
'blur'
}
],
password2
:
[
{
required
:
true
,
message
:
'请确认新密码'
,
trigger
:
'blur'
}
]
}
}
},
computed
:
{
submitDisabled
()
{
return
this
.
params
.
password1
&&
this
.
params
.
password2
}
},
methods
:
{
// 登录
submit
()
{
this
.
$refs
.
uForm
.
validate
(
async
valid
=>
{
if
(
valid
)
{
let
res
=
await
this
.
$u
.
api
.
changePassword
(
this
.
params
)
const
{
Status
,
Result
}
=
res
.
data
if
(
Status
===
'true'
)
{
this
.
$u
.
vuex
(
'vuex_token'
,
`
${
res
.
token_type
}
${
res
.
access_token
}
`
)
this
.
$u
.
toast
(
'密码修改成功'
)
// 登录成功后返回来源页面
let
timer
=
setTimeout
(()
=>
{
uni
.
navigateBack
({
})
clearTimeout
(
timer
)
},
500
)
}
else
{
this
.
$u
.
toast
(
'修改失败'
)
}
}
else
{
console
.
log
(
'修改失败'
);
}
})
}
},
onReady
()
{
this
.
$refs
.
uForm
.
setRules
(
this
.
rules
)
}
}
</
script
>
<
style
>
</
style
>
pages/customer/customer.vue
0 → 100644
View file @
f75eddbb
<
template
>
<view>
授权列表
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
}
},
methods
:
{
}
}
</
script
>
<
style
>
</
style
>
pages/index/index.vue
View file @
f75eddbb
...
...
@@ -75,9 +75,9 @@
//获取最新的授权信息
getNewestAuthFromServer
()
{
var
param
=
{
id
:
uni
.
getStorageSync
(
'us
a
erId'
)
id
:
uni
.
getStorageSync
(
'userId'
)
}
this
.
$u
.
api
.
getAuthorized
(
{
param
}
).
then
(
res
=>
{
this
.
$u
.
api
.
getAuthorized
(
param
).
then
(
res
=>
{
const
{
Status
,
Result
}
=
res
.
data
if
(
Status
===
'true'
)
{
uni
.
setStorageSync
(
'authorized'
,
Result
.
authorized
)
...
...
pages/login/authorized.vue
View file @
f75eddbb
<
template
>
<view>
授权中心
<view
class=
"wrap"
>
<view
class=
"container"
>
<view
class=
"large-text"
>
请等待管理员授权
</view>
<view
class=
"phone"
@
tap=
"call()"
>
<image
class=
"phone-image"
src=
"../../static/icon/phone.png"
></image>
<view
class=
"phone-text"
>
直接通知管理员
</view>
</view>
<view
class=
"phone-text"
@
tap=
"backToLogin()"
>
返回登录
</view>
</view>
</view>
</
template
>
...
...
@@ -12,11 +19,50 @@
}
},
methods
:
{
// 打电话
call
()
{
uni
.
makePhoneCall
({
phoneNumber
:
'8613918613467'
})
},
// 返回登录
backToLogin
()
{
uni
.
reLaunch
({
url
:
'./login'
})
}
}
}
</
script
>
<
style
>
<
style
lang=
"scss"
scoped
>
.container
{
margin-top
:
200rpx
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
width
:
100%
;
height
:
100%
;
}
.large-text
{
font-size
:
50rpx
;
font-weight
:
bold
;
}
.phone
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
margin-top
:
100rpx
;
margin-bottom
:
60rpx
;
}
.phone-image
{
width
:
80rpx
;
height
:
80rpx
;
}
.phone-text
{
font-size
:
40rpx
;
font-weight
:
bold
;
}
</
style
>
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