mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-27 07:40:51 +00:00
fix: 桌面端新窗口打开任务无法发起聊天的问题
This commit is contained in:
parent
bdbc394b4a
commit
9a12184f9b
2
cmd
2
cmd
@ -135,7 +135,7 @@ run_electron() {
|
|||||||
else
|
else
|
||||||
mkdir -p ./electron/public
|
mkdir -p ./electron/public
|
||||||
cp ./electron/index.html ./electron/public/index.html
|
cp ./electron/index.html ./electron/public/index.html
|
||||||
npx vite build -- fromcmd electron
|
npx vite build -- fromcmd electronBuild
|
||||||
fi
|
fi
|
||||||
node ./electron/build.js $argv
|
node ./electron/build.js $argv
|
||||||
}
|
}
|
||||||
|
|||||||
2
electron/build.js
vendored
2
electron/build.js
vendored
@ -193,7 +193,7 @@ function startBuild(data, publish, release) {
|
|||||||
if (["dev"].includes(argv[2])) {
|
if (["dev"].includes(argv[2])) {
|
||||||
// 开发模式
|
// 开发模式
|
||||||
fs.writeFileSync(devloadCachePath, utils.formatUrl("127.0.0.1:" + env.parsed.APP_PORT), 'utf8');
|
fs.writeFileSync(devloadCachePath, utils.formatUrl("127.0.0.1:" + env.parsed.APP_PORT), 'utf8');
|
||||||
child_process.spawn("npx", ["vite", "--", "fromcmd", "electron"], {stdio: "inherit"});
|
child_process.spawn("npx", ["vite", "--", "fromcmd", "electronDev"], {stdio: "inherit"});
|
||||||
child_process.spawn("npm", ["run", "start-quiet"], {stdio: "inherit", cwd: "electron"});
|
child_process.spawn("npm", ["run", "start-quiet"], {stdio: "inherit", cwd: "electron"});
|
||||||
} else if (["app"].includes(argv[2])) {
|
} else if (["app"].includes(argv[2])) {
|
||||||
// 编译给app
|
// 编译给app
|
||||||
|
|||||||
3
electron/electron-preload.js
vendored
3
electron/electron-preload.js
vendored
@ -50,6 +50,9 @@ contextBridge.exposeInMainWorld(
|
|||||||
sendMessage: function (action, args) {
|
sendMessage: function (action, args) {
|
||||||
ipcRenderer.send(action, args);
|
ipcRenderer.send(action, args);
|
||||||
},
|
},
|
||||||
|
sendSyncMessage: function (action, args) {
|
||||||
|
ipcRenderer.sendSync(action, args)
|
||||||
|
},
|
||||||
listenOnce: function (action, callback) {
|
listenOnce: function (action, callback) {
|
||||||
ipcRenderer.once(action, function (event, args) {
|
ipcRenderer.once(action, function (event, args) {
|
||||||
callback(args);
|
callback(args);
|
||||||
|
|||||||
12
vite.config.js
vendored
12
vite.config.js
vendored
@ -7,11 +7,10 @@ import vitePluginFileCopy from 'vite-plugin-file-copy';
|
|||||||
import autoprefixer from 'autoprefixer';
|
import autoprefixer from 'autoprefixer';
|
||||||
|
|
||||||
const argv = process.argv;
|
const argv = process.argv;
|
||||||
const isCmd = argv.includes('fromcmd');
|
const basePath = argv.includes('electronBuild') ? './' : '/';
|
||||||
const isElectron = argv.includes('electron');
|
const publicPath = argv.includes('electronBuild') ? 'electron/public' : 'public';
|
||||||
const publicPath = isElectron ? 'electron/public' : 'public';
|
|
||||||
|
|
||||||
if (!isCmd) {
|
if (!argv.includes('fromcmd')) {
|
||||||
spawnSync("npx", [resolve(__dirname, 'cmd'), argv.includes("build") ? "build" : "dev"], {stdio: "inherit"});
|
spawnSync("npx", [resolve(__dirname, 'cmd'), argv.includes("build") ? "build" : "dev"], {stdio: "inherit"});
|
||||||
process.exit()
|
process.exit()
|
||||||
}
|
}
|
||||||
@ -22,7 +21,7 @@ export default defineConfig(({command, mode}) => {
|
|||||||
const port = parseInt(env['APP_DEV_PORT'])
|
const port = parseInt(env['APP_DEV_PORT'])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: isElectron ? './' : '/',
|
base: basePath,
|
||||||
publicDir: publicPath,
|
publicDir: publicPath,
|
||||||
server: {
|
server: {
|
||||||
host,
|
host,
|
||||||
@ -39,9 +38,6 @@ export default defineConfig(({command, mode}) => {
|
|||||||
},
|
},
|
||||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
|
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
|
||||||
},
|
},
|
||||||
define: {
|
|
||||||
'process.env.NODE_ENV': command === 'serve' ? '"development"' : '"production"',
|
|
||||||
},
|
|
||||||
build: {
|
build: {
|
||||||
manifest: true,
|
manifest: true,
|
||||||
outDir: publicPath,
|
outDir: publicPath,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user