Merge branch 'v-next-dev' of https://gitee.com/yudaocode/yudao-ui-admin-vben into v-next-dev
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { h } from 'vue';
|
||||
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
@@ -6,12 +8,11 @@ import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table';
|
||||
import { isFunction, isString } from '@vben/utils';
|
||||
|
||||
import { Button, Image, Popconfirm, Switch } from 'ant-design-vue';
|
||||
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useVbenForm } from './form';
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { $t } from '#/locales';
|
||||
|
||||
setupVbenVxeTable({
|
||||
configVxeTable: (vxeUI) => {
|
||||
@@ -162,10 +163,10 @@ setupVbenVxeTable({
|
||||
return presets[opt]
|
||||
? { code: opt, ...presets[opt], ...defaultProps }
|
||||
: {
|
||||
code: opt,
|
||||
text: $te(`common.${opt}`) ? $t(`common.${opt}`) : opt,
|
||||
...defaultProps,
|
||||
};
|
||||
code: opt,
|
||||
text: $te(`common.${opt}`) ? $t(`common.${opt}`) : opt,
|
||||
...defaultProps,
|
||||
};
|
||||
} else {
|
||||
return { ...defaultProps, ...presets[opt.code], ...opt };
|
||||
}
|
||||
@@ -188,10 +189,10 @@ setupVbenVxeTable({
|
||||
icon: undefined,
|
||||
onClick: listen
|
||||
? () =>
|
||||
attrs?.onClick?.({
|
||||
code: opt.code,
|
||||
row,
|
||||
})
|
||||
attrs?.onClick?.({
|
||||
code: opt.code,
|
||||
row,
|
||||
})
|
||||
: undefined,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -5,11 +5,11 @@ import type {
|
||||
|
||||
import { generateAccessible } from '@vben/access';
|
||||
import { preferences } from '@vben/preferences';
|
||||
|
||||
import { BasicLayout, IFrameView } from '#/layouts';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
import { convertServerMenuToRouteRecordStringComponent } from '@vben/utils';
|
||||
|
||||
import { BasicLayout, IFrameView } from '#/layouts';
|
||||
|
||||
const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue');
|
||||
|
||||
async function generateAccess(options: GenerateMenuAndRoutesOptions) {
|
||||
@@ -26,6 +26,7 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) {
|
||||
fetchMenuListAsync: async () => {
|
||||
// 由于 yudao 通过 accessStore 读取,所以不在进行 message.loading 提示
|
||||
const accessMenus = accessStore.accessMenus;
|
||||
// TODO @芋艿:爆红!!!
|
||||
return convertServerMenuToRouteRecordStringComponent(accessMenus);
|
||||
},
|
||||
// 可以指定没有权限跳转403页面
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import type { AuthPermissionInfo, Recordable, UserInfo} from '@vben/types';
|
||||
import type { AuthPermissionInfo, Recordable, UserInfo } from '@vben/types';
|
||||
|
||||
import type { AuthApi } from '#/api';
|
||||
|
||||
import { ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
@@ -9,7 +11,14 @@ import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores';
|
||||
import { notification } from 'ant-design-vue';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
import { type AuthApi, getAuthPermissionInfoApi, loginApi, logoutApi, smsLogin, register, socialLogin } from '#/api';
|
||||
import {
|
||||
getAuthPermissionInfoApi,
|
||||
loginApi,
|
||||
logoutApi,
|
||||
register,
|
||||
smsLogin,
|
||||
socialLogin,
|
||||
} from '#/api';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
export const useAuthStore = defineStore('auth', () => {
|
||||
@@ -27,7 +36,7 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
* @param onSuccess 登录成功后的回调函数
|
||||
*/
|
||||
async function authLogin(
|
||||
type: 'mobile' | 'username' | 'register' | 'social',
|
||||
type: 'mobile' | 'register' | 'social' | 'username',
|
||||
params: Recordable<any>,
|
||||
onSuccess?: () => Promise<void> | void,
|
||||
) {
|
||||
@@ -35,10 +44,15 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
let userInfo: null | UserInfo = null;
|
||||
try {
|
||||
loginLoading.value = true;
|
||||
const { accessToken, refreshToken } = type === 'mobile' ? await smsLogin(params as AuthApi.SmsLoginParams)
|
||||
: type === 'register' ? await register(params as AuthApi.RegisterParams)
|
||||
: type === 'social' ? await socialLogin(params as AuthApi.SocialLoginParams)
|
||||
: await loginApi(params);
|
||||
const { accessToken, refreshToken } =
|
||||
type === 'mobile'
|
||||
? await smsLogin(params as AuthApi.SmsLoginParams)
|
||||
: type === 'register'
|
||||
? await register(params as AuthApi.RegisterParams)
|
||||
: // eslint-disable-next-line unicorn/no-nested-ternary
|
||||
type === 'social'
|
||||
? await socialLogin(params as AuthApi.SocialLoginParams)
|
||||
: await loginApi(params);
|
||||
|
||||
// 如果成功获取到 accessToken
|
||||
if (accessToken) {
|
||||
|
||||
Reference in New Issue
Block a user