mirror of
https://github.com/chillzhuang/Saber.git
synced 2024-11-24 11:29:28 +08:00
🎉 2.6.1发布,增加登陆验证码,支持Seata1.0
This commit is contained in:
parent
d6e7dd61b5
commit
1e8cf13587
@ -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)
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "saber-admin",
|
||||
"version": "2.5.4",
|
||||
"version": "2.6.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
@ -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'
|
||||
|
@ -39,18 +39,39 @@
|
||||
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>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
import {mapGetters} from "vuex";
|
||||
import website from '@/config/website';
|
||||
import {getCaptcha} from "@/api/user";
|
||||
|
||||
export default {
|
||||
name: "userlogin",
|
||||
@ -58,35 +79,55 @@
|
||||
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: [
|
||||
{ required: false, message: "请输入租户ID", trigger: "blur" }
|
||||
{required: false, message: "请输入租户ID", trigger: "blur"}
|
||||
],
|
||||
username: [
|
||||
{ required: true, message: "请输入用户名", trigger: "blur" }
|
||||
{required: true, message: "请输入用户名", trigger: "blur"}
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: "请输入密码", trigger: "blur" },
|
||||
{ min: 1, message: "密码长度最少为6位", trigger: "blur" }
|
||||
{required: true, message: "请输入密码", trigger: "blur"},
|
||||
{min: 1, message: "密码长度最少为6位", trigger: "blur"}
|
||||
]
|
||||
},
|
||||
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 = "");
|
||||
},
|
||||
@ -99,7 +140,7 @@
|
||||
spinner: "el-icon-loading"
|
||||
});
|
||||
this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
|
||||
this.$router.push({ path: this.tagWel.value });
|
||||
this.$router.push({path: this.tagWel.value});
|
||||
loading.close();
|
||||
}).catch(() => {
|
||||
loading.close()
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { setToken, removeToken } from '@/util/auth'
|
||||
import { setStore, getStore } from '@/util/store'
|
||||
import { isURL, validatenull } from '@/util/validate'
|
||||
import { deepClone } from '@/util/util'
|
||||
import {setToken, removeToken} from '@/util/auth'
|
||||
import {setStore, getStore} from '@/util/store'
|
||||
import {isURL, validatenull} from '@/util/validate'
|
||||
import {deepClone} from '@/util/util'
|
||||
import webiste from '@/config/website'
|
||||
import { loginByUsername, getUserInfo, getMenu, getTopMenu, logout, refeshToken, getButtons } from '@/api/user'
|
||||
import {loginByUsername, getUserInfo, getMenu, getTopMenu, logout, refeshToken, getButtons} from '@/api/user'
|
||||
|
||||
|
||||
function addPath(ele, first) {
|
||||
@ -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,20 +28,21 @@ function addPath(ele, first) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const user = {
|
||||
state: {
|
||||
userInfo: getStore({ name: 'userInfo' }) || [],
|
||||
permission: getStore({ name: 'permission' }) || {},
|
||||
userInfo: getStore({name: 'userInfo'}) || [],
|
||||
permission: getStore({name: 'permission'}) || {},
|
||||
roles: [],
|
||||
menu: getStore({ name: 'menu' }) || [],
|
||||
menu: getStore({name: 'menu'}) || [],
|
||||
menuAll: [],
|
||||
token: getStore({ name: 'token' }) || '',
|
||||
token: getStore({name: 'token'}) || '',
|
||||
},
|
||||
actions: {
|
||||
//根据用户名登录
|
||||
LoginByUsername({ commit }, userInfo) {
|
||||
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);
|
||||
@ -53,7 +54,7 @@ const user = {
|
||||
})
|
||||
})
|
||||
},
|
||||
GetButtons({ commit }) {
|
||||
GetButtons({commit}) {
|
||||
return new Promise((resolve) => {
|
||||
getButtons().then(res => {
|
||||
const data = res.data.data;
|
||||
@ -63,7 +64,7 @@ const user = {
|
||||
})
|
||||
},
|
||||
//根据手机号登录
|
||||
LoginByPhone({ commit }, userInfo) {
|
||||
LoginByPhone({commit}, userInfo) {
|
||||
return new Promise((resolve) => {
|
||||
loginByUsername(userInfo.phone, userInfo.code).then(res => {
|
||||
const data = res.data.data;
|
||||
@ -74,7 +75,7 @@ const user = {
|
||||
})
|
||||
})
|
||||
},
|
||||
GetUserInfo({ commit }) {
|
||||
GetUserInfo({commit}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getUserInfo().then((res) => {
|
||||
const data = res.data.data;
|
||||
@ -86,7 +87,7 @@ const user = {
|
||||
})
|
||||
},
|
||||
//刷新token
|
||||
RefeshToken({ state, commit }) {
|
||||
RefeshToken({state, commit}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
refeshToken(state.refeshToken).then(res => {
|
||||
const data = res.data.data;
|
||||
@ -98,7 +99,7 @@ const user = {
|
||||
})
|
||||
},
|
||||
// 登出
|
||||
LogOut({ commit }) {
|
||||
LogOut({commit}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
logout().then(() => {
|
||||
commit('SET_TOKEN', '')
|
||||
@ -114,7 +115,7 @@ const user = {
|
||||
})
|
||||
},
|
||||
//注销session
|
||||
FedLogOut({ commit }) {
|
||||
FedLogOut({commit}) {
|
||||
return new Promise(resolve => {
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_MENU', [])
|
||||
@ -134,7 +135,7 @@ const user = {
|
||||
})
|
||||
},
|
||||
//获取系统菜单
|
||||
GetMenu({ commit, dispatch }, parentId) {
|
||||
GetMenu({commit, dispatch}, parentId) {
|
||||
return new Promise(resolve => {
|
||||
getMenu(parentId).then((res) => {
|
||||
const data = res.data.data
|
||||
@ -153,15 +154,15 @@ const user = {
|
||||
SET_TOKEN: (state, token) => {
|
||||
setToken(token)
|
||||
state.token = token;
|
||||
setStore({ name: 'token', content: state.token, type: 'session' })
|
||||
setStore({name: 'token', content: state.token, type: 'session'})
|
||||
},
|
||||
SET_USERIFNO: (state, userInfo) => {
|
||||
state.userInfo = userInfo;
|
||||
setStore({ name: 'userInfo', content: state.userInfo })
|
||||
setStore({name: 'userInfo', content: state.userInfo})
|
||||
},
|
||||
SET_MENU: (state, menu) => {
|
||||
state.menu = menu
|
||||
setStore({ name: 'menu', content: state.menu, type: 'session' })
|
||||
setStore({name: 'menu', content: state.menu, type: 'session'})
|
||||
},
|
||||
SET_MENU_ALL: (state, menuAll) => {
|
||||
state.menuAll = menuAll;
|
||||
@ -171,6 +172,7 @@ const user = {
|
||||
},
|
||||
SET_PERMISSION: (state, permission) => {
|
||||
let result = [];
|
||||
|
||||
function getCode(list) {
|
||||
list.forEach(ele => {
|
||||
if (typeof (ele) === 'object') {
|
||||
@ -185,12 +187,13 @@ const user = {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
getCode(permission);
|
||||
state.permission = {};
|
||||
result.forEach(ele => {
|
||||
state.permission[ele] = true;
|
||||
});
|
||||
setStore({ name: 'permission', content: state.permission, type: 'session' })
|
||||
setStore({name: 'permission', content: state.permission, type: 'session'})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,4 +160,5 @@
|
||||
line-height: 38px;
|
||||
text-indent: 5px;
|
||||
text-align: center;
|
||||
cursor:pointer!important;
|
||||
}
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user