mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-23 00:08:09 +08:00
example open dir
This commit is contained in:
@@ -6,13 +6,30 @@ class ExampleController extends BaseController {
|
||||
|
||||
async openLocalDir() {
|
||||
const self = this;
|
||||
const { service } = this;
|
||||
const { ctx, service } = this;
|
||||
const body = ctx.request.body;
|
||||
const id = body.id;
|
||||
const data = {};
|
||||
let dir = '';
|
||||
switch (id) {
|
||||
case 'download' :
|
||||
dir = 'C:/Users/Public/Downloads';
|
||||
break;
|
||||
case 'picture' :
|
||||
dir = 'C:/Users/Public/Pictures';
|
||||
break;
|
||||
case 'video' :
|
||||
dir = 'C:/Users/Public/Videos';
|
||||
break;
|
||||
case 'doc' :
|
||||
dir = 'C:/Users/Public/Documents';
|
||||
break;
|
||||
case 'music' :
|
||||
dir = 'C:/Users/Public/Music';
|
||||
break;
|
||||
}
|
||||
|
||||
const data = {
|
||||
title: 'example test'
|
||||
};
|
||||
|
||||
await service.example.openLocalDir();
|
||||
await service.example.openLocalDir(dir);
|
||||
|
||||
self.sendSuccess(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user