Merge remote-tracking branch 'origin/v2-dev' into v2-dev

pull/189/head
xiaojunnuo 2024-09-23 13:34:36 +08:00
commit e85b4da2e3
12 changed files with 107 additions and 57 deletions

View File

@ -33,10 +33,11 @@ export class IframeClient {
window.addEventListener('message', async (event: MessageEvent<IframeMessageData<any>>) => {
const data = event.data;
if (data.action) {
console.log('收到消息', data);
console.log(`收到消息[isSub:${this.isInFrame()}]`, data);
try {
const handler = this.handlers[data.action];
if (handler) {
debugger;
const res = await handler(data);
if (data.id && data.action !== 'reply') {
await this.send('reply', res, data.id);
@ -45,6 +46,7 @@ export class IframeClient {
throw new Error(`action:${data.action} 未注册处理器`);
}
} catch (e: any) {
console.error(e);
await this.send('reply', {}, data.id, 500, e.message);
}
}
@ -77,7 +79,7 @@ export class IframeClient {
};
return new Promise((resolve, reject) => {
const onReply = async (reply: IframeMessageData<R>) => {
const onReply = (reply: IframeMessageData<R>) => {
if (reply.errorCode && reply.errorCode > 0) {
reject(new IframeException(reply));
return;
@ -89,6 +91,7 @@ export class IframeClient {
onReply,
};
try {
console.log(`send message[isSub:${this.isInFrame()}]:`, reqMessageData);
if (!this.iframe) {
if (!window.parent) {
reject('当前页面不在 iframe 中');

View File

@ -1,55 +1,55 @@
import { request } from "/src/api/service";
const apiPrefix = "/pi/access";
export function GetList(query: any) {
return request({
export async function GetList(query: any) {
return await request({
url: apiPrefix + "/page",
method: "post",
data: query
});
}
export function AddObj(obj: any) {
return request({
export async function AddObj(obj: any) {
return await request({
url: apiPrefix + "/add",
method: "post",
data: obj
});
}
export function UpdateObj(obj: any) {
return request({
export async function UpdateObj(obj: any) {
return await request({
url: apiPrefix + "/update",
method: "post",
data: obj
});
}
export function DelObj(id: number) {
return request({
export async function DelObj(id: number) {
return await request({
url: apiPrefix + "/delete",
method: "post",
params: { id }
});
}
export function GetObj(id: number) {
return request({
export async function GetObj(id: number) {
return await request({
url: apiPrefix + "/info",
method: "post",
params: { id }
});
}
export function GetProviderDefine(type: string) {
return request({
export async function GetProviderDefine(type: string) {
return await request({
url: apiPrefix + "/define",
method: "post",
params: { type }
});
}
export function GetProviderDefineByAccessType(type: string) {
return request({
export async function GetProviderDefineByAccessType(type: string) {
return await request({
url: apiPrefix + "/defineByAccessType",
method: "post",
params: { type }

View File

@ -3,7 +3,7 @@ import { request } from "/src/api/service";
const apiPrefix = "/pi/history";
export function GetList(query: any) {
return request({
return await request({
url: apiPrefix + "/page",
method: "post",
data: query
@ -11,7 +11,7 @@ export function GetList(query: any) {
}
export function AddObj(obj: any) {
return request({
return await request({
url: apiPrefix + "/add",
method: "post",
data: obj
@ -19,7 +19,7 @@ export function AddObj(obj: any) {
}
export function UpdateObj(obj: any) {
return request({
return await request({
url: apiPrefix + "/update",
method: "post",
data: obj
@ -27,7 +27,7 @@ export function UpdateObj(obj: any) {
}
export function DelObj(id: any) {
return request({
return await request({
url: apiPrefix + "/delete",
method: "post",
params: { id }
@ -35,7 +35,7 @@ export function DelObj(id: any) {
}
export function GetObj(id: any) {
return request({
return await request({
url: apiPrefix + "/info",
method: "post",
params: { id }
@ -43,7 +43,7 @@ export function GetObj(id: any) {
}
export function GetDetail(id: any) {
return request({
return await request({
url: apiPrefix + "/detail",
method: "post",
params: { id }
@ -51,7 +51,7 @@ export function GetDetail(id: any) {
}
export function DeleteBatch(ids: any[]) {
return request({
return await request({
url: apiPrefix + "/deleteByIds",
method: "post",
data: { ids }

View File

@ -1,14 +1,14 @@
import { request } from "/src/api/service";
export async function getMineInfo() {
return request({
return await request({
url: "/mine/info",
method: "POST"
});
}
export async function changePassword(form: any) {
return request({
return await request({
url: "/mine/changePassword",
method: "POST",
data: form

View File

@ -4,7 +4,7 @@ const apiPrefix = "/pi/pipeline";
const historyApiPrefix = "/pi/history";
export function GetList(query: any) {
return request({
return await request({
url: apiPrefix + "/page",
method: "post",
data: query
@ -12,7 +12,7 @@ export function GetList(query: any) {
}
export function AddObj(obj: any) {
return request({
return await request({
url: apiPrefix + "/add",
method: "post",
data: obj
@ -20,7 +20,7 @@ export function AddObj(obj: any) {
}
export function UpdateObj(obj: any) {
return request({
return await request({
url: apiPrefix + "/update",
method: "post",
data: obj
@ -28,7 +28,7 @@ export function UpdateObj(obj: any) {
}
export function DelObj(id: any) {
return request({
return await request({
url: apiPrefix + "/delete",
method: "post",
params: { id }
@ -36,7 +36,7 @@ export function DelObj(id: any) {
}
export function GetObj(id: any) {
return request({
return await request({
url: apiPrefix + "/info",
method: "post",
params: { id }
@ -44,7 +44,7 @@ export function GetObj(id: any) {
}
export function GetDetail(id: any) {
return request({
return await request({
url: apiPrefix + "/detail",
method: "post",
params: { id }
@ -52,7 +52,7 @@ export function GetDetail(id: any) {
}
export function Save(pipelineEntity: any) {
return request({
return await request({
url: apiPrefix + "/save",
method: "post",
data: pipelineEntity
@ -60,7 +60,7 @@ export function Save(pipelineEntity: any) {
}
export function Trigger(id: any, stepId?: string) {
return request({
return await request({
url: apiPrefix + "/trigger",
method: "post",
params: { id, stepId }
@ -68,7 +68,7 @@ export function Trigger(id: any, stepId?: string) {
}
export function Cancel(historyId: any) {
return request({
return await request({
url: apiPrefix + "/cancel",
method: "post",
params: { historyId }
@ -76,7 +76,7 @@ export function Cancel(historyId: any) {
}
export async function GetFiles(pipelineId: number) {
return request({
return await request({
url: historyApiPrefix + "/files",
method: "post",
params: { pipelineId }

View File

@ -1,9 +1,25 @@
import { request } from "/@/api/service";
export function PreBindUser(userId: number) {
request({
export async function PreBindUser(userId: number) {
await request({
url: "/sys/account/preBindUser",
method: "post",
data: { userId }
});
}
export async function BindUser(userId: number) {
await request({
url: "/sys/account/bindUser",
method: "post",
data: { userId }
});
}
export async function UnbindUser(userId: number) {
await request({
url: "/sys/account/unbindUser",
method: "post",
data: { userId }
});
}

View File

@ -32,10 +32,21 @@ onMounted(() => {
return subjectInfo;
});
iframeClient.register("preBindSubject", async (req) => {
let preBindUserId = null;
iframeClient.register("preBindUser", async (req) => {
const userId = req.data.userId;
preBindUserId = userId;
await api.PreBindUser(userId);
});
iframeClient.register("onBoundUser", async (req) => {
await api.BindUser(preBindUserId);
});
iframeClient.register("unbindUser", async (req) => {
const userId = req.data.userId;
await api.UnbindUser(userId);
});
});
</script>

View File

@ -1,7 +1,7 @@
import { request } from "/src/api/service";
const apiPrefix = "/sys/authority/permission";
export async function GetList(query: any) {
return request({
return await request({
url: apiPrefix + "/page",
method: "post",
data: query
@ -9,14 +9,14 @@ export async function GetList(query: any) {
}
export async function GetTree() {
return request({
return await request({
url: apiPrefix + "/tree",
method: "post"
});
}
export async function AddObj(obj: any) {
return request({
return await request({
url: apiPrefix + "/add",
method: "post",
data: obj
@ -24,7 +24,7 @@ export async function AddObj(obj: any) {
}
export async function UpdateObj(obj: any) {
return request({
return await request({
url: apiPrefix + "/update",
method: "post",
data: obj
@ -32,7 +32,7 @@ export async function UpdateObj(obj: any) {
}
export async function DelObj(id: any) {
return request({
return await request({
url: apiPrefix + "/delete",
method: "post",
params: { id }
@ -40,7 +40,7 @@ export async function DelObj(id: any) {
}
export async function GetObj(id: any) {
return request({
return await request({
url: apiPrefix + "/info",
method: "post",
params: { id }

View File

@ -1,7 +1,7 @@
import { request } from "/src/api/service";
const apiPrefix = "/sys/authority/role";
export async function GetList(query: any) {
return request({
return await request({
url: apiPrefix + "/page",
method: "post",
data: query
@ -9,7 +9,7 @@ export async function GetList(query: any) {
}
export async function AddObj(obj: any) {
return request({
return await request({
url: apiPrefix + "/add",
method: "post",
data: obj
@ -17,7 +17,7 @@ export async function AddObj(obj: any) {
}
export async function UpdateObj(obj: any) {
return request({
return await request({
url: apiPrefix + "/update",
method: "post",
data: obj
@ -25,7 +25,7 @@ export async function UpdateObj(obj: any) {
}
export async function DelObj(id: any) {
return request({
return await request({
url: apiPrefix + "/delete",
method: "post",
params: { id }
@ -33,7 +33,7 @@ export async function DelObj(id: any) {
}
export async function GetObj(id: any) {
return request({
return await request({
url: apiPrefix + "/info",
method: "post",
params: { id }
@ -47,7 +47,7 @@ export async function GetObj(id: any) {
* @constructor
*/
export function getPermissionIds(roleId: any) {
return request({
return await request({
url: apiPrefix + "/getPermissionIds",
method: "post",
params: { id: roleId }
@ -62,7 +62,7 @@ export function getPermissionIds(roleId: any) {
* @constructor
*/
export function DoAuthz(roleId: any, permissionIds: any) {
return request({
return await request({
url: apiPrefix + "/authz",
method: "post",
data: { roleId, permissionIds }

View File

@ -1,7 +1,7 @@
import { request } from "/src/api/service";
const apiPrefix = "/sys/authority/user";
export async function GetList(query: any) {
return request({
return await request({
url: apiPrefix + "/page",
method: "post",
data: query
@ -9,7 +9,7 @@ export async function GetList(query: any) {
}
export async function AddObj(obj: any) {
return request({
return await request({
url: apiPrefix + "/add",
method: "post",
data: obj
@ -17,7 +17,7 @@ export async function AddObj(obj: any) {
}
export async function UpdateObj(obj: any) {
return request({
return await request({
url: apiPrefix + "/update",
method: "post",
data: obj
@ -25,7 +25,7 @@ export async function UpdateObj(obj: any) {
}
export async function DelObj(id: any) {
return request({
return await request({
url: apiPrefix + "/delete",
method: "post",
params: { id }
@ -33,7 +33,7 @@ export async function DelObj(id: any) {
}
export async function GetObj(id: any) {
return request({
return await request({
url: apiPrefix + "/info",
method: "post",
params: { id }

View File

@ -8,7 +8,9 @@ import { SysInstallInfo } from '../system/service/models.js';
export type PreBindUserReq = {
userId: number;
};
export type BindUserReq = {
userId: number;
};
/**
*/
@Provide()
@ -35,4 +37,20 @@ export class BasicController extends BaseController {
return this.ok({});
}
@Post('/bindUser', { summary: 'sys:settings:edit' })
public async bindUser(@Body(ALL) body: BindUserReq) {
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
installInfo.bindUserId = body.userId;
await this.sysSettingsService.saveSetting(installInfo);
return this.ok({});
}
@Post('/unbindUser', { summary: 'sys:settings:edit' })
public async unbindUser() {
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
installInfo.bindUserId = null;
await this.sysSettingsService.saveSetting(installInfo);
return this.ok({});
}
}

View File

@ -30,6 +30,8 @@ export class SysInstallInfo extends BaseSettings {
static __access__ = 'private';
installTime: number;
siteId?: string;
bindUserId?: number;
bindUrl?: string;
}
export class SysLicenseInfo extends BaseSettings {