🎉 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">
<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/license-Apache%202-blue.svg" alt="Build 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://sns.bladex.vip](https://sns.bladex.vip)
* 会员计划:[SpringBlade会员计划](https://gitee.com/smallc/SpringBlade/wikis/SpringBlade会员计划)
* 交流一群:`477853168`
* 交流二群:`751253339`
* 交流一群:`477853168`(满)
* 交流二群:`751253339`(满)
* 交流三群:`784729540`
## 在线演示
* Saber-基于Vue[https://saber.bladex.vip](https://saber.bladex.vip)

View File

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

View File

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

View File

@ -39,11 +39,31 @@
class="icon-mima"></i>
</el-input>
</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-button type="primary"
size="small"
@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>
</template>
@ -51,6 +71,7 @@
<script>
import {mapGetters} from "vuex";
import website from '@/config/website';
import {getCaptcha} from "@/api/user";
export default {
name: "userlogin",
@ -58,10 +79,20 @@
return {
tenantMode: website.tenantMode,
loginForm: {
//ID
tenantId: "000000",
//
username: "admin",
//
password: "admin",
type: "account"
//
type: "account",
//
code: "",
//
key: "",
//
image: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
},
loginRules: {
tenantId: [
@ -78,15 +109,25 @@
passwordType: "password"
};
},
created() {},
mounted() {},
created() {
this.refreshCode();
},
mounted() {
},
computed: {
...mapGetters(["tagWel"])
},
props: [],
methods: {
refreshCode() {
getCaptcha().then(res => {
const data = res.data.data;
this.loginForm.key = data.key;
this.loginForm.image = data.image;
})
},
showPassword() {
this.passwordType == ""
this.passwordType === ""
? (this.passwordType = "password")
: (this.passwordType = "");
},

View File

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

View File

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

View File

@ -2,10 +2,10 @@
<div>
<basic-container>
<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/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">
<img src="https://img.shields.io/badge/Saber%20Author-Small%20Chill-ff69b4.svg" alt="Downloads"/>
</a>
@ -124,6 +124,16 @@
<el-row>
<basic-container>
<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">
<div>1.升级SpringCloud Hoxton.SR1</div>
<div>2.升级SpringBoot 2.2.2.RELEASE</div>