diff --git a/backend/src/main/java/io/dataease/commons/license/DefaultLicenseService.java b/backend/src/main/java/io/dataease/commons/license/DefaultLicenseService.java index b0e074fece..c9c3da40eb 100644 --- a/backend/src/main/java/io/dataease/commons/license/DefaultLicenseService.java +++ b/backend/src/main/java/io/dataease/commons/license/DefaultLicenseService.java @@ -21,8 +21,8 @@ public class DefaultLicenseService { private static final String LICENSE_ID = "fit2cloud_license"; private static final String validatorUtil = "/usr/bin/validator"; - private static final String product = "cmp"; - private static final String[] NO_PLU_LIMIT_MODULES = new String[]{"dashboard", "gateway"}; + private static final String product = "dataease"; + /*private static final String[] NO_PLU_LIMIT_MODULES = new String[]{"dashboard", "gateway"};*/ public F2CLicenseResponse validateLicense(String product, String licenseKey){ List command = new ArrayList(); diff --git a/backend/src/main/java/io/dataease/controller/AboutController.java b/backend/src/main/java/io/dataease/controller/AboutController.java new file mode 100644 index 0000000000..a4d9fa1e6d --- /dev/null +++ b/backend/src/main/java/io/dataease/controller/AboutController.java @@ -0,0 +1,32 @@ +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 map) { + return aboutService.updateLicense(map.get("license")); + } + + @PostMapping("/license/validate") + public F2CLicenseResponse validateLicense(@RequestBody Map map) { + return aboutService.validateLicense(map.get("license")); + } + + @GetMapping("/build/version") + public Object getBuildVersion() { + return aboutService.getBuildVersion(); + } +} diff --git a/backend/src/main/java/io/dataease/service/AboutService.java b/backend/src/main/java/io/dataease/service/AboutService.java new file mode 100644 index 0000000000..70171f576b --- /dev/null +++ b/backend/src/main/java/io/dataease/service/AboutService.java @@ -0,0 +1,54 @@ +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"; + } +} diff --git a/frontend/src/api/system/about.js b/frontend/src/api/system/about.js new file mode 100644 index 0000000000..b2a5d1739b --- /dev/null +++ b/frontend/src/api/system/about.js @@ -0,0 +1,24 @@ +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 + }) +} diff --git a/frontend/src/assets/DataEase-color.png b/frontend/src/assets/DataEase-color.png new file mode 100644 index 0000000000..3fafa755eb Binary files /dev/null and b/frontend/src/assets/DataEase-color.png differ diff --git a/frontend/src/assets/license_header.png b/frontend/src/assets/license_header.png new file mode 100644 index 0000000000..3dd7dc62bc Binary files /dev/null and b/frontend/src/assets/license_header.png differ diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index a16446ff52..d4a9e3d59f 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -82,7 +82,9 @@ export default { thirdparty: 'Or connect with', thirdpartyTips: 'Can not be simulated on local, so please combine you own business simulation! ! !', expires: 'Login token expired, please login again', - tokenError: 'Token error, please login again' + tokenError: 'Token error, please login again', + username_error: 'Please enter the correct user name', + password_error: 'The password can not be less than 6 digits' }, commons: { icon: 'Icon', @@ -776,7 +778,8 @@ export default { edit_custom_table: 'Edit self help dataset', edit_field: 'Edit Field', preview_100_data: 'Show 100 lines data', - invalid_table_check: 'Please sync data first.' + invalid_table_check: 'Please sync data first.', + parse_error: 'Parse Error' }, datasource: { datasource: 'Data Source', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 7a003b77db..bf9037fb98 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -82,7 +82,9 @@ export default { thirdparty: '第三方登陸', thirdpartyTips: '本地不能模拟,请结合自己业务进行模拟!!!', expires: '登陸信息过期,请重新登陸', - tokenError: '信息错误,请重新登陸' + tokenError: '信息错误,请重新登陸', + username_error: '請輸入正確的用戶名', + password_error: '密碼不小於6位' }, commons: { icon: '圖標', @@ -776,7 +778,8 @@ export default { edit_custom_table: '編輯自助數據集', edit_field: '編輯自斷', preview_100_data: '顯示前100行數據', - invalid_table_check: '非直連數據集請先完成數據同步' + invalid_table_check: '非直連數據集請先完成數據同步', + parse_error: '解析錯誤' }, datasource: { datasource: '數據源', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index fe69e1ade0..a046374298 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -82,7 +82,9 @@ export default { thirdparty: '第三方登录', thirdpartyTips: '本地不能模拟,请结合自己业务进行模拟!!!', expires: '登录token过期,请重新登录', - tokenError: 'token错误,请重新登录' + tokenError: 'token错误,请重新登录', + username_error: '请输入正确的用户名', + password_error: '密码不小于6位' }, commons: { icon: '图标', @@ -776,7 +778,8 @@ export default { edit_custom_table: '编辑自助数据集', edit_field: '编辑字段', preview_100_data: '显示前100行数据', - invalid_table_check: '非直连数据集请先完成数据同步' + invalid_table_check: '非直连数据集请先完成数据同步', + parse_error: '解析错误' }, datasource: { datasource: '数据源', diff --git a/frontend/src/layout/components/Licbar.vue b/frontend/src/layout/components/Licbar.vue index 1d8446cf53..66575df2fe 100644 --- a/frontend/src/layout/components/Licbar.vue +++ b/frontend/src/layout/components/Licbar.vue @@ -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%; } diff --git a/frontend/src/layout/components/Topbar.vue b/frontend/src/layout/components/Topbar.vue index 095f8490b4..d682cbd451 100644 --- a/frontend/src/layout/components/Topbar.vue +++ b/frontend/src/layout/components/Topbar.vue @@ -43,51 +43,23 @@ {{ name }} - {{ $t('commons.personal_info') }} {{ $t('user.reset_password') }} - {{ $t('commons.help_documentation') }} - - - {{ $t('commons.about_us') }} - + + {{ $t('commons.about_us') }} + {{ $t('commons.exit_system') }} - diff --git a/frontend/src/layout/index.vue b/frontend/src/layout/index.vue index 5a8fbb1abd..594e075b83 100644 --- a/frontend/src/layout/index.vue +++ b/frontend/src/layout/index.vue @@ -1,6 +1,6 @@ - + @@ -76,7 +76,7 @@ - + @@ -85,7 +85,7 @@ - + diff --git a/frontend/src/views/system/user/index.vue b/frontend/src/views/system/user/index.vue index 86959314ac..bda6a482fe 100644 --- a/frontend/src/views/system/user/index.vue +++ b/frontend/src/views/system/user/index.vue @@ -14,18 +14,18 @@ - - - + + + - - + + - + @@ -64,11 +64,11 @@ - {{ $t('commons.man') }} - {{ $t('commons.woman') }} + {{ $t('commons.man') }} + {{ $t('commons.woman') }} - + {{ $t('commons.enable') }} {{ $t('commons.disable') }}