diff --git a/ant-design-vue-jeecg/src/api/api.js b/ant-design-vue-jeecg/src/api/api.js index b5aba7d..0c5e29b 100644 --- a/ant-design-vue-jeecg/src/api/api.js +++ b/ant-design-vue-jeecg/src/api/api.js @@ -111,6 +111,8 @@ export const getLocationTypeList = (params) => getAction('/config/locationType/g export const getLocationHighList = (params) => postAction('/config/locationHigh/getLocationHighList', params); //获取货主列表 export const getCompanyList = (params) => getAction('/config/company/getCompanyList', params); +//系统激活信息查询 +export const querySystemActivationInfo = (params) => getAction('/sys/querySystemActivationInfo', params); //获取盘点类型列表 export const getCountTypeList = (params) => getAction('/config/cycleCountPreference/getCountTypeList', params); //获取承运商列表 diff --git a/ant-design-vue-jeecg/src/components/page/GlobalHeader.vue b/ant-design-vue-jeecg/src/components/page/GlobalHeader.vue index e5df8c1..a33bbc0 100644 --- a/ant-design-vue-jeecg/src/components/page/GlobalHeader.vue +++ b/ant-design-vue-jeecg/src/components/page/GlobalHeader.vue @@ -7,45 +7,30 @@ <div v-if="mode === 'sidemenu'" class="header" :class="theme"> <a-icon - v-if="device==='mobile'" + v-if="device === 'mobile'" class="trigger" :type="collapsed ? 'menu-fold' : 'menu-unfold'" - @click="toggle"></a-icon> - <a-icon - v-else - class="trigger" - :type="collapsed ? 'menu-unfold' : 'menu-fold'" - @click="toggle"/> - - <span style="height:59;line-height:59px;" v-if="device === 'desktop'">欢迎进入 华恒仓储管理系统</span> - <a @click="downWord" style="height:59;line-height:59px;color: #d71345" v-if="manual === 'desktop'"> WMS操作手册</a> - <span v-else>华恒仓储管理系统</span> + @click="toggle" + ></a-icon> + <a-icon v-else class="trigger" :type="collapsed ? 'menu-unfold' : 'menu-fold'" @click="toggle" /> - <user-menu :theme="theme"/> + <span style="height:59;line-height:59px;" v-if="device === 'desktop'">欢迎进入 华恒仓储管理系统</span> + <span style="height:59;line-height:59px;color: #d71345" v-if="manual === 'desktop'">{{ expirationTime }}</span> + <user-menu :theme="theme" /> </div> <!-- 顶部导航栏模式 --> <div v-else :class="['top-nav-header-index', theme]"> <div class="header-index-wide"> <div class="header-index-left" :style="topMenuStyle.headerIndexLeft"> - <logo class="top-nav-header" :show-title="device !== 'mobile'" :style="topMenuStyle.topNavHeader"/> + <logo class="top-nav-header" :show-title="device !== 'mobile'" :style="topMenuStyle.topNavHeader" /> <div v-if="device !== 'mobile'" :style="topMenuStyle.topSmenuStyle"> - <s-menu - mode="horizontal" - :menu="menus" - :theme="theme" - @updateMenuTitle="handleUpdateMenuTitle" - ></s-menu> + <s-menu mode="horizontal" :menu="menus" :theme="theme" @updateMenuTitle="handleUpdateMenuTitle"></s-menu> </div> - <a-icon - v-else - class="trigger" - :type="collapsed ? 'menu-fold' : 'menu-unfold'" - @click="toggle"></a-icon> + <a-icon v-else class="trigger" :type="collapsed ? 'menu-fold' : 'menu-unfold'" @click="toggle"></a-icon> </div> - <user-menu class="header-index-right" :theme="theme" :style="topMenuStyle.headerIndexRight"/> + <user-menu class="header-index-right" :theme="theme" :style="topMenuStyle.headerIndexRight" /> </div> </div> - </a-layout-header> </template> @@ -53,15 +38,15 @@ import UserMenu from '../tools/UserMenu' import SMenu from '../menu/' import Logo from '../tools/Logo' -import {downLoad} from '@/api/api' -import {mixin} from '@/utils/mixin.js' +import { downLoad, querySystemActivationInfo } from '@/api/api' +import { mixin } from '@/utils/mixin.js' import { downFile } from '@/api/manage' export default { name: 'GlobalHeader', components: { UserMenu, SMenu, - Logo, + Logo }, mixins: [mixin], props: { @@ -89,12 +74,11 @@ export default { required: false, default: 'desktop' }, - manual:{ + manual: { type: String, required: false, default: 'desktop' - }, - + } }, data() { return { @@ -106,12 +90,16 @@ export default { headerIndexRight: {}, topSmenuStyle: {} }, + expirationTime: '', chatStatus: '', - url:{ - downLoad:"/sys/common/downLoad" + url: { + downLoad: '/sys/common/downLoad' } } }, + created() { + this.loadFrom(); + }, watch: { /** 监听设备变化 */ device() { @@ -148,16 +136,23 @@ export default { this.headerBarFixed = false } }, + loadFrom() { + querySystemActivationInfo().then(res => { + if (res.success) { + this.expirationTime = '系统授权到期日:' + res.result.expirationTime; + } + }) + }, toggle() { this.$emit('toggle') }, - downWord(){ - var fileName='华恒WMS4操作说明书.doc'; - return downFile(this.url.downLoad, fileName).then((data) => { + downWord() { + var fileName = '华恒WMS4操作说明书.doc' + return downFile(this.url.downLoad, fileName).then(data => { debugger - this.$message.info("华恒WMS4操作说明书开始下载...."); + this.$message.info('华恒WMS4操作说明书开始下载....') if (!data || data.size === 0) { - this.$message.error("文件下载失败"); + this.$message.error('文件下载失败') return } if (typeof window.navigator.msSaveBlob !== 'undefined') { @@ -186,10 +181,10 @@ export default { this.topMenuStyle.headerIndexLeft = {} } else { let rightWidth = '356px' - this.topMenuStyle.topNavHeader = {'min-width': '208px'} - this.topMenuStyle.topSmenuStyle = {'width': 'calc(100% - 208px)'} - this.topMenuStyle.headerIndexRight = {'min-width': rightWidth, 'white-space': 'nowrap'} - this.topMenuStyle.headerIndexLeft = {'width': `calc(100% - ${rightWidth})`} + this.topMenuStyle.topNavHeader = { 'min-width': '208px' } + this.topMenuStyle.topSmenuStyle = { width: 'calc(100% - 208px)' } + this.topMenuStyle.headerIndexRight = { 'min-width': rightWidth, 'white-space': 'nowrap' } + this.topMenuStyle.headerIndexLeft = { width: `calc(100% - ${rightWidth})` } } } }, @@ -198,9 +193,8 @@ export default { // update-begin-author:sunjianlei date:20210508 for: 修复动态功能测试菜单、带参数菜单标题错误、展开错误的问题 handleUpdateMenuTitle(value) { this.$emit('updateMenuTitle', value) - }, + } // update-end-author:sunjianlei date:20210508 for: 修复动态功能测试菜单、带参数菜单标题错误、展开错误的问题 - } } </script> @@ -211,9 +205,7 @@ export default { @height: 59px; .layout { - .top-nav-header-index { - .header-index-wide { margin-left: 0px; @@ -248,7 +240,8 @@ export default { } } - .header, .top-nav-header-index { + .header, + .top-nav-header-index { &.dark .trigger:hover { background: rgba(0, 0, 0, 0.05); } @@ -261,5 +254,4 @@ export default { } /* update_end author:scott date:20190220 for: 缩小首页布局顶部的高度*/ - </style> \ No newline at end of file diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/LoginController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/LoginController.java index 54fc256..200667e 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/LoginController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/system/controller/LoginController.java @@ -74,9 +74,13 @@ import com.auth0.jwt.JWTVerifier; import com.auth0.jwt.algorithms.Algorithm; import com.auth0.jwt.exceptions.JWTVerificationException; import com.auth0.jwt.exceptions.TokenExpiredException; +import com.auth0.jwt.interfaces.DecodedJWT; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.RandomUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -200,6 +204,51 @@ public class LoginController { // systemSync.sendSysAnnouncement(sysUser); return result; } + + @ApiOperation("系统激活信息查询") + @GetMapping(value = "/querySystemActivationInfo") + public Result<?> querySystemActivationInfo() throws IOException { + Result<?> result = new Result(); + // 是否需要校验激活码 + if (applicationConfig.getCheckSystemActivationCode() == null) { + result.setSuccess(false); + result.setCode(499); + result.setMessage("是否检查系统激活码参数未启用"); + return result; + } + if (!applicationConfig.getCheckSystemActivationCode()) { + result.setSuccess(true); + result.setCode(200); + return result; + } + try { + String activationCode = huahengRedisUtil.get(HuahengJwtUtil.SYSTEM_ACTIVATION_CODE_KEY, String.class); + if (StringUtils.isEmpty(activationCode)) { + result.setSuccess(false); + result.setCode(499); + result.setMessage("系统激活码为空"); + return result; + } + // 验证激活码 + Algorithm algorithm = Algorithm.RSA256(new SystemRSA256Key().getPublicKey(), new SystemRSA256Key().getPrivateKey()); + JWTVerifier verifier = + JWT.require(algorithm).withClaim("operator", applicationConfig.getArtifactId()).withIssuer(applicationConfig.getArtifactId()).build(); + DecodedJWT decodedJWT = verifier.verify(activationCode); + Map<String, String> returnMap = new HashMap<String, String>(); + returnMap.put("audience", decodedJWT.getClaim("aud").asString()); + returnMap.put("expirationTime", DateUtil.format(decodedJWT.getClaim("exp").asDate(), DatePattern.NORM_DATE_PATTERN)); + return Result.OK("系统激活信息查询成功", returnMap); + } catch (TokenExpiredException e) { + result.setSuccess(false); + result.setCode(499); + result.setMessage("系统激活授权期限已到期"); + } catch (Exception e) { + result.setSuccess(false); + result.setCode(499); + result.setMessage("系统激活码无效"); + } + return result; + } @ApiOperation("系统激活API") @RequestMapping(value = "/systemActivation", method = RequestMethod.POST)