diff --git a/package-lock.json b/package-lock.json
index 3f8b7ba..f80c8b4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1368,6 +1368,34 @@
"progress": "^2.0.3",
"semver": "^6.2.0",
"sumchecker": "^3.0.1"
+ },
+ "dependencies": {
+ "fs-extra": {
+ "version": "8.1.0",
+ "resolved": "https://registry.nlark.com/fs-extra/download/fs-extra-8.1.0.tgz",
+ "integrity": "sha1-SdQ8RaiM2Wd2aMt74bRu/bjS4cA=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^4.0.0",
+ "universalify": "^0.1.0"
+ }
+ },
+ "jsonfile": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npm.taobao.org/jsonfile/download/jsonfile-4.0.0.tgz?cache=0&sync_timestamp=1604161797011&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjsonfile%2Fdownload%2Fjsonfile-4.0.0.tgz",
+ "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
+ "universalify": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npm.taobao.org/universalify/download/universalify-0.1.2.tgz?cache=0&sync_timestamp=1603179967633&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Funiversalify%2Fdownload%2Funiversalify-0.1.2.tgz",
+ "integrity": "sha1-tkb2m+OULavOzJ1mOcgNwQXvqmY=",
+ "dev": true
+ }
}
},
"@electron/universal": {
@@ -5758,14 +5786,13 @@
"dev": true
},
"fs-extra": {
- "version": "8.1.0",
- "resolved": "https://registry.nlark.com/fs-extra/download/fs-extra-8.1.0.tgz",
- "integrity": "sha1-SdQ8RaiM2Wd2aMt74bRu/bjS4cA=",
- "dev": true,
+ "version": "10.0.0",
+ "resolved": "https://registry.nlark.com/fs-extra/download/fs-extra-10.0.0.tgz",
+ "integrity": "sha1-n/YbZV3eU/s0qC34S7IUzoAuF8E=",
"requires": {
"graceful-fs": "^4.2.0",
- "jsonfile": "^4.0.0",
- "universalify": "^0.1.0"
+ "jsonfile": "^6.0.1",
+ "universalify": "^2.0.0"
}
},
"fs.realpath": {
@@ -5969,8 +5996,7 @@
"graceful-fs": {
"version": "4.2.6",
"resolved": "https://registry.nlark.com/graceful-fs/download/graceful-fs-4.2.6.tgz",
- "integrity": "sha1-/wQLKwhTsjw9MQJ1I3BvGIXXa+4=",
- "dev": true
+ "integrity": "sha1-/wQLKwhTsjw9MQJ1I3BvGIXXa+4="
},
"graceful-readlink": {
"version": "1.0.1",
@@ -6928,12 +6954,12 @@
}
},
"jsonfile": {
- "version": "4.0.0",
- "resolved": "https://registry.npm.taobao.org/jsonfile/download/jsonfile-4.0.0.tgz?cache=0&sync_timestamp=1604161797011&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjsonfile%2Fdownload%2Fjsonfile-4.0.0.tgz",
- "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
- "dev": true,
+ "version": "6.1.0",
+ "resolved": "https://registry.npm.taobao.org/jsonfile/download/jsonfile-6.1.0.tgz?cache=0&sync_timestamp=1604161797011&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjsonfile%2Fdownload%2Fjsonfile-6.1.0.tgz",
+ "integrity": "sha1-vFWyY0eTxnnsZAMJTrE2mKbsCq4=",
"requires": {
- "graceful-fs": "^4.1.6"
+ "graceful-fs": "^4.1.6",
+ "universalify": "^2.0.0"
}
},
"jszip": {
@@ -8226,7 +8252,7 @@
},
"react-popper": {
"version": "1.3.11",
- "resolved": "https://registry.npm.taobao.org/react-popper/download/react-popper-1.3.11.tgz?cache=0&sync_timestamp=1616674786422&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freact-popper%2Fdownload%2Freact-popper-1.3.11.tgz",
+ "resolved": "https://registry.npm.taobao.org/react-popper/download/react-popper-1.3.11.tgz",
"integrity": "sha1-osw/Cme3W2bPpi0sQJ+d0fzHH/0=",
"dev": true,
"requires": {
@@ -10018,10 +10044,9 @@
}
},
"universalify": {
- "version": "0.1.2",
- "resolved": "https://registry.npm.taobao.org/universalify/download/universalify-0.1.2.tgz?cache=0&sync_timestamp=1603179967633&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Funiversalify%2Fdownload%2Funiversalify-0.1.2.tgz",
- "integrity": "sha1-tkb2m+OULavOzJ1mOcgNwQXvqmY=",
- "dev": true
+ "version": "2.0.0",
+ "resolved": "https://registry.npm.taobao.org/universalify/download/universalify-2.0.0.tgz?cache=0&sync_timestamp=1603179967633&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Funiversalify%2Fdownload%2Funiversalify-2.0.0.tgz",
+ "integrity": "sha1-daSYTv7cSwiXXFrrc/Uw0C3yVxc="
},
"unpipe": {
"version": "1.0.0",
diff --git a/package.json b/package.json
index 367eb44..545b748 100644
--- a/package.json
+++ b/package.json
@@ -93,6 +93,7 @@
"@emotion/react": "^11.4.0",
"@emotion/styled": "^11.3.0",
"framer-motion": "^4.1.17",
+ "fs-extra": "^10.0.0",
"normalize.css": "^8.0.1"
},
"build": {
diff --git a/plugins/md.ts b/plugins/md.ts
new file mode 100644
index 0000000..4499610
--- /dev/null
+++ b/plugins/md.ts
@@ -0,0 +1,35 @@
+import MarkdownIt from "markdown-it"
+
+const mark = new MarkdownIt()
+
+const mdToHtml = (str: string) => {
+ const content = mark.render(str)
+ return `
+ import React from "react"
+ export default React.createElement('div', {dangerouslySetInnerHTML:{__html: \`${content}\`} })`
+}
+
+export default function md(): any {
+ return {
+ name: "vite-plugin-md",
+ enforce: "pre",
+ transform(raw: any, id: any) {
+ if (!/\.md/g.test(id))
+ return
+ try {
+ return mdToHtml(raw)
+ } catch (e) {
+ this.error(e)
+ return ""
+ }
+ },
+ async handleHotUpdate(ctx: any) {
+ if (!/\.md/g.test(ctx.file))
+ return
+ const defaultRead = ctx.read
+ ctx.read = async function() {
+ return mdToHtml(await defaultRead())
+ }
+ }
+ }
+}
diff --git a/src/main/facilities/clock/index.ts b/src/main/facilities/clock/index.ts
new file mode 100644
index 0000000..e1de7c2
--- /dev/null
+++ b/src/main/facilities/clock/index.ts
@@ -0,0 +1,24 @@
+import { ipcMain } from "electron"
+import fs from "fs-extra"
+import path from "path"
+
+const homeDir = require("os").homedir()
+const clockJsonPath = path.resolve(homeDir, ".forceClock/clock.json")
+fs.ensureFileSync(clockJsonPath)
+
+try {
+ console.log(fs.readJSONSync(clockJsonPath))
+ const job = schedule.scheduleJob('42 * * * *', function(){
+ console.log('The answer to life, the universe, and everything!');
+ });
+} catch (e) {
+ console.log(e)
+// 读取JSON文件失败
+}
+
+ipcMain.on("@func:clock:saveData", function(event, data) {
+ fs.writeJson(clockJsonPath, data)
+})
+ipcMain.handle("@func:clock:getData", function() {
+ return fs.readJSONSync(clockJsonPath)
+})
diff --git a/src/main/facilities/index.ts b/src/main/facilities/index.ts
index 93a5ebd..dd9f6e7 100644
--- a/src/main/facilities/index.ts
+++ b/src/main/facilities/index.ts
@@ -1,4 +1,5 @@
import Shared from "@main/share"
+import "@main/facilities/clock"
import setTray from "@main/facilities/tray"
import { app, dialog, ipcMain } from "electron"
import Share from "../share"
diff --git a/src/main/facilities/main/index.ts b/src/main/facilities/main/index.ts
index f6af0a8..4fdf679 100644
--- a/src/main/facilities/main/index.ts
+++ b/src/main/facilities/main/index.ts
@@ -21,12 +21,12 @@ export default function showWindow(url?: string) {
* Initial window options
*/
Shared.data.mainWindow = new BrowserWindow({
- height: 95,
+ height: 600,
useContentSize: true,
- width: 260,
+ width: 800,
resizable: true,
- minWidth: 260,
- minHeight: 95,
+ minWidth: 800,
+ minHeight: 600,
icon: __static + "/icon.png",
// show: false,
// frame: false, // 去除原生的菜单
diff --git a/src/render/plugins/electron/index.ts b/src/render/plugins/electron/index.ts
index 9d4b7e5..1190ea0 100644
--- a/src/render/plugins/electron/index.ts
+++ b/src/render/plugins/electron/index.ts
@@ -1,3 +1,6 @@
+
const electron = require("electron") // 只能用require
export default electron
+
+
diff --git a/src/render/route.tsx b/src/render/route.tsx
index 400f313..054a337 100644
--- a/src/render/route.tsx
+++ b/src/render/route.tsx
@@ -1,4 +1,5 @@
import Page404 from "@/views/Auth/Page404"
+import Home from "@/views/Home"
import Login from "@/views/Login"
import React, { lazy } from "react"
import { useLocation } from "react-router-dom"
@@ -81,9 +82,9 @@ const routes = [
},
{
path: "/home",
- component: lazy(() => import("@/views/Home")),
+ component: Home,//lazy(() => import("@/views/Home")),
exact: true,
- loading: () =>