From 609cde992c103d6ec99d357f7cd7b5fdac365cad Mon Sep 17 00:00:00 2001 From: aooiuu Date: Tue, 4 Jun 2024 19:45:44 +0800 Subject: [PATCH] =?UTF-8?q?feat(vscode):=20=E6=94=AF=E6=8C=81=E6=89=93?= =?UTF-8?q?=E5=BC=80=E8=A7=84=E5=88=99=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/vscode/package.json | 7 +- packages/vscode/src/App.ts | 6 + packages/vscode/src/constants.ts | 3 +- packages/web/package.json | 2 +- packages/web/src/App.vue | 18 --- packages/web/src/pages/pc/rules/index.vue | 8 +- .../web/src/pages/vscode/layout/index.vue | 37 +++++ .../web/src/pages/vscode/rules/index.vsc.vue | 56 ++++++-- packages/web/src/router/router.vsc.ts | 132 ++++++++++-------- 9 files changed, 178 insertions(+), 91 deletions(-) create mode 100644 packages/web/src/pages/vscode/layout/index.vue diff --git a/packages/vscode/package.json b/packages/vscode/package.json index 7e8402fe..00086f13 100644 --- a/packages/vscode/package.json +++ b/packages/vscode/package.json @@ -3,7 +3,7 @@ "displayName": "any-reader", "description": "摸鱼,自定义规则多站点聚合搜索阅读小说、漫画。包含JS规则解析库和VSCode插件。支持本地小说 TXT、EPUB", "icon": "resources/icon.png", - "version": "1.5.0", + "version": "1.5.1", "publisher": "aooiu", "qna": "https://github.com/aooiuu/any-reader/issues", "bugs": { @@ -83,6 +83,11 @@ "title": "open local book dir", "icon": "$(folder-opened)", "category": "any-reader" + }, + { + "command": "any-reader.openUrl", + "title": "open url", + "category": "any-reader" } ], "viewsContainers": { diff --git a/packages/vscode/src/App.ts b/packages/vscode/src/App.ts index a907ddc1..31f1b2db 100644 --- a/packages/vscode/src/App.ts +++ b/packages/vscode/src/App.ts @@ -27,6 +27,7 @@ class App { registerCommand(COMMANDS.searchBook, this.searchBook, this), registerCommand(COMMANDS.getChapter, this.getChapter, this), registerCommand(COMMANDS.discover, this.discover, this), + registerCommand(COMMANDS.openUrl, this.openUrl, this), registerCommand(COMMANDS.openLocalBookDir, this.openLocalBookDir, this), registerCommand(COMMANDS.home, () => this.webView.navigateTo('/rules'), this.webView), registerCommand(COMMANDS.gamePlay, (node: any) => this.webView.navigateTo('/iframe?url=' + node.host, node.name), this.webView) @@ -54,6 +55,11 @@ class App { this.webView.navigateTo('/discover'); } + // 打开链接 + openUrl(url: string) { + this.webView.navigateTo(url); + } + /** * 获取章节 */ diff --git a/packages/vscode/src/constants.ts b/packages/vscode/src/constants.ts index 444c87ec..21a167c6 100644 --- a/packages/vscode/src/constants.ts +++ b/packages/vscode/src/constants.ts @@ -8,7 +8,8 @@ export enum COMMANDS { discover = 'any-reader.discover', openLocalBookDir = 'any-reader.openLocalBookDir', home = 'any-reader.home', - gamePlay = 'any-reader.gamePlay' + gamePlay = 'any-reader.gamePlay', + openUrl = 'any-reader.openUrl' } export const ROOT_PATH = path.join(os.homedir(), '.any-reader'); diff --git a/packages/web/package.json b/packages/web/package.json index 9b3a4451..0eb7e672 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,6 +1,6 @@ { "name": "any-reader-web", - "version": "1.0.0-dev.14", + "version": "1.0.0-dev.15", "private": true, "scripts": { "dev": "cross-env VITE_APP_PLATFORM=browser vite", diff --git a/packages/web/src/App.vue b/packages/web/src/App.vue index 96085218..802ad91e 100644 --- a/packages/web/src/App.vue +++ b/packages/web/src/App.vue @@ -8,30 +8,12 @@ - -
-
-
-
-
-
-
- - -
-
diff --git a/packages/web/src/pages/vscode/rules/index.vsc.vue b/packages/web/src/pages/vscode/rules/index.vsc.vue index 29cb508d..196b805b 100644 --- a/packages/web/src/pages/vscode/rules/index.vsc.vue +++ b/packages/web/src/pages/vscode/rules/index.vsc.vue @@ -1,15 +1,23 @@ + + diff --git a/packages/web/src/router/router.vsc.ts b/packages/web/src/router/router.vsc.ts index 36695227..533978b9 100644 --- a/packages/web/src/router/router.vsc.ts +++ b/packages/web/src/router/router.vsc.ts @@ -6,62 +6,82 @@ const router = createRouter({ routes: [ { path: '/', - component: () => import('@/pages/vscode/home/index.vue') - }, - { - path: '/player', - component: () => import('@/pages/vscode/player/index.vue') - }, - { - path: '/rules', - component: () => import('@/pages/pc/rules/index.vue') - }, - { - path: '/rule-info', - name: 'ruleInfo', - component: () => import('@/pages/pc/rule-info/index.vue') - }, - { - path: '/iframe', - component: () => import('@/pages/vscode/iframe/index.vue') - }, - { - path: '/search', - component: () => import('@/pages/vscode/search/index.vue'), - meta: { - keepAlive: true - } - }, - { - path: '/vsc/search', - component: () => import('@/pages/vscode/search/index.vsc.vue'), - meta: { - keepAlive: true - } - }, - { - path: '/vsc/rules', - component: () => import('@/pages/vscode/rules/index.vsc.vue') - }, - { - path: '/discover', - component: () => import('@/pages/vscode/discover/index.vue') - }, - { - path: '/content', - name: 'content', - component: () => import('@/pages/vscode/content/index.vue') - }, - { - path: '/chapter', - component: () => import('@/pages/vscode/chapter/index.vue'), - meta: { - keepAlive: true - } - }, - { - path: '/settings', - component: () => import('@/pages/vscode/settings/index.vue') + redirect: '/home', + component: () => import('@/pages/vscode/layout/index.vue'), + children: [ + { + path: '/home', + component: () => import('@/pages/vscode/home/index.vue') + }, + { + path: '/player', + component: () => import('@/pages/vscode/player/index.vue'), + meta: { + hideBtmBar: true + } + }, + { + path: '/rules', + component: () => import('@/pages/pc/rules/index.vue'), + meta: { + hideBtmBar: true + } + }, + { + path: '/rule-info', + name: 'ruleInfo', + component: () => import('@/pages/pc/rule-info/index.vue') + }, + { + path: '/iframe', + component: () => import('@/pages/vscode/iframe/index.vue'), + meta: { + hideBtmBar: true + } + }, + { + path: '/search', + component: () => import('@/pages/vscode/search/index.vue'), + meta: { + keepAlive: true, + hideBtmBar: true + } + }, + { + path: '/vsc/search', + component: () => import('@/pages/vscode/search/index.vsc.vue'), + meta: { + keepAlive: true + } + }, + { + path: '/vsc/rules', + component: () => import('@/pages/vscode/rules/index.vsc.vue') + }, + { + path: '/discover', + component: () => import('@/pages/vscode/discover/index.vue'), + meta: { + hideBtmBar: true + } + }, + { + path: '/content', + name: 'content', + component: () => import('@/pages/vscode/content/index.vue') + }, + { + path: '/chapter', + component: () => import('@/pages/vscode/chapter/index.vue'), + meta: { + keepAlive: true + } + }, + { + path: '/settings', + component: () => import('@/pages/vscode/settings/index.vue') + } + ] } ] });