Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
5fc32d6b
提交
5fc32d6b
authored
5月 18, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 新增关于页面 以及 lic更新功能
上级
120dd256
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
337 行增加
和
9 行删除
+337
-9
AboutController.java
...src/main/java/io/dataease/controller/AboutController.java
+32
-0
AboutService.java
backend/src/main/java/io/dataease/service/AboutService.java
+54
-0
about.js
frontend/src/api/system/about.js
+24
-0
license_header.png
frontend/src/assets/license_header.png
+0
-0
Licbar.vue
frontend/src/layout/components/Licbar.vue
+5
-1
Topbar.vue
frontend/src/layout/components/Topbar.vue
+6
-3
index.vue
frontend/src/layout/index.vue
+5
-5
index.vue
frontend/src/views/system/about/index.vue
+211
-0
没有找到文件。
backend/src/main/java/io/dataease/controller/AboutController.java
0 → 100644
浏览文件 @
5fc32d6b
package
io
.
dataease
.
controller
;
import
io.dataease.commons.license.F2CLicenseResponse
;
import
io.dataease.service.AboutService
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.Map
;
@RequestMapping
(
"/about"
)
@RestController
public
class
AboutController
{
@Resource
private
AboutService
aboutService
;
@PostMapping
(
"/license/update"
)
public
F2CLicenseResponse
updateLicense
(
@RequestBody
Map
<
String
,
String
>
map
)
{
return
aboutService
.
updateLicense
(
map
.
get
(
"license"
));
}
@PostMapping
(
"/license/validate"
)
public
F2CLicenseResponse
validateLicense
(
@RequestBody
Map
<
String
,
String
>
map
)
{
return
aboutService
.
validateLicense
(
map
.
get
(
"license"
));
}
@GetMapping
(
"/build/version"
)
public
Object
getBuildVersion
()
{
return
aboutService
.
getBuildVersion
();
}
}
backend/src/main/java/io/dataease/service/AboutService.java
0 → 100644
浏览文件 @
5fc32d6b
package
io
.
dataease
.
service
;
import
io.dataease.commons.license.DefaultLicenseService
;
import
io.dataease.commons.license.F2CLicenseResponse
;
import
io.dataease.commons.utils.CommonBeanFactory
;
import
io.dataease.commons.utils.LogUtil
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.core.env.Environment
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.io.File
;
import
java.util.Optional
;
@Service
public
class
AboutService
{
private
static
final
String
BUILD_VERSION
=
"/opt/fit2cloud/conf/version"
;
private
static
final
String
product
=
"dataease"
;
@Resource
private
DefaultLicenseService
defaultLicenseService
;
public
F2CLicenseResponse
updateLicense
(
String
licenseKey
)
{
F2CLicenseResponse
f2CLicenseResponse
=
defaultLicenseService
.
updateLicense
(
product
,
licenseKey
);
return
f2CLicenseResponse
;
}
public
F2CLicenseResponse
validateLicense
(
String
licenseKey
)
{
if
(
StringUtils
.
isNotBlank
(
licenseKey
))
{
return
defaultLicenseService
.
validateLicense
(
product
,
licenseKey
);
}
else
{
return
defaultLicenseService
.
validateLicense
();
}
}
public
String
getBuildVersion
()
{
try
{
File
file
=
new
File
(
BUILD_VERSION
);
if
(
file
.
exists
())
{
String
version
=
FileUtils
.
readFileToString
(
file
,
"UTF-8"
);
if
(
StringUtils
.
isNotBlank
(
version
))
{
return
version
;
}
}
String
property
=
CommonBeanFactory
.
getBean
(
Environment
.
class
).
getProperty
(
"cmp.version"
);
String
result
=
Optional
.
ofNullable
(
property
).
orElse
(
"V1.0"
);
return
result
;
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
"failed to get build version."
,
e
);
}
return
"unknown"
;
}
}
frontend/src/api/system/about.js
0 → 100644
浏览文件 @
5fc32d6b
import
request
from
'@/utils/request'
export
function
validate
(
data
)
{
return
request
({
url
:
'/about/license/validate'
,
method
:
'post'
,
data
})
}
export
function
buildVersion
()
{
return
request
({
url
:
'/about/build/version'
,
method
:
'get'
})
}
export
function
updateInfo
(
data
)
{
return
request
({
url
:
'/about/license/update'
,
method
:
'post'
,
data
})
}
frontend/src/assets/license_header.png
0 → 100644
浏览文件 @
5fc32d6b
31.8 KB
frontend/src/layout/components/Licbar.vue
浏览文件 @
5fc32d6b
...
...
@@ -50,7 +50,11 @@ export default {
background-color
:
#c92100
;
color
:
#fff
;
text-align
:
center
;
padding
:
6px
11px
;
/* padding: 6px 11px; */
position
:
fixed
;
z-index
:
1002
;
top
:
0
;
width
:
100%
;
}
</
style
>
frontend/src/layout/components/Topbar.vue
浏览文件 @
5fc32d6b
...
...
@@ -51,13 +51,16 @@
<el-dropdown-item>
重置密码
</el-dropdown-item>
</router-link>
<a
href=
"
https://panjiachen.github.io/vue-element-admin-site/#/
"
target=
"_blank"
>
<a
href=
"
/swagger-ui/index.html
"
target=
"_blank"
>
<el-dropdown-item>
Docs
</el-dropdown-item>
</a>
<a
href=
"https://fit2cloud.com/"
target=
"_blank"
>
<
!-- <
a href="https://fit2cloud.com/" target="_blank">
<el-dropdown-item>关于</el-dropdown-item>
</a>
</a> -->
<router-link
to=
"/system/about"
>
<el-dropdown-item>
关于
</el-dropdown-item>
</router-link>
<el-dropdown-item
divided
@
click
.
native=
"logout"
>
<span
style=
"display:block;"
>
退出
</span>
</el-dropdown-item>
...
...
frontend/src/layout/index.vue
浏览文件 @
5fc32d6b
<
template
>
<div
:class=
"classObj"
class=
"app-wrapper"
>
<
!--
<licbar
/>
--
>
<
licbar
/
>
<topbar
/>
<div
v-if=
"device==='mobile'&&sidebar.opened"
class=
"drawer-bg"
@
click=
"handleClickOutside"
/>
<sidebar
v-if=
"!sidebar.hide"
class=
"sidebar-container"
/>
...
...
@@ -18,8 +18,8 @@
<
script
>
import
RightPanel
from
'@/components/RightPanel'
//
import { Sidebar, Settings, AppMain, Topbar, Licbar } from './components'
import
{
Sidebar
,
Settings
,
AppMain
,
Topbar
}
from
'./components'
import
{
Sidebar
,
Settings
,
AppMain
,
Topbar
,
Licbar
}
from
'./components'
//
import { Sidebar, Settings, AppMain, Topbar } from './components'
import
ResizeMixin
from
'./mixin/ResizeHandler'
export
default
{
...
...
@@ -29,8 +29,8 @@ export default {
Sidebar
,
Settings
,
AppMain
,
Topbar
//
Licbar
Topbar
,
Licbar
},
mixins
:
[
ResizeMixin
],
computed
:
{
...
...
frontend/src/views/system/about/index.vue
0 → 100644
浏览文件 @
5fc32d6b
<
template
>
<layout-content>
<div>
<el-card
class=
"box-card about-card"
>
<div
slot=
"header"
class=
"clearfix license-header"
>
<img
src=
"@/assets/DataEase-white.png"
alt=
""
style=
"height: 80px;width: 400px;padding-top: 15px;"
>
</div>
<div
class=
"license-content"
>
<div
v-if=
"license.status === 'Fail'"
>
License 无效
</div>
<div
v-if=
"license.status !== 'Fail'"
>
<table>
<tr>
<th>
授权给
</th>
<td>
{{
license
.
corporation
}}
</td>
</tr>
<tr>
<th>
过期时间
</th>
<td>
<label
v-if=
"license.status === 'expired'"
style=
"color: red"
>
{{
license
.
expired
}}
(已过期)
</label>
<label
v-if=
"license.status === 'valid'"
>
{{
license
.
expired
}}
</label>
</td>
</tr>
<tr>
<th>
授权数量
</th>
<td>
{{
license
.
count
}}
</td>
</tr>
<tr>
<th>
版本
</th>
<td>
<span
v-if=
"license.edition"
>
<span
v-if=
"license.edition === 'Standard'"
>
标准版
</span>
<span
v-if=
"license.edition === 'Enterprise'"
>
企业版
</span>
</span>
</td>
</tr>
<tr>
<th>
版本号
</th>
<td>
<span>
{{
build
}}
</span>
</td>
</tr>
</table>
</div>
<div
class=
"md-padding"
/>
<div
layout=
"row"
layout-align=
"space-between center"
class=
"lic_rooter"
>
<el-upload
action=
""
:multiple=
"false"
:show-file-list=
"false"
:file-list=
"fileList"
accept=
".key"
name=
"file"
:before-upload=
"beforeUpload"
>
<a
class=
"md-primary pointer"
>
更新 License
</a>
</el-upload>
<a
class=
"md-primary pointer"
@
click=
"support"
>
获取技术支持
</a>
</div>
</div>
</el-card>
</div>
</layout-content>
</
template
>
<
script
>
import
LayoutContent
from
'@/components/business/LayoutContent'
import
{
validate
,
buildVersion
,
updateInfo
}
from
'@/api/system/about'
import
{
getToken
}
from
'@/utils/auth'
export
default
{
components
:
{
LayoutContent
},
data
()
{
return
{
license
:
{},
version
:
null
,
build
:
null
,
licenseKey
:
''
,
fileList
:
[],
headers
:
{
Authorization
:
getToken
()
}
}
},
created
()
{
this
.
initVersion
()
this
.
getLicenseInfo
()
},
methods
:
{
initVersion
()
{
buildVersion
().
then
(
res
=>
{
this
.
build
=
res
.
data
})
},
getLicenseInfo
()
{
// validate({}).then(res => {
// this.license = this.getLicense(res.data)
// console.log(this.license)
// })
this
.
validateHandler
({},
res
=>
{
this
.
license
=
this
.
getLicense
(
res
.
data
)
})
},
validateHandler
(
param
,
success
)
{
validate
(
param
).
then
(
success
)
},
getLicense
(
result
)
{
return
{
status
:
result
.
status
,
corporation
:
result
.
license
?
result
.
license
.
corporation
:
''
,
expired
:
result
.
license
?
result
.
license
.
expired
:
''
,
count
:
result
.
license
?
result
.
license
.
count
:
''
,
version
:
result
.
license
?
result
.
license
.
version
:
''
,
edition
:
result
.
license
?
result
.
license
.
edition
:
''
}
},
importLic
(
file
)
{
const
reader
=
new
FileReader
()
reader
.
onload
=
function
(
e
)
{
this
.
licenseKey
=
e
.
target
.
result
this
.
validateHandler
({
license
:
this
.
licenseKey
},
response
=>
{
this
.
updateLicense
=
this
.
getLicense
(
response
.
data
)
this
.
update
()
})
}.
bind
(
this
)
reader
.
readAsText
(
file
)
},
update
()
{
const
param
=
{
license
:
this
.
licenseKey
}
updateInfo
(
param
).
then
(
response
=>
{
if
(
response
.
data
.
status
===
'valid'
)
{
this
.
$success
(
this
.
$t
(
'i18n_mc_update_success'
))
this
.
license
=
this
.
getLicense
(
response
.
data
)
}
else
{
this
.
$warning
(
response
.
data
.
message
)
}
})
},
support
()
{
const
url
=
'https://support.fit2cloud.com/'
window
.
open
(
url
,
'_blank'
)
},
beforeUpload
(
file
)
{
// console.log(file)
this
.
importLic
(
file
)
return
false
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.about-card
{
background
:
inherit
;
margin-top
:
5%
;
flex-direction
:
row
;
margin-left
:
20%
;
margin-right
:
20%
;
width
:
640px
;
height
:
400px
;
position
:
relative
;
>>>
div
.el-card__header
{
padding
:
0
;
}
}
.license-header
{
height
:
100px
;
background-image
:
url('../../../assets/license_header.png')
;
text-align
:
center
;
padding
:
20px
0
;
background-size
:
100%
100%
;
}
.license-content
{
font-size
:
16px
;
padding
:
50px
;
>>>
table
{
width
:
100%
;
}
>>>
th
{
text-align
:
left
;
width
:
45%
;
}
>>>
td
{
display
:
table-cell
;
vertical-align
:
inherit
;
}
}
.md-padding
{
padding
:
10px
;
}
.lic_rooter
{
flex-direction
:
row
;
box-sizing
:
border-box
;
display
:
flex
;
align-items
:
center
;
align-content
:
center
;
max-width
:
100%
;
justify-content
:
space-between
;
>>>
a
{
color
:
rgb
(
10
,
123
,
224
);
cursor
:
pointer
;
}
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论