Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzrt
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzrt
提交
5d2ed091
提交
5d2ed091
编写于
6月 08, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
登录样式
上级
cd54da87
变更
2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
339 行增加
和
178 行删除
+339
-178
login.less
app_Web/src/components/login/login.less
+107
-60
login.vue
app_Web/src/components/login/login.vue
+232
-118
未找到文件。
app_Web/src/components/login/login.less
浏览文件 @
5d2ed091
.login{
width: 100vh;
height: 100vh;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
min-height: 100%;
background: #108cee;
> img{
width: 100vw;
height: 100vh;
}
.login-logo{
position: fixed;
left: 80px;
top: 80px;
}
.login-content{
position: fixed;
left: 10%;
top: 30%;
width: 60%;
>span{
color: #fff;
font-size: 84px;
}
}
&-con{
position: fixed;
right: 160px;
top: 50%;
transform: translateY(-60%);
width: 300px;
.ivu-card{
border-radius: 15px;
position: absolute;
left: 0;
right: 0;
top: 150px;
margin: auto;
width: 450px;
.ivu-card-head {
padding: 14px 6px;
padding: 30px 6px;
border-bottom: 0px;
>p{
line-height: 20px;
font-size: 20
px;
color: #17233d
;
font-size: 24
px;
color: #666666
;
font-weight: 700;
text-align:center;
}
}
&-header{
...
...
@@ -45,26 +37,81 @@
padding: 30px 0;
}
.form-con{
padding: 10px 0 0;
.ivu-form-item{
margin-bottom: 20px;
}
p{
font-size: 14px;
font-weight: bold;
height: 21px;
line-height: 21px;
}
button{
background-image: linear-gradient(to bottom,#8bbcf1 0%,#2d8cf0 100%);
border-color:#8bbcf1;
padding: 0px 20px 0px 20px;
>i-button{
width: 170px;
height: 40px;
}
}
.login-tip{
font-size: 10px;
text-align: center;
color: #5f4949;
}
color: red;
height: 30px;
}
}
}
.login_btn{
width: 175px;
height: 40px;
font-size: 18px;
font-family: MicrosoftYaHei;
}
.login_reset {
width: 175px;
height: 40px;
font-size: 18px;
font-family: MicrosoftYaHei;
float: right;
}
.form_tipinfo {
font-family: MicrosoftYaHei-Bold;
font-size: 14px;
font-weight: bold;
font-stretch: normal;
line-height: 24px;
letter-spacing: 0px;
color: #666666;
}
form_tipinfo_more {
font-family: MicrosoftYaHei;
font-size: 14px;
font-weight: normal;
letter-spacing: 0px;
color: #666666;
}
.log_footer {
display: block;
padding: 0 16px;
margin: 48px 0 24px;
text-align: center;
color: #212529;
}
.log_footer a {
color: white;
text-decoration: none;
}
.sign-btn {
display: inline-block;
cursor: pointer;
margin-left: 10px;
}
.wx-svg-container,
.qq-svg-container {
display: inline-block;
width: 40px;
height: 40px;
line-height: 40px;
text-align: center;
padding-top: 1px;
border-radius: 4px;
margin-bottom: -20px;
margin-top: 10px;
}
\ No newline at end of file
app_Web/src/components/login/login.vue
浏览文件 @
5d2ed091
<
template
>
<div
class=
'login'
>
<img
src=
"/assets/img/login_bg.png"
/>
<div
class=
"login-logo"
>
<img
src =
"/assets/img/logo.svg"
/>
</div>
<div
class=
"login-content"
>
<span>
{{
appTitle
}}
</span>
</div>
<img
src=
"/assets/img/background.png"
/>
<div
class=
'login-con'
>
<card
:bordered=
"false"
>
<p
slot=
'title'
>
<!--
<icon
type=
'ios-log-in'
></icon>
-->
<!-- -->
{{
this
.
$t
(
'components.login.caption'
)
}}
<p
slot=
'title'
style=
"text-align: center"
>
{{
appTitle
}}
</p>
<div
class=
'form-con'
>
<i-form
ref=
'loginForm'
:rules=
"rules"
:model=
"form"
>
<form-item
prop=
'loginname'
>
<p>
用户名
</p>
<i-input
size=
'large'
prefix=
'ios-contact'
v-model=
"form.loginname"
:placeholder=
"this.$t('components.login.loginname.placeholder')"
>
v-model
.
trim=
"form.loginname"
placeholder=
"用户名"
@
keyup
.
enter
.
native=
"handleSubmit"
>
</i-input>
</form-item>
<form-item
prop=
'password'
>
<p>
密码
</p>
<i-input
size=
'large'
prefix=
'ios-key'
v-model
=
"form.password"
v-model
.
trim
=
"form.password"
type=
'password'
:placeholder=
"this.$t('components.login.password.placeholder')"
>
placeholder=
"密码"
@
keyup
.
enter
.
native=
"handleSubmit"
>
</i-input>
</form-item>
<form-item>
<i-button
@
click=
"handleSubmit"
type=
'primary'
long
>
{{
this
.
$t
(
'components.login.name'
)
}}
class=
"login_btn"
>
登录
</i-button>
<i-button
@
click=
"goReset"
type=
'success'
class=
"login_reset"
>
重置
</i-button>
</form-item>
<form-item>
<div
style=
"text-align: center"
>
<span
class=
"form_tipinfo"
>
其他登录方式
</span>
</div>
<div
style=
"text-align: center"
>
<div
class=
"sign-btn"
@
click=
"tencentHandleClick('tencent')"
>
<img
src=
"/assets/img/QQ.svg"
class=
"qq-svg-container"
draggable=
"false"
>
</div>
<div
class=
"sign-btn"
@
click=
"wechatHandleClick('wechat')"
>
<img
src=
"/assets/img/weixin.svg"
class=
"wx-svg-container"
draggable=
"false"
>
</div>
</div>
</form-item>
</i-form>
<p
class=
'login-tip'
>
{{
this
.
$t
(
'components.login.tip'
)
}}
{{
this
.
loginTip
}}
<!--
{{
this
.
$t
(
'components.login.tip'
)
}}
-->
</p>
</div>
</card>
<div
class=
"log_footer"
>
<div
class=
"copyright"
>
<a
href=
"https://www.ibizlab.cn/"
target=
"_blank"
>
{{
appTitle
}}
is based on ibizlab .
</a>
</div>
</div>
</div>
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
Vue
,
Component
,
Watch
}
from
'vue-property-decorator'
;
import
{
Environment
}
from
'@/environments/environment'
;
import
{
Vue
,
Component
,
Watch
}
from
'vue-property-decorator'
;
import
{
Environment
}
from
'@/environments/environment'
;
//import Divider from "ibiz-vue-lib/lib/ibiz-vue-lib.common";
@
Component
({
})
export
default
class
Login
extends
Vue
{
@
Component
({
components
:
{}
})
export
default
class
Login
extends
Vue
{
/**
* 表单对象
...
...
@@ -65,15 +87,25 @@ export default class Login extends Vue {
* @type {*}
* @memberof Login
*/
public
form
:
any
=
{
loginname
:
'guest'
,
password
:
'guest'
};
public
form
:
any
=
{
loginname
:
'ibzadmin'
,
password
:
'123456'
};
/**
* 登录提示语
*/
public
loginTip
:
any
=
""
;
/**
* 按钮可点击
*/
public
canClick
:
any
=
true
;
/**
* 应用标题
* 应用名称
*
* @type {string}
* @memberof Login
*/
public
appTitle
:
string
=
Environment
.
AppTitle
;
public
appTitle
:
string
=
Environment
.
AppTitle
;
/**
* 值规则
...
...
@@ -88,13 +120,13 @@ export default class Login extends Vue {
*
* @memberof Login
*/
public
setRules
()
{
public
setRules
()
{
this
.
rules
=
{
loginname
:
[
{
required
:
true
,
message
:
this
.
$t
(
'components.login.loginname.message'
),
trigger
:
'change'
},
{
required
:
true
,
message
:
this
.
$t
(
'components.login.loginname.message'
),
trigger
:
'change'
},
],
password
:
[
{
required
:
true
,
message
:
this
.
$t
(
'components.login.password.message'
),
trigger
:
'change'
},
{
required
:
true
,
message
:
this
.
$t
(
'components.login.password.message'
),
trigger
:
'change'
},
],
}
};
...
...
@@ -104,10 +136,14 @@ export default class Login extends Vue {
*
* @memberof Login
*/
public
created
()
{
public
created
()
{
this
.
setRules
();
}
public
mounted
()
{
this
.
getCookie
();
}
/**
* 监听语言变化
*
...
...
@@ -132,29 +168,107 @@ export default class Login extends Vue {
if
(
!
validatestate
)
{
return
;
}
const
loginname
:
any
=
this
.
form
.
loginname
;
const
password
:
any
=
this
.
form
.
password
;
const
post
:
Promise
<
any
>
=
this
.
$http
.
post
(
'v7/login'
,
this
.
form
,
true
);
post
.
then
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
200
)
{
const
data
=
response
.
data
;
if
(
data
&&
data
.
token
)
{
if
(
data
&&
data
.
token
)
{
localStorage
.
setItem
(
'token'
,
data
.
token
);
}
if
(
data
&&
data
.
user
)
{
if
(
data
&&
data
.
user
)
{
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
// 设置cookie,保存账号密码7天
this
.
setCookie
(
loginname
,
7
);
// 跳转首页
const
url
:
any
=
this
.
$route
.
query
.
redirect
?
this
.
$route
.
query
.
redirect
:
'*'
;
this
.
$router
.
push
({
path
:
url
});
this
.
$router
.
push
({
path
:
url
});
}
}).
catch
((
error
:
any
)
=>
{
const
loginfailed
:
any
=
this
.
$t
(
'components.login.loginfailed'
);
this
.
$Notice
.
error
({
title
:
(
this
.
$t
(
'components.login.error'
)
as
any
),
desc
:
loginfailed
});
// const loginfailed: any = this.$t('components.login.loginfailed');
// this.$Notice.error({ title: (this.$t('components.login.error') as any), desc: loginfailed });
// 登录提示
const
data
=
error
.
data
;
if
(
data
&&
data
.
message
)
{
this
.
loginTip
=
data
.
message
;
this
.
$Message
.
error
({
content
:
"登录失败,"
+
data
.
message
,
duration
:
5
,
closable
:
true
});
}
else
{
this
.
$Message
.
error
({
content
:
"登录失败"
,
duration
:
5
,
closable
:
true
});
}
});
}
/**
* 重置页面
*/
public
goReset
():
void
{
const
_this
=
this
;
_this
.
form
=
{
loginname
:
'ibzadmin'
,
password
:
'123456'
}
}
/**
* 设置cookie,保存账号密码
* @param loginname
* @param password
*/
public
setCookie
(
loginname
:
any
,
exdays
:
any
)
{
// 获取时间
let
exdate
=
new
Date
();
// 保存的天数
exdate
.
setTime
(
exdate
.
getTime
()
+
24
*
60
*
60
*
1000
*
exdays
);
// 字符串拼接cookie
window
.
document
.
cookie
=
"loginname"
+
"="
+
loginname
+
";path=/;expires="
+
exdate
.
toUTCString
();
}
/**
* 获取cookie
*/
public
getCookie
()
{
if
(
document
.
cookie
.
length
>
0
)
{
var
arr
=
document
.
cookie
.
split
(
'; '
);
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
var
arr2
=
arr
[
i
].
split
(
'='
);
//判断查找相对应的值
if
(
arr2
[
0
]
==
'loginname'
)
{
this
.
form
.
loginname
=
arr2
[
1
];
}
}
}
}
/**
* qq授权登录
* @param thirdpart
*/
public
tencentHandleClick
(
thirdpart
:
any
)
{
this
.
$Message
.
warning
(
"qq授权登录暂未支持"
)
}
/**
* 微信授权登录
* @param thirddpart
*/
public
wechatHandleClick
(
thirddpart
:
any
)
{
this
.
$Message
.
warning
(
"微信授权登录暂未支持"
)
}
}
}
</
script
>
<
style
lang=
'less'
>
@import './login.less';
@import './login.less';
</
style
>
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录