first commit
This commit is contained in:
1
src/core/controller/.pydio
Normal file
1
src/core/controller/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
1352edee-3a21-42cf-bf29-5ca3b2846b11
|
||||
47
src/core/controller/Home.controller.ts
Normal file
47
src/core/controller/Home.controller.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { Render, Ipc } from "@annotation/Creted.annotation";
|
||||
import { VideoImplService } from "@service/impl/Video.impl.service";
|
||||
import { Inject } from "@annotation/Ioc.annotation";
|
||||
import { FileIpc } from "@ipc/module/File.ipc";
|
||||
|
||||
export class HomeController {
|
||||
|
||||
@Inject()
|
||||
public readonly VideoImplService!: VideoImplService;
|
||||
|
||||
@Render()
|
||||
public async Home(test: string) {
|
||||
let res = await this.VideoImplService.PlayList({});
|
||||
return {
|
||||
header: true,
|
||||
nav: true,
|
||||
title: '首页页面窗口-测试传给模板的数据',
|
||||
desc: `点我发送ipc,打开窗口,代码实现分别在:src/application/assets/js/page/Home.js
|
||||
和 src/core/ipc/Application.ipc.ts 和 @CreateApplicationIpc 装饰器中!!!`,
|
||||
list: res.data
|
||||
};
|
||||
}
|
||||
|
||||
@Render()
|
||||
@Ipc([ FileIpc ])
|
||||
// 注意 PlayVideo() 方法将被前端发起的全局ipc自动调用,ipc内部会根据这个方法名去自动创建同名的 视频播放窗口,
|
||||
// 并IPC会自动动调用这个 PlayVideo() 方法,并把前端的参数向传入方法的 params,方法内部无脑的去用即可!!
|
||||
public async PlayVideo(params?: { [key:string]:any } ) {
|
||||
console.log("参数:", params)
|
||||
if ((params as object).hasOwnProperty("list")) {
|
||||
return { // 用户点击图片组
|
||||
header: false,
|
||||
nav: false,
|
||||
img: true,
|
||||
video: params
|
||||
}
|
||||
} else {
|
||||
return { // 用户点击视频
|
||||
header: false,
|
||||
nav: false,
|
||||
img: false,
|
||||
video: await this.VideoImplService.PalyVideo(params),
|
||||
Comment: await this.VideoImplService.VideoComment({ photoId: (params as any).photoId })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
src/core/controller/Setting.controller.ts
Normal file
27
src/core/controller/Setting.controller.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { BaseControllerTypes } from "@type/BaseController.types";
|
||||
import { Render, Ipc } from "@annotation/Creted.annotation";
|
||||
import {FileIpc} from "@ipc/module/File.ipc";
|
||||
|
||||
/**
|
||||
* 首页窗体
|
||||
* @Render() 注解:
|
||||
* 用在类的方法上,注意方法名 和 页面模板名称一致。
|
||||
* 作用:表示使用该方法创建页面窗口,方法返回的数据需要是个对象,返回的数据会传给模板
|
||||
* 用法:
|
||||
* 1:@Render(),不传参数,会根据方法名自动载入对应的jade页面文件来创建窗口
|
||||
* 2:@Render('PlayVideo'),传入参数,会根据传入的参数去寻找对应的jade页面来创建窗口
|
||||
* 注意:传入参数后不仅会使用自定义页面,还会抛弃配置文件中的 StartPage 主窗窗口配置
|
||||
*
|
||||
* @Ipc() 注解:
|
||||
* 用在类的方法上,接受一个未实例化的类作为参数
|
||||
* 作用:Ipc注解会自动运行这个类里面的所有方法,请在方法中放置 ipcMain.on 代码!
|
||||
*/
|
||||
export class SettingController {
|
||||
@Render()
|
||||
public Setting() {
|
||||
return {
|
||||
title: '设置页面窗口-测试传给模板的数据',
|
||||
desc: '介绍'
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user