Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
a7144fd0
提交
a7144fd0
authored
10月 20, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 公共链接增加有效期
上级
42a36b10
隐藏空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
304 行增加
和
15 行删除
+304
-15
PanelLink.java
backend/src/main/java/io/dataease/base/domain/PanelLink.java
+3
-0
PanelLinkExample.java
...c/main/java/io/dataease/base/domain/PanelLinkExample.java
+60
-0
PanelLinkMapper.xml
...src/main/java/io/dataease/base/mapper/PanelLinkMapper.xml
+21
-5
ExtPanelLinkMapper.java
.../java/io/dataease/base/mapper/ext/ExtPanelLinkMapper.java
+11
-0
ExtPanelLinkMapper.xml
...n/java/io/dataease/base/mapper/ext/ExtPanelLinkMapper.xml
+17
-0
LinkApi.java
...c/main/java/io/dataease/controller/panel/api/LinkApi.java
+5
-0
LinkServer.java
.../java/io/dataease/controller/panel/server/LinkServer.java
+10
-0
OverTimeRequest.java
...taease/controller/request/panel/link/OverTimeRequest.java
+19
-0
GenerateDto.java
...src/main/java/io/dataease/dto/panel/link/GenerateDto.java
+2
-0
ValidateDto.java
...src/main/java/io/dataease/dto/panel/link/ValidateDto.java
+3
-0
PanelLinkService.java
...main/java/io/dataease/service/panel/PanelLinkService.java
+22
-0
V27__de1.4.sql
backend/src/main/resources/db/migration/V27__de1.4.sql
+4
-0
generatorConfig.xml
backend/src/main/resources/generatorConfig.xml
+1
-1
package.json
frontend/package.json
+1
-1
index.js
frontend/src/api/link/index.js
+8
-0
en.js
frontend/src/lang/en.js
+2
-0
tw.js
frontend/src/lang/tw.js
+19
-0
zh.js
frontend/src/lang/zh.js
+3
-1
link.js
frontend/src/link/link.js
+1
-1
index.vue
frontend/src/views/link/generate/index.vue
+77
-4
index.vue
frontend/src/views/link/index.vue
+12
-2
index.vue
frontend/src/views/link/overtime/index.vue
+3
-0
没有找到文件。
backend/src/main/java/io/dataease/base/domain/PanelLink.java
浏览文件 @
a7144fd0
...
...
@@ -13,5 +13,7 @@ public class PanelLink implements Serializable {
private
String
pwd
;
private
Long
overTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
backend/src/main/java/io/dataease/base/domain/PanelLinkExample.java
浏览文件 @
a7144fd0
...
...
@@ -363,6 +363,66 @@ public class PanelLinkExample {
addCriterion
(
"pwd not between"
,
value1
,
value2
,
"pwd"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOverTimeIsNull
()
{
addCriterion
(
"over_time is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOverTimeIsNotNull
()
{
addCriterion
(
"over_time is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOverTimeEqualTo
(
Long
value
)
{
addCriterion
(
"over_time ="
,
value
,
"overTime"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOverTimeNotEqualTo
(
Long
value
)
{
addCriterion
(
"over_time <>"
,
value
,
"overTime"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOverTimeGreaterThan
(
Long
value
)
{
addCriterion
(
"over_time >"
,
value
,
"overTime"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOverTimeGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"over_time >="
,
value
,
"overTime"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOverTimeLessThan
(
Long
value
)
{
addCriterion
(
"over_time <"
,
value
,
"overTime"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOverTimeLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"over_time <="
,
value
,
"overTime"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOverTimeIn
(
List
<
Long
>
values
)
{
addCriterion
(
"over_time in"
,
values
,
"overTime"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOverTimeNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"over_time not in"
,
values
,
"overTime"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOverTimeBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"over_time between"
,
value1
,
value2
,
"overTime"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOverTimeNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"over_time not between"
,
value1
,
value2
,
"overTime"
);
return
(
Criteria
)
this
;
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
...
...
backend/src/main/java/io/dataease/base/mapper/PanelLinkMapper.xml
浏览文件 @
a7144fd0
...
...
@@ -6,6 +6,7 @@
<result
column=
"valid"
jdbcType=
"BIT"
property=
"valid"
/>
<result
column=
"enable_pwd"
jdbcType=
"BIT"
property=
"enablePwd"
/>
<result
column=
"pwd"
jdbcType=
"VARCHAR"
property=
"pwd"
/>
<result
column=
"over_time"
jdbcType=
"BIGINT"
property=
"overTime"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
...
...
@@ -66,7 +67,7 @@
</where>
</sql>
<sql
id=
"Base_Column_List"
>
resource_id, `valid`, enable_pwd, pwd
resource_id, `valid`, enable_pwd, pwd
, over_time
</sql>
<select
id=
"selectByExample"
parameterType=
"io.dataease.base.domain.PanelLinkExample"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -100,9 +101,9 @@
</delete>
<insert
id=
"insert"
parameterType=
"io.dataease.base.domain.PanelLink"
>
insert into panel_link (resource_id, `valid`, enable_pwd,
pwd)
pwd
, over_time
)
values (#{resourceId,jdbcType=VARCHAR}, #{valid,jdbcType=BIT}, #{enablePwd,jdbcType=BIT},
#{pwd,jdbcType=VARCHAR})
#{pwd,jdbcType=VARCHAR}
, #{overTime,jdbcType=BIGINT}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"io.dataease.base.domain.PanelLink"
>
insert into panel_link
...
...
@@ -119,6 +120,9 @@
<if
test=
"pwd != null"
>
pwd,
</if>
<if
test=
"overTime != null"
>
over_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"resourceId != null"
>
...
...
@@ -133,6 +137,9 @@
<if
test=
"pwd != null"
>
#{pwd,jdbcType=VARCHAR},
</if>
<if
test=
"overTime != null"
>
#{overTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"io.dataease.base.domain.PanelLinkExample"
resultType=
"java.lang.Long"
>
...
...
@@ -156,6 +163,9 @@
<if
test=
"record.pwd != null"
>
pwd = #{record.pwd,jdbcType=VARCHAR},
</if>
<if
test=
"record.overTime != null"
>
over_time = #{record.overTime,jdbcType=BIGINT},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
...
...
@@ -166,7 +176,8 @@
set resource_id = #{record.resourceId,jdbcType=VARCHAR},
`valid` = #{record.valid,jdbcType=BIT},
enable_pwd = #{record.enablePwd,jdbcType=BIT},
pwd = #{record.pwd,jdbcType=VARCHAR}
pwd = #{record.pwd,jdbcType=VARCHAR},
over_time = #{record.overTime,jdbcType=BIGINT}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
...
...
@@ -183,6 +194,9 @@
<if
test=
"pwd != null"
>
pwd = #{pwd,jdbcType=VARCHAR},
</if>
<if
test=
"overTime != null"
>
over_time = #{overTime,jdbcType=BIGINT},
</if>
</set>
where resource_id = #{resourceId,jdbcType=VARCHAR}
</update>
...
...
@@ -190,7 +204,8 @@
update panel_link
set `valid` = #{valid,jdbcType=BIT},
enable_pwd = #{enablePwd,jdbcType=BIT},
pwd = #{pwd,jdbcType=VARCHAR}
pwd = #{pwd,jdbcType=VARCHAR},
over_time = #{overTime,jdbcType=BIGINT}
where resource_id = #{resourceId,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelLinkMapper.java
0 → 100644
浏览文件 @
a7144fd0
package
io
.
dataease
.
base
.
mapper
.
ext
;
import
org.apache.ibatis.annotations.Param
;
import
io.dataease.controller.request.panel.link.OverTimeRequest
;
public
interface
ExtPanelLinkMapper
{
void
updateOverTime
(
@Param
(
"request"
)
OverTimeRequest
request
);
}
backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelLinkMapper.xml
0 → 100644
浏览文件 @
a7144fd0
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"io.dataease.base.mapper.ext.ExtPanelLinkMapper"
>
<update
id=
"updateOverTime"
>
update panel_link set over_time = #{request.overTime} where resource_id = #{request.resourceId}
</update>
</mapper>
backend/src/main/java/io/dataease/controller/panel/api/LinkApi.java
浏览文件 @
a7144fd0
...
...
@@ -6,6 +6,7 @@ import io.dataease.controller.ResultHolder;
import
io.dataease.controller.request.chart.ChartExtRequest
;
import
io.dataease.controller.request.panel.link.EnablePwdRequest
;
import
io.dataease.controller.request.panel.link.LinkRequest
;
import
io.dataease.controller.request.panel.link.OverTimeRequest
;
import
io.dataease.controller.request.panel.link.PasswordRequest
;
import
io.dataease.dto.panel.link.GenerateDto
;
import
io.dataease.dto.panel.link.ValidateDto
;
...
...
@@ -29,6 +30,10 @@ public interface LinkApi {
@PostMapping
(
"/enablePwd"
)
void
enablePwd
(
EnablePwdRequest
request
);
@ApiOperation
(
"过期时间"
)
@PostMapping
(
"/resetOverTime"
)
void
resetOverTime
(
OverTimeRequest
request
);
@ApiOperation
(
"启用/禁用链接分享"
)
@PostMapping
(
"/switchLink"
)
void
switchLink
(
LinkRequest
request
);
...
...
backend/src/main/java/io/dataease/controller/panel/server/LinkServer.java
浏览文件 @
a7144fd0
...
...
@@ -8,6 +8,7 @@ import io.dataease.controller.panel.api.LinkApi;
import
io.dataease.controller.request.chart.ChartExtRequest
;
import
io.dataease.controller.request.panel.link.EnablePwdRequest
;
import
io.dataease.controller.request.panel.link.LinkRequest
;
import
io.dataease.controller.request.panel.link.OverTimeRequest
;
import
io.dataease.controller.request.panel.link.PasswordRequest
;
import
io.dataease.controller.request.panel.link.ValidateRequest
;
import
io.dataease.dto.panel.link.GenerateDto
;
...
...
@@ -46,6 +47,14 @@ public class LinkServer implements LinkApi {
panelLinkService
.
changeEnablePwd
(
request
);
}
@Override
public
void
resetOverTime
(
@RequestBody
OverTimeRequest
request
)
{
panelLinkService
.
overTime
(
request
);
}
@Override
public
void
switchLink
(
@RequestBody
LinkRequest
request
)
{
panelLinkService
.
changeValid
(
request
);
...
...
@@ -74,6 +83,7 @@ public class LinkServer implements LinkApi {
dto
.
setValid
(
one
.
getValid
());
dto
.
setEnablePwd
(
one
.
getEnablePwd
());
dto
.
setPassPwd
(
panelLinkService
.
validateHeads
(
one
));
dto
.
setExpire
(
panelLinkService
.
isExpire
(
one
));
return
dto
;
}
...
...
backend/src/main/java/io/dataease/controller/request/panel/link/OverTimeRequest.java
0 → 100644
浏览文件 @
a7144fd0
package
io
.
dataease
.
controller
.
request
.
panel
.
link
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
@Data
@Getter
@Setter
public
class
OverTimeRequest
{
@ApiModelProperty
(
"资源ID"
)
private
String
resourceId
;
@ApiModelProperty
(
"过期时间"
)
private
Long
overTime
;
}
backend/src/main/java/io/dataease/dto/panel/link/GenerateDto.java
浏览文件 @
a7144fd0
...
...
@@ -14,4 +14,6 @@ public class GenerateDto {
private
String
uri
;
@ApiModelProperty
(
"密码"
)
private
String
pwd
;
@ApiModelProperty
(
"有效期"
)
private
Long
overTime
;
}
backend/src/main/java/io/dataease/dto/panel/link/ValidateDto.java
浏览文件 @
a7144fd0
...
...
@@ -6,6 +6,9 @@ import lombok.Data;
@Data
public
class
ValidateDto
{
@ApiModelProperty
(
"是否过期"
)
private
boolean
expire
;
@ApiModelProperty
(
"是否可用"
)
private
boolean
valid
;
@ApiModelProperty
(
"是否启用密码"
)
...
...
backend/src/main/java/io/dataease/service/panel/PanelLinkService.java
浏览文件 @
a7144fd0
...
...
@@ -9,10 +9,12 @@ import io.dataease.base.domain.PanelGroupWithBLOBs;
import
io.dataease.base.domain.PanelLink
;
import
io.dataease.base.mapper.PanelGroupMapper
;
import
io.dataease.base.mapper.PanelLinkMapper
;
import
io.dataease.base.mapper.ext.ExtPanelLinkMapper
;
import
io.dataease.commons.utils.ServletUtils
;
import
io.dataease.controller.ResultHolder
;
import
io.dataease.controller.request.panel.link.EnablePwdRequest
;
import
io.dataease.controller.request.panel.link.LinkRequest
;
import
io.dataease.controller.request.panel.link.OverTimeRequest
;
import
io.dataease.controller.request.panel.link.PasswordRequest
;
import
io.dataease.dto.panel.link.GenerateDto
;
import
org.apache.commons.lang3.ObjectUtils
;
...
...
@@ -45,6 +47,9 @@ public class PanelLinkService {
@Resource
private
PanelGroupMapper
panelGroupMapper
;
@Resource
private
ExtPanelLinkMapper
extPanelLinkMapper
;
public
void
changeValid
(
LinkRequest
request
){
PanelLink
po
=
new
PanelLink
();
po
.
setResourceId
(
request
.
getResourceId
());
...
...
@@ -66,6 +71,14 @@ public class PanelLinkService {
mapper
.
updateByPrimaryKeySelective
(
po
);
}
public
void
overTime
(
OverTimeRequest
request
)
{
/* PanelLink po = new PanelLink();
po.setResourceId(request.getResourceId());
po.setOverTime(request.getOverTime());
mapper.updateByPrimaryKeySelective(po); */
extPanelLinkMapper
.
updateOverTime
(
request
);
}
public
PanelLink
findOne
(
String
resourceId
){
PanelLink
panelLink
=
mapper
.
selectByPrimaryKey
(
resourceId
);
return
panelLink
;
...
...
@@ -123,6 +136,7 @@ public class PanelLinkService {
result
.
setEnablePwd
(
linl
.
getEnablePwd
());
result
.
setPwd
(
linl
.
getPwd
());
result
.
setUri
(
baseUrl
+
buildLinkParam
(
linl
.
getResourceId
()));
result
.
setOverTime
(
linl
.
getOverTime
());
return
result
;
}
...
...
@@ -144,6 +158,14 @@ public class PanelLinkService {
return
verify
;
}
// 验证链接是否过期
public
Boolean
isExpire
(
PanelLink
panelLink
)
{
if
(
ObjectUtils
.
isEmpty
(
panelLink
.
getOverTime
()))
{
return
false
;
}
return
System
.
currentTimeMillis
()
>
panelLink
.
getOverTime
();
}
public
boolean
validatePwd
(
PasswordRequest
request
)
throws
Exception
{
String
password
=
decryptParam
(
request
.
getPassword
());
String
resourceId
=
request
.
getResourceId
();
...
...
backend/src/main/resources/db/migration/V27__de1.4.sql
浏览文件 @
a7144fd0
ALTER
TABLE
`chart_view`
ADD
COLUMN
`render`
varchar
(
50
)
COMMENT
'视图渲染方式'
AFTER
`type`
;
UPDATE
`chart_view`
SET
`render`
=
'echarts'
WHERE
`type`
!=
'liquid'
;
UPDATE
`chart_view`
SET
`render`
=
'antv'
WHERE
`type`
=
'liquid'
;
ALTER
TABLE
`panel_link`
ADD
COLUMN
`over_time`
bigint
(
13
)
NULL
DEFAULT
NULL
COMMENT
'有效截止时间'
AFTER
`pwd`
;
backend/src/main/resources/generatorConfig.xml
浏览文件 @
a7144fd0
...
...
@@ -65,7 +65,7 @@
<!--要生成的数据库表 -->
<table
tableName=
"
chart_view
"
/>
<table
tableName=
"
panel_link
"
/>
<!-- <table tableName="sys_dict_item"/>-->
<!-- <table tableName="dataset_table_field"/>-->
...
...
frontend/package.json
浏览文件 @
a7144fd0
...
...
@@ -22,7 +22,7 @@
"core-js"
:
"^2.6.5"
,
"echarts"
:
"^5.0.1"
,
"element-resize-detector"
:
"^1.2.3"
,
"element-ui"
:
"2.1
3.0
"
,
"element-ui"
:
"2.1
5.6
"
,
"file-save"
:
"^0.2.0"
,
"file-saver"
:
"^2.0.5"
,
"fit2cloud-ui"
:
"1.5.0-beta.0"
,
...
...
frontend/src/api/link/index.js
浏览文件 @
a7144fd0
...
...
@@ -26,6 +26,14 @@ export function setPwd(data) {
})
}
export
function
setOverTime
(
data
)
{
return
request
({
url
:
'api/link/resetOverTime'
,
method
:
'post'
,
data
})
}
export
function
switchValid
(
data
)
{
return
request
({
url
:
'api/link/switchLink'
,
...
...
frontend/src/lang/en.js
浏览文件 @
a7144fd0
...
...
@@ -1180,6 +1180,8 @@ export default {
passwd_protect
:
'Password Protect'
,
link
:
'Link'
,
link_share
:
'Share Link'
,
over_time
:
'Over time'
,
link_expire
:
'Link is expire'
,
link_share_desc
:
'After opening the link, anyone can access the dashboard through this link.'
,
share
:
'Share'
,
datalist
:
'Chart List'
,
...
...
frontend/src/lang/tw.js
浏览文件 @
a7144fd0
...
...
@@ -1183,6 +1183,8 @@ export default {
passwd_protect
:
'密碼保護'
,
link
:
'鏈接'
,
link_share
:
'鏈接分享'
,
over_time
:
'有效期'
,
link_expire
:
'鏈接已過期!'
,
link_share_desc
:
'開啓鏈接後,任何人可通過此鏈接訪問儀表板。'
,
share
:
'分享'
,
datalist
:
'視圖列表'
,
...
...
@@ -1535,6 +1537,23 @@ export default {
deyear
:
{
label
:
'年份'
,
placeholder
:
'請選擇年份'
},
deshowdate
:
{
label
:
'時間'
,
show_week
:
'顯示星期'
,
show_date
:
'顯示日期'
,
time_format
:
'時間格式'
,
date_format
:
'日期格式'
,
custom
:
'自定義格式'
,
open_mode
:
'展示風格'
,
m_default
:
'簡單風格'
,
m_elec
:
'電子時鐘'
,
m_simple
:
'簡單錶盤'
,
m_complex
:
'複雜錶盤'
,
select_openMode
:
'請選擇展示風格'
,
select_time_format
:
'請選擇時間各式'
,
select_date_format
:
'請選擇日期格式'
}
}
frontend/src/lang/zh.js
浏览文件 @
a7144fd0
...
...
@@ -1187,6 +1187,8 @@ export default {
copy_short_link_passwd
:
'复制短链接及密码'
,
passwd_protect
:
'密码保护'
,
link
:
'链接'
,
over_time
:
'有效期'
,
link_expire
:
'链接已过期!'
,
link_share
:
'链接分享'
,
link_share_desc
:
'开启链接后,任何人可通过此链接访问仪表板。'
,
share
:
'分享'
,
...
...
@@ -1558,7 +1560,7 @@ export default {
m_complex
:
'复杂表盘'
,
select_openMode
:
'请选择展示风格'
,
select_time_format
:
'请选择时间格式'
,
select_date_format
:
'请选择
时间
格式'
select_date_format
:
'请选择
日期
格式'
}
}
frontend/src/link/link.js
浏览文件 @
a7144fd0
...
...
@@ -9,7 +9,7 @@ import '@/components/canvas/custom-component' // 注册自定义组件
import
widgets
from
'@/components/widget'
import
*
as
echarts
from
'echarts'
import
UmyUi
from
'umy-ui'
import
'@/utils/DateUtil'
Vue
.
use
(
UmyUi
)
Vue
.
prototype
.
$echarts
=
echarts
Vue
.
config
.
productionTip
=
false
...
...
frontend/src/views/link/generate/index.vue
浏览文件 @
a7144fd0
...
...
@@ -2,7 +2,7 @@
<div>
<el-form
ref=
"createOrganization"
inline
:model=
"form"
size=
"small"
label-width=
"80px"
>
<el-form-item
:label=
"$t('panel.link_share')"
>
<el-form-item
ref=
"form"
:label=
"$t('panel.link_share')"
>
<el-switch
v-model=
"valid"
style=
"width: 370px;"
...
...
@@ -22,6 +22,19 @@
/>
</el-form-item>
<el-form-item
v-if=
"valid"
:label=
"$t('panel.over_time')"
>
<el-date-picker
v-model=
"form.overTime"
type=
"datetime"
placeholder=
"选择日期时间"
align=
"right"
value-format=
"timestamp"
:picker-options=
"pickerOptions"
default-time=
"23:59:59"
@
change=
"resetOverTime"
/>
</el-form-item>
<el-form-item
v-if=
"valid"
label=
" "
>
<el-checkbox
v-model=
"form.enablePwd"
@
change=
"resetEnablePwd"
>
{{
$t
(
'panel.passwd_protect'
)
}}
</el-checkbox>
...
...
@@ -45,7 +58,7 @@
</
template
>
<
script
>
import
{
loadGenerate
,
setPwd
,
switchValid
,
switchEnablePwd
,
shortUrl
}
from
'@/api/link'
import
{
loadGenerate
,
setPwd
,
switchValid
,
switchEnablePwd
,
shortUrl
,
setOverTime
}
from
'@/api/link'
import
{
encrypt
,
decrypt
}
from
'@/utils/rsaEncrypt'
export
default
{
...
...
@@ -65,7 +78,28 @@ export default {
valid
:
false
,
form
:
{},
newUrl
:
null
,
defaultForm
:
{
enablePwd
:
false
,
pwd
:
null
,
uri
:
null
}
defaultForm
:
{
enablePwd
:
false
,
pwd
:
null
,
uri
:
null
},
pickerOptions
:
{
disabledDate
:
time
=>
{
return
time
<
(
Date
.
now
()
-
8.64e7
)
},
shortcuts
:
[{
text
:
'一天'
,
onClick
:
function
(
picker
)
{
picker
.
$emit
(
'pick'
,
this
.
limitDate
(
'day'
))
}.
bind
(
this
)
},
{
text
:
'一周'
,
onClick
:
(
picker
)
=>
{
picker
.
$emit
(
'pick'
,
this
.
limitDate
(
'week'
))
}
},
{
text
:
'一月'
,
onClick
:
(
picker
)
=>
{
picker
.
$emit
(
'pick'
,
this
.
limitDate
(
'month'
))
}
}]
}
}
},
computed
:
{
...
...
@@ -80,12 +114,14 @@ export default {
methods
:
{
currentGenerate
()
{
loadGenerate
(
this
.
resourceId
).
then
(
res
=>
{
const
{
valid
,
enablePwd
,
pwd
,
uri
}
=
res
.
data
const
{
valid
,
enablePwd
,
pwd
,
uri
,
overTime
}
=
res
.
data
this
.
valid
=
valid
this
.
form
.
enablePwd
=
enablePwd
this
.
form
.
uri
=
uri
?
(
this
.
origin
+
uri
)
:
uri
// 返回的密码是共钥加密后的 所以展示需要私钥解密一波
pwd
&&
(
this
.
form
.
pwd
=
decrypt
(
pwd
))
/* overTime && (this.form.overTime = overTime) */
overTime
&&
(
this
.
$set
(
this
.
form
,
'overTime'
,
overTime
))
this
.
requestShort
()
})
},
...
...
@@ -122,6 +158,16 @@ export default {
value
&&
!
this
.
form
.
pwd
&&
this
.
resetPwd
()
})
},
resetOverTime
(
value
)
{
const
param
=
{
resourceId
:
this
.
resourceId
,
overTime
:
value
}
setOverTime
(
param
).
then
(
res
=>
{
// this.form.overTime = value
this
.
$forceUpdate
()
})
},
onCopy
(
e
)
{
// alert('You just copied: ' + e.text)
...
...
@@ -152,6 +198,33 @@ export default {
this
.
newUrl
=
res
.
data
}
})
},
limitDate
(
type
)
{
const
now
=
new
Date
()
const
nowTime
=
now
.
getTime
()
const
oneDay
=
24
*
60
*
60
*
1000
if
(
type
===
'day'
)
{
const
tom
=
new
Date
(
nowTime
+
oneDay
)
return
new
Date
(
tom
.
format
(
'yyyy-MM-dd'
)
+
' 23:59:59'
)
}
if
(
type
===
'week'
)
{
const
tom
=
new
Date
(
nowTime
+
oneDay
*
7
)
return
new
Date
(
tom
.
format
(
'yyyy-MM-dd'
)
+
' 23:59:59'
)
}
if
(
type
===
'month'
)
{
const
result
=
new
Date
()
const
curMonth
=
now
.
getMonth
()
+
1
if
(
curMonth
===
12
)
{
result
.
setYear
(
now
.
getYear
()
+
1
)
result
.
setMonth
(
0
)
}
else
{
result
.
setMonth
(
curMonth
)
}
return
new
Date
(
result
.
format
(
'yyyy-MM-dd'
)
+
' 23:59:59'
)
}
return
null
}
}
}
...
...
frontend/src/views/link/index.vue
浏览文件 @
a7144fd0
...
...
@@ -3,6 +3,7 @@
<link-error
v-if=
"showIndex===0"
:resource-id=
"resourceId"
/>
<link-pwd
v-if=
"showIndex===1"
:resource-id=
"resourceId"
@
fresh-token=
"refreshToken"
/>
<link-view
v-if=
"showIndex===2"
:resource-id=
"resourceId"
/>
<link-expire
v-if=
"showIndex===3"
:resource-id=
"resourceId"
/>
</div>
</
template
>
<
script
>
...
...
@@ -11,9 +12,10 @@ import { validate } from '@/api/link'
import
LinkView
from
'./view'
import
LinkError
from
'./error'
import
LinkPwd
from
'./pwd'
import
LinkExpire
from
'./overtime'
export
default
{
components
:
{
LinkError
,
LinkPwd
,
LinkView
LinkError
,
LinkPwd
,
LinkView
,
LinkExpire
},
data
()
{
return
{
...
...
@@ -31,7 +33,7 @@ export default {
loadInit
()
{
this
.
link
=
getQueryVariable
(
this
.
PARAMKEY
)
validate
({
link
:
this
.
link
}).
then
(
res
=>
{
const
{
resourceId
,
valid
,
enablePwd
,
passPwd
}
=
res
.
data
const
{
resourceId
,
valid
,
enablePwd
,
passPwd
,
expire
}
=
res
.
data
this
.
resourceId
=
resourceId
// 如果链接无效 直接显示无效页面
if
(
!
valid
||
!
resourceId
)
{
...
...
@@ -39,6 +41,11 @@ export default {
return
}
if
(
expire
)
{
this
.
showExpire
()
return
}
if
(
enablePwd
&&
!
passPwd
)
{
this
.
showPwd
()
return
...
...
@@ -64,6 +71,9 @@ export default {
// 显示仪表板
showView
()
{
this
.
showIndex
=
2
},
showExpire
()
{
this
.
showIndex
=
3
}
}
}
...
...
frontend/src/views/link/overtime/index.vue
0 → 100644
浏览文件 @
a7144fd0
<
template
>
<el-empty
:description=
"$t('panel.link_expire')"
/>
</
template
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论