Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzrt
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzrt
提交
d7cfa4ac
提交
d7cfa4ac
编写于
8月 03, 2020
作者:
laizhilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改登出后自动填充表单的逻辑
上级
9f9af46b
变更
7
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
400 行增加
和
450 行删除
+400
-450
dingdingRedirect.html
app_Web/public/assets/dingdingRedirect.html
+3
-3
qqRedirect.html
app_Web/public/assets/qqRedirect.html
+3
-3
weixinRedirect.html
app_Web/public/assets/weixinRedirect.html
+3
-4
dingdingLoginRedirect.vue
app_Web/src/components/login/dingdingLoginRedirect.vue
+18
-14
login.vue
app_Web/src/components/login/login.vue
+333
-341
qqLoginRedirect.vue
app_Web/src/components/login/qqLoginRedirect.vue
+21
-71
weixinLoginRedirect.vue
app_Web/src/components/login/weixinLoginRedirect.vue
+19
-14
未找到文件。
app_Web/public/assets/dingdingRedirect.html
浏览文件 @
d7cfa4ac
...
@@ -40,7 +40,8 @@
...
@@ -40,7 +40,8 @@
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
}
if
(
data
.
ibzuser
)
{
if
(
data
.
ibzuser
)
{
var
ibzuser
=
JSON
.
stringify
(
data
.
ibzuser
);
var
ibzuser
=
data
.
ibzuser
;
localStorage
.
setItem
(
'ibzuser'
,
JSON
.
stringify
(
ibzuser
));
// 设置cookie,保存账号密码7天
// 设置cookie,保存账号密码7天
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
// 跳转首页
// 跳转首页
...
@@ -58,7 +59,6 @@
...
@@ -58,7 +59,6 @@
}
}
});
});
}
else
{
}
else
{
alert
(
"钉钉授权登录失败!"
);
// 回到登录页
// 回到登录页
window
.
location
.
href
=
"../"
;
window
.
location
.
href
=
"../"
;
}
}
...
@@ -76,7 +76,7 @@
...
@@ -76,7 +76,7 @@
// 设置cookie
// 设置cookie
function
setCookie
(
loginname
,
password
,
exdays
)
{
function
setCookie
(
loginname
,
password
,
exdays
)
{
// 获取时间
// 获取时间
let
exdate
=
new
Date
();
var
exdate
=
new
Date
();
// 保存的天数
// 保存的天数
exdate
.
setTime
(
exdate
.
getTime
()
+
24
*
60
*
60
*
1000
*
exdays
);
exdate
.
setTime
(
exdate
.
getTime
()
+
24
*
60
*
60
*
1000
*
exdays
);
// 字符串拼接cookie
// 字符串拼接cookie
...
...
app_Web/public/assets/qqRedirect.html
浏览文件 @
d7cfa4ac
...
@@ -40,7 +40,8 @@
...
@@ -40,7 +40,8 @@
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
}
if
(
data
.
ibzuser
)
{
if
(
data
.
ibzuser
)
{
var
ibzuser
=
JSON
.
stringify
(
data
.
ibzuser
);
var
ibzuser
=
data
.
ibzuser
;
localStorage
.
setItem
(
'ibzuser'
,
JSON
.
stringify
(
ibzuser
));
// 设置cookie,保存账号密码7天
// 设置cookie,保存账号密码7天
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
// 跳转首页
// 跳转首页
...
@@ -58,7 +59,6 @@
...
@@ -58,7 +59,6 @@
}
}
});
});
}
else
{
}
else
{
alert
(
"微信授权登录失败!"
);
// 回到登录页
// 回到登录页
window
.
location
.
href
=
"../"
;
window
.
location
.
href
=
"../"
;
}
}
...
@@ -76,7 +76,7 @@
...
@@ -76,7 +76,7 @@
// 设置cookie
// 设置cookie
function
setCookie
(
loginname
,
password
,
exdays
)
{
function
setCookie
(
loginname
,
password
,
exdays
)
{
// 获取时间
// 获取时间
let
exdate
=
new
Date
();
var
exdate
=
new
Date
();
// 保存的天数
// 保存的天数
exdate
.
setTime
(
exdate
.
getTime
()
+
24
*
60
*
60
*
1000
*
exdays
);
exdate
.
setTime
(
exdate
.
getTime
()
+
24
*
60
*
60
*
1000
*
exdays
);
// 字符串拼接cookie
// 字符串拼接cookie
...
...
app_Web/public/assets/weixinRedirect.html
浏览文件 @
d7cfa4ac
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
data
:
JSON
.
stringify
(
opt
),
data
:
JSON
.
stringify
(
opt
),
contentType
:
'application/json'
,
contentType
:
'application/json'
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
// console.log(JSON.stringify(data));
if
(
data
)
{
if
(
data
)
{
if
(
data
.
openid
)
{
if
(
data
.
openid
)
{
localStorage
.
setItem
(
'openid'
,
data
.
openid
);
localStorage
.
setItem
(
'openid'
,
data
.
openid
);
...
@@ -40,7 +39,8 @@
...
@@ -40,7 +39,8 @@
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
}
if
(
data
.
ibzuser
)
{
if
(
data
.
ibzuser
)
{
var
ibzuser
=
JSON
.
stringify
(
data
.
ibzuser
);
var
ibzuser
=
data
.
ibzuser
;
localStorage
.
setItem
(
'ibzuser'
,
JSON
.
stringify
(
ibzuser
));
// 设置cookie,保存账号密码7天
// 设置cookie,保存账号密码7天
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
// 跳转首页
// 跳转首页
...
@@ -58,7 +58,6 @@
...
@@ -58,7 +58,6 @@
}
}
});
});
}
else
{
}
else
{
alert
(
"微信授权登录失败!"
);
// 回到登录页
// 回到登录页
window
.
location
.
href
=
"../"
;
window
.
location
.
href
=
"../"
;
}
}
...
@@ -76,7 +75,7 @@
...
@@ -76,7 +75,7 @@
// 设置cookie
// 设置cookie
function
setCookie
(
loginname
,
password
,
exdays
)
{
function
setCookie
(
loginname
,
password
,
exdays
)
{
// 获取时间
// 获取时间
let
exdate
=
new
Date
();
var
exdate
=
new
Date
();
// 保存的天数
// 保存的天数
exdate
.
setTime
(
exdate
.
getTime
()
+
24
*
60
*
60
*
1000
*
exdays
);
exdate
.
setTime
(
exdate
.
getTime
()
+
24
*
60
*
60
*
1000
*
exdays
);
// 字符串拼接cookie
// 字符串拼接cookie
...
...
app_Web/src/components/login/dingdingLoginRedirect.vue
浏览文件 @
d7cfa4ac
...
@@ -149,7 +149,6 @@
...
@@ -149,7 +149,6 @@
if
(
!
this
.
state
)
{
if
(
!
this
.
state
)
{
this
.
state
=
this
.
getUrlParam
(
'state'
);
this
.
state
=
this
.
getUrlParam
(
'state'
);
}
}
// alert("code:" + this.code + "\nstate:" + this.state);
// 获取失败,回到登录页
// 获取失败,回到登录页
if
(
!
this
.
code
||
!
this
.
state
)
{
if
(
!
this
.
code
||
!
this
.
state
)
{
this
.
$message
.
error
(
"钉钉授权,获取code失败"
);
this
.
$message
.
error
(
"钉钉授权,获取code失败"
);
...
@@ -201,7 +200,6 @@
...
@@ -201,7 +200,6 @@
/**
/**
* 注册处理
* 注册处理
*/
*/
...
@@ -244,7 +242,8 @@
...
@@ -244,7 +242,8 @@
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
}
if
(
data
.
ibzuser
)
{
if
(
data
.
ibzuser
)
{
let
ibzuser
:
any
=
JSON
.
stringify
(
data
.
ibzuser
);
let
ibzuser
:
any
=
data
.
ibzuser
;
localStorage
.
setItem
(
'ibzuser'
,
JSON
.
stringify
(
ibzuser
));
// 设置cookie,保存账号密码7天
// 设置cookie,保存账号密码7天
this
.
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
this
.
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
// 跳转首页
// 跳转首页
...
@@ -268,24 +267,29 @@
...
@@ -268,24 +267,29 @@
closable
:
true
closable
:
true
});
});
}
}
// 返回登录页
this
.
goLogin
();
});
});
}
}
/**
/**
* 设置cookie,保存账号密码
* 设置cookie
* @param loginname
* @param password
*/
*/
public
setCookie
(
loginname
:
any
,
password
:
any
,
exdays
:
any
)
{
public
setCookie
(
name
:
any
,
value
:
any
,
day
:
any
)
{
// 获取时间
if
(
day
!==
0
)
{
//当设置的时间等于0时,不设置expires属性,cookie在浏览器关闭后删除
let
exdate
=
new
Date
();
var
curDate
=
new
Date
();
// 保存的天数
var
curTamp
=
curDate
.
getTime
();
exdate
.
setTime
(
exdate
.
getTime
()
+
24
*
60
*
60
*
1000
*
exdays
);
var
curWeeHours
=
new
Date
(
curDate
.
toLocaleDateString
()).
getTime
()
-
1
;
// 字符串拼接cookie
var
passedTamp
=
curTamp
-
curWeeHours
;
window
.
document
.
cookie
=
"loginname"
+
"="
+
loginname
+
";path=/;expires="
+
exdate
.
toUTCString
();
var
leftTamp
=
24
*
60
*
60
*
1000
-
passedTamp
;
window
.
document
.
cookie
=
"password"
+
"="
+
password
+
";path=/;expires="
+
exdate
.
toUTCString
();
var
leftTime
=
new
Date
();
leftTime
.
setTime
(
leftTamp
+
curTamp
);
document
.
cookie
=
name
+
"="
+
escape
(
value
)
+
";expires="
+
leftTime
.
toUTCString
();
}
else
{
document
.
cookie
=
name
+
"="
+
escape
(
value
);
}
}
}
...
...
app_Web/src/components/login/login.vue
浏览文件 @
d7cfa4ac
<
template
>
<
template
>
<div
class=
'login'
>
<div
class=
'login'
>
<img
src=
"/assets/img/background.png"
/>
<img
src=
"/assets/img/background.png"
draggable=
"false"
/>
<div
class=
'login-con'
>
<div
class=
'login-con'
>
<card
:bordered=
"false"
>
<card
:bordered=
"false"
>
...
@@ -40,7 +40,6 @@
...
@@ -40,7 +40,6 @@
class=
"login_reset"
>
重置
class=
"login_reset"
>
重置
</i-button>
</i-button>
</form-item>
</form-item>
<form-item>
<form-item>
<a
@
click=
"goRegister"
class=
"goRegister"
draggable=
"false"
>
没有账号,现在注册一个
</a>
<a
@
click=
"goRegister"
class=
"goRegister"
draggable=
"false"
>
没有账号,现在注册一个
</a>
</form-item>
</form-item>
...
@@ -50,7 +49,7 @@
...
@@ -50,7 +49,7 @@
<span
class=
"form_tipinfo"
>
其他登录方式
</span>
<span
class=
"form_tipinfo"
>
其他登录方式
</span>
</div>
</div>
<div
style=
"text-align: center"
>
<div
style=
"text-align: center"
>
<div
class=
"sign-btn"
@
click=
"
tencentHandleClick('tencent
')"
>
<div
class=
"sign-btn"
@
click=
"
qqHandleClick('qq
')"
>
<img
src=
"/assets/img/QQ.svg"
class=
"qq-svg-container"
draggable=
"false"
>
<img
src=
"/assets/img/QQ.svg"
class=
"qq-svg-container"
draggable=
"false"
>
</div>
</div>
<div
class=
"sign-btn"
@
click=
"wechatHandleClick('wechat')"
>
<div
class=
"sign-btn"
@
click=
"wechatHandleClick('wechat')"
>
...
@@ -63,15 +62,12 @@
...
@@ -63,15 +62,12 @@
</form-item>
</form-item>
</i-form>
</i-form>
<p
class=
'login-tip'
>
{{
this
.
loginTip
}}
<!--
{{
this
.
$t
(
'components.login.tip'
)
}}
-->
</p>
</div>
</div>
</card>
</card>
<div
class=
"log_footer"
>
<div
class=
"log_footer"
>
<div
class=
"copyright"
>
<div
class=
"copyright"
>
<a
href=
"https://www.ibizlab.cn/"
target=
"_blank"
>
{{
appTitle
}}
is based on ibizlab .
</a>
<a
href=
"https://www.ibizlab.cn/"
target=
"_blank"
draggable=
"false"
>
{{
appTitle
}}
is based on ibizlab
.
</a>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -79,14 +75,13 @@
...
@@ -79,14 +75,13 @@
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Vue
,
Component
,
Watch
}
from
'vue-property-decorator'
;
import
{
Vue
,
Component
,
Watch
}
from
'vue-property-decorator'
;
import
{
Environment
}
from
'@/environments/environment'
;
import
{
Environment
}
from
'@/environments/environment'
;
//import Divider from "ibiz-vue-lib/lib/ibiz-vue-lib.common";
@
Component
({
@
Component
({
components
:
{}
components
:
{}
})
})
export
default
class
Login
extends
Vue
{
export
default
class
Login
extends
Vue
{
/**
/**
* 表单对象
* 表单对象
...
@@ -94,17 +89,8 @@ export default class Login extends Vue {
...
@@ -94,17 +89,8 @@ export default class Login extends Vue {
* @type {*}
* @type {*}
* @memberof Login
* @memberof Login
*/
*/
public
form
:
any
=
{
loginname
:
'ibzadmin'
,
password
:
'123456'
};
public
form
:
any
=
{
loginname
:
'guest'
,
password
:
'123456'
};
/**
* 登录提示语
*/
public
loginTip
:
any
=
""
;
/**
* 按钮可点击
*/
public
canClick
:
any
=
true
;
/**
/**
* 应用名称
* 应用名称
...
@@ -154,6 +140,14 @@ export default class Login extends Vue {
...
@@ -154,6 +140,14 @@ export default class Login extends Vue {
if
(
this
.
getCookie
(
"password"
)
&&
this
.
getCookie
(
"password"
)
!==
'undefined'
)
{
if
(
this
.
getCookie
(
"password"
)
&&
this
.
getCookie
(
"password"
)
!==
'undefined'
)
{
this
.
form
.
password
=
this
.
getCookie
(
"password"
);
this
.
form
.
password
=
this
.
getCookie
(
"password"
);
}
}
if
(
localStorage
.
getItem
(
"ibzuser"
))
{
const
ibzuser
:
any
=
localStorage
.
getItem
(
"ibzuser"
);
if
(
ibzuser
)
{
const
ibzuserObj
:
any
=
JSON
.
parse
(
ibzuser
);
this
.
form
.
loginname
=
ibzuserObj
.
loginname
;
this
.
form
.
password
=
ibzuserObj
.
password
;
}
}
}
}
/**
/**
...
@@ -172,10 +166,6 @@ export default class Login extends Vue {
...
@@ -172,10 +166,6 @@ export default class Login extends Vue {
* @memberof Login
* @memberof Login
*/
*/
public
handleSubmit
():
void
{
public
handleSubmit
():
void
{
// 清除cookie
let
leftTime
=
new
Date
();
leftTime
.
setTime
(
leftTime
.
getSeconds
()
-
1000
);
document
.
cookie
=
"ibzuaa-token=;expires="
+
leftTime
.
toUTCString
();
const
form
:
any
=
this
.
$refs
.
loginForm
;
const
form
:
any
=
this
.
$refs
.
loginForm
;
let
validatestate
:
boolean
=
true
;
let
validatestate
:
boolean
=
true
;
form
.
validate
((
valid
:
boolean
)
=>
{
form
.
validate
((
valid
:
boolean
)
=>
{
...
@@ -193,10 +183,13 @@ export default class Login extends Vue {
...
@@ -193,10 +183,13 @@ export default class Login extends Vue {
const
data
=
response
.
data
;
const
data
=
response
.
data
;
if
(
data
&&
data
.
token
)
{
if
(
data
&&
data
.
token
)
{
localStorage
.
setItem
(
'token'
,
data
.
token
);
localStorage
.
setItem
(
'token'
,
data
.
token
);
this
.
setCookie
(
'ibzuaa-token'
,
data
.
token
,
0
);
this
.
setCookie
(
'ibzuaa-token'
,
data
.
token
,
0
);
}
if
(
data
&&
data
.
user
)
{
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
}
// 设置cookie,保存账号密码7天
// 设置cookie,保存账号密码7天
this
.
setCookie
(
"loginname"
,
loginname
,
7
);
this
.
setCookie
(
"loginname"
,
loginname
,
7
);
// 跳转首页
// 跳转首页
const
url
:
any
=
this
.
$route
.
query
.
redirect
?
this
.
$route
.
query
.
redirect
:
'*'
;
const
url
:
any
=
this
.
$route
.
query
.
redirect
?
this
.
$route
.
query
.
redirect
:
'*'
;
this
.
$router
.
push
({
path
:
url
});
this
.
$router
.
push
({
path
:
url
});
...
@@ -204,10 +197,9 @@ export default class Login extends Vue {
...
@@ -204,10 +197,9 @@ export default class Login extends Vue {
}).
catch
((
error
:
any
)
=>
{
}).
catch
((
error
:
any
)
=>
{
// 登录提示
// 登录提示
const
data
=
error
.
data
;
const
data
=
error
.
data
;
if
(
data
&&
data
.
message
)
{
if
(
data
&&
data
.
detail
)
{
this
.
loginTip
=
data
.
message
;
this
.
$Message
.
error
({
this
.
$Message
.
error
({
content
:
"登录失败,"
+
data
.
message
,
content
:
"登录失败,"
+
data
.
detail
,
duration
:
5
,
duration
:
5
,
closable
:
true
closable
:
true
});
});
...
@@ -240,20 +232,17 @@ export default class Login extends Vue {
...
@@ -240,20 +232,17 @@ export default class Login extends Vue {
_this
.
$router
.
push
(
'/register'
);
_this
.
$router
.
push
(
'/register'
);
}
}
/**
/**
* 设置cookie
* 设置cookie
*
* @memberof Login
*/
*/
public
setCookie
(
name
:
any
,
value
:
any
,
day
:
any
)
{
public
setCookie
(
name
:
any
,
value
:
any
,
day
:
any
)
{
if
(
day
!==
0
)
{
//当设置的时间等于0时,不设置expires属性,cookie在浏览器关闭后删除
if
(
day
!==
0
)
{
//当设置的时间等于0时,不设置expires属性,cookie在浏览器关闭后删除
let
curDate
=
new
Date
();
var
curDate
=
new
Date
();
let
curTamp
=
curDate
.
getTime
();
var
curTamp
=
curDate
.
getTime
();
let
curWeeHours
=
new
Date
(
curDate
.
toLocaleDateString
()).
getTime
()
-
1
;
var
curWeeHours
=
new
Date
(
curDate
.
toLocaleDateString
()).
getTime
()
-
1
;
let
passedTamp
=
curTamp
-
curWeeHours
;
var
passedTamp
=
curTamp
-
curWeeHours
;
let
leftTamp
=
24
*
60
*
60
*
1000
-
passedTamp
;
var
leftTamp
=
24
*
60
*
60
*
1000
-
passedTamp
;
let
leftTime
=
new
Date
();
var
leftTime
=
new
Date
();
leftTime
.
setTime
(
leftTamp
+
curTamp
);
leftTime
.
setTime
(
leftTamp
+
curTamp
);
document
.
cookie
=
name
+
"="
+
escape
(
value
)
+
";expires="
+
leftTime
.
toUTCString
();
document
.
cookie
=
name
+
"="
+
escape
(
value
)
+
";expires="
+
leftTime
.
toUTCString
();
}
else
{
}
else
{
...
@@ -263,12 +252,10 @@ export default class Login extends Vue {
...
@@ -263,12 +252,10 @@ export default class Login extends Vue {
/**
/**
* 获取cookie
* 获取cookie
*
* @memberof Login
*/
*/
public
getCookie
(
name
:
any
):
any
{
public
getCookie
(
name
:
any
):
any
{
let
arr
;
var
arr
;
let
reg
=
new
RegExp
(
"(^| )"
+
name
+
"=([^;]*)(;|$)"
);
var
reg
=
new
RegExp
(
"(^| )"
+
name
+
"=([^;]*)(;|$)"
);
if
(
arr
=
document
.
cookie
.
match
(
reg
))
if
(
arr
=
document
.
cookie
.
match
(
reg
))
return
unescape
(
arr
[
2
]);
return
unescape
(
arr
[
2
]);
else
else
...
@@ -279,7 +266,7 @@ export default class Login extends Vue {
...
@@ -279,7 +266,7 @@ export default class Login extends Vue {
* qq授权登录
* qq授权登录
* @param thirdpart
* @param thirdpart
*/
*/
public
tencent
HandleClick
(
thirdpart
:
any
)
{
public
qq
HandleClick
(
thirdpart
:
any
)
{
// 截取地址,拼接需要部分组成新地址
// 截取地址,拼接需要部分组成新地址
const
baseUrl
=
this
.
getNeedLocation
();
const
baseUrl
=
this
.
getNeedLocation
();
...
@@ -330,11 +317,13 @@ export default class Login extends Vue {
...
@@ -330,11 +317,13 @@ export default class Login extends Vue {
});
});
}
}
/**
/**
* 微信授权登录
* 微信授权登录
* @param third
dpart
* @param thir
dpart
*/
*/
public
wechatHandleClick
(
third
dpart
:
any
)
{
public
wechatHandleClick
(
thir
dpart
:
any
)
{
// 从后台获取微信开放平台提供的appid
// 从后台获取微信开放平台提供的appid
const
get
:
Promise
<
any
>
=
this
.
$http
.
get
(
'/uaa/getWechatAppId'
);
const
get
:
Promise
<
any
>
=
this
.
$http
.
get
(
'/uaa/getWechatAppId'
);
get
.
then
((
response
:
any
)
=>
{
get
.
then
((
response
:
any
)
=>
{
...
@@ -381,8 +370,10 @@ export default class Login extends Vue {
...
@@ -381,8 +370,10 @@ export default class Login extends Vue {
});
});
}
}
});
});
}
}
/**
/**
* 钉钉授权登录
* 钉钉授权登录
* @param thirdpart
* @param thirdpart
...
@@ -463,7 +454,8 @@ export default class Login extends Vue {
...
@@ -463,7 +454,8 @@ export default class Login extends Vue {
return
baseUrl
;
return
baseUrl
;
}
}
}
}
</
script
>
</
script
>
<
style
lang=
'less'
>
<
style
lang=
'less'
>
...
...
app_Web/src/components/login/qqLoginRedirect.vue
浏览文件 @
d7cfa4ac
...
@@ -144,7 +144,7 @@
...
@@ -144,7 +144,7 @@
* 挂载
* 挂载
*/
*/
public
mounted
()
{
public
mounted
()
{
let
_this
=
this
;
// 从url获取授权code和state
// 从url获取授权code和state
this
.
code
=
this
.
$route
.
query
.
code
;
this
.
code
=
this
.
$route
.
query
.
code
;
if
(
!
this
.
code
)
{
if
(
!
this
.
code
)
{
...
@@ -156,7 +156,7 @@
...
@@ -156,7 +156,7 @@
}
}
// 获取失败,回到登录页
// 获取失败,回到登录页
if
(
!
this
.
code
||
!
this
.
state
)
{
if
(
!
this
.
code
||
!
this
.
state
)
{
this
.
$message
.
error
(
"
微信
授权,获取code失败"
);
this
.
$message
.
error
(
"
QQ
授权,获取code失败"
);
this
.
goLogin
();
this
.
goLogin
();
}
}
else
{
else
{
...
@@ -168,6 +168,7 @@
...
@@ -168,6 +168,7 @@
this
.
nickname
=
localStorage
.
getItem
(
"nickname"
);
this
.
nickname
=
localStorage
.
getItem
(
"nickname"
);
}
}
}
}
}
}
...
@@ -247,7 +248,8 @@
...
@@ -247,7 +248,8 @@
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
}
if
(
data
.
ibzuser
)
{
if
(
data
.
ibzuser
)
{
let
ibzuser
:
any
=
JSON
.
stringify
(
data
.
ibzuser
);
let
ibzuser
:
any
=
data
.
ibzuser
;
localStorage
.
setItem
(
'ibzuser'
,
JSON
.
stringify
(
ibzuser
));
// 设置cookie,保存账号密码7天
// 设置cookie,保存账号密码7天
this
.
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
this
.
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
// 跳转首页
// 跳转首页
...
@@ -271,81 +273,29 @@
...
@@ -271,81 +273,29 @@
closable
:
true
closable
:
true
});
});
}
}
// 返回登录页
this
.
goLogin
();
});
});
}
}
/**
/**
*
自动登录倒计时
*
设置cookie
*/
*/
public
countDown
(
totalTime
:
any
):
void
{
public
setCookie
(
name
:
any
,
value
:
any
,
day
:
any
)
{
if
(
!
this
.
canClick
)
return
;
if
(
day
!==
0
)
{
//当设置的时间等于0时,不设置expires属性,cookie在浏览器关闭后删除
this
.
canClick
=
false
;
var
curDate
=
new
Date
();
this
.
BtnContent
=
totalTime
+
's后自动登录'
;
var
curTamp
=
curDate
.
getTime
();
// 设置定时器
var
curWeeHours
=
new
Date
(
curDate
.
toLocaleDateString
()).
getTime
()
-
1
;
let
clock
=
window
.
setInterval
(()
=>
{
var
passedTamp
=
curTamp
-
curWeeHours
;
// 秒数-1
var
leftTamp
=
24
*
60
*
60
*
1000
-
passedTamp
;
totalTime
--
;
var
leftTime
=
new
Date
();
this
.
BtnContent
=
totalTime
+
's后自动登录'
;
leftTime
.
setTime
(
leftTamp
+
curTamp
);
if
(
totalTime
<
0
)
{
document
.
cookie
=
name
+
"="
+
escape
(
value
)
+
";expires="
+
leftTime
.
toUTCString
();
// 清除定时器
window
.
clearInterval
(
clock
);
// 登录请求
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
)
{
localStorage
.
setItem
(
'token'
,
data
.
token
);
}
if
(
data
&&
data
.
user
)
{
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
// 设置cookie,保存账号密码7天
this
.
setCookie
(
loginname
,
password
,
7
);
// 跳转首页
const
url
:
any
=
this
.
$route
.
query
.
redirect
?
this
.
$route
.
query
.
redirect
:
'*'
;
this
.
$router
.
push
({
path
:
url
});
}
}).
catch
((
error
:
any
)
=>
{
const
data
=
error
.
data
;
if
(
data
&&
data
.
detail
)
{
this
.
$Message
.
error
({
content
:
"登录失败,"
+
data
.
detail
,
duration
:
3
,
closable
:
true
});
}
else
{
}
else
{
this
.
$Message
.
error
({
document
.
cookie
=
name
+
"="
+
escape
(
value
);
content
:
"登录失败"
,
duration
:
3
,
closable
:
true
});
}
});
}
}
},
1000
)
}
/**
* 设置cookie,保存账号密码
* @param loginname
* @param password
*/
public
setCookie
(
loginname
:
any
,
password
:
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
();
window
.
document
.
cookie
=
"password"
+
"="
+
password
+
";path=/;expires="
+
exdate
.
toUTCString
();
}
}
}
}
</
script
>
</
script
>
...
...
app_Web/src/components/login/weixinLoginRedirect.vue
浏览文件 @
d7cfa4ac
...
@@ -87,7 +87,7 @@
...
@@ -87,7 +87,7 @@
public
state
:
any
;
public
state
:
any
;
/**
/**
*
钉钉
用户身份的唯一标识
*
微信
用户身份的唯一标识
*/
*/
public
openid
:
any
;
public
openid
:
any
;
...
@@ -244,7 +244,8 @@
...
@@ -244,7 +244,8 @@
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
}
if
(
data
.
ibzuser
)
{
if
(
data
.
ibzuser
)
{
let
ibzuser
:
any
=
JSON
.
stringify
(
data
.
ibzuser
);
let
ibzuser
:
any
=
data
.
ibzuser
;
localStorage
.
setItem
(
'ibzuser'
,
JSON
.
stringify
(
ibzuser
));
// 设置cookie,保存账号密码7天
// 设置cookie,保存账号密码7天
this
.
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
this
.
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
// 跳转首页
// 跳转首页
...
@@ -268,23 +269,27 @@
...
@@ -268,23 +269,27 @@
closable
:
true
closable
:
true
});
});
}
}
// 返回登录页
this
.
goLogin
();
});
});
}
}
/**
/**
* 设置cookie,保存账号密码
* 设置cookie
* @param loginname
* @param password
*/
*/
public
setCookie
(
loginname
:
any
,
password
:
any
,
exdays
:
any
)
{
public
setCookie
(
name
:
any
,
value
:
any
,
day
:
any
)
{
// 获取时间
if
(
day
!==
0
)
{
//当设置的时间等于0时,不设置expires属性,cookie在浏览器关闭后删除
let
exdate
=
new
Date
();
var
curDate
=
new
Date
();
// 保存的天数
var
curTamp
=
curDate
.
getTime
();
exdate
.
setTime
(
exdate
.
getTime
()
+
24
*
60
*
60
*
1000
*
exdays
);
var
curWeeHours
=
new
Date
(
curDate
.
toLocaleDateString
()).
getTime
()
-
1
;
// 字符串拼接cookie
var
passedTamp
=
curTamp
-
curWeeHours
;
window
.
document
.
cookie
=
"loginname"
+
"="
+
loginname
+
";path=/;expires="
+
exdate
.
toUTCString
();
var
leftTamp
=
24
*
60
*
60
*
1000
-
passedTamp
;
window
.
document
.
cookie
=
"password"
+
"="
+
password
+
";path=/;expires="
+
exdate
.
toUTCString
();
var
leftTime
=
new
Date
();
leftTime
.
setTime
(
leftTamp
+
curTamp
);
document
.
cookie
=
name
+
"="
+
escape
(
value
)
+
";expires="
+
leftTime
.
toUTCString
();
}
else
{
document
.
cookie
=
name
+
"="
+
escape
(
value
);
}
}
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录