mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 11:52:07 +08:00
1
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const BaseController = require('../base');
|
||||
const BaseController = require('./base');
|
||||
const os = require('os');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
@@ -1,21 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
const BaseController = require('../base');
|
||||
|
||||
class HomeController extends BaseController {
|
||||
|
||||
/**
|
||||
* 单页应用入口(vue、react等)
|
||||
*/
|
||||
async index() {
|
||||
const { ctx } = this;
|
||||
|
||||
const data = {
|
||||
title: 'hello electron-egg'
|
||||
};
|
||||
|
||||
await ctx.render('index.ejs', data);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HomeController;
|
||||
'use strict';
|
||||
|
||||
const BaseController = require('./base');
|
||||
|
||||
class HomeController extends BaseController {
|
||||
|
||||
/**
|
||||
* 单页应用入口(vue、react等)
|
||||
*/
|
||||
async index() {
|
||||
const { ctx } = this;
|
||||
|
||||
const data = {
|
||||
title: 'hello electron-egg'
|
||||
};
|
||||
|
||||
await ctx.render('index.ejs', data);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HomeController;
|
||||
@@ -6,43 +6,43 @@
|
||||
module.exports = app => {
|
||||
const { router, controller } = app;
|
||||
// open local dir
|
||||
router.post('/api/v1/example/openLocalDir', controller.v1.example.openLocalDir);
|
||||
router.post('/api/example/openLocalDir', controller.example.openLocalDir);
|
||||
// executeJS
|
||||
router.post('/api/v1/example/executeJS', controller.v1.example.executeJS);
|
||||
router.post('/api/example/executeJS', controller.example.executeJS);
|
||||
// upload file
|
||||
router.post('/api/v1/example/uploadFile', controller.v1.example.uploadFile);
|
||||
router.post('/api/example/uploadFile', controller.example.uploadFile);
|
||||
// get ws url
|
||||
router.post('/api/v1/example/getWsUrl', controller.v1.example.getWsUrl);
|
||||
router.post('/api/example/getWsUrl', controller.example.getWsUrl);
|
||||
// add test data
|
||||
router.post('/api/v1/example/addTestData', controller.v1.example.addTestData);
|
||||
router.post('/api/example/addTestData', controller.example.addTestData);
|
||||
// delete test data
|
||||
router.post('/api/v1/example/delTestData', controller.v1.example.delTestData);
|
||||
router.post('/api/example/delTestData', controller.example.delTestData);
|
||||
// update test data
|
||||
router.post('/api/v1/example/updateTestData', controller.v1.example.updateTestData);
|
||||
router.post('/api/example/updateTestData', controller.example.updateTestData);
|
||||
// get test data
|
||||
router.post('/api/v1/example/getTestData', controller.v1.example.getTestData);
|
||||
router.post('/api/example/getTestData', controller.example.getTestData);
|
||||
// set shortcut
|
||||
router.post('/api/v1/example/setShortcut', controller.v1.example.setShortcut);
|
||||
router.post('/api/example/setShortcut', controller.example.setShortcut);
|
||||
// open launch
|
||||
router.post('/api/v1/example/autoLaunchEnable', controller.v1.example.autoLaunchEnable);
|
||||
router.post('/api/example/autoLaunchEnable', controller.example.autoLaunchEnable);
|
||||
// close launch
|
||||
router.post('/api/v1/example/autoLaunchDisable', controller.v1.example.autoLaunchDisable);
|
||||
router.post('/api/example/autoLaunchDisable', controller.example.autoLaunchDisable);
|
||||
// is launch
|
||||
router.post('/api/v1/example/autoLaunchIsEnabled', controller.v1.example.autoLaunchIsEnabled);
|
||||
router.post('/api/example/autoLaunchIsEnabled', controller.example.autoLaunchIsEnabled);
|
||||
// open software
|
||||
router.post('/api/v1/example/openSoftware', controller.v1.example.openSoftware);
|
||||
router.post('/api/example/openSoftware', controller.example.openSoftware);
|
||||
// select file dir
|
||||
router.post('/api/v1/example/selectFileDir', controller.v1.example.selectFileDir);
|
||||
router.post('/api/example/selectFileDir', controller.example.selectFileDir);
|
||||
// test some electron api
|
||||
router.post('/api/v1/example/testElectronApi', controller.v1.example.testElectronApi);
|
||||
router.post('/api/example/testElectronApi', controller.example.testElectronApi);
|
||||
// test2
|
||||
router.post('/api/v1/example/test2', controller.v1.example.test2);
|
||||
router.post('/api/example/test2', controller.example.test2);
|
||||
// message show
|
||||
router.post('/api/v1/example/messageShow', controller.v1.example.messageShow);
|
||||
router.post('/api/example/messageShow', controller.example.messageShow);
|
||||
// message show confirm
|
||||
router.post('/api/v1/example/messageShowConfirm', controller.v1.example.messageShowConfirm);
|
||||
router.post('/api/example/messageShowConfirm', controller.example.messageShowConfirm);
|
||||
// upload chrome extension
|
||||
router.post('/api/v1/example/uploadExtension', controller.v1.example.uploadExtension);
|
||||
router.post('/api/example/uploadExtension', controller.example.uploadExtension);
|
||||
// db operation
|
||||
router.post('/api/v1/example/dbOperation', controller.v1.example.dbOperation);
|
||||
router.post('/api/example/dbOperation', controller.example.dbOperation);
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-db">
|
||||
<div id="app-base-db">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 本地数据库
|
||||
@@ -208,7 +208,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-db {
|
||||
#app-base-db {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-extension">
|
||||
<div id="app-base-extension">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 上传扩展程序(crx文件格式)
|
||||
@@ -67,7 +67,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-extension {
|
||||
#app-base-extension {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-file">
|
||||
<div id="app-base-file">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 上传文件到sm图床
|
||||
@@ -203,7 +203,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-file {
|
||||
#app-base-file {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-notification">
|
||||
<div id="app-base-notification">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 弹出桌面通知
|
||||
@@ -72,7 +72,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-notification {
|
||||
#app-base-notification {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-powermonitor">
|
||||
<div id="app-base-powermonitor">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 监控电源状态
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-powermonitor {
|
||||
#app-base-powermonitor {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-screen">
|
||||
<div id="app-base-screen">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 屏幕信息
|
||||
@@ -51,7 +51,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-screen {
|
||||
#app-base-screen {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-shortcut">
|
||||
<div id="app-base-shortcut">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 快捷键
|
||||
@@ -84,7 +84,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-shortcut {
|
||||
#app-base-shortcut {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-socket-ipc">
|
||||
<div id="app-base-socket-ipc">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 渲染进程与主进程IPC通信
|
||||
@@ -93,7 +93,7 @@ export default {
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-socket-ipc {
|
||||
#app-base-socket-ipc {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-software-open">
|
||||
<div id="app-base-software-open">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 调用其它软件(exe、bash等可执行程序)
|
||||
@@ -52,7 +52,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-software-open {
|
||||
#app-base-software-open {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-system-launch">
|
||||
<div id="app-base-system-launch">
|
||||
<div class="one-block-2">
|
||||
<a-list class="set-auto" itemLayout="horizontal">
|
||||
<a-list-item style="text-align: left;">
|
||||
@@ -72,7 +72,7 @@ export default {
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-system-launch {
|
||||
#app-base-system-launch {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-test-api">
|
||||
<div id="app-base-test-api">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 测试一些操作系统api
|
||||
@@ -36,7 +36,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-test-api {
|
||||
#app-base-test-api {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-screen">
|
||||
<div id="app-base-screen">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 系统主题模式
|
||||
@@ -72,7 +72,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-screen {
|
||||
#app-base-screen {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-window">
|
||||
<div id="app-base-window">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 新窗口中加载web内容
|
||||
@@ -50,7 +50,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-window {
|
||||
#app-base-window {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div id="app-demo-window-view">
|
||||
<div id="app-base-window-view">
|
||||
<div class="one-block-1">
|
||||
<span>
|
||||
1. 嵌入web内容
|
||||
@@ -58,7 +58,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
#app-demo-window-view {
|
||||
#app-base-window-view {
|
||||
padding: 0px 10px;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
Reference in New Issue
Block a user