'use strict'; const { Controller } = require('ee-core'); const Log = require('ee-core/log'); const { dialog } = require('electron'); const { checkSelectImages } = require('../api/imageMatting') /** * example * @class */ class ExampleController extends Controller { constructor(ctx) { super(ctx); } /** * 所有方法接收两个参数 * @param args 前端传的参数 * @param event - ipc通信时才有值。详情见:控制器文档 */ /** * upload */ async upload (param) { // const result = await Services.get('example').test('electron'); let dialogParams = {} if(param === 'file'){ dialogParams = { title:"选择图片", properties: ['openFile'], filters: [ { name: '支持JPG', extensions: ['jpg'] }, ] } }else{ dialogParams = { title:"选择文件夹", properties: ['openDirectory'] } } const filePaths = dialog.showOpenDialogSync(dialogParams); Log.info(filePaths); const res = await checkSelectImages({ path_type:1, path:filePaths[0], }) Log.info(res); return 'hello upload'; } } ExampleController.toString = () => '[class ExampleController]'; module.exports = ExampleController;