Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
ae56b13b
Unverified
提交
ae56b13b
authored
12月 30, 2021
作者:
fit2cloud-chenyw
提交者:
GitHub
12月 30, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1560 from dataease/pr@dev@fix_public_link_time
fix: 公共链接有效期
上级
2a4f3a76
1b174f58
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
86 行增加
和
39 行删除
+86
-39
index.vue
frontend/src/views/link/generate/index.vue
+86
-39
没有找到文件。
frontend/src/views/link/generate/index.vue
浏览文件 @
ae56b13b
...
@@ -15,11 +15,7 @@
...
@@ -15,11 +15,7 @@
<el-link
class=
"de-link"
style=
"width: 370px;"
disabled
>
{{
$t
(
'panel.link_share_desc'
)
}}
</el-link>
<el-link
class=
"de-link"
style=
"width: 370px;"
disabled
>
{{
$t
(
'panel.link_share_desc'
)
}}
</el-link>
</el-form-item>
</el-form-item>
<el-form-item
v-if=
"valid"
:label=
"$t('panel.link')"
>
<el-form-item
v-if=
"valid"
:label=
"$t('panel.link')"
>
<el-input
<el-input
v-model
.
number=
"form.uri"
disabled
style=
"width: 370px;"
/>
v-model
.
number=
"form.uri"
disabled
style=
"width: 370px;"
/>
</el-form-item>
</el-form-item>
<el-form-item
v-if=
"valid"
:label=
"$t('panel.over_time')"
prop=
"overTime"
>
<el-form-item
v-if=
"valid"
:label=
"$t('panel.over_time')"
prop=
"overTime"
>
...
@@ -37,17 +33,34 @@
...
@@ -37,17 +33,34 @@
</el-form-item>
</el-form-item>
<el-form-item
v-if=
"valid"
label=
" "
>
<el-form-item
v-if=
"valid"
label=
" "
>
<el-checkbox
v-model=
"form.enablePwd"
@
change=
"resetEnablePwd"
>
{{
$t
(
'panel.passwd_protect'
)
}}
</el-checkbox>
<el-checkbox
v-model=
"form.enablePwd"
@
change=
"resetEnablePwd"
>
{{
$t
(
'panel.passwd_protect'
)
}}
</el-checkbox>
<span
v-if=
"form.enablePwd"
class=
"de-span"
>
{{
form
.
pwd
}}
</span>
<span
v-if=
"form.enablePwd"
class=
"de-span"
>
{{
form
.
pwd
}}
</span>
<span
v-if=
"form.enablePwd"
class=
"de-span"
@
click=
"resetPwd"
><el-link
:underline=
"false"
type=
"primary"
>
{{
$t
(
'commons.reset'
)
}}
</el-link></span>
<span
v-if=
"form.enablePwd"
class=
"de-span"
@
click=
"resetPwd"
>
<el-link
:underline=
"false"
type=
"primary"
>
{{
$t
(
'commons.reset'
)
}}
</el-link>
</span>
</el-form-item>
</el-form-item>
<div
v-if=
"valid"
class=
"auth-root-class"
>
<div
v-if=
"valid"
class=
"auth-root-class"
>
<span
slot=
"footer"
>
<span
slot=
"footer"
>
<el-button
v-if=
"!form.enablePwd"
v-clipboard:copy=
"form.uri"
v-clipboard:success=
"onCopy"
v-clipboard:error=
"onError"
size=
"mini"
type=
"primary"
>
{{
$t
(
'panel.copy_link'
)
}}
</el-button>
<el-button
<el-button
v-if=
"form.enablePwd"
v-clipboard:copy=
"form.uri + ' Password: '+ form.pwd"
v-clipboard:success=
"onCopy"
v-clipboard:error=
"onError"
size=
"mini"
type=
"primary"
>
{{
$t
(
'panel.copy_link_passwd'
)
}}
</el-button>
v-if=
"!form.enablePwd"
v-clipboard:copy=
"form.uri"
v-clipboard:success=
"onCopy"
v-clipboard:error=
"onError"
size=
"mini"
type=
"primary"
>
{{
$t
(
'panel.copy_link'
)
}}
</el-button>
<el-button
v-if=
"form.enablePwd"
v-clipboard:copy=
"form.uri + ' Password: '+ form.pwd"
v-clipboard:success=
"onCopy"
v-clipboard:error=
"onError"
size=
"mini"
type=
"primary"
>
{{
$t
(
'panel.copy_link_passwd'
)
}}
</el-button>
</span>
</span>
</div>
</div>
...
@@ -56,8 +69,14 @@
...
@@ -56,8 +69,14 @@
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
import
{
loadGenerate
,
setPwd
,
switchValid
,
switchEnablePwd
,
shortUrl
,
setOverTime
}
from
'@/api/link'
loadGenerate
,
setPwd
,
switchValid
,
switchEnablePwd
,
shortUrl
,
setOverTime
}
from
'@/api/link'
export
default
{
export
default
{
name
:
'LinkGenerate'
,
name
:
'LinkGenerate'
,
...
@@ -75,7 +94,11 @@ export default {
...
@@ -75,7 +94,11 @@ export default {
pwdNums
:
4
,
pwdNums
:
4
,
valid
:
false
,
valid
:
false
,
form
:
{},
form
:
{},
defaultForm
:
{
enablePwd
:
false
,
pwd
:
null
,
uri
:
null
},
defaultForm
:
{
enablePwd
:
false
,
pwd
:
null
,
uri
:
null
},
pickerOptions
:
{
pickerOptions
:
{
disabledDate
:
time
=>
{
disabledDate
:
time
=>
{
return
time
.
getTime
()
<
(
Date
.
now
()
-
8.64e7
)
return
time
.
getTime
()
<
(
Date
.
now
()
-
8.64e7
)
...
@@ -103,9 +126,11 @@ export default {
...
@@ -103,9 +126,11 @@ export default {
minTime
:
'15:51'
minTime
:
'15:51'
},
},
rules
:
{
rules
:
{
overTime
:
[
overTime
:
[{
{
required
:
false
,
validator
:
this
.
validateMin
,
trigger
:
'blur'
}
required
:
false
,
]
validator
:
this
.
validateMin
,
trigger
:
'blur'
}]
}
}
}
}
},
},
...
@@ -122,7 +147,13 @@ export default {
...
@@ -122,7 +147,13 @@ export default {
currentGenerate
()
{
currentGenerate
()
{
loadGenerate
(
this
.
resourceId
).
then
(
res
=>
{
loadGenerate
(
this
.
resourceId
).
then
(
res
=>
{
const
{
valid
,
enablePwd
,
pwd
,
uri
,
overTime
}
=
res
.
data
const
{
valid
,
enablePwd
,
pwd
,
uri
,
overTime
}
=
res
.
data
this
.
valid
=
valid
this
.
valid
=
valid
this
.
form
.
enablePwd
=
enablePwd
this
.
form
.
enablePwd
=
enablePwd
this
.
form
.
uri
=
uri
?
(
this
.
origin
+
uri
)
:
uri
this
.
form
.
uri
=
uri
?
(
this
.
origin
+
uri
)
:
uri
...
@@ -183,7 +214,7 @@ export default {
...
@@ -183,7 +214,7 @@ export default {
overTime
:
value
overTime
:
value
}
}
setOverTime
(
param
).
then
(
res
=>
{
setOverTime
(
param
).
then
(
res
=>
{
// this.form.overTime = value
// this.form.overTime = value
this
.
$forceUpdate
()
this
.
$forceUpdate
()
})
})
})
})
...
@@ -192,8 +223,7 @@ export default {
...
@@ -192,8 +223,7 @@ export default {
onCopy
(
e
)
{
onCopy
(
e
)
{
this
.
$success
(
this
.
$t
(
'commons.copy_success'
))
this
.
$success
(
this
.
$t
(
'commons.copy_success'
))
},
},
onError
(
e
)
{
onError
(
e
)
{},
},
onChange
(
value
)
{
onChange
(
value
)
{
const
param
=
{
const
param
=
{
resourceId
:
this
.
resourceId
,
resourceId
:
this
.
resourceId
,
...
@@ -207,7 +237,9 @@ export default {
...
@@ -207,7 +237,9 @@ export default {
const
url
=
this
.
form
.
uri
const
url
=
this
.
form
.
uri
if
(
!
url
)
return
if
(
!
url
)
return
shortUrl
({
resourceId
:
this
.
resourceId
}).
then
(
res
=>
{
shortUrl
({
resourceId
:
this
.
resourceId
}).
then
(
res
=>
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
this
.
form
.
uri
=
this
.
origin
+
res
.
data
this
.
form
.
uri
=
this
.
origin
+
res
.
data
}
}
...
@@ -228,15 +260,19 @@ export default {
...
@@ -228,15 +260,19 @@ export default {
return
new
Date
(
tom
.
format
(
'yyyy-MM-dd'
)
+
' 23:59:59'
)
return
new
Date
(
tom
.
format
(
'yyyy-MM-dd'
)
+
' 23:59:59'
)
}
}
if
(
type
===
'month'
)
{
if
(
type
===
'month'
)
{
const
result
=
new
Date
()
const
nowMonth
=
now
.
getMonth
()
const
curMonth
=
now
.
getMonth
()
+
1
const
nowYear
=
now
.
getFullYear
()
if
(
curMonth
===
12
)
{
let
nowDate
=
now
.
getDate
()
result
.
setYear
(
now
.
getYear
()
+
1
)
result
.
setMonth
(
0
)
const
tarYear
=
nowYear
}
else
{
const
deffMonth
=
nowMonth
+
1
result
.
setMonth
(
curMonth
)
const
diffYear
=
deffMonth
/
12
}
return
new
Date
(
result
.
format
(
'yyyy-MM-dd'
)
+
' 23:59:59'
)
const
targetMonth
=
deffMonth
%
12
const
days
=
this
.
getMonthDays
(
targetMonth
)
nowDate
=
nowDate
>
days
?
days
:
nowDate
return
new
Date
(
tarYear
+
diffYear
,
deffMonth
%
12
,
nowDate
,
23
,
59
,
59
)
}
}
return
null
return
null
},
},
...
@@ -247,21 +283,32 @@ export default {
...
@@ -247,21 +283,32 @@ export default {
return
callback
(
new
Error
(
'不能小于当前时间'
))
return
callback
(
new
Error
(
'不能小于当前时间'
))
}
}
return
callback
()
return
callback
()
},
getMonthDays
(
nowMonth
)
{
var
now
=
new
Date
()
var
monthStartDate
=
new
Date
(
now
.
getFullYear
(),
nowMonth
,
1
)
var
monthEndDate
=
new
Date
(
now
.
getFullYear
(),
nowMonth
+
1
,
1
)
var
days
=
(
monthEndDate
-
monthStartDate
)
/
(
1000
*
60
*
60
*
24
)
return
days
}
}
}
}
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.de-link
{
.de-link
{
justify-content
:
left
!
important
;
justify-content
:
left
!
important
;
}
}
.de-span
{
margin
:
0
15px
;
.de-span
{
}
margin
:
0
15px
;
.auth-root-class
{
}
margin
:
15px
0px
5px
;
text-align
:
right
;
.auth-root-class
{
}
margin
:
15px
0px
5px
;
text-align
:
right
;
}
</
style
>
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论