🎉 2.6.1发布,增加登陆验证码,支持Seata1.0

This commit is contained in:
smallchill 2020-02-12 01:01:20 +08:00
parent d6e7dd61b5
commit 1e8cf13587
7 changed files with 272 additions and 206 deletions

View File

@ -1,5 +1,5 @@
<p align="center"> <p align="center">
<img src="https://img.shields.io/badge/Release-V2.6.0-green.svg" alt="Downloads"> <img src="https://img.shields.io/badge/Release-V2.6.1-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status"> <img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status">
<img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status"> <img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR1-blue.svg" alt="Coverage Status"> <img src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR1-blue.svg" alt="Coverage Status">
@ -56,8 +56,9 @@ SpringBlade
* 官网地址:[https://bladex.vip](https://bladex.vip) * 官网地址:[https://bladex.vip](https://bladex.vip)
* 问答社区:[https://sns.bladex.vip](https://sns.bladex.vip) * 问答社区:[https://sns.bladex.vip](https://sns.bladex.vip)
* 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划) * 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划)
* 交流一群:`477853168` * 交流一群:`477853168`(满)
* 交流二群:`751253339` * 交流二群:`751253339`(满)
* 交流三群:`784729540`
## 在线演示 ## 在线演示
* Saber-基于Vue[https://saber.bladex.vip](https://saber.bladex.vip) * Saber-基于Vue[https://saber.bladex.vip](https://saber.bladex.vip)

View File

@ -1,6 +1,6 @@
{ {
"name": "saber-admin", "name": "saber-admin",
"version": "2.5.4", "version": "2.6.1",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",

View File

@ -1,16 +1,21 @@
import request from '@/router/axios'; import request from '@/router/axios';
import {baseUrl} from '@/config/env'; import {baseUrl} from '@/config/env';
export const loginByUsername = (tenantId, account, password, type) => request({ export const loginByUsername = (tenantId, account, password, type, key, code) => request({
url: '/api/blade-auth/token', url: '/api/blade-auth/token',
method: 'post', method: 'post',
headers: {
'Captcha-Key': key,
'Captcha-Code': code,
},
params: { params: {
grantType: 'captcha',
tenantId, tenantId,
account, account,
password, password,
type type
} }
}) });
export const getButtons = () => request({ export const getButtons = () => request({
url: '/api/blade-system/menu/buttons', url: '/api/blade-system/menu/buttons',
@ -32,6 +37,11 @@ export const getMenu = () => request({
method: 'get' method: 'get'
}); });
export const getCaptcha = () => request({
url: '/api/blade-auth/captcha',
method: 'get'
});
export const getTopMenu = () => request({ export const getTopMenu = () => request({
url: baseUrl + '/user/getTopMenu', url: baseUrl + '/user/getTopMenu',
method: 'get' method: 'get'

View File

@ -39,11 +39,31 @@
class="icon-mima"></i> class="icon-mima"></i>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="code">
<el-row :span="24">
<el-col :span="16">
<el-input size="small"
@keyup.enter.native="handleLogin"
v-model="loginForm.code"
auto-complete="off"
:placeholder="$t('login.code')">
<i slot="prefix" class="icon-yanzhengma"/>
</el-input>
</el-col>
<el-col :span="8">
<div class="login-code">
<img :src="loginForm.image" class="login-code-img" @click="refreshCode"
/>
</div>
</el-col>
</el-row>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" <el-button type="primary"
size="small" size="small"
@click.native.prevent="handleLogin" @click.native.prevent="handleLogin"
class="login-submit">{{$t('login.submit')}}</el-button> class="login-submit">{{$t('login.submit')}}
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
@ -51,6 +71,7 @@
<script> <script>
import {mapGetters} from "vuex"; import {mapGetters} from "vuex";
import website from '@/config/website'; import website from '@/config/website';
import {getCaptcha} from "@/api/user";
export default { export default {
name: "userlogin", name: "userlogin",
@ -58,10 +79,20 @@
return { return {
tenantMode: website.tenantMode, tenantMode: website.tenantMode,
loginForm: { loginForm: {
//ID
tenantId: "000000", tenantId: "000000",
//
username: "admin", username: "admin",
//
password: "admin", password: "admin",
type: "account" //
type: "account",
//
code: "",
//
key: "",
//
image: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
}, },
loginRules: { loginRules: {
tenantId: [ tenantId: [
@ -78,15 +109,25 @@
passwordType: "password" passwordType: "password"
}; };
}, },
created() {}, created() {
mounted() {}, this.refreshCode();
},
mounted() {
},
computed: { computed: {
...mapGetters(["tagWel"]) ...mapGetters(["tagWel"])
}, },
props: [], props: [],
methods: { methods: {
refreshCode() {
getCaptcha().then(res => {
const data = res.data.data;
this.loginForm.key = data.key;
this.loginForm.image = data.image;
})
},
showPassword() { showPassword() {
this.passwordType == "" this.passwordType === ""
? (this.passwordType = "password") ? (this.passwordType = "password")
: (this.passwordType = ""); : (this.passwordType = "");
}, },

View File

@ -14,7 +14,7 @@ function addPath(ele, first) {
path: propsConfig.path || 'path', path: propsConfig.path || 'path',
icon: propsConfig.icon || 'icon', icon: propsConfig.icon || 'icon',
children: propsConfig.children || 'children' children: propsConfig.children || 'children'
} };
const icon = ele[propsDefault.icon]; const icon = ele[propsDefault.icon];
ele[propsDefault.icon] = validatenull(icon) ? menu.iconDefault : icon; ele[propsDefault.icon] = validatenull(icon) ? menu.iconDefault : icon;
const isChild = ele[propsDefault.children] && ele[propsDefault.children].length !== 0; const isChild = ele[propsDefault.children] && ele[propsDefault.children].length !== 0;
@ -28,6 +28,7 @@ function addPath(ele, first) {
} }
} }
const user = { const user = {
state: { state: {
userInfo: getStore({name: 'userInfo'}) || [], userInfo: getStore({name: 'userInfo'}) || [],
@ -41,7 +42,7 @@ const user = {
//根据用户名登录 //根据用户名登录
LoginByUsername({commit}, userInfo) { LoginByUsername({commit}, userInfo) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
loginByUsername(userInfo.tenantId, userInfo.username, userInfo.password, userInfo.type).then(res => { loginByUsername(userInfo.tenantId, userInfo.username, userInfo.password, userInfo.type, userInfo.key, userInfo.code).then(res => {
const data = res.data.data; const data = res.data.data;
commit('SET_TOKEN', data.accessToken); commit('SET_TOKEN', data.accessToken);
commit('SET_USERIFNO', data); commit('SET_USERIFNO', data);
@ -171,6 +172,7 @@ const user = {
}, },
SET_PERMISSION: (state, permission) => { SET_PERMISSION: (state, permission) => {
let result = []; let result = [];
function getCode(list) { function getCode(list) {
list.forEach(ele => { list.forEach(ele => {
if (typeof (ele) === 'object') { if (typeof (ele) === 'object') {
@ -185,6 +187,7 @@ const user = {
}) })
} }
getCode(permission); getCode(permission);
state.permission = {}; state.permission = {};
result.forEach(ele => { result.forEach(ele => {

View File

@ -160,4 +160,5 @@
line-height: 38px; line-height: 38px;
text-indent: 5px; text-indent: 5px;
text-align: center; text-align: center;
cursor:pointer!important;
} }

View File

@ -2,10 +2,10 @@
<div> <div>
<basic-container> <basic-container>
<p style="text-align: center;"> <p style="text-align: center;">
<img src="https://img.shields.io/badge/Release-V2.6.0-green.svg" alt="Downloads"/> <img src="https://img.shields.io/badge/Release-V2.6.1-green.svg" alt="Downloads"/>
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status"/> <img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status"/>
<img src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR1-blue.svg" alt="Coverage Status"/> <img src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR1-blue.svg" alt="Coverage Status"/>
<img src="https://img.shields.io/badge/Spring%20Boot-2.2.2.RELEASE-blue.svg" alt="Downloads"/> <img src="https://img.shields.io/badge/Spring%20Boot-2.2.4.RELEASE-blue.svg" alt="Downloads"/>
<a target="_blank" href="https://bladex.vip"> <a target="_blank" href="https://bladex.vip">
<img src="https://img.shields.io/badge/Saber%20Author-Small%20Chill-ff69b4.svg" alt="Downloads"/> <img src="https://img.shields.io/badge/Saber%20Author-Small%20Chill-ff69b4.svg" alt="Downloads"/>
</a> </a>
@ -124,6 +124,16 @@
<el-row> <el-row>
<basic-container> <basic-container>
<el-collapse v-model="logActiveNames" @change="handleChange"> <el-collapse v-model="logActiveNames" @change="handleChange">
<el-collapse-item title="2.6.1发布 增加登陆验证码支持seata1.0" name="15">
<div>1.升级SpringBoot 2.2.4.RELEASE</div>
<div>2.升级Alibaba Cloud 2.2.0.RELEASE</div>
<div>3.升级Mybatis-Plus 3.3.1</div>
<div>4.增加登陆验证码功能</div>
<div>5.增加验证码对应的CaptchaTokenGranter</div>
<div>6.增加RedisUtil方便业务操作</div>
<div>7.增加Condition类getQueryWrapper自定义排除参数的入口</div>
<div>8.优化Seata封装完美支持1.0.0版本</div>
</el-collapse-item>
<el-collapse-item title="2.6.0发布 升级Hoxton.SR1 适配最新架构" name="14"> <el-collapse-item title="2.6.0发布 升级Hoxton.SR1 适配最新架构" name="14">
<div>1.升级SpringCloud Hoxton.SR1</div> <div>1.升级SpringCloud Hoxton.SR1</div>
<div>2.升级SpringBoot 2.2.2.RELEASE</div> <div>2.升级SpringBoot 2.2.2.RELEASE</div>