Skip to content

Commit

Permalink
upgrade: upgrade abp framework to 7.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
colinin committed Aug 9, 2023
1 parent 5fcd5b4 commit 78e169a
Show file tree
Hide file tree
Showing 36 changed files with 268 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Tagged Release"

on:
push:
branches: [ rel-7.2.2 ]
branches: [ rel-7.3.2 ]

jobs:
tagged-release:
Expand All @@ -14,4 +14,4 @@ jobs:
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
automatic_release_tag: "7.2.2"
automatic_release_tag: "7.3.2"
7 changes: 7 additions & 0 deletions apps/vue/src/api/sys/model/userModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface LoginParams {
password: string;
twoFactorProvider?: string;
twoFactorCode?: string;
enterpriseId?: string;
}

export interface LoginByPhoneParams {
Expand All @@ -32,6 +33,12 @@ export interface LoginResultModel {
refresh_token: string;
}

export interface PortalLoginModel {
id: string;
name: string;
logo?: string;
}

/**
* @description: Get user information return value
*/
Expand Down
5 changes: 3 additions & 2 deletions apps/vue/src/api/sys/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ enum Api {
/**
* @description: user login api
*/
export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') {
export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal', isPortalLogin: boolean = false) {
const setting = useGlobSetting();
const tokenParams = {
client_id: setting.clientId,
client_secret: setting.clientSecret,
grant_type: 'password',
grant_type: isPortalLogin ? 'portal' : 'password',
username: params.username,
password: params.password,
enterpriseId: params.enterpriseId,
scope: 'openid email address phone profile offline_access lingyun-abp-application',
TwoFactorProvider: params.twoFactorProvider,
TwoFactorCode: params.twoFactorCode,
Expand Down
2 changes: 2 additions & 0 deletions apps/vue/src/locales/lang/en/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ export default {
login: {
backSignIn: 'Back sign in',
mobileSignInFormTitle: 'Mobile sign in',
portalSignInFormTitle: 'Portal sign in',
qrSignInFormTitle: 'Qr code sign in',
signInFormTitle: 'Sign in',
signUpFormTitle: 'Sign up',
forgetFormTitle: 'Reset password',
twoFactorFormTitle: 'Two factor',

loginToPortalTitle: 'Login To Portal',
signInTitle: 'Backstage management system',
signInDesc: 'Enter your personal details and get started!',
policy: 'I agree to the xxx Privacy Policy',
Expand Down
2 changes: 2 additions & 0 deletions apps/vue/src/locales/lang/zh-CN/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ export default {
backSignIn: '返回',
signInFormTitle: '登录',
mobileSignInFormTitle: '手机登录',
portalSignInFormTitle: '平台登录',
qrSignInFormTitle: '二维码登录',
signUpFormTitle: '注册',
forgetFormTitle: '重置密码',
twoFactorFormTitle: '二次认证',

loginToPortalTitle: '登陆到门户',
signInTitle: '开箱即用的中后台管理系统',
signInDesc: '输入您的个人详细信息开始使用!',
policy: '我同意xxx隐私政策',
Expand Down
24 changes: 16 additions & 8 deletions apps/vue/src/store/modules/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,18 @@ export const useUserStore = defineStore({
async login(
params: LoginParams & {
goHome?: boolean;
isPortalLogin?: boolean;
mode?: ErrorMessageMode;
loginCallback?: () => Promise<void>;
},
): Promise<GetUserInfoModel | null> {
try {
const { goHome = true, mode, ...loginParams } = params;
const data = await loginApi(loginParams, mode);
const { goHome = true, mode, isPortalLogin, loginCallback, ...loginParams } = params;
const data = await loginApi(loginParams, mode, isPortalLogin);
const { access_token } = data;
this.setSso(false);
this.setToken(access_token);
return this.afterLoginAction(goHome);
return this.afterLoginAction(goHome, loginCallback);
} catch (error) {
return Promise.reject(error);
}
Expand All @@ -118,15 +120,16 @@ export const useUserStore = defineStore({
params: LoginByPhoneParams & {
goHome?: boolean;
mode?: ErrorMessageMode;
loginCallback?: () => Promise<void>;
},
): Promise<GetUserInfoModel | null> {
try {
const { goHome = true, mode, ...loginParams } = params;
const { goHome = true, mode, loginCallback, ...loginParams } = params;
const data = await loginPhoneApi(loginParams, mode);
const { access_token } = data;
this.setSso(false);
this.setToken(access_token);
return this.afterLoginAction(goHome);
return this.afterLoginAction(goHome, loginCallback);
} catch (error) {
return Promise.reject(error);
}
Expand All @@ -138,10 +141,10 @@ export const useUserStore = defineStore({
return this.afterLoginAction(true);
},

async afterLoginAction(goHome?: boolean): Promise<GetUserInfoModel | null> {
async afterLoginAction(goHome?: boolean, loginCallback?: () => Promise<void>): Promise<GetUserInfoModel | null> {
if (!this.getToken) return null;
// get user info
await this.getUserInfoAction();
await this.getUserInfoAction(loginCallback);

try {
const appStore = useAppStoreWithOut();
Expand All @@ -167,17 +170,22 @@ export const useUserStore = defineStore({
}
return this.userInfo;
},
async getUserInfoAction(): Promise<GetUserInfoModel> {
async getUserInfoAction(loginCallback?: () => Promise<void>): Promise<GetUserInfoModel> {
const userInfo = await getUserInfo();

const abpStore = useAbpStoreWithOut();

let currentUser = abpStore.getApplication.currentUser;
// 避免多次请求接口
if (userInfo?.sub !== currentUser.id) {
await abpStore.initlizeAbpApplication();
currentUser = abpStore.getApplication.currentUser;
}

if (loginCallback) {
await loginCallback();
}

const outgoingUserInfo: { [key: string]: any } = {
// 从 currentuser 接口获取
userId: currentUser.id,
Expand Down
4 changes: 4 additions & 0 deletions apps/vue/src/utils/http/axios/checkStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ export function checkResponse(response: any): string | undefined {
return undefined;
}

if (response.data.Enterprises) {
return response.data.Enterprises;
}

let errorJson = response.data.error;

// abp框架抛出异常信息
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,26 @@
key: './',
path: '',
name: './',
isLeaf: false,
children: [],
},
]);
watch(
() => props.bucket,
(bucket) => {
if (bucket) {
expandedKeys.value = [];
selectedKeys.value = [];
fetchFolders(bucket).then((fs) => {
folders.value[0].children = fs;
var foldersRoot: Folder[] = [{
title: L('Objects:Root'),
key: './',
path: '',
name: './',
isLeaf: false,
children: fs,
}];
folders.value = foldersRoot;
});
}
},
Expand All @@ -77,10 +88,10 @@
)
const fetchChildren: TreeProps['loadData'] = treeNode => {
return new Promise((resolve) => {
if (treeNode.dataRef!.children!.length > 0) {
resolve();
return;
}
// if (treeNode.dataRef!.children!.length > 0) {
// resolve();
// return;
// }
let path = '';
if (treeNode.dataRef?.path) {
path = path + treeNode.dataRef?.path;
Expand Down Expand Up @@ -119,6 +130,7 @@
title: item.name,
path: item.path,
children: [],
isLeaf: false,
};
});
return resolve(fs);
Expand Down
1 change: 1 addition & 0 deletions apps/vue/src/views/oss-management/objects/datas/typing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ export interface Folder {
title: string,
path?: string,
name: string,
isLeaf?: boolean,
children?: Folder[],
}
2 changes: 2 additions & 0 deletions apps/vue/src/views/sys/login/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
class="relative w-full px-5 py-8 mx-auto my-auto rounded-md shadow-md xl:ml-16 xl:bg-transparent sm:px-8 xl:p-4 xl:shadow-none sm:w-3/4 lg:w-2/4 xl:w-auto enter-x"
>
<LoginForm />
<PortalForm />
<ForgetPasswordForm />
<RegisterForm />
<MobileRegisterForm />
Expand All @@ -57,6 +58,7 @@
import RegisterForm from './RegisterForm.vue';
import MobileForm from './MobileForm.vue';
import QrCodeForm from './QrCodeForm.vue';
import PortalForm from './PortalForm.vue';
import MobileRegisterForm from './MobileRegisterForm.vue';
import { useGlobSetting } from '/@/hooks/setting';
import { useI18n } from '/@/hooks/web/useI18n';
Expand Down
7 changes: 6 additions & 1 deletion apps/vue/src/views/sys/login/LoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
<Divider class="enter-x">{{ t('sys.login.otherSignIn') }}</Divider>

<div class="flex justify-evenly enter-x" :class="`${prefixCls}-sign-in-way`">
<GlobalOutlined
v-if="getLoginState !== LoginStateEnum.Portal"
:title="t('sys.login.portalSignInFormTitle')"
@click="setLoginState(LoginStateEnum.Portal)"
/>
<SvgIcon
v-if="getLoginState !== LoginStateEnum.SSO"
name="idsv4"
Expand Down Expand Up @@ -106,7 +111,7 @@
import { reactive, ref, unref, computed } from 'vue';
import { Checkbox, Form, Input, Row, Col, Button, Divider } from 'ant-design-vue';
import { MobileOutlined, WechatOutlined, UserOutlined } from '@ant-design/icons-vue';
import { MobileOutlined, WechatOutlined, UserOutlined, GlobalOutlined } from '@ant-design/icons-vue';
import { SvgIcon } from '/@/components/Icon';
import { Input as BInput } from '/@/components/Input';
import { useModal } from '/@/components/Modal';
Expand Down
1 change: 1 addition & 0 deletions apps/vue/src/views/sys/login/LoginFormTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
const titleObj = {
[LoginStateEnum.RESET_PASSWORD]: t('sys.login.forgetFormTitle'),
[LoginStateEnum.LOGIN]: t('sys.login.signInFormTitle'),
[LoginStateEnum.Portal]: t('sys.login.signInFormTitle'),
[LoginStateEnum.REGISTER]: t('sys.login.signUpFormTitle'),
[LoginStateEnum.MOBILE_REGISTER]: t('sys.login.signUpFormTitle'),
[LoginStateEnum.MOBILE]: t('sys.login.mobileSignInFormTitle'),
Expand Down
Loading

0 comments on commit 78e169a

Please sign in to comment.