
@@ -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 @@
-
@@ -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