From 467a42bf60e376498c93c4b866351f6bc0c2dbb9 Mon Sep 17 00:00:00 2001 From: shuiyu1123 Date: Wed, 29 Apr 2026 19:22:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 index.ux 中 showToast 属性名与方法名冲突导致 toast 功能失效 - 修复 about.ux 版权年份 2024→2026 - 修复 package.json 名称与应用名不匹配 - 修复 detail.ux/offline.ux 中 toast 使用 transform 不兼容快应用 - 修复 detail.ux/offline.ux 中 toast 文字颜色不可见(#000→#fff) - 修复 InputMethod.ux 中乱码注释和拼写错误(tookit→toolkit) - 修复 home.ux 底部版本文字显示旧名称 - 修复 index.ux 错误信息使用模板字符串兼容性问题 - 将 * 按钮从保存离线页改为添加收藏功能 --- package.json | 2 +- src/components/InputMethod/InputMethod.ux | 8 +-- src/pages/about/about.ux | 2 +- src/pages/detail/detail.ux | 7 +- src/pages/home/home.ux | 2 +- src/pages/index/index.ux | 78 +++++++++-------------- src/pages/offline/offline.ux | 7 +- 7 files changed, 46 insertions(+), 60 deletions(-) diff --git a/package.json b/package.json index bbcd9ab..080a711 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "腕上JM", + "name": "搜哩浏览器", "version": "1.0.0", "description": "", "engines": { diff --git a/src/components/InputMethod/InputMethod.ux b/src/components/InputMethod/InputMethod.ux index d9498df..12ff3fd 100644 --- a/src/components/InputMethod/InputMethod.ux +++ b/src/components/InputMethod/InputMethod.ux @@ -3,7 +3,7 @@
- +
@@ -11,7 +11,7 @@
- +
@@ -77,7 +77,7 @@
- +
@@ -260,7 +260,7 @@
- + diff --git a/src/pages/about/about.ux b/src/pages/about/about.ux index 549ebb2..4a65dcd 100644 --- a/src/pages/about/about.ux +++ b/src/pages/about/about.ux @@ -39,7 +39,7 @@ export default { name: '搜哩浏览器', version: 'v1.0.0', description: '专为智能手表设计的轻量浏览器', - copyright: '© 2024 搜哩浏览器' + copyright: '© 2026 搜哩浏览器' }, sections: [ { diff --git a/src/pages/detail/detail.ux b/src/pages/detail/detail.ux index 8e23b05..8159db8 100644 --- a/src/pages/detail/detail.ux +++ b/src/pages/detail/detail.ux @@ -263,15 +263,16 @@ export default { .toast { position: fixed; bottom: 80px; - left: 50%; - transform: translateX(-50%); + left: 0; + right: 0; + justify-content: center; padding: 10px 20px; border-radius: 20px; background-color: rgba(48, 209, 88, 0.95); } .toast-text { - color: #000; + color: #fff; font-size: 14px; } \ No newline at end of file diff --git a/src/pages/home/home.ux b/src/pages/home/home.ux index ff6fccb..06550a8 100644 --- a/src/pages/home/home.ux +++ b/src/pages/home/home.ux @@ -57,7 +57,7 @@
diff --git a/src/pages/index/index.ux b/src/pages/index/index.ux index d0e7d91..1abd3f1 100644 --- a/src/pages/index/index.ux +++ b/src/pages/index/index.ux @@ -140,7 +140,7 @@
R
-
+
*
@@ -179,7 +179,7 @@
-
+
{{toastMsg}}
@@ -348,7 +348,7 @@ export default { ], showImageModal: false, currentImage: null, - showToast: false, + toastVisible: false, toastMsg: '' }, @@ -449,7 +449,7 @@ export default { if (response.code === 200 && response.data) { this.parseHtml(response.data) } else { - this.errorMsg = `错误: ${response.code}` + this.errorMsg = '错误: ' + response.code } this.isLoading = false }, @@ -483,61 +483,45 @@ export default { this.currentImage = null }, - savePage() { - if (!this.currentUrl || this.htmlElements.length === 0) { - this.showToast('无内容可保存') + addBookmark() { + if (!this.currentUrl) { + this.showToast('请先打开网页') return } - const safeElements = this.htmlElements.slice(0, 100).map(e => ({ - type: e.type, - parts: e.parts, - text: e.text, - url: e.url, - thumbUrl: e.thumbUrl, - alt: e.alt - })) - - const pageData = { + const colors = ['#0a84ff', '#30d158', '#ff375f', '#ff9f0a', '#bf5af2', '#64d2ff'] + const bookmark = { id: Date.now().toString(), - title: truncateText(this.pageTitle, 50), + name: this.pageTitle || formatDisplayUrl(this.currentUrl), url: this.currentUrl, - elements: safeElements, - saveTime: new Date().toLocaleString() - } - - let jsonStr - try { - jsonStr = JSON.stringify(pageData) - if (jsonStr.length > 100000) { - this.showToast('页面过大') - return - } - } catch (e) { - this.showToast('保存失败') - return + color: colors[Math.floor(Math.random() * colors.length)], + icon: (this.pageTitle || formatDisplayUrl(this.currentUrl)).charAt(0).toUpperCase() } storage.get({ - key: 'offline_pages', + key: 'user_bookmarks', success: (data) => { - let pages = [] - try { pages = JSON.parse(data || '[]') } catch (e) {} - if (pages.length >= 20) pages = pages.slice(0, 19) - pages.unshift(pageData) + let bookmarks = [] + try { bookmarks = JSON.parse(data || '[]') } catch (e) {} + const exists = bookmarks.some(b => b.url === this.currentUrl) + if (exists) { + this.showToast('已收藏过') + return + } + bookmarks.unshift(bookmark) storage.set({ - key: 'offline_pages', - value: JSON.stringify(pages), - success: () => this.showToast('保存成功'), - fail: () => this.showToast('保存失败') + key: 'user_bookmarks', + value: JSON.stringify(bookmarks), + success: () => this.showToast('收藏成功'), + fail: () => this.showToast('收藏失败') }) }, fail: () => { storage.set({ - key: 'offline_pages', - value: JSON.stringify([pageData]), - success: () => this.showToast('保存成功'), - fail: () => this.showToast('保存失败') + key: 'user_bookmarks', + value: JSON.stringify([bookmark]), + success: () => this.showToast('收藏成功'), + fail: () => this.showToast('收藏失败') }) } }) @@ -545,8 +529,8 @@ export default { showToast(msg) { this.toastMsg = msg - this.showToast = true - setTimeout(() => this.showToast = false, 2000) + this.toastVisible = true + setTimeout(() => this.toastVisible = false, 2000) } } diff --git a/src/pages/offline/offline.ux b/src/pages/offline/offline.ux index 524e4f0..9e036fe 100644 --- a/src/pages/offline/offline.ux +++ b/src/pages/offline/offline.ux @@ -276,15 +276,16 @@ export default { .toast { position: fixed; bottom: 80px; - left: 50%; - transform: translateX(-50%); + left: 0; + right: 0; + justify-content: center; padding: 10px 20px; border-radius: 20px; background-color: rgba(48, 209, 88, 0.95); } .toast-text { - color: #000; + color: #fff; font-size: 14px; } \ No newline at end of file