Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-manage-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-manage-ui
Commits
ca0554b0
Commit
ca0554b0
authored
Apr 24, 2023
by
李鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix
parent
2025f13a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
9 deletions
+56
-9
src/page/login/index.vue
src/page/login/index.vue
+40
-9
src/services/helper.js
src/services/helper.js
+16
-0
No files found.
src/page/login/index.vue
View file @
ca0554b0
...
...
@@ -8,10 +8,7 @@
: getImageUrl('bg.png')
})`,
}">
<el-alert
class=
"bg-warning"
title=
"系统有效期剩余345 天,请管理员及时更换license!"
type=
"warning"
/>
<el-alert
v-if=
"showValidityDays"
class=
"bg-warning"
:title=
"validityTips"
type=
"warning"
/>
<div
class=
"bg-main"
>
<!--
<div
class=
"bg-logo"
>
<img
class=
"logo"
src=
"../../assets/imgs/login_img_logo.png"
/>
...
...
@@ -69,7 +66,8 @@ import { ElMessage } from "element-plus";
import
{
ref
,
onBeforeMount
,
onMounted
}
from
"
vue
"
;
import
{
useRouter
}
from
"
vue-router
"
;
import
store
from
"
../../store
"
;
import
{
getImageUrl
}
from
"
@/services/helper.js
"
;
import
{
getImageUrl
,
timeDifference
}
from
"
@/services/helper.js
"
;
import
{
result
}
from
"
lodash
"
;
const
router
=
useRouter
();
const
pageType
=
ref
(
"
login
"
);
...
...
@@ -77,6 +75,15 @@ const loginTab = ref("account");
const
configOptions
=
ref
({});
const
dialogPasswordChange
=
ref
(
false
);
//剩余有效期提醒文案
const
validityTips
=
ref
(
""
);
//是否展示剩余有效期提醒
const
showValidityDays
=
ref
(
false
);
onBeforeMount
(()
=>
{
getLoginPageConfig
();
getSysOptions
();
});
const
switchPageType
=
(
type
)
=>
{
// pageType.value = type
...
...
@@ -95,7 +102,34 @@ const getLoginPageConfig = () => {
}
});
};
//获取首选项配置
const
getSysOptions
=
()
=>
{
axios
.
get
(
`/apaas/system/v5/sysOptions`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
200
)
{
const
result
=
res
.
data
.
data
||
{};
if
(
result
.
license_dead_date
&&
result
.
license_inform_day
)
{
calculateValidityDays
(
new
Date
().
getTime
(),
new
Date
(
result
.
license_dead_date
).
getTime
(),
result
.
license_inform_day
);
}
}
else
{
ElMessage
.
error
(
res
.
data
.
data
);
}
});
};
const
calculateValidityDays
=
(
start
,
end
,
validityTipsLimit
)
=>
{
if
(
start
>
end
)
{
validityTips
.
value
=
"
系统已过有效期,请管理员更换license!
"
;
showValidityDays
.
value
=
true
;
return
;
}
const
leaveTimeConfig
=
timeDifference
(
start
,
end
);
if
(
leaveTimeConfig
.
days
>
validityTipsLimit
)
return
;
validityTips
.
value
=
`系统有效期剩余
${
leaveTimeConfig
.
days
}
天,请管理员及时更换license!`
;
showValidityDays
.
value
=
true
;
};
const
open
=
(
url
)
=>
{
if
(
url
!==
""
)
{
window
.
open
(
url
);
...
...
@@ -103,9 +137,6 @@ const open = (url) => {
return
;
}
};
onBeforeMount
(()
=>
{
getLoginPageConfig
();
});
</
script
>
<
style
lang=
"scss"
scoped
>
...
...
src/services/helper.js
View file @
ca0554b0
...
...
@@ -223,6 +223,21 @@ var timeForMatAdd = function (count) {
};
};
//计算时间差
var
timeDifference
=
function
(
startTime
,
endTime
)
{
//可以传日期时间或时间戳
let
start
=
typeof
startTime
==
"
number
"
?
startTime
:
new
Date
(
startTime
).
getTime
(),
end
=
typeof
endTime
==
"
number
"
?
endTime
:
new
Date
(
endTime
).
getTime
(),
difference
=
end
-
start
,
//时间差的毫秒数
days
=
Math
.
floor
(
difference
/
(
24
*
3600
*
1000
)),
//计算出相差天数
leave1
=
difference
%
(
24
*
3600
*
1000
),
//计算天数后剩余的毫秒数
hours
=
Math
.
floor
(
leave1
/
(
3600
*
1000
)),
//计算相差小时数
leave2
=
leave1
%
(
3600
*
1000
),
//计算小时数后剩余的毫秒数
minutes
=
Math
.
floor
(
leave2
/
(
60
*
1000
)),
//计算相差分钟数
leave3
=
leave2
%
(
60
*
1000
),
//计算分钟数后剩余的毫秒数
seconds
=
Math
.
round
(
leave3
/
1000
);
return
{
days
,
hours
,
minutes
,
seconds
};
};
var
useConsole
=
function
()
{
//改写console.log,防止打印数据泄露
window
.
isDebug
=
false
;
// 控制是否屏蔽全局console.log 日志;isDebug设为false即可屏蔽
...
...
@@ -297,6 +312,7 @@ export {
getQueryString
,
timeForMatReduce
,
timeForMatAdd
,
timeDifference
,
useConsole
,
getFirstChild
,
getImageUrl
,
...
...
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