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 @@
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
if
(
data
.
ibzuser
)
{
var
ibzuser
=
JSON
.
stringify
(
data
.
ibzuser
);
var
ibzuser
=
data
.
ibzuser
;
localStorage
.
setItem
(
'ibzuser'
,
JSON
.
stringify
(
ibzuser
));
// 设置cookie,保存账号密码7天
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
// 跳转首页
...
...
@@ -58,7 +59,6 @@
}
});
}
else
{
alert
(
"钉钉授权登录失败!"
);
// 回到登录页
window
.
location
.
href
=
"../"
;
}
...
...
@@ -76,7 +76,7 @@
// 设置cookie
function
setCookie
(
loginname
,
password
,
exdays
)
{
// 获取时间
let
exdate
=
new
Date
();
var
exdate
=
new
Date
();
// 保存的天数
exdate
.
setTime
(
exdate
.
getTime
()
+
24
*
60
*
60
*
1000
*
exdays
);
// 字符串拼接cookie
...
...
app_Web/public/assets/qqRedirect.html
浏览文件 @
d7cfa4ac
...
...
@@ -40,7 +40,8 @@
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
if
(
data
.
ibzuser
)
{
var
ibzuser
=
JSON
.
stringify
(
data
.
ibzuser
);
var
ibzuser
=
data
.
ibzuser
;
localStorage
.
setItem
(
'ibzuser'
,
JSON
.
stringify
(
ibzuser
));
// 设置cookie,保存账号密码7天
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
// 跳转首页
...
...
@@ -58,7 +59,6 @@
}
});
}
else
{
alert
(
"微信授权登录失败!"
);
// 回到登录页
window
.
location
.
href
=
"../"
;
}
...
...
@@ -76,7 +76,7 @@
// 设置cookie
function
setCookie
(
loginname
,
password
,
exdays
)
{
// 获取时间
let
exdate
=
new
Date
();
var
exdate
=
new
Date
();
// 保存的天数
exdate
.
setTime
(
exdate
.
getTime
()
+
24
*
60
*
60
*
1000
*
exdays
);
// 字符串拼接cookie
...
...
app_Web/public/assets/weixinRedirect.html
浏览文件 @
d7cfa4ac
...
...
@@ -25,7 +25,6 @@
data
:
JSON
.
stringify
(
opt
),
contentType
:
'application/json'
,
success
:
function
(
data
)
{
// console.log(JSON.stringify(data));
if
(
data
)
{
if
(
data
.
openid
)
{
localStorage
.
setItem
(
'openid'
,
data
.
openid
);
...
...
@@ -40,7 +39,8 @@
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
if
(
data
.
ibzuser
)
{
var
ibzuser
=
JSON
.
stringify
(
data
.
ibzuser
);
var
ibzuser
=
data
.
ibzuser
;
localStorage
.
setItem
(
'ibzuser'
,
JSON
.
stringify
(
ibzuser
));
// 设置cookie,保存账号密码7天
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
// 跳转首页
...
...
@@ -58,7 +58,6 @@
}
});
}
else
{
alert
(
"微信授权登录失败!"
);
// 回到登录页
window
.
location
.
href
=
"../"
;
}
...
...
@@ -76,7 +75,7 @@
// 设置cookie
function
setCookie
(
loginname
,
password
,
exdays
)
{
// 获取时间
let
exdate
=
new
Date
();
var
exdate
=
new
Date
();
// 保存的天数
exdate
.
setTime
(
exdate
.
getTime
()
+
24
*
60
*
60
*
1000
*
exdays
);
// 字符串拼接cookie
...
...
app_Web/src/components/login/dingdingLoginRedirect.vue
浏览文件 @
d7cfa4ac
...
...
@@ -149,7 +149,6 @@
if
(
!
this
.
state
)
{
this
.
state
=
this
.
getUrlParam
(
'state'
);
}
// alert("code:" + this.code + "\nstate:" + this.state);
// 获取失败,回到登录页
if
(
!
this
.
code
||
!
this
.
state
)
{
this
.
$message
.
error
(
"钉钉授权,获取code失败"
);
...
...
@@ -201,7 +200,6 @@
/**
* 注册处理
*/
...
...
@@ -244,7 +242,8 @@
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
if
(
data
.
ibzuser
)
{
let
ibzuser
:
any
=
JSON
.
stringify
(
data
.
ibzuser
);
let
ibzuser
:
any
=
data
.
ibzuser
;
localStorage
.
setItem
(
'ibzuser'
,
JSON
.
stringify
(
ibzuser
));
// 设置cookie,保存账号密码7天
this
.
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
// 跳转首页
...
...
@@ -268,24 +267,29 @@
closable
:
true
});
}
// 返回登录页
this
.
goLogin
();
});
}
/**
* 设置cookie,保存账号密码
* @param loginname
* @param password
* 设置cookie
*/
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
();
public
setCookie
(
name
:
any
,
value
:
any
,
day
:
any
)
{
if
(
day
!==
0
)
{
//当设置的时间等于0时,不设置expires属性,cookie在浏览器关闭后删除
var
curDate
=
new
Date
();
var
curTamp
=
curDate
.
getTime
();
var
curWeeHours
=
new
Date
(
curDate
.
toLocaleDateString
()).
getTime
()
-
1
;
var
passedTamp
=
curTamp
-
curWeeHours
;
var
leftTamp
=
24
*
60
*
60
*
1000
-
passedTamp
;
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
此差异已折叠。
点击以展开。
app_Web/src/components/login/qqLoginRedirect.vue
浏览文件 @
d7cfa4ac
...
...
@@ -144,7 +144,7 @@
* 挂载
*/
public
mounted
()
{
let
_this
=
this
;
// 从url获取授权code和state
this
.
code
=
this
.
$route
.
query
.
code
;
if
(
!
this
.
code
)
{
...
...
@@ -156,7 +156,7 @@
}
// 获取失败,回到登录页
if
(
!
this
.
code
||
!
this
.
state
)
{
this
.
$message
.
error
(
"
微信
授权,获取code失败"
);
this
.
$message
.
error
(
"
QQ
授权,获取code失败"
);
this
.
goLogin
();
}
else
{
...
...
@@ -168,6 +168,7 @@
this
.
nickname
=
localStorage
.
getItem
(
"nickname"
);
}
}
}
...
...
@@ -247,7 +248,8 @@
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
if
(
data
.
ibzuser
)
{
let
ibzuser
:
any
=
JSON
.
stringify
(
data
.
ibzuser
);
let
ibzuser
:
any
=
data
.
ibzuser
;
localStorage
.
setItem
(
'ibzuser'
,
JSON
.
stringify
(
ibzuser
));
// 设置cookie,保存账号密码7天
this
.
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
// 跳转首页
...
...
@@ -271,81 +273,29 @@
closable
:
true
});
}
// 返回登录页
this
.
goLogin
();
});
}
/**
*
自动登录倒计时
*
设置cookie
*/
public
countDown
(
totalTime
:
any
):
void
{
if
(
!
this
.
canClick
)
return
;
this
.
canClick
=
false
;
this
.
BtnContent
=
totalTime
+
's后自动登录'
;
// 设置定时器
let
clock
=
window
.
setInterval
(()
=>
{
// 秒数-1
totalTime
--
;
this
.
BtnContent
=
totalTime
+
's后自动登录'
;
if
(
totalTime
<
0
)
{
// 清除定时器
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
{
this
.
$Message
.
error
({
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
();
public
setCookie
(
name
:
any
,
value
:
any
,
day
:
any
)
{
if
(
day
!==
0
)
{
//当设置的时间等于0时,不设置expires属性,cookie在浏览器关闭后删除
var
curDate
=
new
Date
();
var
curTamp
=
curDate
.
getTime
();
var
curWeeHours
=
new
Date
(
curDate
.
toLocaleDateString
()).
getTime
()
-
1
;
var
passedTamp
=
curTamp
-
curWeeHours
;
var
leftTamp
=
24
*
60
*
60
*
1000
-
passedTamp
;
var
leftTime
=
new
Date
();
leftTime
.
setTime
(
leftTamp
+
curTamp
);
document
.
cookie
=
name
+
"="
+
escape
(
value
)
+
";expires="
+
leftTime
.
toUTCString
();
}
else
{
document
.
cookie
=
name
+
"="
+
escape
(
value
);
}
}
}
</
script
>
...
...
app_Web/src/components/login/weixinLoginRedirect.vue
浏览文件 @
d7cfa4ac
...
...
@@ -87,7 +87,7 @@
public
state
:
any
;
/**
*
钉钉
用户身份的唯一标识
*
微信
用户身份的唯一标识
*/
public
openid
:
any
;
...
...
@@ -244,7 +244,8 @@
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
data
.
user
));
}
if
(
data
.
ibzuser
)
{
let
ibzuser
:
any
=
JSON
.
stringify
(
data
.
ibzuser
);
let
ibzuser
:
any
=
data
.
ibzuser
;
localStorage
.
setItem
(
'ibzuser'
,
JSON
.
stringify
(
ibzuser
));
// 设置cookie,保存账号密码7天
this
.
setCookie
(
ibzuser
.
loginname
,
ibzuser
.
password
,
7
);
// 跳转首页
...
...
@@ -268,23 +269,27 @@
closable
:
true
});
}
// 返回登录页
this
.
goLogin
();
});
}
/**
* 设置cookie,保存账号密码
* @param loginname
* @param password
* 设置cookie
*/
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
();
public
setCookie
(
name
:
any
,
value
:
any
,
day
:
any
)
{
if
(
day
!==
0
)
{
//当设置的时间等于0时,不设置expires属性,cookie在浏览器关闭后删除
var
curDate
=
new
Date
();
var
curTamp
=
curDate
.
getTime
();
var
curWeeHours
=
new
Date
(
curDate
.
toLocaleDateString
()).
getTime
()
-
1
;
var
passedTamp
=
curTamp
-
curWeeHours
;
var
leftTamp
=
24
*
60
*
60
*
1000
-
passedTamp
;
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
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录