Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f4aa89249 | |||
|
|
e76b034d50 | ||
|
|
e93d0ab0b1 | ||
|
|
218c21bddc | ||
|
|
2a5114a370 | ||
|
|
e152ac4625 | ||
|
|
242a77856e | ||
|
|
134d299857 | ||
|
|
20bf7ad7da | ||
|
|
7c3f0f393d | ||
|
|
280abcecbe | ||
|
|
15139bd606 |
16
.claude/settings.local.json
Normal file
16
.claude/settings.local.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"allow": [
|
||||||
|
"Bash(npm run:*)",
|
||||||
|
"Bash(npm install:*)",
|
||||||
|
"Bash(NODE_OPTIONS='--loader ts-node/esm' npm run make -- --platform=darwin)",
|
||||||
|
"Bash(ELECTRON_FORGE_CLI_SCRIPT='tsx' npm run make -- --platform=darwin)",
|
||||||
|
"Bash(DEBUG='*' npm run make -- --platform=darwin)",
|
||||||
|
"Bash(grep -r \"forge.config\" /Users/brother7/Documents/AI/zn-ai/node_modules/@electron-forge/core/dist/*.js)",
|
||||||
|
"Bash(node -e ':*)",
|
||||||
|
"Bash(JITI_DEBUG=1 npm run make -- --platform=darwin)",
|
||||||
|
"Bash(JITI_FS_CACHE=false npm run make -- --platform=darwin)",
|
||||||
|
"Bash(JITI_DEBUG=1 JITI_FS_CACHE=false npm run make -- --platform=darwin)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,32 +3,43 @@ import { MakerSquirrel } from '@electron-forge/maker-squirrel';
|
|||||||
import { MakerZIP } from '@electron-forge/maker-zip';
|
import { MakerZIP } from '@electron-forge/maker-zip';
|
||||||
import { MakerDeb } from '@electron-forge/maker-deb';
|
import { MakerDeb } from '@electron-forge/maker-deb';
|
||||||
import { MakerRpm } from '@electron-forge/maker-rpm';
|
import { MakerRpm } from '@electron-forge/maker-rpm';
|
||||||
|
import { MakerDMG } from '@electron-forge/maker-dmg';
|
||||||
import { VitePlugin } from '@electron-forge/plugin-vite';
|
import { VitePlugin } from '@electron-forge/plugin-vite';
|
||||||
import { FusesPlugin } from '@electron-forge/plugin-fuses';
|
import { FusesPlugin } from '@electron-forge/plugin-fuses';
|
||||||
import { FuseV1Options, FuseVersion } from '@electron/fuses';
|
import { FuseV1Options, FuseVersion } from '@electron/fuses';
|
||||||
import * as fs from 'fs-extra';
|
import * as fs from 'fs-extra';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as esbuild from 'esbuild';
|
|
||||||
|
|
||||||
const config: ForgeConfig = {
|
const config: ForgeConfig = {
|
||||||
packagerConfig: {
|
packagerConfig: {
|
||||||
asar: true,
|
asar: true,
|
||||||
tmpdir: path.resolve(process.cwd(), '..', 'electron-packager-tmp'),
|
tmpdir: path.resolve(process.cwd(), '..', 'electron-packager-tmp'),
|
||||||
|
name: 'NianXX',
|
||||||
|
icon: path.join(__dirname, 'public/logo'),
|
||||||
|
appCopyright: 'Copyright © 2026 智念科技',
|
||||||
},
|
},
|
||||||
rebuildConfig: {},
|
rebuildConfig: {},
|
||||||
makers: [
|
makers: [
|
||||||
new MakerSquirrel({}),
|
new MakerSquirrel({
|
||||||
|
iconUrl: path.join(__dirname, 'public/logo.ico'),
|
||||||
|
setupIcon: path.join(__dirname, 'public/logo.ico'),
|
||||||
|
setupExe: 'NianXX.exe',
|
||||||
|
}),
|
||||||
new MakerZIP({}, ['darwin']),
|
new MakerZIP({}, ['darwin']),
|
||||||
new MakerRpm({}),
|
new MakerRpm({}),
|
||||||
new MakerDeb({}),
|
new MakerDeb({}),
|
||||||
|
new MakerDMG(
|
||||||
|
(arch: string) => ({
|
||||||
|
name: `NianXX-${arch}`,
|
||||||
|
icon: path.join(__dirname, 'public/logo.icns'),
|
||||||
|
appPath: '',
|
||||||
|
} as any)
|
||||||
|
),
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
new VitePlugin({
|
new VitePlugin({
|
||||||
// `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
|
|
||||||
// If you are familiar with Vite configuration, it will look really familiar.
|
|
||||||
build: [
|
build: [
|
||||||
{
|
{
|
||||||
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
|
|
||||||
entry: 'src/main/main.ts',
|
entry: 'src/main/main.ts',
|
||||||
config: 'vite.main.config.ts',
|
config: 'vite.main.config.ts',
|
||||||
target: 'main',
|
target: 'main',
|
||||||
@@ -46,8 +57,6 @@ const config: ForgeConfig = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
// Fuses are used to enable/disable various Electron functionality
|
|
||||||
// at package time, before code signing the application
|
|
||||||
new FusesPlugin({
|
new FusesPlugin({
|
||||||
version: FuseVersion.V1,
|
version: FuseVersion.V1,
|
||||||
[FuseV1Options.RunAsNode]: false,
|
[FuseV1Options.RunAsNode]: false,
|
||||||
@@ -64,17 +73,20 @@ const config: ForgeConfig = {
|
|||||||
const dest = path.join(buildPath, '.vite', 'build', 'scripts');
|
const dest = path.join(buildPath, '.vite', 'build', 'scripts');
|
||||||
await fs.ensureDir(dest);
|
await fs.ensureDir(dest);
|
||||||
|
|
||||||
// Bundle mjs scripts using esbuild
|
// 动态导入esbuild
|
||||||
|
const esbuildModule = await import('esbuild');
|
||||||
|
const esbuildBuild = esbuildModule.build;
|
||||||
|
|
||||||
const files = await fs.readdir(src);
|
const files = await fs.readdir(src);
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
if (file.endsWith('.js')) {
|
if (file.endsWith('.js')) {
|
||||||
await esbuild.build({
|
await esbuildBuild({
|
||||||
entryPoints: [path.join(src, file)],
|
entryPoints: [path.join(src, file)],
|
||||||
outfile: path.join(dest, file),
|
outfile: path.join(dest, file),
|
||||||
bundle: true,
|
bundle: true,
|
||||||
platform: 'node',
|
platform: 'node',
|
||||||
target: 'node24', // Adjust based on Electron version
|
target: 'node24',
|
||||||
external: [ 'electron' ], // Exclude electron and playwright dependencies from bundling
|
external: [ 'electron' ],
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -82,7 +94,6 @@ const config: ForgeConfig = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force playwright into the packaged node_modules since Forge Vite plugin ignores it
|
|
||||||
const playwrightSrc = path.join(__dirname, 'node_modules', 'playwright');
|
const playwrightSrc = path.join(__dirname, 'node_modules', 'playwright');
|
||||||
const playwrightDest = path.join(buildPath, 'node_modules', 'playwright');
|
const playwrightDest = path.join(buildPath, 'node_modules', 'playwright');
|
||||||
if (await fs.pathExists(playwrightSrc)) {
|
if (await fs.pathExists(playwrightSrc)) {
|
||||||
@@ -104,10 +115,9 @@ const config: ForgeConfig = {
|
|||||||
await fs.copy(chromiumBidiSrc, chromiumBidiDest);
|
await fs.copy(chromiumBidiSrc, chromiumBidiDest);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force bytenode into the packaged node_modules since Forge Vite plugin ignores it
|
|
||||||
const bytenodeSrc = path.join(__dirname, 'node_modules', 'bytenode');
|
const bytenodeSrc = path.join(__dirname, 'node_modules', 'bytenode');
|
||||||
const bytenodeDest = path.join(buildPath, 'node_modules', 'bytenode');
|
const bytenodeDest = path.join(buildPath, 'node_modules', 'bytenode');
|
||||||
|
|
||||||
if (await fs.pathExists(bytenodeSrc)) {
|
if (await fs.pathExists(bytenodeSrc)) {
|
||||||
await fs.ensureDir(path.join(buildPath, 'node_modules'));
|
await fs.ensureDir(path.join(buildPath, 'node_modules'));
|
||||||
await fs.copy(bytenodeSrc, bytenodeDest);
|
await fs.copy(bytenodeSrc, bytenodeDest);
|
||||||
@@ -125,6 +135,7 @@ const config: ForgeConfig = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async postPackage(_forgeConfig, options) {
|
async postPackage(_forgeConfig, options) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const electronVersion = require('electron/package.json').version;
|
const electronVersion = require('electron/package.json').version;
|
||||||
const nodeVersion = process.version;
|
const nodeVersion = process.version;
|
||||||
const versionData = {
|
const versionData = {
|
||||||
@@ -150,6 +161,7 @@ const config: ForgeConfig = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async postMake(_forgeConfig, outputs) {
|
async postMake(_forgeConfig, outputs) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const electronVersion = require('electron/package.json').version;
|
const electronVersion = require('electron/package.json').version;
|
||||||
const nodeVersion = process.version;
|
const nodeVersion = process.version;
|
||||||
const versionData = {
|
const versionData = {
|
||||||
|
|||||||
4183
package-lock.json
generated
4183
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
21
package.json
21
package.json
@@ -8,6 +8,8 @@
|
|||||||
"start": "dotenv -e .env -- electron-forge start",
|
"start": "dotenv -e .env -- electron-forge start",
|
||||||
"package": "electron-forge package",
|
"package": "electron-forge package",
|
||||||
"make": "electron-forge make",
|
"make": "electron-forge make",
|
||||||
|
"make:mac": "electron-forge make --platform=darwin --arch=arm64,x64",
|
||||||
|
"make:mac-arm64": "electron-forge make --platform=darwin --arch=arm64",
|
||||||
"publish": "electron-forge publish",
|
"publish": "electron-forge publish",
|
||||||
"lint": "eslint --ext .ts,.tsx .",
|
"lint": "eslint --ext .ts,.tsx .",
|
||||||
"generate-prod-entry": "node build/scripts/generateProdEntry.js",
|
"generate-prod-entry": "node build/scripts/generateProdEntry.js",
|
||||||
@@ -22,14 +24,16 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron-forge/cli": "^7.8.3",
|
"@electron-forge/cli": "^7.6.0",
|
||||||
"@electron-forge/maker-deb": "^7.10.2",
|
"@electron-forge/maker-deb": "^7.6.0",
|
||||||
"@electron-forge/maker-rpm": "^7.10.2",
|
"@electron-forge/maker-dmg": "^7.6.0",
|
||||||
"@electron-forge/maker-squirrel": "^7.10.2",
|
"@electron-forge/maker-rpm": "^7.6.0",
|
||||||
"@electron-forge/maker-zip": "^7.10.2",
|
"@electron-forge/maker-squirrel": "^7.6.0",
|
||||||
|
"@electron-forge/maker-wix": "^7.11.1",
|
||||||
|
"@electron-forge/maker-zip": "^7.6.0",
|
||||||
"@electron-forge/plugin-auto-unpack-natives": "^7.10.2",
|
"@electron-forge/plugin-auto-unpack-natives": "^7.10.2",
|
||||||
"@electron-forge/plugin-fuses": "^7.10.2",
|
"@electron-forge/plugin-fuses": "^7.6.0",
|
||||||
"@electron-forge/plugin-vite": "^7.10.2",
|
"@electron-forge/plugin-vite": "^7.6.0",
|
||||||
"@electron/fuses": "^1.8.0",
|
"@electron/fuses": "^1.8.0",
|
||||||
"@tailwindcss/typography": "^0.5.19",
|
"@tailwindcss/typography": "^0.5.19",
|
||||||
"@tailwindcss/vite": "^4.1.17",
|
"@tailwindcss/vite": "^4.1.17",
|
||||||
@@ -42,9 +46,10 @@
|
|||||||
"esbuild": "^0.27.4",
|
"esbuild": "^0.27.4",
|
||||||
"openapi-ts-request": "^1.10.1",
|
"openapi-ts-request": "^1.10.1",
|
||||||
"tailwindcss": "^4.1.11",
|
"tailwindcss": "^4.1.11",
|
||||||
|
"tsx": "^4.21.0",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"unplugin-auto-import": "^20.3.0",
|
"unplugin-auto-import": "^20.3.0",
|
||||||
"vite": "^7.1.9"
|
"vite": "^5.4.11"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@iconify-json/material-symbols": "^1.2.50",
|
"@iconify-json/material-symbols": "^1.2.50",
|
||||||
|
|||||||
BIN
public/logo.icns
Normal file
BIN
public/logo.icns
Normal file
Binary file not shown.
BIN
public/logo.ico
BIN
public/logo.ico
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
@@ -51,8 +51,7 @@ export function runTaskOperationService() {
|
|||||||
['fzName', 'fg_trace.js'],
|
['fzName', 'fg_trace.js'],
|
||||||
['mtName', 'mt_trace.js'],
|
['mtName', 'mt_trace.js'],
|
||||||
['dyHotelName', 'dy_hotel_trace.js'],
|
['dyHotelName', 'dy_hotel_trace.js'],
|
||||||
['dyHotSpringName', 'dy_hot_spring_trace.js'],
|
['dyHotSpringName', 'dy_hot_spring_trace.js']
|
||||||
['xcName', 'xc_trace.js'],
|
|
||||||
]
|
]
|
||||||
const scriptEntries = pairs.filter(([prop]) => roomType?.[prop])
|
const scriptEntries = pairs.filter(([prop]) => roomType?.[prop])
|
||||||
|
|
||||||
@@ -75,9 +74,14 @@ export function runTaskOperationService() {
|
|||||||
dyHotelName: 'douyin',
|
dyHotelName: 'douyin',
|
||||||
dyHotSpringName: 'douyin',
|
dyHotSpringName: 'douyin',
|
||||||
}
|
}
|
||||||
|
const defaultTabIndexMap: Record<string, number> = {
|
||||||
|
fliggy: 0,
|
||||||
|
meituan: 1,
|
||||||
|
douyin: 2
|
||||||
|
}
|
||||||
const mappedName = channelNameMap[item.channel]
|
const mappedName = channelNameMap[item.channel]
|
||||||
const tabIndex = mappedName ? (openedTabIndexByChannelName.get(mappedName) ?? i) : i
|
const tabIndex = mappedName ? (openedTabIndexByChannelName.get(mappedName) ?? defaultTabIndexMap[mappedName] ?? i) : i
|
||||||
log.info(`Launching script for channel ${item.channel}: ${item.scriptPath}`)
|
log.info(`Launching script for channel ${item.channel}: ${item.scriptPath} (tabIndex: ${tabIndex})`)
|
||||||
const result = await executeScriptServiceInstance.executeScript(item.scriptPath, {
|
const result = await executeScriptServiceInstance.executeScript(item.scriptPath, {
|
||||||
roomType: roomType[item.channel],
|
roomType: roomType[item.channel],
|
||||||
startTime: options.startTime,
|
startTime: options.startTime,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const isSameOrigin = (currentUrl, targetUrl) => {
|
|||||||
const current = normalizeUrl(currentUrl);
|
const current = normalizeUrl(currentUrl);
|
||||||
const target = normalizeUrl(targetUrl);
|
const target = normalizeUrl(targetUrl);
|
||||||
if (!current || !target) return false;
|
if (!current || !target) return false;
|
||||||
|
|
||||||
return current.origin === target.origin;
|
return current.origin === target.origin;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 245 KiB |
@@ -220,5 +220,6 @@ const navigateToRoomStatusManagement = async (page) => {
|
|||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
} finally {
|
} finally {
|
||||||
await safeDisconnectBrowser(browser);
|
await safeDisconnectBrowser(browser);
|
||||||
|
process.exit(process.exitCode || 0);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -220,5 +220,6 @@ const navigateToRoomStatusManagement = async (page) => {
|
|||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
} finally {
|
} finally {
|
||||||
await safeDisconnectBrowser(browser);
|
await safeDisconnectBrowser(browser);
|
||||||
|
process.exit(process.exitCode || 0);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -169,5 +169,6 @@ const toggleRoomByDateIndex = async (container, { roomType, dateIndex, operation
|
|||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
} finally {
|
} finally {
|
||||||
await safeDisconnectBrowser(browser);
|
await safeDisconnectBrowser(browser);
|
||||||
|
process.exit(process.exitCode || 0);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 74 KiB |
@@ -232,5 +232,6 @@ const toggleRoom = async (page, { roomType, mmdd, operation }) => {
|
|||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
} finally {
|
} finally {
|
||||||
await safeDisconnectBrowser(browser);
|
await safeDisconnectBrowser(browser);
|
||||||
|
process.exit(process.exitCode || 0);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -128,5 +128,6 @@ const isBlankLikePage = (url) => {
|
|||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
process.exit(process.exitCode || 0);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
import log from 'electron-log';
|
|
||||||
|
|
||||||
log.info('xc_trace.mjs placeholder: not implemented');
|
|
||||||
process.exit(0);
|
|
||||||
@@ -46,6 +46,6 @@ export async function launchLocalChrome() {
|
|||||||
// 延迟几秒等浏览器起来
|
// 延迟几秒等浏览器起来
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
resolve(0);
|
resolve(0);
|
||||||
}, 3000); // 延迟3秒
|
}, 1000); // 延迟1秒
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
5
src/main/utils/db.ts
Normal file
5
src/main/utils/db.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import Dexie from 'dexie'
|
||||||
|
|
||||||
|
export const db = new Dexie('NianXX') as Dexie & {}
|
||||||
|
|
||||||
|
db.version(1).stores({})
|
||||||
@@ -31,6 +31,6 @@ export function createLogo() {
|
|||||||
if (logo != null) {
|
if (logo != null) {
|
||||||
return logo;
|
return logo;
|
||||||
}
|
}
|
||||||
logo = path.join(__dirname, 'logo.ico');
|
logo = path.join(__dirname, '/public/logo.ico');
|
||||||
return logo;
|
return logo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,23 +8,23 @@
|
|||||||
<native-tooltip :content="t('window.minimize')">
|
<native-tooltip :content="t('window.minimize')">
|
||||||
<button v-show="isMinimizable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]"
|
<button v-show="isMinimizable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]"
|
||||||
@click="minimizeWindow">
|
@click="minimizeWindow">
|
||||||
<iconify-icon icon="material-symbols:check-indeterminate-small" color="#525866" :width="btnSize"
|
<iconify-icon icon="material-symbols:check-indeterminate-small" :color="color" :width="btnSize"
|
||||||
:height="btnSize" />
|
:height="btnSize" />
|
||||||
</button>
|
</button>
|
||||||
</native-tooltip>
|
</native-tooltip>
|
||||||
<native-tooltip :content="isMaximized ? t('window.restore') : t('window.maximize')">
|
<native-tooltip :content="isMaximized ? t('window.restore') : t('window.maximize')">
|
||||||
<button v-show="isMaximizable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]"
|
<button v-show="isMaximizable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]"
|
||||||
@click="maximizeWindow">
|
@click="maximizeWindow">
|
||||||
<iconify-icon icon="material-symbols:chrome-maximize-outline-sharp" color="#525866" :width="btnSize"
|
<iconify-icon icon="material-symbols:chrome-maximize-outline-sharp" :color="color" :width="btnSize"
|
||||||
:height="btnSize" v-show="!isMaximized" />
|
:height="btnSize" v-show="!isMaximized" />
|
||||||
<iconify-icon icon="material-symbols:chrome-restore-outline-sharp" color="#525866" :width="btnSize"
|
<iconify-icon icon="material-symbols:chrome-restore-outline-sharp" :color="color" :width="btnSize"
|
||||||
:height="btnSize" v-show="isMaximized" />
|
:height="btnSize" v-show="isMaximized" />
|
||||||
</button>
|
</button>
|
||||||
</native-tooltip>
|
</native-tooltip>
|
||||||
<native-tooltip :content="t('window.close')">
|
<native-tooltip :content="t('window.close')">
|
||||||
<button v-show="isClosable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]"
|
<button v-show="isClosable" class="flex items-center justify-center cursor-pointer w-[40px] h-[40px]"
|
||||||
@click="handleClose">
|
@click="handleClose">
|
||||||
<iconify-icon icon="material-symbols:close" color="#525866" :width="btnSize" :height="btnSize" />
|
<iconify-icon icon="material-symbols:close" :color="color" :width="btnSize" :height="btnSize" />
|
||||||
</button>
|
</button>
|
||||||
</native-tooltip>
|
</native-tooltip>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,9 +42,10 @@ interface HeaderBarProps {
|
|||||||
isMaximizable?: boolean;
|
isMaximizable?: boolean;
|
||||||
isMinimizable?: boolean;
|
isMinimizable?: boolean;
|
||||||
isClosable?: boolean;
|
isClosable?: boolean;
|
||||||
|
color?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
defineOptions({ name: 'HeaderBar' })
|
defineOptions({ name: 'HeaderBar', color: '#525866' })
|
||||||
|
|
||||||
withDefaults(defineProps<HeaderBarProps>(), {
|
withDefaults(defineProps<HeaderBarProps>(), {
|
||||||
isMaximizable: true,
|
isMaximizable: true,
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ export const channels: Item[] = [
|
|||||||
{
|
{
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
channelName: 'douyin',
|
channelName: 'douyin',
|
||||||
channelUrl: 'https://life.douyin.com/p/goods_winetour/physical_room_list?groupid=1816249020842116',
|
channelUrl: 'https://life.douyin.com/p/travel-ari/hotel/price_amount_state?groupid=1816249020842116',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -64,6 +64,9 @@
|
|||||||
|
|
||||||
<!-- 任务中心(仅在引导页显示) -->
|
<!-- 任务中心(仅在引导页显示) -->
|
||||||
<TaskCenter v-if="isGuidePage" />
|
<TaskCenter v-if="isGuidePage" />
|
||||||
|
|
||||||
|
<!-- 任务操作弹窗 -->
|
||||||
|
<TaskOperationDialog ref="taskOperationDialogRef" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@@ -83,6 +86,9 @@ import ChatNameTime from './components/ChatNameTime.vue';
|
|||||||
import ChatAttach from './components/ChatAttach.vue';
|
import ChatAttach from './components/ChatAttach.vue';
|
||||||
import ChatInputArea from './components/ChatInputArea.vue';
|
import ChatInputArea from './components/ChatInputArea.vue';
|
||||||
import TaskCenter from './TaskCenter.vue';
|
import TaskCenter from './TaskCenter.vue';
|
||||||
|
import TaskOperationDialog from './components/TaskOperationDialog.vue';
|
||||||
|
import emitter from '@utils/emitter';
|
||||||
|
import { taskCenterItem } from '@constant/taskCenterList';
|
||||||
|
|
||||||
import { Session } from '../../utils/storage';
|
import { Session } from '../../utils/storage';
|
||||||
|
|
||||||
@@ -147,6 +153,16 @@ const isSessionActive = ref(false);
|
|||||||
/// 指令通用消息类型
|
/// 指令通用消息类型
|
||||||
let commonTypeMessage: string = "";
|
let commonTypeMessage: string = "";
|
||||||
|
|
||||||
|
// 任务操作弹窗ref
|
||||||
|
const taskOperationDialogRef = ref<InstanceType<typeof TaskOperationDialog> | null>(null);
|
||||||
|
|
||||||
|
// 打开任务操作弹窗
|
||||||
|
const openTaskOperationDialog = (item: taskCenterItem) => {
|
||||||
|
if (taskOperationDialogRef.value) {
|
||||||
|
taskOperationDialogRef.value.open(item);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// WebSocket 相关
|
// WebSocket 相关
|
||||||
let webSocketManager: WebSocketManager | null = null;
|
let webSocketManager: WebSocketManager | null = null;
|
||||||
/// 使用统一的连接状态判断函数,避免状态不同步
|
/// 使用统一的连接状态判断函数,避免状态不同步
|
||||||
@@ -272,6 +288,8 @@ onMounted(() => {
|
|||||||
try {
|
try {
|
||||||
// 有token时,加载最近会话、最近消息、初始化socket
|
// 有token时,加载最近会话、最近消息、初始化socket
|
||||||
initHandler();
|
initHandler();
|
||||||
|
// 监听任务操作事件
|
||||||
|
emitter.on('OPERATION_CHANNEL', openTaskOperationDialog);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("初始化错误:", error);
|
console.error("初始化错误:", error);
|
||||||
}
|
}
|
||||||
@@ -822,6 +840,8 @@ const stopRequest = async () => {
|
|||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
console.log("组件销毁");
|
console.log("组件销毁");
|
||||||
resetConfig();
|
resetConfig();
|
||||||
|
// 移除事件监听
|
||||||
|
emitter.off('OPERATION_CHANNEL', openTaskOperationDialog);
|
||||||
});
|
});
|
||||||
|
|
||||||
const resetConfig = () => {
|
const resetConfig = () => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="h-screen login-bg flex flex-col">
|
<div class="h-screen login-bg flex flex-col">
|
||||||
<header-bar>
|
<header-bar color="#fff">
|
||||||
<drag-region class="w-full" />
|
<drag-region class="w-full" />
|
||||||
</header-bar>
|
</header-bar>
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,15 @@
|
|||||||
"composite": true,
|
"composite": true,
|
||||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.config.tsbuildinfo",
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.config.tsbuildinfo",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"module": "ESNext",
|
"module": "commonjs",
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "node",
|
||||||
|
"esModuleInterop": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noEmit": true
|
"noEmit": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"**.config.ts",
|
"**.config.ts",
|
||||||
"**/*.ts",
|
"**/*.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ export default defineConfig(async () => {
|
|||||||
css: {
|
css: {
|
||||||
transformer: 'lightningcss' as CSSOptions['transformer'],
|
transformer: 'lightningcss' as CSSOptions['transformer'],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
build: {
|
||||||
|
target: 'es2022',
|
||||||
|
},
|
||||||
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
|
|||||||
Reference in New Issue
Block a user