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
b39cfc25
Commit
b39cfc25
authored
Jan 07, 2022
by
Jenny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 登录页面
parent
b6f322b5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
15 deletions
+86
-15
http.api.js
common/http.api.js
+2
-2
http.interceptor.js
common/http.interceptor.js
+1
-1
login.vue
pages/login/login.vue
+79
-12
common.scss
static/style/common.scss
+4
-0
No files found.
common/http.api.js
View file @
b39cfc25
const
install
=
(
Vue
,
vm
)
=>
{
/*************** 认证 API *****************/
// 登录
let
authLogin
=
params
=>
vm
.
$u
.
post
(
'/api/auth/l
ogin'
,
params
)
let
quickLogin
=
params
=>
vm
.
$u
.
post
(
'/report/user/quickL
ogin'
,
params
)
vm
.
$u
.
api
=
{
auth
Login
quick
Login
}
}
...
...
common/http.interceptor.js
View file @
b39cfc25
const
install
=
(
Vue
,
vm
)
=>
{
Vue
.
prototype
.
$u
.
http
.
setConfig
({
baseUrl
:
'https://api.
shop.eduwork.cn
'
,
// 请求的本域名
baseUrl
:
'https://api.
charleskeith.cn/api
'
,
// 请求的本域名
showLoading
:
true
,
// 是否显示请求中的loading
loadingText
:
'努力加载中。。。'
,
// 请求loading中的文字提示
loadingTime
:
300
,
// 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
...
...
pages/login/login.vue
View file @
b39cfc25
<
template
>
<view>
登录
<view
class=
"wrap"
>
<view
class=
"content"
>
<u-form
ref=
"uForm"
:model=
"params"
:error-type=
"['toast']"
:label-width=
"120"
>
<u-form-item
label=
"用户名"
prop=
"userName"
>
<u-input
v-model=
"params.userName"
type=
"text"
/>
</u-form-item>
<u-form-item
label=
"密码"
prop=
"password"
>
<u-input
v-model=
"params.password"
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
{
export
default
{
data
()
{
return
{
params
:
{
appId
:
wx
.
getAccountInfoSync
().
miniProgram
.
appId
,
userName
:
''
,
password
:
''
},
rules
:
{
userName
:
[
{
required
:
true
,
message
:
'请输入用户名'
,
trigger
:
'blur'
}
],
password
:
[
{
required
:
true
,
message
:
'请输入密码'
,
trigger
:
'blur'
}
]
}
}
},
computed
:
{
submitDisabled
()
{
return
this
.
params
.
userName
&&
this
.
params
.
password
}
},
methods
:
{
submit
()
{
this
.
$refs
.
uForm
.
validate
(
async
valid
=>
{
if
(
valid
)
{
let
res
=
await
this
.
$u
.
api
.
quickLogin
(
this
.
params
)
this
.
$u
.
vuex
(
'vuex_token'
,
`
${
res
.
token_type
}
${
res
.
access_token
}
`
)
this
.
$u
.
toast
(
'登录成功'
)
// 登录成功后返回来源页面
let
timer
=
setTimeout
(()
=>
{
const
backUrl
=
uni
.
getStorageSync
(
'back_url'
)
||
'/pages/index/index'
this
.
$u
.
route
({
type
:
'reLaunch'
,
url
:
backUrl
})
clearTimeout
(
timer
)
},
500
)
}
else
{
console
.
log
(
'验证失败'
);
}
})
}
},
onReady
()
{
this
.
$refs
.
uForm
.
setRules
(
this
.
rules
)
}
};
</
script
>
<
style
>
<
style
lang=
"scss"
scoped
>
</
style
>
\ No newline at end of file
static/style/common.scss
View file @
b39cfc25
...
...
@@ -17,3 +17,7 @@
}
}
}
.my-u-block
{
display
:
block
;
}
\ No newline at end of file
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