修复部分已知问题;主要调整包依赖、语法错误
This commit is contained in:
parent
996ba6bd9d
commit
1c2184becb
@ -1,137 +1,144 @@
|
|||||||
export const preloads = {
|
export const preloads = {
|
||||||
include: [
|
include: [
|
||||||
"vue",
|
|
||||||
"vue-router",
|
|
||||||
"pinia",
|
|
||||||
"axios",
|
|
||||||
"@vueuse/core",
|
|
||||||
"sortablejs",
|
|
||||||
"path-to-regexp",
|
|
||||||
"echarts",
|
|
||||||
"@wangeditor/editor",
|
|
||||||
"@wangeditor/editor-for-vue",
|
|
||||||
"vue-i18n",
|
|
||||||
"path-browserify",
|
|
||||||
"unocss",
|
|
||||||
"node",
|
|
||||||
"md5",
|
|
||||||
"sqlite3",
|
|
||||||
"element-plus/es/components/form/style/css",
|
|
||||||
"element-plus/es/components/form-item/style/css",
|
|
||||||
"element-plus/es/components/button/style/css",
|
|
||||||
"element-plus/es/components/input/style/css",
|
|
||||||
"element-plus/es/components/input-number/style/css",
|
|
||||||
"element-plus/es/components/switch/style/css",
|
|
||||||
"element-plus/es/components/upload/style/css",
|
|
||||||
"element-plus/es/components/menu/style/css",
|
|
||||||
"element-plus/es/components/col/style/css",
|
|
||||||
"element-plus/es/components/icon/style/css",
|
|
||||||
"element-plus/es/components/row/style/css",
|
|
||||||
"element-plus/es/components/tag/style/css",
|
|
||||||
"element-plus/es/components/dialog/style/css",
|
|
||||||
"element-plus/es/components/loading/style/css",
|
|
||||||
"element-plus/es/components/radio/style/css",
|
|
||||||
"element-plus/es/components/radio-group/style/css",
|
|
||||||
"element-plus/es/components/popover/style/css",
|
|
||||||
"element-plus/es/components/scrollbar/style/css",
|
|
||||||
"element-plus/es/components/tooltip/style/css",
|
|
||||||
"element-plus/es/components/dropdown/style/css",
|
|
||||||
"element-plus/es/components/dropdown-menu/style/css",
|
|
||||||
"element-plus/es/components/dropdown-item/style/css",
|
|
||||||
"element-plus/es/components/sub-menu/style/css",
|
|
||||||
"element-plus/es/components/menu-item/style/css",
|
|
||||||
"element-plus/es/components/divider/style/css",
|
|
||||||
"element-plus/es/components/card/style/css",
|
|
||||||
"element-plus/es/components/link/style/css",
|
|
||||||
"element-plus/es/components/breadcrumb/style/css",
|
|
||||||
"element-plus/es/components/breadcrumb-item/style/css",
|
|
||||||
"element-plus/es/components/table/style/css",
|
|
||||||
"element-plus/es/components/tree-select/style/css",
|
|
||||||
"element-plus/es/components/table-column/style/css",
|
|
||||||
"element-plus/es/components/select/style/css",
|
|
||||||
"element-plus/es/components/option/style/css",
|
|
||||||
"element-plus/es/components/pagination/style/css",
|
|
||||||
"element-plus/es/components/tree/style/css",
|
|
||||||
"element-plus/es/components/alert/style/css",
|
|
||||||
"element-plus/es/components/radio-button/style/css",
|
|
||||||
"element-plus/es/components/checkbox-group/style/css",
|
|
||||||
"element-plus/es/components/checkbox/style/css",
|
|
||||||
"element-plus/es/components/tabs/style/css",
|
|
||||||
"element-plus/es/components/tab-pane/style/css",
|
|
||||||
"element-plus/es/components/rate/style/css",
|
|
||||||
"element-plus/es/components/date-picker/style/css",
|
|
||||||
"element-plus/es/components/notification/style/css",
|
|
||||||
"element-plus/es/components/image/style/css",
|
|
||||||
"element-plus/es/components/statistic/style/css",
|
|
||||||
"element-plus/es/components/watermark/style/css",
|
|
||||||
"element-plus/es/components/config-provider/style/css",
|
|
||||||
"element-plus/es/components/text/style/css",
|
|
||||||
"element-plus/es/components/drawer/style/css",
|
|
||||||
"element-plus/es/components/color-picker/style/css",
|
|
||||||
"element-plus/es/components/backtop/style/css",
|
|
||||||
"element-plus/es/components/message-box/style/css",
|
|
||||||
"element-plus/es/components/container/style/css",
|
|
||||||
"element-plus/es/components/header/style/css",
|
|
||||||
"element-plus/es/components/aside/style/css",
|
|
||||||
"element-plus/es/components/main/style/css",
|
|
||||||
"element-plus/es/components/empty/style/css",
|
|
||||||
"element-plus/es/components/empty/style/css",
|
|
||||||
"element-plus/es",
|
|
||||||
"element-plus/es/components/base/style/css",
|
|
||||||
"element-plus/es/components/footer/style/css",
|
|
||||||
"element-plus/es/components/badge/style/css",
|
|
||||||
"element-plus/es/components/image-viewer/style/css",
|
|
||||||
"element-plus/es/components/space/style/css",
|
|
||||||
"element-plus/es/components/descriptions/style/css",
|
|
||||||
"element-plus/es/components/descriptions-item/style/css",
|
|
||||||
"element-plus/es/components/time-picker/style/css",
|
|
||||||
"element-plus/dist/locale/en.min",
|
|
||||||
"element-plus/dist/locale/zh-cn.min",
|
|
||||||
"mitt",
|
|
||||||
"screenfull",
|
|
||||||
"dayjs",
|
|
||||||
"driver.js",
|
|
||||||
"echarts/core",
|
|
||||||
"echarts/charts",
|
|
||||||
"echarts/components",
|
|
||||||
"echarts/features",
|
|
||||||
"echarts/renderers",
|
|
||||||
"echarts-liquidfill",
|
|
||||||
"pinia-plugin-persistedstate",
|
|
||||||
"qs",
|
|
||||||
"vuedraggable",
|
|
||||||
"@univerjs/core",
|
"@univerjs/core",
|
||||||
|
"@univerjs/data-validation",
|
||||||
"@univerjs/design",
|
"@univerjs/design",
|
||||||
"@univerjs/docs",
|
|
||||||
"@univerjs/docs-ui",
|
"@univerjs/docs-ui",
|
||||||
|
"@univerjs/docs",
|
||||||
|
"@univerjs/drawing-ui",
|
||||||
|
"@univerjs/drawing",
|
||||||
"@univerjs/engine-formula",
|
"@univerjs/engine-formula",
|
||||||
"@univerjs/engine-render",
|
"@univerjs/engine-render",
|
||||||
"@univerjs/sheets",
|
|
||||||
"@univerjs/sheets-formula",
|
|
||||||
"@univerjs/sheets-ui",
|
|
||||||
"@univerjs/ui",
|
|
||||||
"@univerjs/facade",
|
"@univerjs/facade",
|
||||||
"@univerjs/sheets-zen-editor",
|
|
||||||
"@univerjs/sheets-hyper-link",
|
|
||||||
"@univerjs/sheets-hyper-link-ui",
|
|
||||||
"@univerjs/drawing",
|
|
||||||
"@univerjs/drawing-ui",
|
|
||||||
"@univerjs/sheets-drawing",
|
|
||||||
"@univerjs/sheets-drawing-ui",
|
|
||||||
"@univerjs/find-replace",
|
"@univerjs/find-replace",
|
||||||
"@univerjs/sheets-find-replace",
|
|
||||||
"@univerjs/sheets-filter",
|
|
||||||
"@univerjs/sheets-filter-ui",
|
|
||||||
"@univerjs/sheets-sort",
|
|
||||||
"@univerjs/sheets-sort-ui",
|
|
||||||
"@univerjs/data-validation",
|
|
||||||
"@univerjs/sheets-data-validation",
|
|
||||||
"@univerjs/sheets-conditional-formatting",
|
|
||||||
"@univerjs/sheets-conditional-formatting-ui",
|
"@univerjs/sheets-conditional-formatting-ui",
|
||||||
|
"@univerjs/sheets-conditional-formatting",
|
||||||
|
"@univerjs/sheets-data-validation",
|
||||||
|
"@univerjs/sheets-drawing-ui",
|
||||||
|
"@univerjs/sheets-drawing",
|
||||||
|
"@univerjs/sheets-filter-ui",
|
||||||
|
"@univerjs/sheets-filter",
|
||||||
|
"@univerjs/sheets-find-replace",
|
||||||
|
"@univerjs/sheets-formula",
|
||||||
|
"@univerjs/sheets-hyper-link-ui",
|
||||||
|
"@univerjs/sheets-hyper-link",
|
||||||
"@univerjs/sheets-numfmt",
|
"@univerjs/sheets-numfmt",
|
||||||
|
"@univerjs/sheets-sort-ui",
|
||||||
|
"@univerjs/sheets-sort",
|
||||||
|
"@univerjs/sheets-thread-comment-base",
|
||||||
|
"@univerjs/sheets-thread-comment",
|
||||||
|
"@univerjs/sheets-ui",
|
||||||
|
"@univerjs/sheets-zen-editor",
|
||||||
|
"@univerjs/sheets",
|
||||||
"@univerjs/thread-comment-ui",
|
"@univerjs/thread-comment-ui",
|
||||||
"@univerjs/thread-comment",
|
"@univerjs/thread-comment",
|
||||||
"@univerjs/sheets-thread-comment-base",
|
"@univerjs/ui",
|
||||||
"@univerjs/sheets-thread-comment"
|
"@vueuse/core",
|
||||||
|
"@wangeditor/editor-for-vue",
|
||||||
|
"@wangeditor/editor",
|
||||||
|
"axios",
|
||||||
|
"color",
|
||||||
|
"dayjs",
|
||||||
|
"driver.js",
|
||||||
|
"echarts-liquidfill",
|
||||||
|
"echarts",
|
||||||
|
"echarts/charts",
|
||||||
|
"echarts/components",
|
||||||
|
"echarts/core",
|
||||||
|
"echarts/features",
|
||||||
|
"echarts/renderers",
|
||||||
|
"element-plus",
|
||||||
|
"element-plus/dist/locale/en.min",
|
||||||
|
"element-plus/dist/locale/zh-cn.min",
|
||||||
|
"element-plus/es",
|
||||||
|
"element-plus/es/components/alert/style/css",
|
||||||
|
"element-plus/es/components/aside/style/css",
|
||||||
|
"element-plus/es/components/backtop/style/css",
|
||||||
|
"element-plus/es/components/badge/style/css",
|
||||||
|
"element-plus/es/components/base/style/css",
|
||||||
|
"element-plus/es/components/breadcrumb-item/style/css",
|
||||||
|
"element-plus/es/components/breadcrumb/style/css",
|
||||||
|
"element-plus/es/components/button/style/css",
|
||||||
|
"element-plus/es/components/card/style/css",
|
||||||
|
"element-plus/es/components/checkbox-group/style/css",
|
||||||
|
"element-plus/es/components/checkbox/style/css",
|
||||||
|
"element-plus/es/components/col/style/css",
|
||||||
|
"element-plus/es/components/color-picker/style/css",
|
||||||
|
"element-plus/es/components/config-provider/style/css",
|
||||||
|
"element-plus/es/components/container/style/css",
|
||||||
|
"element-plus/es/components/date-picker/style/css",
|
||||||
|
"element-plus/es/components/descriptions-item/style/css",
|
||||||
|
"element-plus/es/components/descriptions/style/css",
|
||||||
|
"element-plus/es/components/dialog/style/css",
|
||||||
|
"element-plus/es/components/divider/style/css",
|
||||||
|
"element-plus/es/components/drawer/style/css",
|
||||||
|
"element-plus/es/components/dropdown-item/style/css",
|
||||||
|
"element-plus/es/components/dropdown-menu/style/css",
|
||||||
|
"element-plus/es/components/dropdown/style/css",
|
||||||
|
"element-plus/es/components/empty/style/css",
|
||||||
|
"element-plus/es/components/empty/style/css",
|
||||||
|
"element-plus/es/components/footer/style/css",
|
||||||
|
"element-plus/es/components/form-item/style/css",
|
||||||
|
"element-plus/es/components/form/style/css",
|
||||||
|
"element-plus/es/components/header/style/css",
|
||||||
|
"element-plus/es/components/icon/style/css",
|
||||||
|
"element-plus/es/components/image-viewer/style/css",
|
||||||
|
"element-plus/es/components/image/style/css",
|
||||||
|
"element-plus/es/components/input-number/style/css",
|
||||||
|
"element-plus/es/components/input/style/css",
|
||||||
|
"element-plus/es/components/link/style/css",
|
||||||
|
"element-plus/es/components/loading/style/css",
|
||||||
|
"element-plus/es/components/main/style/css",
|
||||||
|
"element-plus/es/components/menu-item/style/css",
|
||||||
|
"element-plus/es/components/menu/style/css",
|
||||||
|
"element-plus/es/components/message/style/css",
|
||||||
|
"element-plus/es/components/message-box/style/css",
|
||||||
|
"element-plus/es/components/notification/style/css",
|
||||||
|
"element-plus/es/components/option/style/css",
|
||||||
|
"element-plus/es/components/pagination/style/css",
|
||||||
|
"element-plus/es/components/popover/style/css",
|
||||||
|
"element-plus/es/components/progress/style/css",
|
||||||
|
"element-plus/es/components/radio-button/style/css",
|
||||||
|
"element-plus/es/components/radio-group/style/css",
|
||||||
|
"element-plus/es/components/radio/style/css",
|
||||||
|
"element-plus/es/components/rate/style/css",
|
||||||
|
"element-plus/es/components/row/style/css",
|
||||||
|
"element-plus/es/components/scrollbar/style/css",
|
||||||
|
"element-plus/es/components/select/style/css",
|
||||||
|
"element-plus/es/components/space/style/css",
|
||||||
|
"element-plus/es/components/statistic/style/css",
|
||||||
|
"element-plus/es/components/sub-menu/style/css",
|
||||||
|
"element-plus/es/components/switch/style/css",
|
||||||
|
"element-plus/es/components/tab-pane/style/css",
|
||||||
|
"element-plus/es/components/table-column/style/css",
|
||||||
|
"element-plus/es/components/table/style/css",
|
||||||
|
"element-plus/es/components/tabs/style/css",
|
||||||
|
"element-plus/es/components/tag/style/css",
|
||||||
|
"element-plus/es/components/text/style/css",
|
||||||
|
"element-plus/es/components/time-picker/style/css",
|
||||||
|
"element-plus/es/components/tooltip/style/css",
|
||||||
|
"element-plus/es/components/tree-select/style/css",
|
||||||
|
"element-plus/es/components/tree/style/css",
|
||||||
|
"element-plus/es/components/upload/style/css",
|
||||||
|
"element-plus/es/components/watermark/style/css",
|
||||||
|
"element-plus/es/locale/lang/zh-cn",
|
||||||
|
"element-plus/es/locale/lang/en",
|
||||||
|
"exceljs",
|
||||||
|
"md5",
|
||||||
|
"mitt",
|
||||||
|
"path-browserify",
|
||||||
|
"path-to-regexp",
|
||||||
|
"pinia-plugin-persistedstate",
|
||||||
|
"pinia",
|
||||||
|
"process",
|
||||||
|
"qs",
|
||||||
|
"screenfull",
|
||||||
|
"sortablejs",
|
||||||
|
"sqlite3",
|
||||||
|
"unocss",
|
||||||
|
"vue-i18n",
|
||||||
|
"vue-router",
|
||||||
|
"vue",
|
||||||
|
"vuedraggable",
|
||||||
],
|
],
|
||||||
}
|
};
|
||||||
|
@ -13,82 +13,82 @@ import {getConfig} from "./utils";
|
|||||||
const config = getConfig();
|
const config = getConfig();
|
||||||
|
|
||||||
export default (env = "production", type = "main") => {
|
export default (env = "production", type = "main") => {
|
||||||
return defineConfig({
|
return defineConfig({
|
||||||
input:
|
input:
|
||||||
type === "main"
|
type === "main"
|
||||||
? path.join(__dirname, "..", "src", "main", "index.ts")
|
? path.join(__dirname, "..", "src", "main", "index.ts")
|
||||||
: path.join(__dirname, "..", "src", "preload", "index.ts"),
|
: path.join(__dirname, "..", "src", "preload", "index.ts"),
|
||||||
output: {
|
output: {
|
||||||
file: path.join(
|
file: path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
"..",
|
"..",
|
||||||
"dist",
|
"dist",
|
||||||
"electron",
|
"electron",
|
||||||
"main",
|
"main",
|
||||||
`${type === "main" ? type : "preload"}.js`
|
`${type === "main" ? type : "preload"}.js`
|
||||||
),
|
),
|
||||||
format: "cjs",
|
format: "cjs",
|
||||||
name: type === "main" ? "MainProcess" : "MainPreloadProcess",
|
name: type === "main" ? "MainProcess" : "MainPreloadProcess",
|
||||||
sourcemap: false,
|
sourcemap: false,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
replace({
|
replace({
|
||||||
preventAssignment: true,
|
preventAssignment: true,
|
||||||
"process.env.userConfig": config ? JSON.stringify(config) : "{}",
|
"process.env.userConfig": config ? JSON.stringify(config) : "{}",
|
||||||
}),
|
}),
|
||||||
// 提供路径和读取别名
|
// 提供路径和读取别名
|
||||||
nodeResolve({
|
nodeResolve({
|
||||||
preferBuiltins: true,
|
preferBuiltins: true,
|
||||||
browser: false,
|
browser: false,
|
||||||
extensions: [".mjs", ".ts", ".js", ".json", ".node"],
|
extensions: [".mjs", ".ts", ".js", ".json", ".node"],
|
||||||
}),
|
}),
|
||||||
commonjs({
|
commonjs({
|
||||||
sourceMap: false,
|
sourceMap: false,
|
||||||
}),
|
}),
|
||||||
json(),
|
json(),
|
||||||
esbuild({
|
esbuild({
|
||||||
// All options are optional
|
// All options are optional
|
||||||
include: /\.[jt]s?$/, // default, inferred from `loaders` option
|
include: /\.[jt]s?$/, // default, inferred from `loaders` option
|
||||||
exclude: /node_modules/, // default
|
exclude: /node_modules/, // default
|
||||||
// watch: process.argv.includes('--watch'), // rollup 中有配置
|
// watch: process.argv.includes('--watch'), // rollup 中有配置
|
||||||
sourceMap: false, // default
|
sourceMap: false, // default
|
||||||
minify: env === "production",
|
minify: env === "production",
|
||||||
target: "esnext", // default, or 'es20XX', 'esnext' //es2017
|
target: "esnext", // default, or 'es20XX', 'esnext' //es2017
|
||||||
// Like @rollup/plugin-replace
|
// Like @rollup/plugin-replace
|
||||||
define: {
|
define: {
|
||||||
__VERSION__: '"x.y.z"',
|
__VERSION__: '"x.y.z"',
|
||||||
},
|
},
|
||||||
// Add extra loaders
|
// Add extra loaders
|
||||||
loaders: {
|
loaders: {
|
||||||
// Add .json files support
|
// Add .json files support
|
||||||
// require @rollup/plugin-commonjs
|
// require @rollup/plugin-commonjs
|
||||||
".json": "json",
|
".json": "json",
|
||||||
// Enable JSX in .js files too
|
// Enable JSX in .js files too
|
||||||
".js": "jsx",
|
".js": "jsx",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
alias({
|
alias({
|
||||||
entries: [
|
entries: [
|
||||||
{ find: "@main", replacement: path.join(__dirname, "../src/main") },
|
{find: "@main", replacement: path.join(__dirname, "../src/main")},
|
||||||
{
|
{
|
||||||
find: "@config",
|
find: "@config",
|
||||||
replacement: path.join(__dirname, "..", "config"),
|
replacement: path.join(__dirname, "..", "config"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
process.env.NODE_ENV === "production" && obfuscator({}),
|
process.env.NODE_ENV === "production" && obfuscator({}),
|
||||||
],
|
],
|
||||||
external: [
|
external: [
|
||||||
...builtinModules,
|
...builtinModules,
|
||||||
"axios",
|
"axios",
|
||||||
"electron",
|
"electron",
|
||||||
"express",
|
"express",
|
||||||
"ffi-napi",
|
"ffi-napi",
|
||||||
"ref-napi",
|
"ref-napi",
|
||||||
"ref-struct-napi",
|
"ref-struct-napi",
|
||||||
"semver",
|
"semver",
|
||||||
"glob",
|
"glob",
|
||||||
"sqlite3",
|
"sqlite3",
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
import { config } from "dotenv";
|
import {config} from "dotenv";
|
||||||
import { join } from "path";
|
import {join} from "path";
|
||||||
import minimist from "minimist";
|
import minimist from "minimist";
|
||||||
|
|
||||||
const argv = minimist(process.argv.slice(2));
|
const argv = minimist(process.argv.slice(2));
|
||||||
const rootResolve = (...pathSegments: string[]) => join(__dirname, "..", ...pathSegments);
|
const rootResolve = (...pathSegments: string[]) =>
|
||||||
|
join(__dirname, "..", ...pathSegments);
|
||||||
|
|
||||||
export const getEnv = () => argv["m"];
|
export const getEnv = () => argv["m"];
|
||||||
|
|
||||||
const getEnvPath = () => {
|
const getEnvPath = () => {
|
||||||
if (
|
if (
|
||||||
String(typeof getEnv()) === "boolean" ||
|
String(typeof getEnv()) === "boolean" ||
|
||||||
String(typeof getEnv()) === "undefined"
|
String(typeof getEnv()) === "undefined"
|
||||||
) {
|
) {
|
||||||
return rootResolve("env/dev.env");
|
return rootResolve("env/dev.env");
|
||||||
}
|
}
|
||||||
return rootResolve(`env/${getEnv()}.env`);
|
return rootResolve(`env/${getEnv()}.env`);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getConfig = () => config({ path: getEnvPath() }).parsed;
|
export const getConfig = () => config({ path: getEnvPath() }).parsed;
|
||||||
|
@ -42,13 +42,13 @@ const config = getConfig();
|
|||||||
const __APP_INFO__ = {
|
const __APP_INFO__ = {
|
||||||
pkg: pkg,
|
pkg: pkg,
|
||||||
buildTimestamp: Date.now(),
|
buildTimestamp: Date.now(),
|
||||||
lastBuildTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
lastBuildTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
||||||
};
|
};
|
||||||
|
|
||||||
const root = resolve("src/renderer");
|
const root = resolve("src/renderer");
|
||||||
const src = resolve("src");
|
const src = resolve("src");
|
||||||
// const theme: string = resolve("src/renderer/themes/default");
|
// const theme: string = resolve("src/renderer/themes/default");
|
||||||
const theme: string = resolve("src/renderer/themes/geeker");
|
// const theme: string = resolve("src/renderer/themes/geeker");
|
||||||
const themeGeeker: string = resolve("src/renderer/themes/geeker");
|
const themeGeeker: string = resolve("src/renderer/themes/geeker");
|
||||||
const themeDefault: string = resolve("src/renderer/themes/default");
|
const themeDefault: string = resolve("src/renderer/themes/default");
|
||||||
const mode = config && config.NODE_ENV;
|
const mode = config && config.NODE_ENV;
|
||||||
@ -60,7 +60,7 @@ export default defineConfig({
|
|||||||
__CONFIG__: config,
|
__CONFIG__: config,
|
||||||
__ISWEB__: Number(config && config.target),
|
__ISWEB__: Number(config && config.target),
|
||||||
__APP_INFO__: JSON.stringify(__APP_INFO__),
|
__APP_INFO__: JSON.stringify(__APP_INFO__),
|
||||||
'process.env': process.env,
|
"process.env": process.env,
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
@ -72,7 +72,7 @@ export default defineConfig({
|
|||||||
"@renderer": root,
|
"@renderer": root,
|
||||||
"@src": src,
|
"@src": src,
|
||||||
"@store": join(root, "/store/modules"),
|
"@store": join(root, "/store/modules"),
|
||||||
"@theme": theme,
|
// "@theme": theme,
|
||||||
"@themeDefault": themeDefault,
|
"@themeDefault": themeDefault,
|
||||||
"@themeGeeker": themeGeeker,
|
"@themeGeeker": themeGeeker,
|
||||||
},
|
},
|
||||||
@ -148,7 +148,12 @@ export default defineConfig({
|
|||||||
* TBD: resolve("@theme/components"),测试用法,效果未知
|
* TBD: resolve("@theme/components"),测试用法,效果未知
|
||||||
*/
|
*/
|
||||||
// dirs: ["src/components", join(theme, "/components"), join(theme, "/**/components")],
|
// dirs: ["src/components", join(theme, "/components"), join(theme, "/**/components")],
|
||||||
dirs: ["src/components", join(themeDefault, "/components"), join(themeDefault, "/**/components"),"src/**/components"],
|
dirs: [
|
||||||
|
"src/components",
|
||||||
|
join(themeDefault, "/components"),
|
||||||
|
join(themeDefault, "/**/components"),
|
||||||
|
"src/**/components",
|
||||||
|
],
|
||||||
// 指定自动导入组件TS类型声明文件路径 (false:关闭自动生成)
|
// 指定自动导入组件TS类型声明文件路径 (false:关闭自动生成)
|
||||||
// dts: false,
|
// dts: false,
|
||||||
dts: "fixTypes/components.d.ts",
|
dts: "fixTypes/components.d.ts",
|
||||||
@ -159,11 +164,14 @@ export default defineConfig({
|
|||||||
}),
|
}),
|
||||||
createSvgIconsPlugin({
|
createSvgIconsPlugin({
|
||||||
// 指定需要缓存的图标文件夹
|
// 指定需要缓存的图标文件夹
|
||||||
iconDirs: [join(themeDefault, "assets/icons"),join(themeGeeker, "assets/icons"),"@renderer/assets/icons"],
|
iconDirs: [
|
||||||
|
join(themeDefault, "assets/icons"),
|
||||||
|
join(themeGeeker, "assets/icons"),
|
||||||
|
"@renderer/assets/icons",
|
||||||
|
],
|
||||||
// 指定symbolId格式
|
// 指定symbolId格式
|
||||||
symbolId: "icon-[dir]-[name]",
|
symbolId: "icon-[dir]-[name]",
|
||||||
}),
|
}),
|
||||||
|
|
||||||
],
|
],
|
||||||
optimizeDeps: preloads,
|
optimizeDeps: preloads,
|
||||||
});
|
});
|
||||||
|
38
.vscode/launch.json
vendored
Normal file
38
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"compounds": [
|
||||||
|
{
|
||||||
|
"name": "Main + renderer",
|
||||||
|
"configurations": [
|
||||||
|
"Main",
|
||||||
|
"Renderer"
|
||||||
|
],
|
||||||
|
"stopAll": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Renderer",
|
||||||
|
"port": 9222,
|
||||||
|
"request": "attach",
|
||||||
|
"type": "chrome",
|
||||||
|
"webRoot": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Main",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
||||||
|
"windows": {
|
||||||
|
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
|
||||||
|
},
|
||||||
|
"args": [
|
||||||
|
".",
|
||||||
|
"--remote-debugging-port=9222"
|
||||||
|
],
|
||||||
|
"outputCapture": "std",
|
||||||
|
"console": "integratedTerminal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
26
.vscode/settings.json
vendored
26
.vscode/settings.json
vendored
@ -6,25 +6,47 @@
|
|||||||
"**/CVS": true,
|
"**/CVS": true,
|
||||||
"**/.DS_Store": true,
|
"**/.DS_Store": true,
|
||||||
"**/Thumbs.db": true,
|
"**/Thumbs.db": true,
|
||||||
"**/node_modules": true
|
"**/node_modules": false
|
||||||
},
|
},
|
||||||
"npm.packageManager": "yarn",
|
"npm.packageManager": "yarn",
|
||||||
"workbench.editor.highlightModifiedTabs": true,
|
"workbench.editor.highlightModifiedTabs": true,
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
|
"backtop",
|
||||||
|
"cfonts",
|
||||||
"clsx",
|
"clsx",
|
||||||
|
"csstype",
|
||||||
|
"datas",
|
||||||
|
"echarts",
|
||||||
|
"exceljs",
|
||||||
"geeker",
|
"geeker",
|
||||||
|
"Hiluker",
|
||||||
"iconfont",
|
"iconfont",
|
||||||
|
"iconify",
|
||||||
"Ikaros",
|
"Ikaros",
|
||||||
"ISWEB",
|
"ISWEB",
|
||||||
|
"liquidfill",
|
||||||
|
"listr",
|
||||||
|
"mydb",
|
||||||
|
"napi",
|
||||||
"notheme",
|
"notheme",
|
||||||
"nprogress",
|
"nprogress",
|
||||||
"numfmt",
|
"numfmt",
|
||||||
|
"persistedstate",
|
||||||
"pinia",
|
"pinia",
|
||||||
|
"portfinder",
|
||||||
|
"regedit",
|
||||||
|
"rowid",
|
||||||
|
"screenfull",
|
||||||
|
"sockjs",
|
||||||
|
"sortablejs",
|
||||||
|
"stompjs",
|
||||||
"univer",
|
"univer",
|
||||||
"univerjs",
|
"univerjs",
|
||||||
"unocss",
|
"unocss",
|
||||||
"unplugin",
|
"unplugin",
|
||||||
|
"vuedraggable",
|
||||||
"vueuse",
|
"vueuse",
|
||||||
"wangeditor"
|
"wangeditor",
|
||||||
|
"webstomp"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
# 2024.09.21
|
||||||
|
|
||||||
|
- 更新开发包到最新。
|
||||||
|
|
||||||
# 2024.09.16
|
# 2024.09.16
|
||||||
|
|
||||||
- 添加sqlite3使用,用法演示放在home/index页面
|
- 添加sqlite3使用,用法演示放在home/index页面
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
{
|
{
|
||||||
"asar": false,
|
"asar": false,
|
||||||
"extraFiles": [],
|
"extraFiles": [
|
||||||
|
"sqlite3.db",
|
||||||
|
"src/main/db/sqlite.db",
|
||||||
|
"debug.txt"
|
||||||
|
],
|
||||||
"publish": [
|
"publish": [
|
||||||
{
|
{
|
||||||
"provider": "generic",
|
"provider": "generic",
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
export default {
|
export default {
|
||||||
build: {
|
build: {
|
||||||
cleanConsole: true,
|
cleanConsole: true,
|
||||||
hotPublishConfigName:"updater",
|
hotPublishConfigName: "updater",
|
||||||
},
|
},
|
||||||
dev: {
|
dev: {
|
||||||
removeElectronJunk: true,
|
removeElectronJunk: true,
|
||||||
chineseLog: true,
|
chineseLog: true,
|
||||||
port: 9080,
|
port: 9080,
|
||||||
},
|
},
|
||||||
DllFolder: "",
|
DllFolder: "",
|
||||||
};
|
};
|
||||||
|
6
fixTypes/vite-env.d.ts
vendored
6
fixTypes/vite-env.d.ts
vendored
@ -1,12 +1,12 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
declare module '*.vue' {
|
declare module '*.vue' {
|
||||||
import type { DefineComponent } from 'vue'
|
import type {DefineComponent} from 'vue'
|
||||||
const component: DefineComponent<{}, {}, any>
|
const component: DefineComponent<{}, {}, any>
|
||||||
export default component
|
export default component
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Window {
|
interface window {
|
||||||
// expose in the `electron/preload/index.ts`
|
// expose in the `electron/preload/index.ts`
|
||||||
ipcRenderer: import('electron').IpcRenderer
|
ipcRenderer: import('electron').IpcRenderer
|
||||||
}
|
}
|
||||||
|
17076
package-lock.json
generated
17076
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
151
package.json
151
package.json
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "hi-sass-frame-front",
|
"name": "hi-sass-frame-front",
|
||||||
"title": "Hi-sass系统框架",
|
"title": "Hi-sass系统框架",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"main": "./dist/electron/main/main.js",
|
"main": "./dist/electron/main/main.js",
|
||||||
"author": "fm453 <https://gitea.hiluker.com/fm453/hi-sass-frame>",
|
"author": "fm453 <https://gitea.hiluker.com/fm453/hi-sass-frame>",
|
||||||
"homepage": "https://gitea.hiluker.com/fm453/hi-sass-frame",
|
"homepage": "https://gitea.hiluker.com/fm453/hi-sass-frame",
|
||||||
@ -9,7 +9,7 @@
|
|||||||
"description": "基于https://gitee.com/Zh-Sky/electron-vite-template.git项目进行改造,升级内置组件electron31+vite5+vue3,添加引入elementUi2.7.5。框架思路借鉴有来开源的https://gitee.com/youlaiorg/vue3-element-admin.git项目。",
|
"description": "基于https://gitee.com/Zh-Sky/electron-vite-template.git项目进行改造,升级内置组件electron31+vite5+vue3,添加引入elementUi2.7.5。框架思路借鉴有来开源的https://gitee.com/youlaiorg/vue3-element-admin.git项目。",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env tsx .electron-vite/dev-runner.ts -m dev",
|
"dev": "cross-env tsx .electron-vite/dev-runner.ts -m prod",
|
||||||
"build": "cross-env BUILD_TARGET=clean tsx .electron-vite/build.ts -m prod && electron-builder -c build.json",
|
"build": "cross-env BUILD_TARGET=clean tsx .electron-vite/build.ts -m prod && electron-builder -c build.json",
|
||||||
"build:win32": "cross-env BUILD_TARGET=clean tsx .electron-vite/build.ts -w prod && electron-builder -c build.json --win --ia32",
|
"build:win32": "cross-env BUILD_TARGET=clean tsx .electron-vite/build.ts -w prod && electron-builder -c build.json --win --ia32",
|
||||||
"build:win64": "cross-env BUILD_TARGET=clean tsx .electron-vite/build.ts -w prod && electron-builder -c build.json --win --x64",
|
"build:win64": "cross-env BUILD_TARGET=clean tsx .electron-vite/build.ts -w prod && electron-builder -c build.json --win --x64",
|
||||||
@ -23,51 +23,51 @@
|
|||||||
"postinstall": "electron-builder install-app-deps"
|
"postinstall": "electron-builder install-app-deps"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grpc/grpc-js": "^1.11.1",
|
"@grpc/grpc-js": "1.9.14",
|
||||||
"@univerjs/core": "^0.2.8",
|
"@univerjs/core": "^0.2.15",
|
||||||
"@univerjs/data-validation": "^0.2.8",
|
"@univerjs/data-validation": "^0.2.15",
|
||||||
"@univerjs/design": "^0.2.8",
|
"@univerjs/design": "^0.2.15",
|
||||||
"@univerjs/docs": "^0.2.8",
|
"@univerjs/docs": "^0.2.15",
|
||||||
"@univerjs/docs-hyper-link": "^0.2.9",
|
"@univerjs/docs-hyper-link": "^0.2.15",
|
||||||
"@univerjs/docs-ui": "^0.2.8",
|
"@univerjs/docs-ui": "^0.2.15",
|
||||||
"@univerjs/drawing": "^0.2.8",
|
"@univerjs/drawing": "^0.2.15",
|
||||||
"@univerjs/drawing-ui": "^0.2.8",
|
"@univerjs/drawing-ui": "^0.2.15",
|
||||||
"@univerjs/engine-formula": "^0.2.8",
|
"@univerjs/engine-formula": "^0.2.15",
|
||||||
"@univerjs/engine-numfmt": "^0.2.8",
|
"@univerjs/engine-numfmt": "^0.2.15",
|
||||||
"@univerjs/engine-render": "^0.2.8",
|
"@univerjs/engine-render": "^0.2.15",
|
||||||
"@univerjs/facade": "^0.2.8",
|
"@univerjs/facade": "^0.2.15",
|
||||||
"@univerjs/find-replace": "^0.2.8",
|
"@univerjs/find-replace": "^0.2.15",
|
||||||
"@univerjs/network": "^0.2.9",
|
"@univerjs/network": "^0.2.15",
|
||||||
"@univerjs/rpc": "^0.2.9",
|
"@univerjs/rpc": "^0.2.15",
|
||||||
"@univerjs/sheets": "^0.2.8",
|
"@univerjs/sheets": "^0.2.15",
|
||||||
"@univerjs/sheets-conditional-formatting": "^0.2.8",
|
"@univerjs/sheets-conditional-formatting": "^0.2.15",
|
||||||
"@univerjs/sheets-conditional-formatting-ui": "^0.2.8",
|
"@univerjs/sheets-conditional-formatting-ui": "^0.2.15",
|
||||||
"@univerjs/sheets-crosshair-highlight": "^0.2.9",
|
"@univerjs/sheets-crosshair-highlight": "^0.2.15",
|
||||||
"@univerjs/sheets-data-validation": "^0.2.8",
|
"@univerjs/sheets-data-validation": "^0.2.15",
|
||||||
"@univerjs/sheets-drawing": "^0.2.8",
|
"@univerjs/sheets-drawing": "^0.2.15",
|
||||||
"@univerjs/sheets-drawing-ui": "^0.2.8",
|
"@univerjs/sheets-drawing-ui": "^0.2.15",
|
||||||
"@univerjs/sheets-filter": "^0.2.8",
|
"@univerjs/sheets-filter": "^0.2.15",
|
||||||
"@univerjs/sheets-filter-ui": "^0.2.8",
|
"@univerjs/sheets-filter-ui": "^0.2.15",
|
||||||
"@univerjs/sheets-find-replace": "^0.2.8",
|
"@univerjs/sheets-find-replace": "^0.2.15",
|
||||||
"@univerjs/sheets-formula": "^0.2.8",
|
"@univerjs/sheets-formula": "^0.2.15",
|
||||||
"@univerjs/sheets-hyper-link": "^0.2.8",
|
"@univerjs/sheets-hyper-link": "^0.2.15",
|
||||||
"@univerjs/sheets-hyper-link-ui": "^0.2.8",
|
"@univerjs/sheets-hyper-link-ui": "^0.2.15",
|
||||||
"@univerjs/sheets-numfmt": "^0.2.8",
|
"@univerjs/sheets-numfmt": "^0.2.15",
|
||||||
"@univerjs/sheets-sort": "^0.2.8",
|
"@univerjs/sheets-sort": "^0.2.15",
|
||||||
"@univerjs/sheets-sort-ui": "^0.2.8",
|
"@univerjs/sheets-sort-ui": "^0.2.15",
|
||||||
"@univerjs/sheets-thread-comment": "^0.2.8",
|
"@univerjs/sheets-thread-comment": "^0.2.15",
|
||||||
"@univerjs/sheets-thread-comment-base": "^0.2.8",
|
"@univerjs/sheets-thread-comment-base": "^0.2.15",
|
||||||
"@univerjs/sheets-ui": "^0.2.8",
|
"@univerjs/sheets-ui": "^0.2.15",
|
||||||
"@univerjs/sheets-zen-editor": "^0.2.8",
|
"@univerjs/sheets-zen-editor": "^0.2.15",
|
||||||
"@univerjs/thread-comment": "^0.2.8",
|
"@univerjs/telemetry": "^0.2.15",
|
||||||
"@univerjs/thread-comment-ui": "^0.2.8",
|
"@univerjs/thread-comment": "^0.2.15",
|
||||||
"@univerjs/ui": "^0.2.8",
|
"@univerjs/thread-comment-ui": "^0.2.15",
|
||||||
|
"@univerjs/ui": "^0.2.15",
|
||||||
"@univerjs/vite-plugin": "^0.5.0",
|
"@univerjs/vite-plugin": "^0.5.0",
|
||||||
"@wangeditor/editor": "^5.1.23",
|
"@wangeditor/editor": "^5.1.23",
|
||||||
"@wangeditor/editor-for-vue": "^5.1.12",
|
"@wangeditor/editor-for-vue": "^5.1.12",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"axios": "^1.7.4",
|
"axios": "^1.7.7",
|
||||||
"clsx": "^2.1.1",
|
|
||||||
"color": "^4.2.3",
|
"color": "^4.2.3",
|
||||||
"csstype": "^3.1.3",
|
"csstype": "^3.1.3",
|
||||||
"date-fns": "^3.6.0",
|
"date-fns": "^3.6.0",
|
||||||
@ -75,43 +75,44 @@
|
|||||||
"driver.js": "^1.3.1",
|
"driver.js": "^1.3.1",
|
||||||
"echarts": "^5.5.1",
|
"echarts": "^5.5.1",
|
||||||
"echarts-liquidfill": "^3.1.0",
|
"echarts-liquidfill": "^3.1.0",
|
||||||
"electron-log": "^5.1.7",
|
"electron-log": "^5.2.0",
|
||||||
"electron-updater": "^6.2.1",
|
"electron-updater": "^6.3.7",
|
||||||
"electron_updater_node_cli": "^0.3.3",
|
"electron_updater_node_cli": "^0.3.3",
|
||||||
"electron_updater_node_core": "^0.3.3",
|
"electron_updater_node_core": "^0.3.3",
|
||||||
"element-plus": "^2.8.0",
|
"element-plus": "^2.8.3",
|
||||||
"exceljs": "^4.4.0",
|
"exceljs": "^4.4.0",
|
||||||
"express": "^4.19.2",
|
"express": "^4.21.0",
|
||||||
"express-ws": "^5.0.2",
|
"express-ws": "^5.0.2",
|
||||||
"glob": "^11.0.0",
|
"md5": "^2.3.0",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"pinia": "^2.2.2",
|
"pinia": "^2.2.2",
|
||||||
"pinia-plugin-persistedstate": "^3.2.3",
|
"pinia-plugin-persistedstate": "^3.2.3",
|
||||||
"regedit": "^5.1.3",
|
"regedit": "^5.1.3",
|
||||||
"rxjs": "^7.8.1",
|
"sass": "1.79.3",
|
||||||
"screenfull": "^6.0.2",
|
"screenfull": "^6.0.2",
|
||||||
"semver": "^7.6.3",
|
"semver": "^7.6.3",
|
||||||
"sockjs-client": "^1.6.1",
|
"sockjs-client": "^1.6.1",
|
||||||
"sortablejs": "^1.15.3",
|
"sortablejs": "^1.15.3",
|
||||||
"sqlite3": "^5.1.7",
|
"sqlite3": "^5.1.7",
|
||||||
"stompjs": "^2.3.3",
|
"stompjs": "^2.3.3",
|
||||||
"unocss": "^0.62.3",
|
"unocss": "^0.62.4",
|
||||||
"uuid": "^10.0.0",
|
"uuid": "^10.0.0",
|
||||||
"vue": "^3.4.21",
|
"vue": "^3.5.7",
|
||||||
"vue-i18n": "9.14.0",
|
"vue-i18n": "9.14.0",
|
||||||
"vue-router": "^4.4.3",
|
"vue-router": "^4.4.5",
|
||||||
"vuedraggable": "^2.24.3",
|
"vuedraggable": "^2.24.3",
|
||||||
"webstomp-client": "^1.2.6",
|
"webstomp-client": "^1.2.6",
|
||||||
"ws": "^8.18.0"
|
"ws": "^8.18.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify-json/ep": "^1.1.16",
|
"@iconify-json/ep": "^1.2.0",
|
||||||
|
"@npmcli/move-file": "1.1.2",
|
||||||
"@rollup/plugin-alias": "^5.1.0",
|
"@rollup/plugin-alias": "^5.1.0",
|
||||||
"@rollup/plugin-commonjs": "^26.0.1",
|
"@rollup/plugin-commonjs": "^26.0.1",
|
||||||
"@rollup/plugin-json": "^6.1.0",
|
"@rollup/plugin-json": "^6.1.0",
|
||||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||||
"@rollup/plugin-replace": "^5.0.5",
|
"@rollup/plugin-replace": "^5.0.7",
|
||||||
"@rollup/plugin-typescript": "^11.1.6",
|
"@rollup/plugin-typescript": "^11.1.6",
|
||||||
"@types/adm-zip": "^0.5.5",
|
"@types/adm-zip": "^0.5.5",
|
||||||
"@types/color": "^3.0.6",
|
"@types/color": "^3.0.6",
|
||||||
@ -120,7 +121,7 @@
|
|||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/lodash": "^4.17.7",
|
"@types/lodash": "^4.17.7",
|
||||||
"@types/minimist": "^1.2.5",
|
"@types/minimist": "^1.2.5",
|
||||||
"@types/node": "^22.5.4",
|
"@types/node": "^22.5.5",
|
||||||
"@types/nprogress": "^0.2.3",
|
"@types/nprogress": "^0.2.3",
|
||||||
"@types/path-browserify": "^1.0.3",
|
"@types/path-browserify": "^1.0.3",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
@ -128,47 +129,55 @@
|
|||||||
"@types/sortablejs": "^1.15.8",
|
"@types/sortablejs": "^1.15.8",
|
||||||
"@types/stompjs": "^2.3.9",
|
"@types/stompjs": "^2.3.9",
|
||||||
"@types/uuid": "^10.0.0",
|
"@types/uuid": "^10.0.0",
|
||||||
"@vitejs/plugin-vue": "^5.1.2",
|
"@vitejs/plugin-vue": "^5.1.4",
|
||||||
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
||||||
"@vue/compiler-sfc": "^3.4.38",
|
"@vue/compiler-sfc": "^3.5.7",
|
||||||
"adm-zip": "^0.5.15",
|
"adm-zip": "^0.5.16",
|
||||||
|
"are-we-there-yet": "3.0.1",
|
||||||
|
"bufferutil": "^4.0.8",
|
||||||
"cfonts": "^3.3.0",
|
"cfonts": "^3.3.0",
|
||||||
"chalk": "5.3.0",
|
"chalk": "5.3.0",
|
||||||
|
"clsx": "^2.1.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"del": "^7.1.0",
|
"del": "^7.1.0",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"electron": "^32.0.2",
|
"electron": "^32.1.2",
|
||||||
"electron-builder": "^24.13.3",
|
"electron-builder": "^24.13.3",
|
||||||
"electron-builder-squirrel-windows": "^24.13.3",
|
"electron-builder-squirrel-windows": "^24.13.3",
|
||||||
"electron-devtools-vendor": "^3.0.0",
|
"electron-devtools-vendor": "^3.0.0",
|
||||||
"esbuild": "^0.23.1",
|
"esbuild": "^0.23.1",
|
||||||
"extract-zip": "^2.0.1",
|
"extract-zip": "^2.0.1",
|
||||||
"fs-extra": "^11.2.0",
|
"fs-extra": "^11.2.0",
|
||||||
"inquirer": "^10.1.8",
|
"inquirer": "^10.2.2",
|
||||||
"javascript-obfuscator": "^4.1.1",
|
"javascript-obfuscator": "^4.1.1",
|
||||||
"listr2": "^8.2.4",
|
"listr2": "^8.2.4",
|
||||||
"minimist": "^1.2.8",
|
"minimist": "^1.2.8",
|
||||||
"path-to-regexp": "^7.1.0",
|
"npmlog": "6.0.2",
|
||||||
|
"path-to-regexp": "^8.1.0",
|
||||||
"portfinder": "^1.0.32",
|
"portfinder": "^1.0.32",
|
||||||
"postcss": "^8.4.41",
|
"postcss": "^8.4.47",
|
||||||
"postcss-html": "^1.7.0",
|
"postcss-html": "^1.7.0",
|
||||||
"postcss-scss": "^4.0.9",
|
"postcss-scss": "^4.0.9",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"rollup": "^4.21.0",
|
"resolve-url": "0.2.1",
|
||||||
|
"rollup": "^4.22.4",
|
||||||
"rollup-plugin-esbuild": "^6.1.1",
|
"rollup-plugin-esbuild": "^6.1.1",
|
||||||
"rollup-plugin-obfuscator": "^1.1.0",
|
"rollup-plugin-obfuscator": "^1.1.0",
|
||||||
"sass": "^1.77.8",
|
"rxjs": "^7.8.1",
|
||||||
"tslib": "^2.6.3",
|
"sass-embedded": "^1.79.3",
|
||||||
"tsx": "^4.17.0",
|
"source-map-resolve": "0.5.3",
|
||||||
"typescript": "^5.5.4",
|
"source-map-url": "0.4.1",
|
||||||
"unplugin-auto-import": "^0.17.6",
|
"sourcemap-codec": "1.4.8",
|
||||||
|
"tslib": "^2.7.0",
|
||||||
|
"tsx": "^4.19.1",
|
||||||
|
"typescript": "^5.6.2",
|
||||||
|
"unplugin-auto-import": "^0.17.8",
|
||||||
"unplugin-icons": "^0.18.5",
|
"unplugin-icons": "^0.18.5",
|
||||||
"unplugin-vue-components": "^0.26.0",
|
"unplugin-vue-components": "^0.26.0",
|
||||||
"vite": "^5.4.1",
|
"vite": "^5.4.7",
|
||||||
"vite-plugin-pwa": "^0.20.5",
|
|
||||||
"vite-plugin-svg-icons": "^2.0.1",
|
"vite-plugin-svg-icons": "^2.0.1",
|
||||||
"vite-plugin-vue-devtools": "^7.3.0"
|
"vite-plugin-vue-devtools": "^7.4.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0"
|
"node": ">=18.0.0"
|
||||||
|
5707
pnpm-lock.yaml
generated
5707
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
BIN
sqlite3.db
Normal file
BIN
sqlite3.db
Normal file
Binary file not shown.
@ -14,13 +14,13 @@ export const BrowserDemoUrl: string = "https://www.hiluker.cn";
|
|||||||
export const StorageKey: string = "Hi_sass_tester_453";
|
export const StorageKey: string = "Hi_sass_tester_453";
|
||||||
|
|
||||||
// # 远程服务
|
// # 远程服务
|
||||||
const RemotePort = 3000;
|
const RemotePort: number = 3000;
|
||||||
const RemoteApi = "/api/v1/";
|
const RemoteApi: string = "/api/v1/";
|
||||||
// # 线上接口地址
|
// # 线上接口地址
|
||||||
const RemoteApiUrl = "http://api.frame.sass.hiluker.cn";
|
const RemoteApiUrl: string = "http://api.frame.sass.hiluker.cn";
|
||||||
// # 开发接口地址
|
// # 开发接口地址
|
||||||
// const REMOTE_API_URL = "http://127.0.0.1:8989";
|
// const REMOTE_API_URL:string = "http://127.0.0.1:8989";
|
||||||
const RemoteServer = false;
|
const RemoteServer: boolean = false;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
GwLink,
|
GwLink,
|
||||||
@ -29,5 +29,5 @@ export default {
|
|||||||
DisableF12,
|
DisableF12,
|
||||||
HilukerLink,
|
HilukerLink,
|
||||||
StorageKey,
|
StorageKey,
|
||||||
RemoteApi
|
RemoteApi,
|
||||||
}
|
};
|
||||||
|
@ -139,19 +139,30 @@ export const preloadPath = isDev
|
|||||||
* 开发环境:/tray.html
|
* 开发环境:/tray.html
|
||||||
* 产品环境:src/renderer/public/tray.html
|
* 产品环境:src/renderer/public/tray.html
|
||||||
*/
|
*/
|
||||||
export const trayURL = getUrl(
|
export const trayURL = getUrl("/tray.html", `${staticPath.__static}/tray.html`);
|
||||||
"/tray.html",
|
|
||||||
`${staticPath.__static}/tray.html`
|
|
||||||
);
|
|
||||||
/**
|
/**
|
||||||
* 托盘图标设置
|
* 托盘图标设置
|
||||||
*/
|
*/
|
||||||
export const trayIconPath = isDev
|
export const trayIconPath = isDev
|
||||||
? join(staticPath.__static, "trayIcon", "trayIcon.png")
|
? join(staticPath.__static, "trayIcon", "trayIcon.png")
|
||||||
: join(app.getAppPath(), "dist", "electron", "renderer", "trayIcon", "trayIcon.png");
|
: join(
|
||||||
|
app.getAppPath(),
|
||||||
|
"dist",
|
||||||
|
"electron",
|
||||||
|
"renderer",
|
||||||
|
"trayIcon",
|
||||||
|
"trayIcon.png"
|
||||||
|
);
|
||||||
export const trayTransparentIconPath = isDev
|
export const trayTransparentIconPath = isDev
|
||||||
? join(staticPath.__static, "trayIcon", "transparent.png")
|
? join(staticPath.__static, "trayIcon", "transparent.png")
|
||||||
: join(app.getAppPath(), "dist", "electron", "renderer", "trayIcon", "transparent.png");
|
: join(
|
||||||
|
app.getAppPath(),
|
||||||
|
"dist",
|
||||||
|
"electron",
|
||||||
|
"renderer",
|
||||||
|
"trayIcon",
|
||||||
|
"transparent.png"
|
||||||
|
);
|
||||||
|
|
||||||
export const lib = staticPath.__lib;
|
export const lib = staticPath.__lib;
|
||||||
export const common = staticPath.__common;
|
export const common = staticPath.__common;
|
||||||
|
@ -13,9 +13,9 @@ export const mainWindowConfig: BrowserWindowConstructorOptions = {
|
|||||||
frame: IsUseSysTitle,
|
frame: IsUseSysTitle,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload,
|
preload,
|
||||||
contextIsolation: true, //内容上下文隔离
|
contextIsolation: true, //内容上下文隔离
|
||||||
nodeIntegration: false, //是否允许禁用渲染器沙盒,禁用则窗口可使用Node.js模块的系统API
|
nodeIntegration: false, //是否允许禁用渲染器沙盒,禁用则窗口可使用Node.js模块的系统API
|
||||||
webSecurity: true, //开启后将出现域名cors限制;内置服务器的mock请求要相应地调整express配置,在server/server.ts中配置跨域
|
webSecurity: true, //开启后将出现域名cors限制;内置服务器的mock请求要相应地调整express配置,在server/server.ts中配置跨域
|
||||||
// 如果是开发模式可以使用devTools
|
// 如果是开发模式可以使用devTools
|
||||||
devTools: process.env.NODE_ENV === "development",
|
devTools: process.env.NODE_ENV === "development",
|
||||||
// 在macos中启用橡皮动画
|
// 在macos中启用橡皮动画
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
import {SqliteDb} from './sqliteDb';
|
import {SqliteDb} from "./sqliteDb.js";
|
||||||
|
|
||||||
const db = new SqliteDb();
|
export async function run(sql: string, params: string[]) {
|
||||||
|
const db = new SqliteDb();
|
||||||
export async function run(sql, params) {
|
// console.log(sql,params);
|
||||||
try {
|
return await db.run(sql, params).then((res) => {
|
||||||
return await db.run(sql, params);
|
return res;
|
||||||
} catch (err) {
|
});
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function checkTable(tableName: string) {
|
export async function checkTable(tableName: string) {
|
||||||
return await db.table_exists('lorem').then((exists) => {
|
const db = new SqliteDb();
|
||||||
|
return await db.table_exists(tableName).then((exists) => {
|
||||||
return exists;
|
return exists;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function close() {
|
export function close() {
|
||||||
|
const db = new SqliteDb();
|
||||||
return db.close();
|
return db.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
run,
|
run,
|
||||||
checkTable,
|
checkTable,
|
||||||
close
|
close,
|
||||||
}
|
};
|
||||||
// const db = new SqliteDb;
|
// const db = new SqliteDb;
|
||||||
// db.table_exists('lorem').then((exists) => {
|
// db.table_exists('lorem').then((exists) => {
|
||||||
// console.log('数据表lorem检查存在:',exists);
|
// console.log('数据表lorem检查存在:',exists);
|
||||||
|
Binary file not shown.
@ -1,16 +1,29 @@
|
|||||||
//sqlite相关操作
|
//sqlite相关操作
|
||||||
import {app} from "electron";
|
import {app} from "electron";
|
||||||
import path from "path";
|
|
||||||
import {Database} from "sqlite3";
|
import {Database} from "sqlite3";
|
||||||
|
import path from "path";
|
||||||
|
import * as fs from "node:fs";
|
||||||
|
|
||||||
const dataPath = path.join(app.getPath('userData'), 'db');
|
const isPackaged = app.isPackaged;//是否已打包
|
||||||
const dbPath = process.env.NODE_ENV === 'production' ? dataPath : 'src/main/db';
|
const basePath = isPackaged ? app.getPath("userData") : __dirname;
|
||||||
|
const dbPath = path.join(basePath, "datas");
|
||||||
|
//确保数据目录存在
|
||||||
|
if (!fs.existsSync(dbPath)) {
|
||||||
|
fs.mkdirSync(dbPath, {recursive: true});
|
||||||
|
}
|
||||||
|
const dbFile = path.join(dbPath, "sqlite.db");
|
||||||
|
const sourceFile = isPackaged ? path.resolve(app.getAppPath(), '../../src/main/db/sqlite.db') : path.join(__dirname, '../../../src/main/db/sqlite.db');
|
||||||
|
// console.log(app.getAppPath(),sourceFile)
|
||||||
|
// 如果数据库文件不存在,则从资源中复制它
|
||||||
|
if (!fs.existsSync(dbFile)) {
|
||||||
|
fs.copyFileSync(sourceFile, dbFile);
|
||||||
|
}
|
||||||
|
|
||||||
export class SqliteDb {
|
export class SqliteDb {
|
||||||
db;
|
db;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.db = new Database(dbPath + "/sqlite.db");
|
this.db = new Database(dbFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,9 +39,12 @@ export class SqliteDb {
|
|||||||
}
|
}
|
||||||
stmt.finalize();
|
stmt.finalize();
|
||||||
|
|
||||||
this.db.each("SELECT rowid AS id, info FROM testSqlite", (err: any, row: any) => {
|
this.db.each(
|
||||||
console.log(row.id + ": " + row.info);
|
"SELECT rowid AS id, info FROM testSqlite",
|
||||||
});
|
(err: any, row: any) => {
|
||||||
|
if (!err) console.log(row.id + ": " + row.info);
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
this.db.close();
|
this.db.close();
|
||||||
}
|
}
|
||||||
@ -42,15 +58,15 @@ export class SqliteDb {
|
|||||||
let mydb = this.db;
|
let mydb = this.db;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
mydb.get(sql, params, (err: any, row: any) => {
|
mydb.get(sql, params, (err: any, row: any) => {
|
||||||
console.log('查表执行结果:', err, row)
|
console.log("查表执行结果:", err, row);
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
resolve(false);
|
resolve(false);
|
||||||
} else {
|
} else {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +75,7 @@ export class SqliteDb {
|
|||||||
async run(sql: string, params: string[]) {
|
async run(sql: string, params: string[]) {
|
||||||
let promise = new Promise((resolve, reject) => {
|
let promise = new Promise((resolve, reject) => {
|
||||||
this.db.get(sql, params, (err: any, row: any) => {
|
this.db.get(sql, params, (err: any, row: any) => {
|
||||||
console.log('SQL语句执行结果:', err, row)
|
console.log("SQL语句执行结果:", err, row);
|
||||||
if (err) reject(err);
|
if (err) reject(err);
|
||||||
resolve(row);
|
resolve(row);
|
||||||
});
|
});
|
||||||
|
@ -30,12 +30,12 @@ export function useBrowserHandle(): Pick<
|
|||||||
[IpcChannel.GetLastBrowserDemoTabData]: async (event) => {
|
[IpcChannel.GetLastBrowserDemoTabData]: async (event) => {
|
||||||
// 拖出tab创建的窗口获取当前tab信息
|
// 拖出tab创建的窗口获取当前tab信息
|
||||||
if (lastDragView) {
|
if (lastDragView) {
|
||||||
let positionX = -1
|
let positionX = -1;
|
||||||
if (dragTabOffsetX) {
|
if (dragTabOffsetX) {
|
||||||
const currentWin = BrowserWindow.fromBrowserView(lastDragView)
|
const currentWin = BrowserWindow.fromBrowserView(lastDragView);
|
||||||
const bound = currentWin.getBounds()
|
const bound = currentWin.getBounds();
|
||||||
const {x, y} = screen.getCursorScreenPoint()
|
const {x, y} = screen.getCursorScreenPoint();
|
||||||
positionX = x - bound.x - dragTabOffsetX
|
positionX = x - bound.x - dragTabOffsetX;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
positionX,
|
positionX,
|
||||||
@ -99,10 +99,8 @@ export function useBrowserHandle(): Pick<
|
|||||||
);
|
);
|
||||||
currentView.webContents.loadURL(url);
|
currentView.webContents.loadURL(url);
|
||||||
},
|
},
|
||||||
[IpcChannel.BrowserTabMousedown]: async (event, {
|
[IpcChannel.BrowserTabMousedown]: async (event, {offsetX}) => {
|
||||||
offsetX
|
dragTabOffsetX = offsetX;
|
||||||
}) => {
|
|
||||||
dragTabOffsetX = offsetX
|
|
||||||
},
|
},
|
||||||
[IpcChannel.BrowserTabMousemove]: async (
|
[IpcChannel.BrowserTabMousemove]: async (
|
||||||
event,
|
event,
|
||||||
@ -148,16 +146,12 @@ export function useBrowserHandle(): Pick<
|
|||||||
startScreenY = screenY;
|
startScreenY = screenY;
|
||||||
|
|
||||||
// 设置拖拽的 tab 位置
|
// 设置拖拽的 tab 位置
|
||||||
const bound = movingWin.getBounds()
|
const bound = movingWin.getBounds();
|
||||||
movingWin.webContents.send(
|
movingWin.webContents.send(IpcChannel.BrowserViewTabPositionXUpdate, {
|
||||||
IpcChannel.BrowserViewTabPositionXUpdate,
|
dragTabOffsetX,
|
||||||
{
|
positionX: screenX - bound.x,
|
||||||
dragTabOffsetX,
|
bvWebContentsId: currentView.webContents.id,
|
||||||
positionX: screenX - bound.x,
|
});
|
||||||
bvWebContentsId: currentView.webContents.id,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// 内部移动 movingWin = null
|
// 内部移动 movingWin = null
|
||||||
for (let i = 0; i < winList.length; i++) {
|
for (let i = 0; i < winList.length; i++) {
|
||||||
@ -222,7 +216,7 @@ export function useBrowserHandle(): Pick<
|
|||||||
win?.close();
|
win?.close();
|
||||||
} else {
|
} else {
|
||||||
win?.setAlwaysOnTop(false);
|
win?.setAlwaysOnTop(false);
|
||||||
win?.webContents?.send(IpcChannel.BrowserTabMouseup)
|
win?.webContents?.send(IpcChannel.BrowserTabMouseup);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
useNewWindow = null;
|
useNewWindow = null;
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import mydb from '../db';
|
import mydb from "../db";
|
||||||
import {IpcChannel} from "../ipc";
|
import {IpcChannel} from "../ipc";
|
||||||
|
|
||||||
export function useDbHandle() {
|
export function useDbHandle() {
|
||||||
return {
|
return {
|
||||||
[IpcChannel.SqlRun]: async (event, args) => {
|
[IpcChannel.SqlRun]: async (event, args) => {
|
||||||
let sql = args.sql, params = args.params || [];
|
let sql = args.sql,
|
||||||
|
params = args.params || [];
|
||||||
try {
|
try {
|
||||||
return await mydb.run(sql, params);
|
return await mydb.run(sql, params);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -12,5 +13,5 @@ export function useDbHandle() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,10 @@ import {IpcChannel, IpcMainHandle} from "../ipc";
|
|||||||
|
|
||||||
import {createLocalFile, loadLocalFile} from "../hook/dataFileHook";
|
import {createLocalFile, loadLocalFile} from "../hook/dataFileHook";
|
||||||
|
|
||||||
export function useFileHandle(): Pick<IpcMainHandle, IpcChannel.FileRead | IpcChannel.FileWrite> {
|
export function useFileHandle(): Pick<
|
||||||
|
IpcMainHandle,
|
||||||
|
IpcChannel.FileRead | IpcChannel.FileWrite
|
||||||
|
> {
|
||||||
return {
|
return {
|
||||||
[IpcChannel.FileRead]: (event, args) => {
|
[IpcChannel.FileRead]: (event, args) => {
|
||||||
// console.log(args);
|
// console.log(args);
|
||||||
@ -14,12 +17,14 @@ export function useFileHandle(): Pick<IpcMainHandle, IpcChannel.FileRead | IpcCh
|
|||||||
// console.log(args);
|
// console.log(args);
|
||||||
let filename = args.filename,
|
let filename = args.filename,
|
||||||
data = args.data;
|
data = args.data;
|
||||||
return createLocalFile(filename, data).then((r) => {
|
return createLocalFile(filename, data)
|
||||||
return r;
|
.then((r) => {
|
||||||
}).catch(err => {
|
return r;
|
||||||
// console.log(err);
|
})
|
||||||
return false;
|
.catch((err) => {
|
||||||
});
|
// console.log(err);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import {dialog, BrowserWindow, app} from "electron";
|
import {app, BrowserWindow, dialog} from "electron";
|
||||||
import {IsUseSysTitle} from "../config/const";
|
import {IsUseSysTitle} from "../config/const";
|
||||||
import {winURL, staticPaths} from "../config/staticPath";
|
import {staticPaths, winURL} from "../config/staticPath";
|
||||||
import DownloadFile from "../services/downloadFile";
|
import DownloadFile from "../services/downloadFile";
|
||||||
import {otherWindowConfig} from "../config/windowsConfig";
|
import {otherWindowConfig} from "../config/windowsConfig";
|
||||||
import {IpcChannel} from "../ipc";
|
import {IpcChannel} from "../ipc";
|
||||||
import {showOnMyComputer, hideOnMyComputer, checkIsShowOnMyComputer} from "../services/regeditUtils"
|
import {checkIsShowOnMyComputer, hideOnMyComputer, showOnMyComputer,} from "../services/regeditUtils";
|
||||||
import {openDevTools} from "../hook/devToolHook";
|
import {openDevTools} from "../hook/devToolHook";
|
||||||
|
|
||||||
export function useMainHandle() {
|
export function useMainHandle() {
|
||||||
@ -51,7 +51,7 @@ export function useMainHandle() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
[IpcChannel.OpenErrorbox]: (_event, arg) => {
|
[IpcChannel.OpenErrorbox]: (_event, arg) => {
|
||||||
dialog.showErrorBox(arg.title, arg.message)
|
dialog.showErrorBox(arg.title, arg.message);
|
||||||
},
|
},
|
||||||
|
|
||||||
[IpcChannel.StartDownload]: (event, downloadUrl) => {
|
[IpcChannel.StartDownload]: (event, downloadUrl) => {
|
||||||
@ -67,7 +67,7 @@ export function useMainHandle() {
|
|||||||
});
|
});
|
||||||
// 开发模式下自动开启devtools
|
// 开发模式下自动开启devtools
|
||||||
if (process.env.NODE_ENV === "development") {
|
if (process.env.NODE_ENV === "development") {
|
||||||
openDevTools(ChildWin)
|
openDevTools(ChildWin);
|
||||||
}
|
}
|
||||||
ChildWin.loadURL(winURL + `#${arg.url}`);
|
ChildWin.loadURL(winURL + `#${arg.url}`);
|
||||||
ChildWin.once("ready-to-show", () => {
|
ChildWin.once("ready-to-show", () => {
|
||||||
@ -91,14 +91,14 @@ export function useMainHandle() {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
[IpcChannel.CheckShowOnMyComputer]: async () => {
|
[IpcChannel.CheckShowOnMyComputer]: async () => {
|
||||||
return await checkIsShowOnMyComputer()
|
return await checkIsShowOnMyComputer();
|
||||||
},
|
},
|
||||||
[IpcChannel.SetShowOnMyComputer]: async (event, bool) => {
|
[IpcChannel.SetShowOnMyComputer]: async (event, bool) => {
|
||||||
if (bool) {
|
if (bool) {
|
||||||
return await showOnMyComputer()
|
return await showOnMyComputer();
|
||||||
} else {
|
} else {
|
||||||
return await hideOnMyComputer()
|
return await hideOnMyComputer();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,20 @@ import {IpcChannel, IpcMainHandle} from "../ipc";
|
|||||||
|
|
||||||
import {openPrintDemoWindow} from "../hook/printHook";
|
import {openPrintDemoWindow} from "../hook/printHook";
|
||||||
|
|
||||||
export function usePrintHandle(): Pick<IpcMainHandle, IpcChannel.GetPrinters | IpcChannel.PrintHandlePrint | IpcChannel.OpenPrintDemoWindow> {
|
export function usePrintHandle(): Pick<
|
||||||
|
IpcMainHandle,
|
||||||
|
| IpcChannel.GetPrinters
|
||||||
|
| IpcChannel.PrintHandlePrint
|
||||||
|
| IpcChannel.OpenPrintDemoWindow
|
||||||
|
> {
|
||||||
return {
|
return {
|
||||||
[IpcChannel.GetPrinters]: async (event) => {
|
[IpcChannel.GetPrinters]: async (event) => {
|
||||||
return await event.sender.getPrintersAsync();
|
return await event.sender.getPrintersAsync();
|
||||||
},
|
},
|
||||||
[IpcChannel.PrintHandlePrint]: async (event, options: WebContentsPrintOptions) => {
|
[IpcChannel.PrintHandlePrint]: async (
|
||||||
|
event,
|
||||||
|
options: WebContentsPrintOptions
|
||||||
|
) => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
event.sender.print(
|
event.sender.print(
|
||||||
options,
|
options,
|
||||||
@ -20,6 +28,6 @@ export function usePrintHandle(): Pick<IpcMainHandle, IpcChannel.GetPrinters | I
|
|||||||
},
|
},
|
||||||
[IpcChannel.OpenPrintDemoWindow]: () => {
|
[IpcChannel.OpenPrintDemoWindow]: () => {
|
||||||
openPrintDemoWindow();
|
openPrintDemoWindow();
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
import {dialog} from "electron";
|
import {dialog} from "electron";
|
||||||
import Server from "../server";
|
import Server from "../server";
|
||||||
import WsServer from "../server/wsServer";
|
import WsServer from "../server/wsServer";
|
||||||
import {IpcMainHandle, IpcChannel} from "../ipc";
|
import {IpcChannel, IpcMainHandle} from "../ipc";
|
||||||
|
|
||||||
export function useServerHandle(): Pick<IpcMainHandle, IpcChannel.StartServer | IpcChannel.StopServer | IpcChannel.StartWsServer | IpcChannel.StopWsServer> {
|
export function useServerHandle(): Pick<
|
||||||
|
IpcMainHandle,
|
||||||
|
| IpcChannel.StartServer
|
||||||
|
| IpcChannel.StopServer
|
||||||
|
| IpcChannel.StartWsServer
|
||||||
|
| IpcChannel.StopWsServer
|
||||||
|
> {
|
||||||
return {
|
return {
|
||||||
[IpcChannel.StartServer]: async () => {
|
[IpcChannel.StartServer]: async () => {
|
||||||
try {
|
try {
|
||||||
@ -11,7 +17,7 @@ export function useServerHandle(): Pick<IpcMainHandle, IpcChannel.StartServer |
|
|||||||
return serverStatus;
|
return serverStatus;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dialog.showErrorBox("错误", error);
|
dialog.showErrorBox("错误", error);
|
||||||
return ""
|
return "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[IpcChannel.StopServer]: async () => {
|
[IpcChannel.StopServer]: async () => {
|
||||||
@ -20,7 +26,7 @@ export function useServerHandle(): Pick<IpcMainHandle, IpcChannel.StartServer |
|
|||||||
return serverStatus;
|
return serverStatus;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dialog.showErrorBox("错误", error);
|
dialog.showErrorBox("错误", error);
|
||||||
return ""
|
return "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[IpcChannel.StartWsServer]: async () => {
|
[IpcChannel.StartWsServer]: async () => {
|
||||||
@ -29,7 +35,7 @@ export function useServerHandle(): Pick<IpcMainHandle, IpcChannel.StartServer |
|
|||||||
return serverStatus;
|
return serverStatus;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dialog.showErrorBox("错误", error);
|
dialog.showErrorBox("错误", error);
|
||||||
return ""
|
return "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[IpcChannel.StopWsServer]: async () => {
|
[IpcChannel.StopWsServer]: async () => {
|
||||||
@ -38,8 +44,8 @@ export function useServerHandle(): Pick<IpcMainHandle, IpcChannel.StartServer |
|
|||||||
return serverStatus;
|
return serverStatus;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dialog.showErrorBox("错误", error);
|
dialog.showErrorBox("错误", error);
|
||||||
return ""
|
return "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
import {BrowserWindow, app} from "electron";
|
import {app, BrowserWindow} from "electron";
|
||||||
import {updater} from "../services/HotUpdater";
|
import {updater} from "../services/HotUpdater";
|
||||||
import {updater as updaterTest} from "../services/HotUpdaterTest";
|
import {updater as updaterTest} from "../services/HotUpdaterTest";
|
||||||
import Update from "../services/checkUpdate";
|
import Update from "../services/checkUpdate";
|
||||||
import {UpdateStatus} from "electron_updater_node_core";
|
import {UpdateStatus} from "electron_updater_node_core";
|
||||||
import {IpcMainHandle, IpcChannel} from "../ipc";
|
import {IpcChannel, IpcMainHandle} from "../ipc";
|
||||||
|
|
||||||
const ALL_UPDATER = new Update();
|
const ALL_UPDATER = new Update();
|
||||||
|
|
||||||
export function useUpdateHandle(): Pick<IpcMainHandle, IpcChannel.CheckUpdate | IpcChannel.ConfirmUpdate | IpcChannel.HotUpdate | IpcChannel.HotUpdateTest> {
|
export function useUpdateHandle(): Pick<
|
||||||
|
IpcMainHandle,
|
||||||
|
| IpcChannel.CheckUpdate
|
||||||
|
| IpcChannel.ConfirmUpdate
|
||||||
|
| IpcChannel.HotUpdate
|
||||||
|
| IpcChannel.HotUpdateTest
|
||||||
|
> {
|
||||||
return {
|
return {
|
||||||
[IpcChannel.CheckUpdate]: (event) => {
|
[IpcChannel.CheckUpdate]: (event) => {
|
||||||
ALL_UPDATER.checkUpdate(BrowserWindow.fromWebContents(event.sender));
|
ALL_UPDATER.checkUpdate(BrowserWindow.fromWebContents(event.sender));
|
||||||
@ -16,7 +22,7 @@ export function useUpdateHandle(): Pick<IpcMainHandle, IpcChannel.CheckUpdate |
|
|||||||
ALL_UPDATER.quitAndInstall();
|
ALL_UPDATER.quitAndInstall();
|
||||||
},
|
},
|
||||||
[IpcChannel.HotUpdate]: (event) => {
|
[IpcChannel.HotUpdate]: (event) => {
|
||||||
updater(BrowserWindow.fromWebContents(event.sender))
|
updater(BrowserWindow.fromWebContents(event.sender));
|
||||||
},
|
},
|
||||||
[IpcChannel.HotUpdateTest]: async (event, arg) => {
|
[IpcChannel.HotUpdateTest]: async (event, arg) => {
|
||||||
console.log("hot-update-test");
|
console.log("hot-update-test");
|
||||||
@ -35,6 +41,6 @@ export function useUpdateHandle(): Pick<IpcMainHandle, IpcChannel.CheckUpdate |
|
|||||||
// 更新出错
|
// 更新出错
|
||||||
console.error("更新出错");
|
console.error("更新出错");
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {BrowserView, BrowserWindow} from "electron";
|
import {BrowserView, BrowserWindow} from "electron";
|
||||||
import {IpcChannel} from "../ipc";
|
import {IpcChannel} from "../ipc";
|
||||||
import {IsUseSysTitle, BrowserDemoUrl} from "../config/const";
|
import {BrowserDemoUrl, IsUseSysTitle} from "../config/const";
|
||||||
import {otherWindowConfig} from "../config/windowsConfig";
|
import {otherWindowConfig} from "../config/windowsConfig";
|
||||||
import {browserDemoURL} from "../config/staticPath";
|
import {browserDemoURL} from "../config/staticPath";
|
||||||
import {openDevTools} from "./devToolHook";
|
import {openDevTools} from "./devToolHook";
|
||||||
@ -21,7 +21,7 @@ export function openBrowserDemoWindow() {
|
|||||||
});
|
});
|
||||||
// // 开发模式下自动开启devtools
|
// // 开发模式下自动开启devtools
|
||||||
if (process.env.NODE_ENV === "development") {
|
if (process.env.NODE_ENV === "development") {
|
||||||
openDevTools(win)
|
openDevTools(win);
|
||||||
}
|
}
|
||||||
win.loadURL(browserDemoURL);
|
win.loadURL(browserDemoURL);
|
||||||
win.on("ready-to-show", () => {
|
win.on("ready-to-show", () => {
|
||||||
@ -50,14 +50,14 @@ export function createDefaultBrowserView(
|
|||||||
width: true,
|
width: true,
|
||||||
height: true,
|
height: true,
|
||||||
});
|
});
|
||||||
bv.webContents.on('did-finish-load', () => {
|
bv.webContents.on("did-finish-load", () => {
|
||||||
console.log(bv.webContents.getURL())
|
console.log(bv.webContents.getURL());
|
||||||
})
|
});
|
||||||
bv.webContents.loadURL(defaultUrl);
|
bv.webContents.loadURL(defaultUrl);
|
||||||
bv.webContents.on("page-title-updated", (event, title) => {
|
bv.webContents.on("page-title-updated", (event, title) => {
|
||||||
const parentBw = BrowserWindow.fromBrowserView(bv);
|
const parentBw = BrowserWindow.fromBrowserView(bv);
|
||||||
if (parentBw) {
|
if (parentBw) {
|
||||||
freshTabData(parentBw, bv, 1)
|
freshTabData(parentBw, bv, 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bv.webContents.on("destroyed", () => {
|
bv.webContents.on("destroyed", () => {
|
||||||
@ -71,7 +71,7 @@ export function createDefaultBrowserView(
|
|||||||
createDefaultBrowserView(parentBw, details.url);
|
createDefaultBrowserView(parentBw, details.url);
|
||||||
return {action: "deny"};
|
return {action: "deny"};
|
||||||
});
|
});
|
||||||
freshTabData(win, bv, 1)
|
freshTabData(win, bv, 1);
|
||||||
viewList.push(bv);
|
viewList.push(bv);
|
||||||
return bv;
|
return bv;
|
||||||
}
|
}
|
||||||
@ -82,17 +82,21 @@ export function addBrowserView(win: BrowserWindow, view: BrowserView) {
|
|||||||
win.show();
|
win.show();
|
||||||
win.setAlwaysOnTop(true);
|
win.setAlwaysOnTop(true);
|
||||||
}
|
}
|
||||||
freshTabData(win, view, 1)
|
freshTabData(win, view, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removeBrowserView(win: BrowserWindow, view: BrowserView) {
|
export function removeBrowserView(win: BrowserWindow, view: BrowserView) {
|
||||||
if (BrowserWindow.fromBrowserView(view) === win) {
|
if (BrowserWindow.fromBrowserView(view) === win) {
|
||||||
win.removeBrowserView(view);
|
win.removeBrowserView(view);
|
||||||
}
|
}
|
||||||
freshTabData(win, view, -1)
|
freshTabData(win, view, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function freshTabData(win: BrowserWindow, bv: BrowserView, status: -1 | 1) {
|
export function freshTabData(
|
||||||
|
win: BrowserWindow,
|
||||||
|
bv: BrowserView,
|
||||||
|
status: -1 | 1
|
||||||
|
) {
|
||||||
win.webContents.send(IpcChannel.BrowserViewTabDataUpdate, {
|
win.webContents.send(IpcChannel.BrowserViewTabDataUpdate, {
|
||||||
bvWebContentsId: bv.webContents.id,
|
bvWebContentsId: bv.webContents.id,
|
||||||
title: bv.webContents.getTitle(),
|
title: bv.webContents.getTitle(),
|
||||||
@ -107,4 +111,4 @@ export const useHookBrowser = {
|
|||||||
addBrowserView,
|
addBrowserView,
|
||||||
removeBrowserView,
|
removeBrowserView,
|
||||||
freshTabData,
|
freshTabData,
|
||||||
}
|
};
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
// 将数据以文件形式保存
|
// 将数据以文件形式保存
|
||||||
|
import {app} from "electron";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import * as fs from "node:fs";
|
import * as fs from "node:fs";
|
||||||
|
|
||||||
//创建目录,测试中的表现:使用递归创建(允许多级目录),否则必须逐级创建
|
//创建目录,测试中的表现:使用递归创建(允许多级目录),否则必须逐级创建
|
||||||
function checkFolder(folderPath) {
|
export function checkFolder(folderPath) {
|
||||||
if (!fs.existsSync(folderPath)) {
|
if (!fs.existsSync(folderPath)) {
|
||||||
fs.mkdirSync(folderPath, {recursive: true});
|
fs.mkdirSync(folderPath, {recursive: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// const folderPath = path.join(app.getPath('userData'), '/datas/files');
|
const basePath = process.env.NODE_ENV === 'production' ? app.getPath('userData') : __dirname;
|
||||||
let folderPath = path.join(__dirname, 'datas/files/');
|
let folderPath = path.join(basePath, "datas/files/");
|
||||||
|
|
||||||
export function createLocalFile(fileName: string, data: any) {
|
export function createLocalFile(fileName: string, data: any) {
|
||||||
checkFolder(folderPath);
|
checkFolder(folderPath);
|
||||||
@ -18,16 +19,19 @@ export function createLocalFile(fileName: string, data: any) {
|
|||||||
const filePath = path.join(folderPath, fileName);
|
const filePath = path.join(folderPath, fileName);
|
||||||
|
|
||||||
// 使用fs.writeFile (异步)创建文件,如果文件已存在则会被覆盖
|
// 使用fs.writeFile (异步)创建文件,如果文件已存在则会被覆盖
|
||||||
return fs.promises.writeFile(filePath, data, {flag: 'w'}).then(() => {
|
return fs.promises
|
||||||
console.log(`文件已创建成功:${filePath}`);
|
.writeFile(filePath, data, {flag: "w"})
|
||||||
return true;
|
.then(() => {
|
||||||
}).catch((err) => {
|
console.log(`文件已创建成功:${filePath}`);
|
||||||
console.log(err);
|
return true;
|
||||||
return false;
|
})
|
||||||
});
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadLocalFile(fileName: string) {
|
export function loadLocalFile(fileName: string) {
|
||||||
const filePath = path.join(folderPath, fileName);
|
const filePath = path.join(folderPath, fileName);
|
||||||
return fs.readFileSync(filePath, 'utf8');
|
return fs.readFileSync(filePath, "utf8");
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,10 @@ import {BrowserWindow} from "electron";
|
|||||||
|
|
||||||
export function openDevTools(win: BrowserWindow) {
|
export function openDevTools(win: BrowserWindow) {
|
||||||
let devtools = new BrowserWindow();
|
let devtools = new BrowserWindow();
|
||||||
devtools.setMenu(null)
|
devtools.setMenu(null);
|
||||||
devtools.webContents.on('did-finish-load', () => devtools.setTitle(win.webContents.getTitle()))
|
devtools.webContents.on("did-finish-load", () =>
|
||||||
|
devtools.setTitle(win.webContents.getTitle())
|
||||||
|
);
|
||||||
win.webContents.setDevToolsWebContents(devtools.webContents);
|
win.webContents.setDevToolsWebContents(devtools.webContents);
|
||||||
win.webContents.openDevTools({
|
win.webContents.openDevTools({
|
||||||
mode: "detach",
|
mode: "detach",
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
import {globalShortcut} from 'electron'
|
import {globalShortcut} from "electron";
|
||||||
import {DisableF12} from "../config/const"
|
import {DisableF12} from "../config/const";
|
||||||
|
|
||||||
const disableF12 = () => {
|
const disableF12 = () => {
|
||||||
if (process.env.NODE_ENV === 'production' || DisableF12) {
|
if (process.env.NODE_ENV === "production" || DisableF12) {
|
||||||
// 在生产环境下,或者设置禁用了F12键的情况下,禁止响应F12键
|
// 在生产环境下,或者设置禁用了F12键的情况下,禁止响应F12键
|
||||||
globalShortcut.register('f12', () => {
|
globalShortcut.register("f12", () => {
|
||||||
console.log('OS用户试图启动控制台')
|
console.log("OS用户试图启动控制台");
|
||||||
})
|
});
|
||||||
globalShortcut.register('CmdOrCtrl+I', () => {
|
// globalShortcut.register('CmdOrCtrl+I', () => {
|
||||||
console.log('MAC用户试图启动控制台')
|
// console.log('MAC用户试图启动控制台')
|
||||||
})
|
// })
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
export default {
|
export default {
|
||||||
disableF12
|
disableF12,
|
||||||
}
|
};
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import {WebContents, app, dialog} from "electron";
|
import type {BrowserWindow, Details, Event, RenderProcessGoneDetails,} from "electron";
|
||||||
import type {
|
import {app, crashReporter, dialog, WebContents} from "electron";
|
||||||
Details,
|
import renderLog from "electron-log/renderer";
|
||||||
RenderProcessGoneDetails,
|
|
||||||
Event,
|
//TBD: crashReporter是测试的
|
||||||
BrowserWindow,
|
|
||||||
} from "electron";
|
|
||||||
|
|
||||||
export interface UseProcessExceptionReturn {
|
export interface UseProcessExceptionReturn {
|
||||||
/**
|
/**
|
||||||
@ -41,6 +40,7 @@ export const useProcessException = (): UseProcessExceptionReturn => {
|
|||||||
) => void
|
) => void
|
||||||
) => {
|
) => {
|
||||||
app.on("render-process-gone", (event, webContents, details) => {
|
app.on("render-process-gone", (event, webContents, details) => {
|
||||||
|
renderLog.error("child-process-gone", JSON.stringify(event), JSON.stringify(details));
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener(event, webContents, details);
|
listener(event, webContents, details);
|
||||||
return;
|
return;
|
||||||
@ -69,6 +69,9 @@ export const useProcessException = (): UseProcessExceptionReturn => {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
message.title = "提示";
|
||||||
|
message.buttons = ["确定", "退出"];
|
||||||
|
message.message = "出现未知问题,反馈给开发者?";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dialog
|
dialog
|
||||||
@ -90,6 +93,9 @@ export const useProcessException = (): UseProcessExceptionReturn => {
|
|||||||
listener?: (event: Event, details: Details) => void
|
listener?: (event: Event, details: Details) => void
|
||||||
) => {
|
) => {
|
||||||
app.on("child-process-gone", (event, details) => {
|
app.on("child-process-gone", (event, details) => {
|
||||||
|
crashReporter.start({submitURL: ''})
|
||||||
|
renderLog.error("child-process-gone", JSON.stringify(event), JSON.stringify(details));
|
||||||
|
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener(event, details);
|
listener(event, details);
|
||||||
return;
|
return;
|
||||||
@ -119,6 +125,9 @@ export const useProcessException = (): UseProcessExceptionReturn => {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
message.title = "提示";
|
||||||
|
message.buttons = ["确定", "退出"];
|
||||||
|
message.message = "出现未知问题,反馈给开发者?";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dialog
|
dialog
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
import {app, globalShortcut} from "electron";
|
import {globalShortcut} from "electron";
|
||||||
|
|
||||||
const hotkeysHook = function (mainWindow) {
|
const hotkeysHook = function (mainWindow) {
|
||||||
mainWindow.on('focus', () => {
|
mainWindow.on("focus", () => {
|
||||||
// mac下快捷键失效的问题
|
// mac下快捷键失效的问题
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === "darwin") {
|
||||||
let contents = mainWindow.webContents
|
let contents = mainWindow.webContents;
|
||||||
globalShortcut.register('CmdOrCtrl+C', () => {
|
globalShortcut.register("CmdOrCtrl+C", () => {
|
||||||
console.log('注册复制快捷键成功')
|
console.log("注册复制快捷键成功");
|
||||||
contents.copy()
|
contents.copy();
|
||||||
})
|
});
|
||||||
globalShortcut.register('CommandOrControl+V', () => {
|
globalShortcut.register("CommandOrControl+V", () => {
|
||||||
console.log('注册粘贴快捷键成功')
|
console.log("注册粘贴快捷键成功");
|
||||||
contents.paste()
|
contents.paste();
|
||||||
})
|
});
|
||||||
globalShortcut.register('CommandOrControl+X', () => {
|
globalShortcut.register("CommandOrControl+X", () => {
|
||||||
console.log('注册剪切快捷键成功')
|
console.log("注册剪切快捷键成功");
|
||||||
contents.cut()
|
contents.cut();
|
||||||
})
|
});
|
||||||
globalShortcut.register('CommandOrControl+A', () => {
|
globalShortcut.register("CommandOrControl+A", () => {
|
||||||
console.log('注册全选快捷键成功')
|
console.log("注册全选快捷键成功");
|
||||||
contents.selectAll()
|
contents.selectAll();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
mainWindow.on('blur', () => {
|
mainWindow.on("blur", () => {
|
||||||
globalShortcut.unregisterAll() // 注销键盘事件
|
globalShortcut.unregisterAll(); // 注销键盘事件
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
export default hotkeysHook;
|
export default hotkeysHook;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// 这里是定义菜单的地方,详情请查看 https://electronjs.org/zh/docs/api/menu
|
// 这里是定义菜单的地方,详情请查看 https://electronjs.org/zh/docs/api/menu
|
||||||
import {dialog, BrowserWindow} from "electron";
|
import type {MenuItem, MenuItemConstructorOptions} from "electron";
|
||||||
import type {MenuItemConstructorOptions, MenuItem} from "electron"
|
import {BrowserWindow, dialog} from "electron";
|
||||||
import packageInfo from '../../../package.json';
|
import packageInfo from "../../../package.json";
|
||||||
import * as diyConst from "../config/const";
|
import * as diyConst from "../config/const";
|
||||||
|
|
||||||
function platform() {
|
function platform() {
|
||||||
@ -14,26 +14,28 @@ const release = process.getSystemVersion();
|
|||||||
const arch = process.arch;
|
const arch = process.arch;
|
||||||
|
|
||||||
function info() {
|
function info() {
|
||||||
dialog.showMessageBox({
|
dialog
|
||||||
title: '关于',
|
.showMessageBox({
|
||||||
type: 'info',
|
title: "关于",
|
||||||
message: `${packageInfo.title}`,
|
type: "info",
|
||||||
detail: `版本信息:${packageInfo.version}\n引擎版本:${process.versions.v8}\n当前系统:${type} ${arch} ${release}`,
|
message: `${packageInfo.title}`,
|
||||||
noLink: true,
|
detail: `版本信息:${packageInfo.version}\n引擎版本:${process.versions.v8}\n当前系统:${type} ${arch} ${release}`,
|
||||||
buttons: ["官网", '确定']
|
noLink: true,
|
||||||
}).then(r => {
|
buttons: ["官网", "确定"],
|
||||||
console.log(r);
|
})
|
||||||
if (r.response === 0) {
|
.then((r) => {
|
||||||
const win = new BrowserWindow({width: 800, height: 600})
|
console.log(r);
|
||||||
// Load a remote URL
|
if (r.response === 0) {
|
||||||
win.loadURL(diyConst.GwLink);
|
const win = new BrowserWindow({width: 800, height: 600});
|
||||||
// Or load a local HTML file
|
// Load a remote URL
|
||||||
// win.loadFile('index.html')
|
win.loadURL(diyConst.GwLink);
|
||||||
}
|
// Or load a local HTML file
|
||||||
})
|
// win.loadFile('index.html')
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const menu: Array<(MenuItemConstructorOptions) | (MenuItem)> = [
|
const menu: Array<MenuItemConstructorOptions | MenuItem> = [
|
||||||
{
|
{
|
||||||
label: "设置",
|
label: "设置",
|
||||||
submenu: [
|
submenu: [
|
||||||
@ -50,43 +52,44 @@ const menu: Array<(MenuItemConstructorOptions) | (MenuItem)> = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '编辑',
|
label: "编辑",
|
||||||
submenu: [{
|
submenu: [
|
||||||
label: '撤销',
|
|
||||||
accelerator: 'CmdOrCtrl+Z',
|
|
||||||
role: 'undo'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: '重做',
|
label: "撤销",
|
||||||
accelerator: 'Shift+CmdOrCtrl+Z',
|
accelerator: "CmdOrCtrl+Z",
|
||||||
role: 'redo'
|
role: "undo",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '剪切',
|
label: "重做",
|
||||||
accelerator: 'CmdOrCtrl+X',
|
accelerator: "Shift+CmdOrCtrl+Z",
|
||||||
role: 'cut'
|
role: "redo",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '复制',
|
label: "剪切",
|
||||||
accelerator: 'CmdOrCtrl+C',
|
accelerator: "CmdOrCtrl+X",
|
||||||
role: 'copy'
|
role: "cut",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '粘贴',
|
label: "复制",
|
||||||
accelerator: 'CmdOrCtrl+V',
|
accelerator: "CmdOrCtrl+C",
|
||||||
role: 'paste'
|
role: "copy",
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
label: "粘贴",
|
||||||
|
accelerator: "CmdOrCtrl+V",
|
||||||
|
role: "paste",
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "帮助",
|
label: "帮助",
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: "关于",
|
label: "关于",
|
||||||
click: info
|
click: info,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default menu
|
export default menu;
|
||||||
|
@ -17,7 +17,7 @@ export function openPrintDemoWindow() {
|
|||||||
});
|
});
|
||||||
// 开发模式下自动开启devtools
|
// 开发模式下自动开启devtools
|
||||||
if (process.env.NODE_ENV === "development") {
|
if (process.env.NODE_ENV === "development") {
|
||||||
openDevTools(win)
|
openDevTools(win);
|
||||||
}
|
}
|
||||||
win.loadURL(printURL);
|
win.loadURL(printURL);
|
||||||
win.on("ready-to-show", () => {
|
win.on("ready-to-show", () => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//定义系统托盘
|
//定义系统托盘
|
||||||
import {dialog, BrowserWindow, Menu} from "electron";
|
import type {MenuItem, MenuItemConstructorOptions} from "electron";
|
||||||
import type {MenuItemConstructorOptions, MenuItem} from "electron"
|
import {BrowserWindow, dialog, Menu} from "electron";
|
||||||
import packageInfo from '../../../package.json';
|
import packageInfo from "../../../package.json";
|
||||||
import * as diyConst from "../config/const";
|
import * as diyConst from "../config/const";
|
||||||
import {trayURL} from "../config/staticPath";
|
import {trayURL} from "../config/staticPath";
|
||||||
|
|
||||||
@ -15,29 +15,31 @@ const release = process.getSystemVersion();
|
|||||||
const arch = process.arch;
|
const arch = process.arch;
|
||||||
|
|
||||||
function info() {
|
function info() {
|
||||||
dialog.showMessageBox({
|
dialog
|
||||||
title: '关于',
|
.showMessageBox({
|
||||||
type: 'info',
|
title: "关于",
|
||||||
message: `${packageInfo.title}`,
|
type: "info",
|
||||||
detail: `版本信息:${packageInfo.version}\n引擎版本:${process.versions.v8}\n当前系统:${type} ${arch} ${release}`,
|
message: `${packageInfo.title}`,
|
||||||
noLink: true,
|
detail: `版本信息:${packageInfo.version}\n引擎版本:${process.versions.v8}\n当前系统:${type} ${arch} ${release}`,
|
||||||
buttons: ["官网", '确定']
|
noLink: true,
|
||||||
}).then(r => {
|
buttons: ["官网", "确定"],
|
||||||
console.log(r);
|
})
|
||||||
if (r.response === 0) {
|
.then((r) => {
|
||||||
const win = new BrowserWindow({width: 800, height: 600})
|
console.log(r);
|
||||||
// Load a remote URL
|
if (r.response === 0) {
|
||||||
win.loadURL(diyConst.GwLink);
|
const win = new BrowserWindow({width: 800, height: 600});
|
||||||
// Or load a local HTML file
|
// Load a remote URL
|
||||||
// win.loadFile('index.html')
|
win.loadURL(diyConst.GwLink);
|
||||||
}
|
// Or load a local HTML file
|
||||||
})
|
// win.loadFile('index.html')
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sleep(ms: number) {
|
export function sleep(ms: number) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
setTimeout(resolve, ms)
|
setTimeout(resolve, ms);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createTrayWindow() {
|
export function createTrayWindow() {
|
||||||
@ -51,34 +53,34 @@ export function createTrayWindow() {
|
|||||||
frame: false,
|
frame: false,
|
||||||
hiddenInMissionControl: true,
|
hiddenInMissionControl: true,
|
||||||
skipTaskbar: true,
|
skipTaskbar: true,
|
||||||
visualEffectState: 'active',
|
visualEffectState: "active",
|
||||||
vibrancy: 'menu'
|
vibrancy: "menu",
|
||||||
})
|
});
|
||||||
win.loadURL(trayURL)
|
win.loadURL(trayURL);
|
||||||
|
|
||||||
win.on('blur', async () => {
|
win.on("blur", async () => {
|
||||||
let opacity = 1
|
let opacity = 1;
|
||||||
while (opacity > 0) {
|
while (opacity > 0) {
|
||||||
await sleep(10)
|
await sleep(10);
|
||||||
opacity -= 0.1
|
opacity -= 0.1;
|
||||||
win.setOpacity(opacity)
|
win.setOpacity(opacity);
|
||||||
}
|
}
|
||||||
win.hide()
|
win.hide();
|
||||||
})
|
});
|
||||||
|
|
||||||
win.on('show', async () => {
|
win.on("show", async () => {
|
||||||
let opacity = 0
|
let opacity = 0;
|
||||||
while (opacity < 1) {
|
while (opacity < 1) {
|
||||||
await sleep(10)
|
await sleep(10);
|
||||||
opacity += 0.2
|
opacity += 0.2;
|
||||||
win.setOpacity(opacity)
|
win.setOpacity(opacity);
|
||||||
}
|
}
|
||||||
win.focus()
|
win.focus();
|
||||||
})
|
});
|
||||||
return win
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
const menu: Array<(MenuItemConstructorOptions) | (MenuItem)> = [
|
const menu: Array<MenuItemConstructorOptions | MenuItem> = [
|
||||||
{
|
{
|
||||||
label: "快速重启",
|
label: "快速重启",
|
||||||
accelerator: "F5",
|
accelerator: "F5",
|
||||||
@ -86,43 +88,44 @@ const menu: Array<(MenuItemConstructorOptions) | (MenuItem)> = [
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: '编辑',
|
label: "编辑",
|
||||||
submenu: [{
|
submenu: [
|
||||||
label: '撤销',
|
|
||||||
accelerator: 'CmdOrCtrl+Z',
|
|
||||||
role: 'undo'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: '重做',
|
label: "撤销",
|
||||||
accelerator: 'Shift+CmdOrCtrl+Z',
|
accelerator: "CmdOrCtrl+Z",
|
||||||
role: 'redo'
|
role: "undo",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '剪切',
|
label: "重做",
|
||||||
accelerator: 'CmdOrCtrl+X',
|
accelerator: "Shift+CmdOrCtrl+Z",
|
||||||
role: 'cut'
|
role: "redo",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '复制',
|
label: "剪切",
|
||||||
accelerator: 'CmdOrCtrl+C',
|
accelerator: "CmdOrCtrl+X",
|
||||||
role: 'copy'
|
role: "cut",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '粘贴',
|
label: "复制",
|
||||||
accelerator: 'CmdOrCtrl+V',
|
accelerator: "CmdOrCtrl+C",
|
||||||
role: 'paste'
|
role: "copy",
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
label: "粘贴",
|
||||||
|
accelerator: "CmdOrCtrl+V",
|
||||||
|
role: "paste",
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "关于我们",
|
label: "关于我们",
|
||||||
click: info
|
click: info,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "退出",
|
label: "退出",
|
||||||
accelerator: "CmdOrCtrl+F4",
|
accelerator: "CmdOrCtrl+F4",
|
||||||
role: "close",
|
role: "close",
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default Menu.buildFromTemplate(menu)
|
export default Menu.buildFromTemplate(menu);
|
||||||
|
@ -1,33 +1,42 @@
|
|||||||
'use strict'
|
"use strict";
|
||||||
|
|
||||||
import {app, session} from 'electron'
|
import {app, crashReporter, session} from "electron";
|
||||||
import InitWindow from './services/windowManager'
|
import InitWindow from "./services/windowManager";
|
||||||
import disableButton from './hook/disableButtonHook'
|
import disableButton from "./hook/disableButtonHook";
|
||||||
import {initTray} from './services/trayManager'
|
import {initTray} from "./services/trayManager";
|
||||||
import domains from "./config/domains";
|
import domains from "./config/domains";
|
||||||
import server from "./server";
|
import server from "./server";
|
||||||
|
import mainLog from "electron-log/main";
|
||||||
|
|
||||||
|
// 初始化日志系统
|
||||||
|
mainLog.initialize();
|
||||||
|
// 记录信息
|
||||||
|
if (!app.isPackaged) mainLog.info('应用启动');
|
||||||
|
//捕获崩溃报告
|
||||||
|
crashReporter.start({uploadToServer: false, ignoreSystemCrashHandler: false});
|
||||||
|
|
||||||
function onAppReady() {
|
function onAppReady() {
|
||||||
new InitWindow().initWindow()
|
new InitWindow().initWindow();
|
||||||
initTray()
|
initTray();
|
||||||
disableButton.disableF12()
|
disableButton.disableF12();
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === "development") {
|
||||||
const {VUEJS_DEVTOOLS} = require("electron-devtools-vendor");
|
const {VUEJS_DEVTOOLS} = require("electron-devtools-vendor");
|
||||||
session.defaultSession.loadExtension(VUEJS_DEVTOOLS, {
|
session.defaultSession
|
||||||
allowFileAccess: true,
|
.loadExtension(VUEJS_DEVTOOLS, {
|
||||||
}).then(r => {
|
allowFileAccess: true,
|
||||||
console.log('已安装: vue-devtools');
|
})
|
||||||
});
|
.then((r) => {
|
||||||
|
console.log("已安装: vue-devtools");
|
||||||
|
});
|
||||||
|
|
||||||
//添加启动内置服务器
|
//添加启动内置服务器
|
||||||
server.StartServer().then((r) => {
|
server.StartServer().then((r) => {
|
||||||
console.log('内置服务器已启动');
|
console.log("内置服务器已启动");
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.whenReady().then(onAppReady)
|
app.whenReady().then(onAppReady);
|
||||||
|
|
||||||
//禁止程序多开;需要单例锁的时候用
|
//禁止程序多开;需要单例锁的时候用
|
||||||
// const gotTheLock = app.requestSingleInstanceLock()
|
// const gotTheLock = app.requestSingleInstanceLock()
|
||||||
@ -36,44 +45,64 @@ app.whenReady().then(onAppReady)
|
|||||||
// app.quit()
|
// app.quit()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
//命令行开关
|
||||||
// 由于9.x版本问题,需要加入该配置关闭跨域问题
|
// 由于9.x版本问题,需要加入该配置关闭跨域问题
|
||||||
app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors')
|
// app.commandLine.appendSwitch("disable-features", "OutOfBlinkCors");
|
||||||
|
//远程调试端口 TBD
|
||||||
|
// app.commandLine.appendSwitch("remote-debugging-port", '8888');
|
||||||
|
//输出日志 TBD
|
||||||
|
// app.commandLine.appendSwitch("enable-logging","file");
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on("window-all-closed", () => {
|
||||||
// 所有平台均为所有窗口关闭就退出软件
|
// 所有平台均为所有窗口关闭就退出软件
|
||||||
app.quit()
|
app.quit();
|
||||||
})
|
});
|
||||||
app.on('browser-window-created', () => {
|
app.on("browser-window-created", () => {
|
||||||
console.log('window-created')
|
console.log("window-created");
|
||||||
})
|
});
|
||||||
/**
|
/**
|
||||||
* 安全检查
|
* 安全检查
|
||||||
* 创建WebView前先检查内容来源
|
* 创建WebView前先检查内容来源
|
||||||
*/
|
*/
|
||||||
app.on('web-contents-created', (event, contents) => {
|
app.on("web-contents-created", (event, contents) => {
|
||||||
contents.on('will-attach-webview', (event, webPreferences, params) => {
|
contents.on("will-attach-webview", (event, webPreferences, params) => {
|
||||||
let isSafe = 0;
|
let isSafe = 0;
|
||||||
domains.some((d) => {
|
domains.some((d) => {
|
||||||
// 验证正在加载的 URL
|
// 验证正在加载的 URL
|
||||||
if (!params.src.startsWith(d)) {
|
if (!params.src.startsWith(d)) {
|
||||||
isSafe -= 1;
|
isSafe -= 1;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
if (isSafe < 0) {
|
if (isSafe < 0) {
|
||||||
|
mainLog.log("main/index.ts提示 非安全访问")
|
||||||
// 禁用 Node.js 集成
|
// 禁用 Node.js 集成
|
||||||
// webPreferences.nodeIntegration = false;
|
// webPreferences.nodeIntegration = false;
|
||||||
// event.preventDefault()
|
// event.preventDefault()
|
||||||
// 如果未使用,则删除预加载脚本或验证其位置是否合法
|
// 如果未使用,则删除预加载脚本或验证其位置是否合法
|
||||||
// delete webPreferences.preload
|
// delete webPreferences.preload
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
if (process.defaultApp) {
|
if (process.defaultApp) {
|
||||||
if (process.argv.length >= 2) {
|
if (process.argv.length >= 2) {
|
||||||
app.removeAsDefaultProtocolClient('Hi-sass-frame')
|
app.removeAsDefaultProtocolClient("Hi-sass-frame");
|
||||||
console.log('由于框架特殊性,开发环境下无法使用')
|
console.log("由于框架特殊性,开发环境下无法使用");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
app.setAsDefaultProtocolClient('Hi-sass-frame')
|
app.setAsDefaultProtocolClient("Hi-sass-frame");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//监听记录主程序错误
|
||||||
|
process.on('uncaughtException', (error) => {
|
||||||
|
mainLog.error(error);
|
||||||
|
// 发送崩溃报告或者保存日志
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('render-process-gone', (event, webContents, details) => {
|
||||||
|
mainLog.warn("app:render-process-gone,", JSON.stringify(event), JSON.stringify(webContents), JSON.stringify(details));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('child-process-gone', (event, details) => {
|
||||||
|
mainLog.warn('app:child-process-gone', JSON.stringify(event), JSON.stringify(details));
|
||||||
|
});
|
||||||
|
@ -1,67 +1,71 @@
|
|||||||
/* eslint-disable prefer-promise-reject-errors */
|
/* eslint-disable prefer-promise-reject-errors */
|
||||||
import appExp from "./server";
|
import appExp from "./server";
|
||||||
import { BuiltInServerPort } from "../config/const";
|
import {BuiltInServerPort} from "../config/const";
|
||||||
import { createServer, Server } from "http";
|
import {createServer, Server} from "http";
|
||||||
|
|
||||||
const port = BuiltInServerPort;
|
const port = BuiltInServerPort;
|
||||||
|
|
||||||
class SingleServer {
|
class SingleServer {
|
||||||
constructor(app: any) {
|
server: Server;
|
||||||
app.set("port", port);
|
|
||||||
this.server = createServer(app);
|
constructor(app: any) {
|
||||||
this.server.keepAliveTimeout = 0;
|
app.set("port", port);
|
||||||
this.server.on("connection", (socket) => {
|
this.server = createServer(app);
|
||||||
// keep-alive 1s后自动关闭
|
this.server.keepAliveTimeout = 0;
|
||||||
socket.setTimeout(1000);
|
this.server.on("connection", (socket) => {
|
||||||
});
|
// keep-alive 1s后自动关闭
|
||||||
}
|
socket.setTimeout(1000);
|
||||||
server: Server;
|
});
|
||||||
startServer() {
|
}
|
||||||
return new Promise((resolve: (value: string) => void, reject) => {
|
|
||||||
try {
|
startServer() {
|
||||||
this.server.listen(port);
|
return new Promise((resolve: (value: string) => void, reject) => {
|
||||||
resolve("内置服务端已经启动");
|
try {
|
||||||
} catch (error) {
|
this.server.listen(port);
|
||||||
switch (error.code) {
|
resolve("内置服务端已经启动");
|
||||||
case "ERR_SERVER_ALREADY_LISTEN":
|
} catch (error) {
|
||||||
resolve("服务端已经启动");
|
switch (error.code) {
|
||||||
break;
|
case "ERR_SERVER_ALREADY_LISTEN":
|
||||||
case "EACCES":
|
resolve("服务端已经启动");
|
||||||
reject("权限不足内置服务器启动失败,请使用管理员权限运行。");
|
break;
|
||||||
break;
|
case "EACCES":
|
||||||
case "EADDRINUSE":
|
reject("权限不足内置服务器启动失败,请使用管理员权限运行。");
|
||||||
reject("内置服务器端口已被占用,请检查。");
|
break;
|
||||||
break;
|
case "EADDRINUSE":
|
||||||
default:
|
reject("内置服务器端口已被占用,请检查。");
|
||||||
reject(error);
|
break;
|
||||||
}
|
default:
|
||||||
}
|
reject(error);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
stopServer() {
|
});
|
||||||
return new Promise((resolve: (value: string) => void, reject) => {
|
}
|
||||||
this.server.close((err) => {
|
|
||||||
if (err) {
|
stopServer() {
|
||||||
switch ((err as any).code) {
|
return new Promise((resolve: (value: string) => void, reject) => {
|
||||||
case "ERR_SERVER_NOT_RUNNING":
|
this.server.close((err) => {
|
||||||
resolve("服务端未启动");
|
if (err) {
|
||||||
break;
|
switch ((err as any).code) {
|
||||||
default:
|
case "ERR_SERVER_NOT_RUNNING":
|
||||||
reject(err);
|
resolve("服务端未启动");
|
||||||
}
|
break;
|
||||||
} else {
|
default:
|
||||||
resolve("服务端已关闭");
|
reject(err);
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
});
|
resolve("服务端已关闭");
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const singleServer = new SingleServer(appExp);
|
const singleServer = new SingleServer(appExp);
|
||||||
export default {
|
export default {
|
||||||
StartServer() {
|
StartServer() {
|
||||||
return singleServer.startServer();
|
return singleServer.startServer();
|
||||||
},
|
},
|
||||||
StopServer() {
|
StopServer() {
|
||||||
return singleServer.stopServer();
|
return singleServer.stopServer();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
import express from 'express'
|
import express from "express";
|
||||||
|
|
||||||
const app = express()
|
|
||||||
const router = express.Router();
|
|
||||||
import config from "../config/const";
|
import config from "../config/const";
|
||||||
|
// 引入mock
|
||||||
|
import mocks from "../../renderer/mock/index";
|
||||||
|
import {lowerCase} from "lodash";
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
const BaseApi = process.env.REMOTE_API ?? config.RemoteApi;
|
const BaseApi = process.env.REMOTE_API ?? config.RemoteApi;
|
||||||
|
|
||||||
@ -17,13 +20,12 @@ const cors = (req, res, next) => {
|
|||||||
res.header("Access-Control-Allow-Credentials", true);
|
res.header("Access-Control-Allow-Credentials", true);
|
||||||
//跨域允许的请求方式
|
//跨域允许的请求方式
|
||||||
res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
|
res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
|
||||||
res.header("Content-Type", "application/json;charset=utf-8")
|
res.header("Content-Type", "application/json;charset=utf-8");
|
||||||
|
|
||||||
if (req.method.toLowerCase() === 'options')
|
if (req.method.toLowerCase() === "options")
|
||||||
res.sendStatus(200); //让options尝试请求快速结束
|
res.sendStatus(200); //让options尝试请求快速结束
|
||||||
else
|
else next();
|
||||||
next();
|
};
|
||||||
}
|
|
||||||
|
|
||||||
//添加空路由占位符,后期动态添加路由用
|
//添加空路由占位符,后期动态添加路由用
|
||||||
// const arr = ["GET","POST","DELETE","PUT","HEAD","OPTIONS"];
|
// const arr = ["GET","POST","DELETE","PUT","HEAD","OPTIONS"];
|
||||||
@ -35,23 +37,19 @@ const cors = (req, res, next) => {
|
|||||||
// });
|
// });
|
||||||
|
|
||||||
//示范
|
//示范
|
||||||
app.get('/message', (req, res) => {
|
app.get("/message", (req, res) => {
|
||||||
res.send('这是来自node服务端的信息')
|
res.send("这是来自node服务端的信息");
|
||||||
})
|
});
|
||||||
|
|
||||||
app.post('/message', (req, res) => {
|
app.post("/message", (req, res) => {
|
||||||
if (req) {
|
if (req) {
|
||||||
res.send(req + '--来自node')
|
res.send(req + "--来自node");
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
// 引入mock
|
|
||||||
import mocks from "../../renderer/mock/index";
|
|
||||||
import {lowerCase} from "lodash";
|
|
||||||
|
|
||||||
for (let i in mocks) {
|
for (let i in mocks) {
|
||||||
let mocker = mocks[i];
|
let mocker = mocks[i];
|
||||||
mocker.forEach(mock => {
|
mocker.forEach((mock) => {
|
||||||
// console.log(BaseApi+mock.url);
|
// console.log(BaseApi+mock.url);
|
||||||
let api = BaseApi + mock.url;
|
let api = BaseApi + mock.url;
|
||||||
let callback = function (req, res) {
|
let callback = function (req, res) {
|
||||||
@ -63,19 +61,19 @@ for (let i in mocks) {
|
|||||||
// console.log(data)
|
// console.log(data)
|
||||||
res.send(data);
|
res.send(data);
|
||||||
} else {
|
} else {
|
||||||
let data = mock.body
|
let data = mock.body;
|
||||||
res.send(data);
|
res.send(data);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
/**
|
/**
|
||||||
* 请求类型 ["GET","POST","DELETE","PUT","HEAD","OPTIONS",……];
|
* 请求类型 ["GET","POST","DELETE","PUT","HEAD","OPTIONS",……];
|
||||||
*/
|
*/
|
||||||
let methods = mock.method;
|
let methods = mock.method;
|
||||||
methods.some((method) => {
|
methods.some((method) => {
|
||||||
let m = lowerCase(method);
|
let m = lowerCase(method);
|
||||||
router[m](api, callback)
|
router[m](api, callback);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
app.use("/", cors, router);
|
app.use("/", cors, router);
|
||||||
export default app
|
export default app;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import express from 'express';
|
import express from "express";
|
||||||
import expressWs from "express-ws";
|
import expressWs from "express-ws";
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const app = express();
|
const app = express();
|
||||||
expressWs(app);//混入功能,使router支持ws方法
|
expressWs(app); //混入功能,使router支持ws方法
|
||||||
const wsClients = [];
|
const wsClients = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,20 +17,19 @@ const cors = (req, res, next) => {
|
|||||||
res.header("Access-Control-Allow-Credentials", true);
|
res.header("Access-Control-Allow-Credentials", true);
|
||||||
//跨域允许的请求方式
|
//跨域允许的请求方式
|
||||||
res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
|
res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
|
||||||
res.header("Content-Type", "application/json;charset=utf-8")
|
res.header("Content-Type", "application/json;charset=utf-8");
|
||||||
|
|
||||||
if (req.method.toLowerCase() === 'options')
|
if (req.method.toLowerCase() === "options")
|
||||||
res.sendStatus(200); //让options尝试请求快速结束
|
res.sendStatus(200); //让options尝试请求快速结束
|
||||||
else
|
else next();
|
||||||
next();
|
};
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接收client的command请求
|
* 接收client的command请求
|
||||||
* @param cmd
|
* @param cmd
|
||||||
*/
|
*/
|
||||||
function get(cmd) {
|
function get(cmd) {
|
||||||
console.log(cmd)
|
console.log(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,7 +38,7 @@ function get(cmd) {
|
|||||||
* @param cb
|
* @param cb
|
||||||
*/
|
*/
|
||||||
function send(msg: string, cb) {
|
function send(msg: string, cb) {
|
||||||
cb.send(msg)
|
cb.send(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,11 +49,11 @@ function callback(ws, req, next) {
|
|||||||
console.log("client connect to server successful!", req, next);
|
console.log("client connect to server successful!", req, next);
|
||||||
// 保存客户端标识
|
// 保存客户端标识
|
||||||
wsClients.push(ws);
|
wsClients.push(ws);
|
||||||
ws.on('connect', () => {
|
ws.on("connect", () => {
|
||||||
ws.send('hello, I am wss');
|
ws.send("hello, I am wss");
|
||||||
});
|
});
|
||||||
// 创建message监听
|
// 创建message监听
|
||||||
ws.on('message', (msg) => {
|
ws.on("message", (msg) => {
|
||||||
// 直接将消息打印出来
|
// 直接将消息打印出来
|
||||||
console.log("receive client msg :", msg);
|
console.log("receive client msg :", msg);
|
||||||
//处理接收的消息
|
//处理接收的消息
|
||||||
@ -66,7 +65,7 @@ function callback(ws, req, next) {
|
|||||||
console.log("client is closed", msg);
|
console.log("client is closed", msg);
|
||||||
for (var index = 0; index < wsClients.length; index++) {
|
for (var index = 0; index < wsClients.length; index++) {
|
||||||
if (wsClients[index] === this) {
|
if (wsClients[index] === this) {
|
||||||
wsClients.splice(index, 1)
|
wsClients.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -78,7 +77,7 @@ function callback(ws, req, next) {
|
|||||||
/**
|
/**
|
||||||
* 构造路由
|
* 构造路由
|
||||||
*/
|
*/
|
||||||
router.ws('/*', callback);
|
router.ws("/*", callback);
|
||||||
|
|
||||||
app.use('/ws', cors, router);
|
app.use("/ws", cors, router);
|
||||||
export default app;
|
export default app;
|
||||||
|
@ -6,67 +6,72 @@ import expressWs from "express-ws";
|
|||||||
/**
|
/**
|
||||||
* 引入http服务器
|
* 引入http服务器
|
||||||
*/
|
*/
|
||||||
import { createServer, Server } from "http";
|
import {createServer, Server} from "http";
|
||||||
|
import app from "./wsRouters";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化WS服务,并设置最大传输文件大小
|
* 初始化WS服务,并设置最大传输文件大小
|
||||||
*/
|
*/
|
||||||
const port = 8888;
|
const port = 8888;
|
||||||
class WsServer {
|
class WsServer {
|
||||||
constructor(app: any) {
|
server: Server;
|
||||||
app.set("port", port);
|
|
||||||
this.server = createServer(app);
|
|
||||||
expressWs(app, this.server, { wsOptions: { maxPayload: 5 * 1024 * 1024 * 1024, } })
|
|
||||||
}
|
|
||||||
|
|
||||||
server: Server;
|
constructor(app: any) {
|
||||||
startServer() {
|
app.set("port", port);
|
||||||
return new Promise((resolve: (value: string) => void, reject) => {
|
this.server = createServer(app);
|
||||||
try {
|
expressWs(app, this.server, {
|
||||||
this.server.listen(port);
|
wsOptions: {maxPayload: 5 * 1024 * 1024 * 1024},
|
||||||
resolve("内置WS服务端已经启动");
|
});
|
||||||
} catch (error) {
|
}
|
||||||
switch (error.code) {
|
|
||||||
case "ERR_SERVER_ALREADY_LISTEN":
|
startServer() {
|
||||||
resolve("WS服务端已经启动");
|
return new Promise((resolve: (value: string) => void, reject) => {
|
||||||
break;
|
try {
|
||||||
case "EACCES":
|
this.server.listen(port);
|
||||||
reject("权限不足WS服务器启动失败,请使用管理员权限运行。");
|
resolve("内置WS服务端已经启动");
|
||||||
break;
|
} catch (error) {
|
||||||
case "EADDRINUSE":
|
switch (error.code) {
|
||||||
reject("WS服务器端口已被占用,请检查。");
|
case "ERR_SERVER_ALREADY_LISTEN":
|
||||||
break;
|
resolve("WS服务端已经启动");
|
||||||
default:
|
break;
|
||||||
reject(error);
|
case "EACCES":
|
||||||
}
|
reject("权限不足WS服务器启动失败,请使用管理员权限运行。");
|
||||||
}
|
break;
|
||||||
});
|
case "EADDRINUSE":
|
||||||
}
|
reject("WS服务器端口已被占用,请检查。");
|
||||||
stopServer() {
|
break;
|
||||||
return new Promise((resolve: (value: string) => void, reject) => {
|
default:
|
||||||
this.server.close((err) => {
|
reject(error);
|
||||||
if (err) {
|
}
|
||||||
switch ((err as any).code) {
|
}
|
||||||
case "ERR_SERVER_NOT_RUNNING":
|
});
|
||||||
resolve("WS服务端未启动");
|
}
|
||||||
break;
|
|
||||||
default:
|
stopServer() {
|
||||||
reject(err);
|
return new Promise((resolve: (value: string) => void, reject) => {
|
||||||
}
|
this.server.close((err) => {
|
||||||
} else {
|
if (err) {
|
||||||
resolve("WS服务端已关闭");
|
switch ((err as any).code) {
|
||||||
}
|
case "ERR_SERVER_NOT_RUNNING":
|
||||||
});
|
resolve("WS服务端未启动");
|
||||||
});
|
break;
|
||||||
}
|
default:
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve("WS服务端已关闭");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
import app from "./wsRouters";
|
|
||||||
const myServer = new WsServer(app);
|
const myServer = new WsServer(app);
|
||||||
export default {
|
export default {
|
||||||
StartServer() {
|
StartServer() {
|
||||||
return myServer.startServer();
|
return myServer.startServer();
|
||||||
},
|
},
|
||||||
StopServer() {
|
StopServer() {
|
||||||
return myServer.stopServer();
|
return myServer.stopServer();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import {app, BrowserWindow} from "electron";
|
import {app, BrowserWindow} from "electron";
|
||||||
import {UpdateInfo, UpdateJson, UpdateStatus, UpdateElectron} from "electron_updater_node_core"
|
import {UpdateElectron, UpdateInfo, UpdateJson, UpdateStatus} from "electron_updater_node_core"
|
||||||
import {dirname, join} from "path";
|
import {join} from "path";
|
||||||
import {version} from '../../../package.json'
|
import {version} from '../../../package.json'
|
||||||
import {Readable} from "stream";
|
import {Readable} from "stream";
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
const request = axios.create()
|
|
||||||
import updateConfig from "../../../updateConfig.json";
|
import updateConfig from "../../../updateConfig.json";
|
||||||
import {IpcChannel, winContentSend} from "../ipc";
|
import {IpcChannel, winContentSend} from "../ipc";
|
||||||
|
|
||||||
|
const request = axios.create()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增量更新
|
* 增量更新
|
||||||
*
|
*
|
||||||
|
@ -1,82 +1,82 @@
|
|||||||
import {ProgressInfo, autoUpdater} from 'electron-updater'
|
import {autoUpdater, ProgressInfo} from "electron-updater";
|
||||||
import {BrowserWindow} from 'electron'
|
import {BrowserWindow} from "electron";
|
||||||
import {IpcChannel, winContentSend} from "../ipc";
|
import {IpcChannel, winContentSend} from "../ipc";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* -1 检查更新失败 0 正在检查更新 1 检测到新版本,准备下载 2 未检测到新版本 3 下载中 4 下载完成
|
* -1 检查更新失败 0 正在检查更新 1 检测到新版本,准备下载 2 未检测到新版本 3 下载中 4 下载完成
|
||||||
**/
|
**/
|
||||||
class Update {
|
class Update {
|
||||||
public mainWindow: BrowserWindow
|
public mainWindow: BrowserWindow;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// 设置url
|
// 设置url
|
||||||
autoUpdater.setFeedURL('http://127.0.0.1:25565/')
|
autoUpdater.setFeedURL("http://127.0.0.1:25565/");
|
||||||
|
|
||||||
// 当更新发生错误的时候触发。
|
// 当更新发生错误的时候触发。
|
||||||
autoUpdater.on('error', (err) => {
|
autoUpdater.on("error", (err) => {
|
||||||
console.log('更新出现错误', err.message)
|
console.log("更新出现错误", err.message);
|
||||||
if (err.message.includes('sha512 checksum mismatch')) {
|
if (err.message.includes("sha512 checksum mismatch")) {
|
||||||
this.Message(this.mainWindow, -1, 'sha512校验失败')
|
this.Message(this.mainWindow, -1, "sha512校验失败");
|
||||||
} else {
|
} else {
|
||||||
this.Message(this.mainWindow, -1, '错误信息请看主进程控制台')
|
this.Message(this.mainWindow, -1, "错误信息请看主进程控制台");
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
// 当开始检查更新的时候触发
|
// 当开始检查更新的时候触发
|
||||||
autoUpdater.on('checking-for-update', () => {
|
autoUpdater.on("checking-for-update", () => {
|
||||||
console.log('开始检查更新')
|
console.log("开始检查更新");
|
||||||
this.Message(this.mainWindow, 0)
|
this.Message(this.mainWindow, 0);
|
||||||
})
|
});
|
||||||
|
|
||||||
// 发现可更新数据时
|
// 发现可更新数据时
|
||||||
autoUpdater.on('update-available', () => {
|
autoUpdater.on("update-available", () => {
|
||||||
console.log('有更新')
|
console.log("有更新");
|
||||||
this.Message(this.mainWindow, 1)
|
this.Message(this.mainWindow, 1);
|
||||||
})
|
});
|
||||||
|
|
||||||
// 没有可更新数据时
|
// 没有可更新数据时
|
||||||
autoUpdater.on('update-not-available', () => {
|
autoUpdater.on("update-not-available", () => {
|
||||||
console.log('没有更新')
|
console.log("没有更新");
|
||||||
this.Message(this.mainWindow, 2)
|
this.Message(this.mainWindow, 2);
|
||||||
})
|
});
|
||||||
|
|
||||||
// 下载监听
|
// 下载监听
|
||||||
autoUpdater.on('download-progress', (progressObj) => {
|
autoUpdater.on("download-progress", (progressObj) => {
|
||||||
this.Message(this.mainWindow, 3, progressObj)
|
this.Message(this.mainWindow, 3, progressObj);
|
||||||
})
|
});
|
||||||
|
|
||||||
// 下载完成
|
// 下载完成
|
||||||
autoUpdater.on('update-downloaded', () => {
|
autoUpdater.on("update-downloaded", () => {
|
||||||
console.log('下载完成')
|
console.log("下载完成");
|
||||||
this.Message(this.mainWindow, 4)
|
this.Message(this.mainWindow, 4);
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 负责向渲染进程发送信息
|
// 负责向渲染进程发送信息
|
||||||
Message(mainWindow: BrowserWindow, type: number, data: string | ProgressInfo = "") {
|
Message(
|
||||||
|
mainWindow: BrowserWindow,
|
||||||
|
type: number,
|
||||||
|
data: string | ProgressInfo = ""
|
||||||
|
) {
|
||||||
const senddata = {
|
const senddata = {
|
||||||
state: type,
|
state: type,
|
||||||
msg: data
|
msg: data,
|
||||||
}
|
};
|
||||||
winContentSend(mainWindow.webContents, IpcChannel.UpdateMsg, senddata)
|
winContentSend(mainWindow.webContents, IpcChannel.UpdateMsg, senddata);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行自动更新检查
|
// 执行自动更新检查
|
||||||
checkUpdate(mainWindow: BrowserWindow) {
|
checkUpdate(mainWindow: BrowserWindow) {
|
||||||
this.mainWindow = mainWindow
|
this.mainWindow = mainWindow;
|
||||||
autoUpdater.checkForUpdates().catch(err => {
|
autoUpdater.checkForUpdates().catch((err) => {
|
||||||
console.log('网络连接问题', err)
|
console.log("网络连接问题", err);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 退出并安装
|
// 退出并安装
|
||||||
quitAndInstall() {
|
quitAndInstall() {
|
||||||
autoUpdater.quitAndInstall()
|
autoUpdater.quitAndInstall();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Update
|
export default Update;
|
||||||
|
@ -17,10 +17,10 @@ const ipcMainHandle: IpcMainHandle = {
|
|||||||
...usePrintHandle(),
|
...usePrintHandle(),
|
||||||
...useServerHandle(),
|
...useServerHandle(),
|
||||||
...useUpdateHandle(),
|
...useUpdateHandle(),
|
||||||
}
|
};
|
||||||
|
|
||||||
export function installIpcMain() {
|
export function installIpcMain() {
|
||||||
Object.entries(ipcMainHandle).forEach(([ipcChannelName, ipcListener]) => {
|
Object.entries(ipcMainHandle).forEach(([ipcChannelName, ipcListener]) => {
|
||||||
ipcMain.handle(ipcChannelName, ipcListener)
|
ipcMain.handle(ipcChannelName, ipcListener);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,22 @@
|
|||||||
import {installIpcMain} from "./ipcMain";
|
import {installIpcMain} from "./ipcMain";
|
||||||
import {IsUseSysTitle, openDevTools, UseStartupChart} from "../config/const";
|
import {IsUseSysTitle, openDevTools, UseStartupChart} from "../config/const";
|
||||||
import menuconfig from "../hook/menuHook";
|
import menuconfig from "../hook/menuHook";
|
||||||
import {app, BrowserWindow, Menu, dialog} from "electron";
|
import {app, BrowserWindow, Menu} from "electron";
|
||||||
import {winURL, loadingURL} from "../config/staticPath";
|
import {loadingURL, winURL} from "../config/staticPath";
|
||||||
import {mainWindowConfig} from "../config/windowsConfig";
|
import {mainWindowConfig} from "../config/windowsConfig";
|
||||||
import hotkeysHook from "../hook/hotkeysHook";
|
import hotkeysHook from "../hook/hotkeysHook";
|
||||||
import {useProcessException} from "../hook/exceptionHook";
|
import {useProcessException} from "../hook/exceptionHook";
|
||||||
import {openDevTools as openDevToolsFunc} from "../hook/devToolHook";
|
import {openDevTools as openDevToolsFunc} from "../hook/devToolHook";
|
||||||
|
|
||||||
|
import path from "path";
|
||||||
|
import * as fs from "node:fs";
|
||||||
|
|
||||||
|
const sourceFile = app.isPackaged ? path.resolve(app.getAppPath(), '../../debug.txt') : path.join(__dirname, '../../../debug.txt');
|
||||||
|
let isDebug = false;
|
||||||
|
if (fs.existsSync(sourceFile)) {
|
||||||
|
isDebug = true;
|
||||||
|
}
|
||||||
|
|
||||||
class MainInit {
|
class MainInit {
|
||||||
public winURL: string = "";
|
public winURL: string = "";
|
||||||
public shartURL: string = "";
|
public shartURL: string = "";
|
||||||
@ -18,7 +27,7 @@ class MainInit {
|
|||||||
this.winURL = winURL;
|
this.winURL = winURL;
|
||||||
this.shartURL = loadingURL;
|
this.shartURL = loadingURL;
|
||||||
// 开发环境或者设置了打开开发者模式时
|
// 开发环境或者设置了打开开发者模式时
|
||||||
if (process.env.NODE_ENV === "development" || openDevTools) {
|
if (process.env.NODE_ENV === "development" || openDevTools || isDebug) {
|
||||||
menuconfig.push({
|
menuconfig.push({
|
||||||
label: "开发者设置",
|
label: "开发者设置",
|
||||||
submenu: [
|
submenu: [
|
||||||
@ -34,7 +43,6 @@ class MainInit {
|
|||||||
installIpcMain();
|
installIpcMain();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 主窗口函数
|
|
||||||
createMainWindow() {
|
createMainWindow() {
|
||||||
this.mainWindow = new BrowserWindow({
|
this.mainWindow = new BrowserWindow({
|
||||||
titleBarStyle: IsUseSysTitle ? "default" : "hidden",
|
titleBarStyle: IsUseSysTitle ? "default" : "hidden",
|
||||||
@ -52,7 +60,7 @@ class MainInit {
|
|||||||
this.mainWindow.once("ready-to-show", () => {
|
this.mainWindow.once("ready-to-show", () => {
|
||||||
this.mainWindow.show();
|
this.mainWindow.show();
|
||||||
// 开发模式下自动开启devtools
|
// 开发模式下自动开启devtools
|
||||||
if (process.env.NODE_ENV === "development") {
|
if (process.env.NODE_ENV === "development" || isDebug) {
|
||||||
openDevToolsFunc(this.mainWindow);
|
openDevToolsFunc(this.mainWindow);
|
||||||
}
|
}
|
||||||
if (UseStartupChart) this.loadWindow.destroy();
|
if (UseStartupChart) this.loadWindow.destroy();
|
||||||
|
@ -9,7 +9,9 @@ contextBridge.exposeInMainWorld("ipcRenderer", {
|
|||||||
once: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void) =>
|
once: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void) =>
|
||||||
ipcRenderer.once(channel, listener),
|
ipcRenderer.once(channel, listener),
|
||||||
invoke: (channel: string, args: any) => ipcRenderer.invoke(channel, args),
|
invoke: (channel: string, args: any) => ipcRenderer.invoke(channel, args),
|
||||||
removeAllListeners: (channel: string) => ipcRenderer.removeAllListeners(channel)
|
removeAllListeners: (channel: string) => ipcRenderer.removeAllListeners(channel),
|
||||||
|
removeListener: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void) =>
|
||||||
|
ipcRenderer.removeListener(channel, listener)
|
||||||
});
|
});
|
||||||
|
|
||||||
function platform() {
|
function platform() {
|
||||||
@ -24,9 +26,10 @@ contextBridge.exposeInMainWorld("systemInfo", {
|
|||||||
platform: platform(),
|
platform: platform(),
|
||||||
release: release,
|
release: release,
|
||||||
arch: arch,
|
arch: arch,
|
||||||
|
vue: () => pkg.dependencies.vue,
|
||||||
node: () => process.versions.node,
|
node: () => process.versions.node,
|
||||||
chrome: () => process.versions.chrome,
|
chrome: () => process.versions.chrome,
|
||||||
electron: () => process.versions.electron
|
electron: () => process.versions.electron
|
||||||
})
|
})
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld("pkgInfo", pkg)
|
contextBridge.exposeInMainWorld("pkgInfo", pkg)
|
||||||
|
@ -6,11 +6,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from "vue";
|
|
||||||
import { i18n } from "./i18n";
|
|
||||||
import TitleBar from "./components/common/TitleBar.vue";
|
import TitleBar from "./components/common/TitleBar.vue";
|
||||||
|
|
||||||
const i18nt = computed(() => i18n.global.messages.value[i18n.global.locale.value].$el);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
import {MenuTypeEnum} from "@themeDefault/enums/MenuTypeEnum";
|
||||||
// 菜单基础URL
|
// 菜单基础URL
|
||||||
const MENU_BASE_URL = "/api/v1/menus";
|
const MENU_BASE_URL = "/api/v1/menus";
|
||||||
|
|
||||||
@ -101,8 +102,6 @@ class MenuAPI {
|
|||||||
|
|
||||||
export default MenuAPI;
|
export default MenuAPI;
|
||||||
|
|
||||||
import { MenuTypeEnum } from "@theme/enums/MenuTypeEnum";
|
|
||||||
|
|
||||||
/** 菜单查询参数 */
|
/** 菜单查询参数 */
|
||||||
export interface MenuQuery {
|
export interface MenuQuery {
|
||||||
/** 搜索关键字 */
|
/** 搜索关键字 */
|
||||||
|
@ -26,17 +26,19 @@ let tips = ref(
|
|||||||
{name: t("about.language"), value: t("about.languageValue")},
|
{name: t("about.language"), value: t("about.languageValue")},
|
||||||
{name: t("about.currentPagePath"), value: path},
|
{name: t("about.currentPagePath"), value: path},
|
||||||
{name: t("about.currentPageName"), value: name},
|
{name: t("about.currentPageName"), value: name},
|
||||||
|
{name: t("about.appVersion"), value: pkgInfo.version},
|
||||||
{
|
{
|
||||||
name: t("about.vueVersion"),
|
name: t("about.vueVersion"),
|
||||||
value:
|
value:
|
||||||
process.env.NODE_ENV === "development"
|
process.env.NODE_ENV === "development"
|
||||||
? pkg.version
|
? systemInfo.vue()
|
||||||
: "不可见",
|
: "不可见",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: t("about.electronVersion"),
|
name: t("about.electronVersion"),
|
||||||
value: systemInfo.electron() || "未获取",
|
value: systemInfo.electron() || "未获取",
|
||||||
},
|
},
|
||||||
|
{name: t("about.chromeV8Version"), value: systemInfo.chrome() || "未获取"},
|
||||||
{
|
{
|
||||||
name: t("about.nodeVersion"),
|
name: t("about.nodeVersion"),
|
||||||
value: systemInfo.node() || "未获取",
|
value: systemInfo.node() || "未获取",
|
||||||
|
@ -24,11 +24,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {onUnmounted, ref, watch, Ref} from "vue";
|
import {ref, Ref, watch} from "vue";
|
||||||
import {IpcChannel, invoke, vueListen} from "@/utils/ipcRenderer";
|
import {invoke, IpcChannel, vueListen} from "@/utils/ipcRenderer";
|
||||||
|
|
||||||
// const process = window.process;
|
const process = window.process;
|
||||||
const platform = process.platform;
|
const platform = window.systemInfo.platform;
|
||||||
const shell = window.shell;
|
const shell = window.shell;
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: Boolean,
|
modelValue: Boolean,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import type { App } from 'vue'
|
import type {App} from 'vue';
|
||||||
import { nextTick } from "vue"
|
import {nextTick} from "vue";
|
||||||
|
|
||||||
export const errorHandler = (App: App<Element>) => {
|
export const errorHandler = (App: App<Element>) => {
|
||||||
App.config.errorHandler = (err, vm, info) => {
|
App.config.errorHandler = (err, vm, info) => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
@ -16,5 +17,4 @@ export const errorHandler = (App: App<Element>) => {
|
|||||||
}
|
}
|
||||||
}).then(r =>{})
|
}).then(r =>{})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
11
src/renderer/fixTypes/auto-imports.d.ts
vendored
11
src/renderer/fixTypes/auto-imports.d.ts
vendored
@ -76,6 +76,7 @@ declare global {
|
|||||||
const onStartTyping: typeof import('@vueuse/core')['onStartTyping']
|
const onStartTyping: typeof import('@vueuse/core')['onStartTyping']
|
||||||
const onUnmounted: typeof import('vue')['onUnmounted']
|
const onUnmounted: typeof import('vue')['onUnmounted']
|
||||||
const onUpdated: typeof import('vue')['onUpdated']
|
const onUpdated: typeof import('vue')['onUpdated']
|
||||||
|
const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
|
||||||
const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
|
const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
|
||||||
const provide: typeof import('vue')['provide']
|
const provide: typeof import('vue')['provide']
|
||||||
const reactify: typeof import('@vueuse/core')['reactify']
|
const reactify: typeof import('@vueuse/core')['reactify']
|
||||||
@ -183,6 +184,7 @@ declare global {
|
|||||||
const useGamepad: typeof import('@vueuse/core')['useGamepad']
|
const useGamepad: typeof import('@vueuse/core')['useGamepad']
|
||||||
const useGeolocation: typeof import('@vueuse/core')['useGeolocation']
|
const useGeolocation: typeof import('@vueuse/core')['useGeolocation']
|
||||||
const useI18n: typeof import('vue-i18n')['useI18n']
|
const useI18n: typeof import('vue-i18n')['useI18n']
|
||||||
|
const useId: typeof import('vue')['useId']
|
||||||
const useIdle: typeof import('@vueuse/core')['useIdle']
|
const useIdle: typeof import('@vueuse/core')['useIdle']
|
||||||
const useImage: typeof import('@vueuse/core')['useImage']
|
const useImage: typeof import('@vueuse/core')['useImage']
|
||||||
const useInfiniteScroll: typeof import('@vueuse/core')['useInfiniteScroll']
|
const useInfiniteScroll: typeof import('@vueuse/core')['useInfiniteScroll']
|
||||||
@ -199,6 +201,7 @@ declare global {
|
|||||||
const useMediaQuery: typeof import('@vueuse/core')['useMediaQuery']
|
const useMediaQuery: typeof import('@vueuse/core')['useMediaQuery']
|
||||||
const useMemoize: typeof import('@vueuse/core')['useMemoize']
|
const useMemoize: typeof import('@vueuse/core')['useMemoize']
|
||||||
const useMemory: typeof import('@vueuse/core')['useMemory']
|
const useMemory: typeof import('@vueuse/core')['useMemory']
|
||||||
|
const useModel: typeof import('vue')['useModel']
|
||||||
const useMounted: typeof import('@vueuse/core')['useMounted']
|
const useMounted: typeof import('@vueuse/core')['useMounted']
|
||||||
const useMouse: typeof import('@vueuse/core')['useMouse']
|
const useMouse: typeof import('@vueuse/core')['useMouse']
|
||||||
const useMouseInElement: typeof import('@vueuse/core')['useMouseInElement']
|
const useMouseInElement: typeof import('@vueuse/core')['useMouseInElement']
|
||||||
@ -244,6 +247,7 @@ declare global {
|
|||||||
const useStyleTag: typeof import('@vueuse/core')['useStyleTag']
|
const useStyleTag: typeof import('@vueuse/core')['useStyleTag']
|
||||||
const useSupported: typeof import('@vueuse/core')['useSupported']
|
const useSupported: typeof import('@vueuse/core')['useSupported']
|
||||||
const useSwipe: typeof import('@vueuse/core')['useSwipe']
|
const useSwipe: typeof import('@vueuse/core')['useSwipe']
|
||||||
|
const useTemplateRef: typeof import('vue')['useTemplateRef']
|
||||||
const useTemplateRefsList: typeof import('@vueuse/core')['useTemplateRefsList']
|
const useTemplateRefsList: typeof import('@vueuse/core')['useTemplateRefsList']
|
||||||
const useTextDirection: typeof import('@vueuse/core')['useTextDirection']
|
const useTextDirection: typeof import('@vueuse/core')['useTextDirection']
|
||||||
const useTextSelection: typeof import('@vueuse/core')['useTextSelection']
|
const useTextSelection: typeof import('@vueuse/core')['useTextSelection']
|
||||||
@ -297,7 +301,8 @@ declare global {
|
|||||||
import('vue')
|
import('vue')
|
||||||
}
|
}
|
||||||
// for vue template auto import
|
// for vue template auto import
|
||||||
import { UnwrapRef } from 'vue'
|
import {UnwrapRef} from 'vue'
|
||||||
|
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
interface GlobalComponents {}
|
interface GlobalComponents {}
|
||||||
interface ComponentCustomProperties {
|
interface ComponentCustomProperties {
|
||||||
@ -367,6 +372,7 @@ declare module 'vue' {
|
|||||||
readonly onStartTyping: UnwrapRef<typeof import('@vueuse/core')['onStartTyping']>
|
readonly onStartTyping: UnwrapRef<typeof import('@vueuse/core')['onStartTyping']>
|
||||||
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
|
readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
|
||||||
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||||
|
readonly onWatcherCleanup: UnwrapRef<typeof import('vue')['onWatcherCleanup']>
|
||||||
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
|
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
|
||||||
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||||
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
|
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
|
||||||
@ -474,6 +480,7 @@ declare module 'vue' {
|
|||||||
readonly useGamepad: UnwrapRef<typeof import('@vueuse/core')['useGamepad']>
|
readonly useGamepad: UnwrapRef<typeof import('@vueuse/core')['useGamepad']>
|
||||||
readonly useGeolocation: UnwrapRef<typeof import('@vueuse/core')['useGeolocation']>
|
readonly useGeolocation: UnwrapRef<typeof import('@vueuse/core')['useGeolocation']>
|
||||||
readonly useI18n: UnwrapRef<typeof import('vue-i18n')['useI18n']>
|
readonly useI18n: UnwrapRef<typeof import('vue-i18n')['useI18n']>
|
||||||
|
readonly useId: UnwrapRef<typeof import('vue')['useId']>
|
||||||
readonly useIdle: UnwrapRef<typeof import('@vueuse/core')['useIdle']>
|
readonly useIdle: UnwrapRef<typeof import('@vueuse/core')['useIdle']>
|
||||||
readonly useImage: UnwrapRef<typeof import('@vueuse/core')['useImage']>
|
readonly useImage: UnwrapRef<typeof import('@vueuse/core')['useImage']>
|
||||||
readonly useInfiniteScroll: UnwrapRef<typeof import('@vueuse/core')['useInfiniteScroll']>
|
readonly useInfiniteScroll: UnwrapRef<typeof import('@vueuse/core')['useInfiniteScroll']>
|
||||||
@ -490,6 +497,7 @@ declare module 'vue' {
|
|||||||
readonly useMediaQuery: UnwrapRef<typeof import('@vueuse/core')['useMediaQuery']>
|
readonly useMediaQuery: UnwrapRef<typeof import('@vueuse/core')['useMediaQuery']>
|
||||||
readonly useMemoize: UnwrapRef<typeof import('@vueuse/core')['useMemoize']>
|
readonly useMemoize: UnwrapRef<typeof import('@vueuse/core')['useMemoize']>
|
||||||
readonly useMemory: UnwrapRef<typeof import('@vueuse/core')['useMemory']>
|
readonly useMemory: UnwrapRef<typeof import('@vueuse/core')['useMemory']>
|
||||||
|
readonly useModel: UnwrapRef<typeof import('vue')['useModel']>
|
||||||
readonly useMounted: UnwrapRef<typeof import('@vueuse/core')['useMounted']>
|
readonly useMounted: UnwrapRef<typeof import('@vueuse/core')['useMounted']>
|
||||||
readonly useMouse: UnwrapRef<typeof import('@vueuse/core')['useMouse']>
|
readonly useMouse: UnwrapRef<typeof import('@vueuse/core')['useMouse']>
|
||||||
readonly useMouseInElement: UnwrapRef<typeof import('@vueuse/core')['useMouseInElement']>
|
readonly useMouseInElement: UnwrapRef<typeof import('@vueuse/core')['useMouseInElement']>
|
||||||
@ -535,6 +543,7 @@ declare module 'vue' {
|
|||||||
readonly useStyleTag: UnwrapRef<typeof import('@vueuse/core')['useStyleTag']>
|
readonly useStyleTag: UnwrapRef<typeof import('@vueuse/core')['useStyleTag']>
|
||||||
readonly useSupported: UnwrapRef<typeof import('@vueuse/core')['useSupported']>
|
readonly useSupported: UnwrapRef<typeof import('@vueuse/core')['useSupported']>
|
||||||
readonly useSwipe: UnwrapRef<typeof import('@vueuse/core')['useSwipe']>
|
readonly useSwipe: UnwrapRef<typeof import('@vueuse/core')['useSwipe']>
|
||||||
|
readonly useTemplateRef: UnwrapRef<typeof import('vue')['useTemplateRef']>
|
||||||
readonly useTemplateRefsList: UnwrapRef<typeof import('@vueuse/core')['useTemplateRefsList']>
|
readonly useTemplateRefsList: UnwrapRef<typeof import('@vueuse/core')['useTemplateRefsList']>
|
||||||
readonly useTextDirection: UnwrapRef<typeof import('@vueuse/core')['useTextDirection']>
|
readonly useTextDirection: UnwrapRef<typeof import('@vueuse/core')['useTextDirection']>
|
||||||
readonly useTextSelection: UnwrapRef<typeof import('@vueuse/core')['useTextSelection']>
|
readonly useTextSelection: UnwrapRef<typeof import('@vueuse/core')['useTextSelection']>
|
||||||
|
@ -17,8 +17,10 @@ export const lang = {
|
|||||||
languageValue: "中文简体",
|
languageValue: "中文简体",
|
||||||
currentPagePath: "当前页面路径:",
|
currentPagePath: "当前页面路径:",
|
||||||
currentPageName: "当前页面名称:",
|
currentPageName: "当前页面名称:",
|
||||||
|
appVersion: "软件版本:",
|
||||||
vueVersion: "Vue版本:",
|
vueVersion: "Vue版本:",
|
||||||
electronVersion: "Electron版本:",
|
electronVersion: "Electron版本:",
|
||||||
|
chromeV8Version: "V8版本:",
|
||||||
nodeVersion: "Node版本:",
|
nodeVersion: "Node版本:",
|
||||||
systemPlatform: "系统平台:",
|
systemPlatform: "系统平台:",
|
||||||
systemVersion: "系统版本:",
|
systemVersion: "系统版本:",
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8"/>
|
||||||
<link href="/favicon.ico" rel="icon"/>
|
|
||||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||||
<title>Hi-Sass-Frame</title>
|
<title>Hi-Sass-Frame</title>
|
||||||
</head>
|
</head>
|
||||||
@ -11,7 +10,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script>
|
<script>
|
||||||
localStorage.setItem("_LOCAL_THEME_", 'notheme')
|
localStorage.setItem("_LOCAL_THEME_", 'default')
|
||||||
const _LOCAL_THEME_ = localStorage.getItem("_LOCAL_THEME_"); //notheme,default,……
|
const _LOCAL_THEME_ = localStorage.getItem("_LOCAL_THEME_"); //notheme,default,……
|
||||||
let jsFile;
|
let jsFile;
|
||||||
switch (_LOCAL_THEME_) {
|
switch (_LOCAL_THEME_) {
|
||||||
@ -31,7 +30,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function importModule() {
|
function importModule() {
|
||||||
var script = document.createElement('script');
|
let script = document.createElement('script');
|
||||||
script.type = 'module';
|
script.type = 'module';
|
||||||
script.src = jsFile; // 模块文件路径
|
script.src = jsFile; // 模块文件路径
|
||||||
document.body.appendChild(script);
|
document.body.appendChild(script);
|
||||||
|
@ -9,8 +9,8 @@ import {useStoreUser} from "@store/user"
|
|||||||
* 路由拦截模式,白名单whiteList 或者 登陆页needLogin 两种模式,后者目录未配置
|
* 路由拦截模式,白名单whiteList 或者 登陆页needLogin 两种模式,后者目录未配置
|
||||||
* 建议采用白名单方式,可以更方便地应对多种角色权限的配置
|
* 建议采用白名单方式,可以更方便地应对多种角色权限的配置
|
||||||
*/
|
*/
|
||||||
// const whiteList = ["/", '/login', '/landing', '/dashboard'] // 不重定向白名单
|
const whiteList = ["/", '/login', '/landing', '/dashboard'] // 不重定向白名单
|
||||||
const whiteList = ["/", '/login'] // 不重定向白名单
|
// const whiteList = ["/", '/login'] // 不重定向白名单
|
||||||
// const needLogin = ['/LandingPage']; //需要登陆的页面,未写相关功能,暂不应用
|
// const needLogin = ['/LandingPage']; //需要登陆的页面,未写相关功能,暂不应用
|
||||||
|
|
||||||
const useInterceptor = function () {
|
const useInterceptor = function () {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import {createApp} from "vue";
|
import {createApp} from "vue";
|
||||||
import App from "./App.vue";
|
import App from "./App.vue";
|
||||||
|
|
||||||
|
import "@themeGeeker/styles/var.scss";
|
||||||
// reset style sheet
|
// reset style sheet
|
||||||
import "@themeGeeker/styles/reset.scss";
|
import "@themeGeeker/styles/reset.scss";
|
||||||
// CSS common style sheet
|
// CSS common style sheet
|
||||||
|
@ -15,4 +15,6 @@ import {i18n} from "@/i18n";
|
|||||||
const i18nt = computed(() => i18n.global.messages.value[i18n.global.locale.value].$el);
|
const i18nt = computed(() => i18n.global.messages.value[i18n.global.locale.value].$el);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
@ -27,8 +27,8 @@ const paths = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"/dashboard": {
|
"/": {
|
||||||
path: "/dashboard",
|
path: "/",
|
||||||
component: () => import("@/themes/_single/views/LandingPage.vue"),
|
component: () => import("@/themes/_single/views/LandingPage.vue"),
|
||||||
// 用于 keep-alive 功能,需要与 SFC 中自动推导或显式声明的组件名称一致
|
// 用于 keep-alive 功能,需要与 SFC 中自动推导或显式声明的组件名称一致
|
||||||
// 参考文档: https://cn.vuejs.org/guide/built-ins/keep-alive.html#include-exclude
|
// 参考文档: https://cn.vuejs.org/guide/built-ins/keep-alive.html#include-exclude
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useAppStore, useSettingsStore } from "@themeDefault/store";
|
import {useAppStore, useSettingsStore} from "@themeDefault/store";
|
||||||
import defaultSettings from "@themeDefault/settings";
|
import defaultSettings from "@themeDefault/settings";
|
||||||
import { ThemeEnum } from "@themeDefault/enums/ThemeEnum";
|
import {ThemeEnum} from "@themeDefault/enums/ThemeEnum";
|
||||||
import { SizeEnum } from "@themeDefault/enums/SizeEnum";
|
import {SizeEnum} from "@themeDefault/enums/SizeEnum";
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
const settingsStore = useSettingsStore();
|
const settingsStore = useSettingsStore();
|
||||||
@ -35,3 +35,7 @@ const fontColor = computed(() => {
|
|||||||
: "rgba(0, 0, 0, .15)";
|
: "rgba(0, 0, 0, .15)";
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
//@import "styles/variables.scss";
|
||||||
|
//@import "styles/variables.module.scss";
|
||||||
|
</style>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
@import "./variables.scss";
|
||||||
/* stylelint-disable property-no-unknown */
|
/* stylelint-disable property-no-unknown */
|
||||||
:export {
|
:export {
|
||||||
sidebar-width: $sidebar-width;
|
sidebar-width: $sidebar-width;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
src="https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5"
|
src="https://www.apifox.cn/apidoc/shared-195e783f-4d85-4235-a038-eec696de4ea5"
|
||||||
width="100%"
|
width="100%"
|
||||||
height="100%"
|
height="100%"
|
||||||
frameborder="0"
|
|
||||||
></iframe>
|
></iframe>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
src="http://vapi.youlai.tech/doc.html"
|
src="http://vapi.youlai.tech/doc.html"
|
||||||
width="100%"
|
width="100%"
|
||||||
height="100%"
|
height="100%"
|
||||||
frameborder="0"
|
|
||||||
></iframe>
|
></iframe>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
src="http://vapi.youlai.tech/swagger-ui.html"
|
src="http://vapi.youlai.tech/swagger-ui.html"
|
||||||
width="100%"
|
width="100%"
|
||||||
height="100%"
|
height="100%"
|
||||||
frameborder="0"
|
|
||||||
></iframe>
|
></iframe>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -15,20 +15,20 @@ function message() {
|
|||||||
<div class="wscn-http404-container">
|
<div class="wscn-http404-container">
|
||||||
<div class="wscn-http404">
|
<div class="wscn-http404">
|
||||||
<div class="pic-404">
|
<div class="pic-404">
|
||||||
<img class="pic-404__parent" src="@/assets/images/404.png" alt="404" />
|
<img alt="404" class="pic-404__parent" src="@themeDefault/assets/images/404.png"/>
|
||||||
<img
|
<img
|
||||||
class="pic-404__child left"
|
class="pic-404__child left"
|
||||||
src="@/assets/images/404_cloud.png"
|
src="@themeDefault/assets/images/404_cloud.png"
|
||||||
alt="404"
|
alt="404"
|
||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
class="pic-404__child mid"
|
class="pic-404__child mid"
|
||||||
src="@/assets/images/404_cloud.png"
|
src="@themeDefault/assets/images/404_cloud.png"
|
||||||
alt="404"
|
alt="404"
|
||||||
/>
|
/>
|
||||||
<img
|
<img
|
||||||
class="pic-404__child right"
|
class="pic-404__child right"
|
||||||
src="@/assets/images/404_cloud.png"
|
src="@themeDefault/assets/images/404_cloud.png"
|
||||||
alt="404"
|
alt="404"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
"title": "数据大屏",
|
"title": "数据大屏",
|
||||||
"isLink": "",
|
"isLink": "",
|
||||||
"isHide": false,
|
"isHide": false,
|
||||||
"isFull": true,
|
"isFull": false,
|
||||||
"isAffix": false,
|
"isAffix": false,
|
||||||
"isKeepAlive": true
|
"isKeepAlive": true
|
||||||
}
|
}
|
||||||
@ -1025,7 +1025,73 @@
|
|||||||
"isAffix": false,
|
"isAffix": false,
|
||||||
"isKeepAlive": true
|
"isKeepAlive": true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"name": "/function",
|
||||||
|
"path": "/function",
|
||||||
|
"component": "Layout",
|
||||||
|
"redirect": "/Layout",
|
||||||
|
"meta": {
|
||||||
|
"icon": "Menu",
|
||||||
|
"title": "功能演示",
|
||||||
|
"hidden": false,
|
||||||
|
"alwaysShow": false,
|
||||||
|
"params": null
|
||||||
|
},
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"path": "icon-demo",
|
||||||
|
"component": "demo/icons",
|
||||||
|
"name": "IconDemo",
|
||||||
|
"meta": {
|
||||||
|
"title": "Icons",
|
||||||
|
"icon": "Notification",
|
||||||
|
"hidden": false,
|
||||||
|
"keepAlive": true,
|
||||||
|
"alwaysShow": false,
|
||||||
|
"params": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "x/function/websocket",
|
||||||
|
"component": "demo/websocket",
|
||||||
|
"name": "/function/websocket",
|
||||||
|
"meta": {
|
||||||
|
"title": "Websocket",
|
||||||
|
"icon": "Loading",
|
||||||
|
"hidden": false,
|
||||||
|
"keepAlive": true,
|
||||||
|
"alwaysShow": false,
|
||||||
|
"params": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "/sheet/univer",
|
||||||
|
"component": "@themeDefault/views/demo/sheet",
|
||||||
|
"name": "/sheet/univer",
|
||||||
|
"meta": {
|
||||||
|
"title": "univer表格",
|
||||||
|
"icon": "Histogram",
|
||||||
|
"hidden": false,
|
||||||
|
"keepAlive": true,
|
||||||
|
"alwaysShow": false,
|
||||||
|
"params": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "other/:id",
|
||||||
|
"component": "demo/other",
|
||||||
|
"name": "Other/:id",
|
||||||
|
"meta": {
|
||||||
|
"title": "敬请期待...",
|
||||||
|
"icon": "Grid",
|
||||||
|
"hidden": false,
|
||||||
|
"alwaysShow": false,
|
||||||
|
"params": null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"msg": "成功"
|
"msg": "成功"
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { createRouter, createWebHashHistory, createWebHistory } from "vue-router";
|
import {createRouter, createWebHashHistory, createWebHistory} from "vue-router";
|
||||||
import { useUserStore } from "@themeGeeker/stores/modules/user";
|
import {useUserStore} from "@themeGeeker/stores/modules/user";
|
||||||
import { useAuthStore } from "@themeGeeker/stores/modules/auth";
|
import {useAuthStore} from "@themeGeeker/stores/modules/auth";
|
||||||
import { LOGIN_URL, ROUTER_WHITE_LIST } from "@themeGeeker/config";
|
import {LOGIN_URL, ROUTER_WHITE_LIST} from "@themeGeeker/config";
|
||||||
import { initDynamicRouter } from "@themeGeeker/routers/modules/dynamicRouter";
|
import {initDynamicRouter} from "@themeGeeker/routers/modules/dynamicRouter";
|
||||||
import { staticRouter, errorRouter } from "@themeGeeker/routers/modules/staticRouter";
|
import {errorRouter, staticRouter} from "@themeGeeker/routers/modules/staticRouter";
|
||||||
import NProgress from "@themeGeeker/config/nprogress";
|
import NProgress from "@themeGeeker/config/nprogress";
|
||||||
|
import Performance from '@/tools/performance'
|
||||||
|
|
||||||
// const mode = import.meta.env.VITE_ROUTER_MODE;
|
// const mode = import.meta.env.VITE_ROUTER_MODE;
|
||||||
const mode = process.env.VITE_ROUTER_MODE;
|
const mode = process.env.VITE_ROUTER_MODE;
|
||||||
@ -43,7 +44,7 @@ const router = createRouter({
|
|||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
|
let end = Performance.startExecute(`${from.path} => ${to.path} 路由耗时`); /// 路由性能监控
|
||||||
// 1.NProgress 开始
|
// 1.NProgress 开始
|
||||||
NProgress.start();
|
NProgress.start();
|
||||||
|
|
||||||
@ -75,6 +76,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
|
|
||||||
// 8.正常访问页面
|
// 8.正常访问页面
|
||||||
next();
|
next();
|
||||||
|
end();
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="cure">
|
<script setup lang="ts" name="cure">
|
||||||
import { ECOption } from "@themeGeeker/components/ECharts/config";
|
import {ECOption} from "@themeGeeker/components/ECharts/config";
|
||||||
import ECharts from "@themeGeeker/components/ECharts/index.vue";
|
import ECharts from "@themeGeeker/components/ECharts/index.vue";
|
||||||
|
|
||||||
const curveData = [
|
const curveData = [
|
||||||
@ -84,7 +84,6 @@ const option: ECOption = {
|
|||||||
color: "#a1a1a1",
|
color: "#a1a1a1",
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
formatter: function (name: string) {
|
formatter: function (name: string) {
|
||||||
undefined;
|
|
||||||
return name.length > 8 ? name.slice(0, 8) + "..." : name;
|
return name.length > 8 ? name.slice(0, 8) + "..." : name;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-attachment: fixed;
|
background-attachment: fixed;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-size: 100% 100%;
|
//background-size: 100% 100%;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
.dataScreen-content {
|
.dataScreen-content {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
<script lang="ts" name="home" setup>
|
<script lang="ts" name="home" setup>
|
||||||
//与主进程通信
|
//与主进程通信
|
||||||
import {invoke, IpcChannel} from "@/utils/ipcRenderer";
|
|
||||||
//测试让主进程添加一个文件
|
//测试让主进程添加一个文件
|
||||||
// const testdata = "我是测试要添加的内容"+Date.now();
|
// const testdata = "我是测试要添加的内容"+Date.now();
|
||||||
// console.log("准备写入的内容:",testdata);
|
// console.log("准备写入的内容:",testdata);
|
||||||
@ -18,11 +17,11 @@ import {invoke, IpcChannel} from "@/utils/ipcRenderer";
|
|||||||
// });
|
// });
|
||||||
|
|
||||||
//测试操作sqlite数据库
|
//测试操作sqlite数据库
|
||||||
const sql = "SELECT name FROM sqlite_master WHERE type='table' AND name=?";
|
// const sql = "SELECT name FROM sqlite_master WHERE type='table' AND name=?";
|
||||||
const params = ['testSqlite'];
|
// const params = ['testSqlite'];
|
||||||
invoke(IpcChannel.SqlRun, {sql: sql, params: params}).then((r) => {
|
// invoke(IpcChannel.SqlRun, {sql: sql, params: params}).then((r) => {
|
||||||
console.log('sqlite数据库操作结果:', r);
|
// console.log('sqlite数据库操作结果:', r);
|
||||||
})
|
// })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="card content-box">
|
<div class="card content-box">
|
||||||
<iframe src="https://www.hiluker.cn/" frameborder="0" class="full-iframe"></iframe>
|
<iframe class="full-iframe" src="https://www.hiluker.cn/"></iframe>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 550px;
|
min-height: 550px;
|
||||||
background-color: #eeeeee;
|
background-color: #eeeeee;
|
||||||
background-image: url("@/assets/images/login_bg.svg");
|
background-image: url("../../assets/images/login_bg.svg");
|
||||||
background-size: 100% 100%;
|
//background-size: 100% 100%;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
.login-box {
|
.login-box {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
8
src/renderer/types/global.d.ts
vendored
8
src/renderer/types/global.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import { ipcRenderer, shell } from "electron";
|
import {ipcRenderer, shell} from "electron";
|
||||||
|
|
||||||
interface AnyObject {
|
interface AnyObject {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
@ -12,6 +12,7 @@ interface memoryInfo {
|
|||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
|
pkgInfo: any;
|
||||||
performance: {
|
performance: {
|
||||||
memory: memoryInfo;
|
memory: memoryInfo;
|
||||||
};
|
};
|
||||||
@ -22,7 +23,10 @@ declare global {
|
|||||||
arch: string;
|
arch: string;
|
||||||
nodeVersion: string;
|
nodeVersion: string;
|
||||||
electronVersion: string;
|
electronVersion: string;
|
||||||
};
|
node: () => void;
|
||||||
|
electron: () => void;
|
||||||
|
chrome: () => void;
|
||||||
|
};
|
||||||
shell: typeof shell;
|
shell: typeof shell;
|
||||||
crash: {
|
crash: {
|
||||||
start: () => void;
|
start: () => void;
|
||||||
|
@ -111,16 +111,16 @@ import {ProgressInfo} from "electron-updater";
|
|||||||
const storeTemplate = useStoreTest();
|
const storeTemplate = useStoreTest();
|
||||||
|
|
||||||
//测试让主进程添加一个文件
|
//测试让主进程添加一个文件
|
||||||
// const testdata = "我是测试要添加的内容"+Date.now();
|
const testdata = "我是测试要添加的内容" + Date.now();
|
||||||
// console.log("准备写入的内容:",testdata);
|
console.log("准备写入的内容:", testdata);
|
||||||
// invoke(IpcChannel.FileWrite,{filename:"test-453.txt",data:testdata}).then((r) => {
|
invoke(IpcChannel.FileWrite, {filename: "test-453.txt", data: testdata}).then((r) => {
|
||||||
// console.log('文件添加结果:',r);
|
console.log('文件添加结果:', r);
|
||||||
// invoke(IpcChannel.FileRead,{filename:"test-453.txt"}).then((r)=>{
|
invoke(IpcChannel.FileRead, {filename: "test-453.txt"}).then((r) => {
|
||||||
// console.log("文件读取结果:",r.data);
|
console.log("文件读取结果:", r.data);
|
||||||
// })
|
})
|
||||||
// });
|
});
|
||||||
|
|
||||||
//测试操作sqlite数据库
|
// 测试操作sqlite数据库
|
||||||
const sql = "SELECT name FROM sqlite_master WHERE type='table' AND name=?";
|
const sql = "SELECT name FROM sqlite_master WHERE type='table' AND name=?";
|
||||||
const params = ['testSqlite'];
|
const params = ['testSqlite'];
|
||||||
let sqliteDemoRes: Ref<string> = ref("");
|
let sqliteDemoRes: Ref<string> = ref("");
|
||||||
@ -196,8 +196,11 @@ function handleCurrentChange(val: number) {
|
|||||||
elCPage.value = val;
|
elCPage.value = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模拟进程崩溃
|
||||||
|
*/
|
||||||
function crash() {
|
function crash() {
|
||||||
process.crash();
|
window.crash.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
function openNewWin() {
|
function openNewWin() {
|
||||||
|
@ -71,8 +71,9 @@
|
|||||||
"lib": [
|
"lib": [
|
||||||
"esnext",
|
"esnext",
|
||||||
"dom"
|
"dom"
|
||||||
]
|
],
|
||||||
//代码运行时包含的库 es2018
|
//代码运行时包含的库 es2018
|
||||||
|
"jsx": "react"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user