Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
thinkApp
Project
Project
Details
Activity
Releases
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
游洁
thinkApp
Commits
34e39f16
Commit
34e39f16
authored
Sep 23, 2022
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成用户鉴权
parent
6532eef2
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
289 additions
and
64 deletions
+289
-64
erp.js
src/api/erp.js
+7
-0
index.js
src/api/index.js
+13
-1
user-card.vue
src/components/user-card.vue
+70
-17
indexassembly.vue
src/pages/index/components/indexassembly.vue
+3
-3
index.vue
src/pages/index/index.vue
+169
-21
accountLogin.vue
src/pages/login/accountLogin.vue
+1
-1
request.js
src/utils/request.js
+15
-10
requestErp.js
src/utils/requestErp.js
+11
-11
No files found.
src/api/erp.js
View file @
34e39f16
...
...
@@ -17,4 +17,11 @@ export function getSudentsByClassInAccount(data) {
method
:
'post'
,
data
})
}
export
function
setStudentClassInAccount
(
data
)
{
return
request
({
url
:
'/AppletCenter/SetStudentClassInAccount'
,
method
:
'post'
,
data
})
}
\ No newline at end of file
src/api/index.js
View file @
34e39f16
...
...
@@ -54,7 +54,19 @@ export function getWeChatOpenId(data) {
*/
export
function
phoneLogin
(
data
)
{
return
request
({
url
:
'/AppletLogin/LoginByAccount'
,
url
:
'/Login/LoginByAccount'
,
method
:
'post'
,
data
})
}
/**
* 手机号登录
* @param {JSON参数} data
*/
export
function
getStudentByAccount
(
data
)
{
return
request
({
url
:
'/Login/GetStudentByAccount'
,
method
:
'post'
,
data
})
...
...
src/components/user-card.vue
View file @
34e39f16
...
...
@@ -16,20 +16,31 @@
<van-popup
:show=
"showChange"
round
catch:touchstart
custom-style=
"height: 650rpx;width:650rpx"
@
close=
"closeChangeUserHandler"
>
<view
class=
"user-change-box"
>
<view
class=
"icon"
>
<van-icon
class-prefix=
'iconfont'
name=
'icon-qiehuan1'
></van-icon>
</view>
<view
class=
"title"
>
切换学员
</view>
<view
class=
"close"
>
<van-icon
name=
'cross'
@
click=
"showChange=false"
></van-icon>
<view
class=
"title-box"
>
<view
class=
"icon"
>
<van-icon
class-prefix=
"iconfont"
name=
"icon-qiehuan1"
></van-icon>
</view>
<view
class=
"title"
>
切换学员
</view>
<view
class=
"close"
>
<van-icon
name=
'cross'
@
click=
"closeChangeUserHandler"
></van-icon>
</view>
</view>
<scroll-view
style=
"overflow-y: auto; height: 1px; flex:1;margin-top:50rpx"
>
<view
class=
"user-item"
@
click=
"changeErpUserHandler(x)"
v-for=
"(x,i) in erpUsers"
>
<view
class=
"avatar"
:style=
"
{background:x.bgColor}">
{{
x
.
AccountName
.
substring
(
0
,
1
)
}}
</view>
<view
class=
"uname"
>
{{
x
.
AccountName
}}
</view>
<view
class=
"check"
v-if=
"x.AccountId==currentErpUser.AccountId"
>
<van-icon
name=
"success"
/>
</view>
</view>
</scroll-view>
</view>
</van-popup>
</view>
...
...
@@ -49,7 +60,14 @@
data
.
currentErpUser
=
uni
.
getStorageSync
(
'erpUserInfo'
)
let
methods
=
{
closeChangeUserHandler
(){
console
.
log
(
'in....'
)
data
.
showChange
=
false
},
changeErpUserHandler
(
x
){
uni
.
setStorageSync
(
"erpUserInfo"
,
x
)
uni
.
reLaunch
({
url
:
'/pages/index/index'
})
},
initColor
(){
if
(
data
.
erpUsers
){
...
...
@@ -79,7 +97,7 @@
},
};
</
script
>
<
style
scoped
>
<
style
>
.index-header-userCard
text
{
font-size
:
26
rpx
;
font-weight
:
bold
;
...
...
@@ -115,29 +133,64 @@
font-weight
:
500
;
color
:
#B8B8B8
;
}
.userCard-box
.user-change-box
{
.userCard-box
.user-change-box
{
padding
:
50
rpx
;
box-sizing
:
border-box
;
height
:
100%
;
display
:
flex
;
flex-direction
:
column
;
}
.userCard-box
.user-change-box
.title-box
{
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
}
.userCard-box
.user-change-box
.icon
{
.userCard-box
.user-change-box
.
title-box
.
icon
{
font-size
:
22
rpx
;
color
:
#282828
;
margin-right
:
8
rpx
;
}
.userCard-box
.user-change-box
.title
{
.userCard-box
.user-change-box
.title
-box
.title
{
font-size
:
36
rpx
;
font-weight
:
bold
;
color
:
#000000
;
width
:
1px
;
flex
:
1
;
}
.userCard-box
.user-change-box
.title
.close
{
.userCard-box
.user-change-box
.title
-box
.close
{
width
:
26
rpx
;
height
:
26
rpx
;
color
:
#282828
;
}
.userCard-box
.user-item
{
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
margin-bottom
:
36
rpx
;
}
.userCard-box
.user-item
.avatar
{
width
:
60
rpx
;
height
:
60
rpx
;
background
:
#9ADBC5
;
border-radius
:
50%
;
font-size
:
38
rpx
;
font-weight
:
500
;
color
:
#FFFFFF
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
.userCard-box
.user-item
.uname
{
font-size
:
28
rpx
;
margin-left
:
32
rpx
;
font-weight
:
500
;
color
:
#000000
;
width
:
1px
;
flex
:
1
;
}
.userCard-box
.user-item
.check
{
color
:
#000000
;
font-size
:
36
rpx
;
}
</
style
>
\ No newline at end of file
src/pages/index/components/indexassembly.vue
View file @
34e39f16
...
...
@@ -126,7 +126,7 @@
uni
.
setStorageSync
(
"ErpStus"
,
r
.
Data
)
let
account
=
[]
r
.
Data
.
forEach
(
x
=>
{
account
.
push
(
x
.
RealPhone
)
account
.
push
(
x
.
ClassInAccount
)
})
methods
.
setAccountsLogin
(
`'
${
account
.
join
(
"','"
)}
'`
)
}
else
{
...
...
@@ -141,7 +141,7 @@
if
(
r
.
Data
&&
r
.
Data
.
length
>
0
){
let
erpStus
=
uni
.
getStorageSync
(
'ErpStus'
)
erpStus
.
forEach
(
x
=>
{
if
(
x
.
RealPhone
==
r
.
Data
[
0
].
UserMobile
){
if
(
x
.
ClassInAccount
==
r
.
Data
[
0
].
Account
){
uni
.
setStorageSync
(
'erpUserInfo'
,
x
)
}
})
...
...
@@ -235,7 +235,7 @@
if
(
r
.
Data
&&
r
.
Data
.
length
>
0
){
uni
.
setStorageSync
(
"ErpStus"
,
r
.
Data
)
r
.
Data
.
forEach
(
x
=>
{
if
(
x
.
RealPhone
==
u
.
Account
){
if
(
x
.
ClassInAccount
==
u
.
Account
){
uni
.
setStorageSync
(
'erpUserInfo'
,
x
)
}
})
...
...
src/pages/index/index.vue
View file @
34e39f16
...
...
@@ -16,28 +16,53 @@
<!--
<signOut
:AccountType=
"0"
></signOut>
-->
<userCard></userCard>
</navbar>
<view
style=
"margin: 40rpx 0 10rpx 0;"
>
<view
style=
"padding:0 50rpx;font-weight: 800;color: #282828;"
>
<view
style=
"font-size: 36rpx;"
>
Hello,
{{
userData
.
AccountName
}}
</view>
<view
style=
"font-size: 50rpx;"
>
您的学情反馈已准备好
</view>
<view
v-if=
"userData"
>
<view
style=
"margin: 40rpx 0 10rpx 0;"
>
<view
style=
"padding:0 50rpx;font-weight: 800;color: #282828;"
>
<view
style=
"font-size: 36rpx;"
>
Hello,
{{
userData
.
AccountName
}}
</view>
<view
style=
"font-size: 50rpx;"
>
您的学情反馈已准备好
</view>
</view>
</view>
<course-card
:stuCourseList=
"stuCourseList"
@
changePopStatus=
'changePopStatusHandler'
@
change=
"changeCourseHandler"
></course-card>
<view
class=
"index-student-title flex"
>
<text>
学情反馈
</text>
<view>
(共
{{
workList
!=
null
&&
workList
.
length
>
0
?
workList
.
length
:
0
}}
条)
</view>
</view>
<view
class=
"index-student-information"
v-if=
"workList && workList.length>0"
>
<template
v-for=
"(item,index) in workList"
>
<JobComponents
v-if=
"item.ResultType==1"
:jobData=
"item"
></JobComponents>
<examComponents
v-if=
"item.ResultType==2"
:jobData=
"item"
></examComponents>
<commentsComponents
v-if=
"item.ResultType==3"
:jobData=
"item"
></commentsComponents>
</
template
>
</view>
<view
class=
"index-student-information"
v-else
>
<view
class=
"noData"
>
<image
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1653902791000_806.png"
mode=
"widthFix"
></image>
<view>
暂无反馈信息
</view>
</view>
</view>
</view>
<course-card
:stuCourseList=
"stuCourseList"
@
changePopStatus=
'changePopStatusHandler'
@
change=
"changeCourseHandler"
></course-card>
<view
class=
"index-student-title flex"
>
<text>
学情反馈
</text>
<view>
(共
{{
workList
!=
null
&&
workList
.
length
>
0
?
workList
.
length
:
0
}}
条)
</view>
</view>
<view
class=
"index-student-information"
v-if=
"workList && workList.length>0"
>
<template
v-for=
"(item,index) in workList"
>
<JobComponents
v-if=
"item.ResultType==1"
:jobData=
"item"
></JobComponents>
<examComponents
v-if=
"item.ResultType==2"
:jobData=
"item"
></examComponents>
<commentsComponents
v-if=
"item.ResultType==3"
:jobData=
"item"
></commentsComponents>
</
template
>
</view>
<view
class=
"index-student-information"
v-else
>
<view
class=
"noData"
>
<image
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1653902791000_806.png"
mode=
"widthFix"
></image>
<view>
暂无反馈信息
</view>
<view
class=
"unbind-box"
v-else
>
<view
class=
"title"
>
未绑定学员ClassIn账号
</view>
<view
class=
"search-box"
>
<input
type=
"text"
:disabled=
"submiting"
maxlength=
"11"
placeholder-style=
"font-size:28rpx;"
@
blur=
"changeSearchKeyHandler"
auto-focus
v-model=
"searchBindKey"
placeholder=
"输入学员ClassIn账号进行绑定"
/>
</view>
<view
class=
"result-box"
v-if=
"searchResult"
>
<view
class=
"avatar-result"
>
{{searchResult.AccountName.substring(0,1)}}
</view>
<view
class=
"name-result"
>
{{searchResult.AccountName}}
</view>
<view
style=
"margin-top: 50rpx;"
>
<van-button
size=
"large"
@
click=
"setBindHandler"
:loading=
"submiting"
custom-style=
"border-radius:10rpx;"
color=
"#C81727"
>
立即绑定
</van-button>
</view>
</view>
</view>
<tabbar
active-name=
'home'
></tabbar>
...
...
@@ -67,11 +92,13 @@
}
from
"vue"
;
import
{
getSweepCode
getSweepCode
,
getStudentByAccount
}
from
'../../api/index.js'
import
{
getImageColor
}
from
'../../utils/index.js'
import
{
setStudentClassInAccount
}
from
'../../api/erp.js'
import
userCard
from
'../../components/user-card.vue'
import
indexassembly
from
'./components/indexassembly.vue'
import
navbar
from
'../../components/navbar.vue'
...
...
@@ -101,10 +128,23 @@
courseId
:
0
,
},
showPopu
:
false
,
searchBindKey
:
''
,
searchResult
:
null
,
submiting
:
false
,
workList
:
[],
//学员作业、考试、评语数据
});
let
methods
=
{
changeSearchKeyHandler
(){
if
(
data
.
searchBindKey
.
length
!=
11
){
uni
.
showToast
({
title
:
'请输入正确手机号码'
})
}
else
{
console
.
log
(
'in...'
)
methods
.
searchHandler
()
}
},
changePopStatusHandler
(
status
){
data
.
showPopu
=
status
==
1
},
...
...
@@ -136,6 +176,53 @@
uni
.
hideLoading
()
})
},
searchHandler
()
{
uni
.
showLoading
({
title
:
'正在查询'
})
getStudentByAccount
({
Account
:
data
.
searchBindKey
}).
then
(
r
=>
{
data
.
searchResult
=
r
.
Data
uni
.
hideLoading
()
}).
catch
(
e
=>
{
uni
.
hideLoading
()
})
},
setBindHandler
(){
data
.
submiting
=
true
uni
.
showLoading
({
title
:
'正在绑定'
})
setStudentClassInAccount
({
account
:
data
.
searchResult
.
Account
}).
then
(
r
=>
{
if
(
r
.
Code
==
1
){
let
users
=
uni
.
getStorageSync
(
"users"
)
users
.
push
(
data
.
searchResult
)
uni
.
setStorageSync
(
'users'
,
users
)
uni
.
setStorageSync
(
'userInfo'
,
data
.
searchResult
)
let
erpUsers
=
uni
.
getStorageSync
(
"ErpStus"
)
let
currentErpUser
=
uni
.
getStorageSync
(
"erpUserInfo"
)
erpUsers
.
forEach
(
x
=>
{
if
(
x
.
AccountId
==
currentErpUser
.
AccountId
){
x
.
ClassInAccount
=
data
.
searchResult
.
Account
currentErpUser
.
ClassInAccount
=
data
.
searchResult
.
Account
}
})
uni
.
setStorageSync
(
'ErpStus'
,
erpUsers
)
uni
.
setStorageSync
(
'erpUserInfo'
,
currentErpUser
)
}
data
.
submiting
=
false
uni
.
hideLoading
()
uni
.
reLaunch
({
url
:
'/pages/index/index'
})
}).
catch
(
e
=>
{
data
.
submiting
=
false
uni
.
hideLoading
()
})
},
//定义更新方法
VersionUpdate
()
{
// 判断应用的 getUpdateManager 是否在当前版本可用
...
...
@@ -339,4 +426,65 @@
top
:
0
;
z-index
:
9
;
}
.unbind-box
{
min-height
:
calc
(
100vh
-
300
rpx
);
box-sizing
:
border-box
;
border-top-left-radius
:
20px
;
border-top-right-radius
:
20px
;
background-color
:
#FFF
;
margin-top
:
200
rpx
;
padding
:
50
rpx
;
}
.unbind-box
.title
{
font-size
:
36
rpx
;
font-weight
:
500
;
color
:
#282828
;
}
.unbind-box
.search-box
{
margin-top
:
50
rpx
;
}
.unbind-box
.search-box
input
{
height
:
100
rpx
;
width
:
100%
;
box-sizing
:
border-box
;
padding
:
0
50
rpx
;
line-height
:
100
rpx
;
color
:
#282828
;
outline
:
none
;
border-radius
:
100
rpx
;
font-size
:
40
rpx
;
border
:
4
rpx
solid
#999
;
font-weight
:
bolder
;
}
.unbind-box
.search-box
input
:focus
,
.unbind-box
.search-box
input
:active
{
border
:
4
rpx
solid
#C81727
!important
;
}
.unbind-box
.search-box
.placeholder
{
color
:
#C81727
;
font-size
:
28
rpx
;
opacity
:
.2
;
}
.unbind-box
.result-box
{
margin-top
:
50
rpx
;
}
.unbind-box
.result-box
.avatar-result
{
width
:
160
rpx
;
height
:
160
rpx
;
text-align
:
center
;
background-color
:
coral
;
border-radius
:
10
rpx
;
line-height
:
160
rpx
;
font-size
:
60
rpx
;
color
:
#FFF
;
font-weight
:
400
;
}
.unbind-box
.result-box
.name-result
{
width
:
160
rpx
;
text-align
:
center
;
font-size
:
32
rpx
;
color
:
#282828
;
margin-top
:
10
rpx
;
}
</
style
>
src/pages/login/accountLogin.vue
View file @
34e39f16
...
...
@@ -200,7 +200,7 @@
if
(
r
.
Data
&&
r
.
Data
.
length
>
0
){
uni
.
setStorageSync
(
"ErpStus"
,
r
.
Data
)
r
.
Data
.
forEach
(
x
=>
{
if
(
x
.
RealPhone
==
u
.
Account
){
if
(
x
.
ClassInAccount
==
u
.
Account
){
uni
.
setStorageSync
(
'erpUserInfo'
,
x
)
}
})
...
...
src/utils/request.js
View file @
34e39f16
...
...
@@ -27,16 +27,21 @@ let request = (param) => {
resolve
(
res
.
data
)
}
else
{
if
(
res
.
data
.
Code
==
10001
||
res
.
data
.
Code
==
10000
)
{
uni
.
showToast
({
title
:
"用户凭证失效,请重新授权"
,
duration
:
2000
,
icon
:
"none"
,
});
uni
.
removeStorageSync
(
'userInfo'
);
uni
.
reLaunch
({
url
:
"/pages/login/login"
})
reject
()
if
(
!
uni
.
getStorageSync
(
'erpUserInfo'
)){
console
.
log
(
'in....'
)
uni
.
showToast
({
title
:
"用户凭证失效,请重新授权"
,
duration
:
2000
,
icon
:
"none"
,
});
uni
.
removeStorageSync
(
'userInfo'
);
uni
.
reLaunch
({
url
:
"/pages/login/login"
})
reject
()
}
else
{
resolve
(
res
.
data
)
}
}
else
{
uni
.
showToast
({
title
:
res
.
data
.
Message
,
...
...
src/utils/requestErp.js
View file @
34e39f16
...
...
@@ -17,7 +17,7 @@ let request = (param) => {
method
:
param
.
method
||
"Post"
,
header
:
param
.
header
||
{
'content-type'
:
"application/json"
,
'
Authorizatio
n'
:
token
||
""
'
toke
n'
:
token
||
""
},
data
:
{
Msg
:
param
.
data
,
...
...
@@ -27,16 +27,16 @@ let request = (param) => {
resolve
(
res
.
data
)
}
else
{
if
(
res
.
data
.
Code
==
10001
||
res
.
data
.
Code
==
10000
)
{
uni
.
showToast
({
title
:
"用户凭证失效,请重新授权"
,
duration
:
2000
,
icon
:
"none"
,
});
uni
.
removeStorageSync
(
'erpUserInfo'
);
uni
.
reLaunch
({
url
:
"/pages/login/login"
})
reject
()
//
uni.showToast({
//
title: "用户凭证失效,请重新授权",
//
duration: 2000,
//
icon: "none",
//
});
//
uni.removeStorageSync('erpUserInfo');
//
uni.reLaunch({
//
url:"/pages/login/login"
//
})
//
reject()
}
else
{
uni
.
showToast
({
title
:
res
.
data
.
Message
,
...
...
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