You've already forked SmartisanNote.Remake
修复 修复移动端滚动问题,调整触摸行为以允许垂直滚动
This commit is contained in:
253
index.html
253
index.html
@@ -1,126 +1,127 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no" />
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
<!-- 透明 -->
|
<!-- 透明 -->
|
||||||
<meta name="apple-mobile-web-app-orientation" content="portrait" />
|
<meta name="apple-mobile-web-app-orientation" content="portrait" />
|
||||||
<!-- 纵向 -->
|
<!-- 纵向 -->
|
||||||
<title>锤子便签</title>
|
<title>锤子便签</title>
|
||||||
<style>
|
<style>
|
||||||
/* Smartisan Notes Color Scheme - Based on Original Design */
|
/* Smartisan Notes Color Scheme - Based on Original Design */
|
||||||
:root {
|
:root {
|
||||||
/* Primary colors - Original Smartisan Notes brown/gold palette */
|
/* Primary colors - Original Smartisan Notes brown/gold palette */
|
||||||
--primary: #5c3c2a; /* Main brown color for UI elements */
|
--primary: #5c3c2a; /* Main brown color for UI elements */
|
||||||
--primary-dark: #4a3224; /* Darker shade of primary */
|
--primary-dark: #4a3224; /* Darker shade of primary */
|
||||||
--primary-light: #f5f0e6; /* Light background tone */
|
--primary-light: #f5f0e6; /* Light background tone */
|
||||||
|
|
||||||
/* Editor typography - Consistent font size and line height */
|
/* Editor typography - Consistent font size and line height */
|
||||||
--editor-font-size: 1.4375rem; /* Base font size for editor */
|
--editor-font-size: 1.4375rem; /* Base font size for editor */
|
||||||
--editor-line-height: 1.1; /* Line height for editor */
|
--editor-line-height: 1.1; /* Line height for editor */
|
||||||
|
|
||||||
/* Background colors - Warm paper-like tones */
|
/* Background colors - Warm paper-like tones */
|
||||||
--background: #fbf7ed; /* Main app background - warm off-white */
|
--background: #fbf7ed; /* Main app background - warm off-white */
|
||||||
--background-secondary: #f7f2e9; /* Slightly darker background */
|
--background-secondary: #f7f2e9; /* Slightly darker background */
|
||||||
--background-card: #ffffff; /* Pure white for cards/notes */
|
--background-card: #ffffff; /* Pure white for cards/notes */
|
||||||
--search-bar-background: #f0f0f0; /* Search bar background - light gray */
|
--search-bar-background: #f0f0f0; /* Search bar background - light gray */
|
||||||
|
|
||||||
/* Text colors - Brown/black tones for readability */
|
/* Text colors - Brown/black tones for readability */
|
||||||
--text-primary: #5c3c2a; /* Main text color - dark brown */
|
--text-primary: #5c3c2a; /* Main text color - dark brown */
|
||||||
--text-secondary: #6e482f; /* Secondary text - medium brown */
|
--text-secondary: #6e482f; /* Secondary text - medium brown */
|
||||||
--text-tertiary: #9e836c; /* Tertiary text - light brown/gray */
|
--text-tertiary: #9e836c; /* Tertiary text - light brown/gray */
|
||||||
--text-inverted: #ffffff; /* White text for dark backgrounds */
|
--text-inverted: #ffffff; /* White text for dark backgrounds */
|
||||||
|
|
||||||
/* Accent colors - Smartisan's signature colors */
|
/* Accent colors - Smartisan's signature colors */
|
||||||
--accent-blue: #5c89f2; /* Blue for links/actions */
|
--accent-blue: #5c89f2; /* Blue for links/actions */
|
||||||
--accent-green: #97cc4e; /* Green for success/positive actions */
|
--accent-green: #97cc4e; /* Green for success/positive actions */
|
||||||
--accent-red: #e65c53; /* Red for errors/dangerous actions */
|
--accent-red: #e65c53; /* Red for errors/dangerous actions */
|
||||||
--accent-orange: #f0880d; /* Orange for warnings/highlights */
|
--accent-orange: #f0880d; /* Orange for warnings/highlights */
|
||||||
--accent-yellow: #ffffdd33; /* Yellow for starred items/highlights (updated to match original) */
|
--accent-yellow: #ffffdd33; /* Yellow for starred items/highlights (updated to match original) */
|
||||||
|
|
||||||
/* Note specific colors */
|
/* Note specific colors */
|
||||||
--note-title: #5c3c2a; /* Note title color */
|
--note-title: #5c3c2a; /* Note title color */
|
||||||
--note-content: #6e482f; /* Note content color */
|
--note-content: #6e482f; /* Note content color */
|
||||||
--note-date: #705c3c2a; /* Date/time color */
|
--note-date: #705c3c2a; /* Date/time color */
|
||||||
--note-star: #ffffdd33; /* Star/favorite color (updated to match original) */
|
--note-star: #ffffdd33; /* Star/favorite color (updated to match original) */
|
||||||
|
|
||||||
/* Folder colors */
|
/* Folder colors */
|
||||||
--folder-name: #9b9b9b; /* Folder name color (60% black) */
|
--folder-name: #9b9b9b; /* Folder name color (60% black) */
|
||||||
--folder-count: #b4b4b4; /* Folder item count color (30% black) */
|
--folder-count: #b4b4b4; /* Folder item count color (30% black) */
|
||||||
--folder-item-selected: #f5f5f5; /* Folder item selected background color */
|
--folder-item-selected: #f5f5f5; /* Folder item selected background color */
|
||||||
|
|
||||||
/* Button colors - Based on Smartisan's button styles */
|
/* Button colors - Based on Smartisan's button styles */
|
||||||
--button-primary: #5c3c2a; /* Primary button - brown */
|
--button-primary: #5c3c2a; /* Primary button - brown */
|
||||||
--button-secondary: #97cc4e; /* Secondary button - green */
|
--button-secondary: #97cc4e; /* Secondary button - green */
|
||||||
--button-danger: #e65c53; /* Danger button - red */
|
--button-danger: #e65c53; /* Danger button - red */
|
||||||
--button-disabled: #d4d4d5; /* Disabled button - light gray */
|
--button-disabled: #d4d4d5; /* Disabled button - light gray */
|
||||||
|
|
||||||
/* Status colors */
|
/* Status colors */
|
||||||
--success: #79ad31; /* Success - green */
|
--success: #79ad31; /* Success - green */
|
||||||
--warning: #f0880d; /* Warning - orange */
|
--warning: #f0880d; /* Warning - orange */
|
||||||
--error: #e64746; /* Error - red */
|
--error: #e64746; /* Error - red */
|
||||||
--info: #5c89f2; /* Info - blue */
|
--info: #5c89f2; /* Info - blue */
|
||||||
|
|
||||||
/* UI elements - Borders, dividers, shadows */
|
/* UI elements - Borders, dividers, shadows */
|
||||||
--border: #e5ddca; /* Light brown border */
|
--border: #e5ddca; /* Light brown border */
|
||||||
--divider: #e5e5e5; /* Light gray divider */
|
--divider: #e5e5e5; /* Light gray divider */
|
||||||
--shadow: #00000014; /* Subtle shadow */
|
--shadow: #00000014; /* Subtle shadow */
|
||||||
|
|
||||||
/* Transparency variants */
|
/* Transparency variants */
|
||||||
--black-05: #0000000d; /* 5% black */
|
--black-05: #0000000d; /* 5% black */
|
||||||
--black-10: #0000001a; /* 10% black */
|
--black-10: #0000001a; /* 10% black */
|
||||||
--black-14: #00000024; /* 14% black */
|
--black-14: #00000024; /* 14% black */
|
||||||
--black-20: #00000033; /* 20% black */
|
--black-20: #00000033; /* 20% black */
|
||||||
--black-30: #0000004d; /* 30% black */
|
--black-30: #0000004d; /* 30% black */
|
||||||
--black-40: #00000066; /* 40% black */
|
--black-40: #00000066; /* 40% black */
|
||||||
--black-50: #00000080; /* 50% black */
|
--black-50: #00000080; /* 50% black */
|
||||||
--black-60: #00000099; /* 60% black */
|
--black-60: #00000099; /* 60% black */
|
||||||
--black-80: #000000cc; /* 80% black */
|
--black-80: #000000cc; /* 80% black */
|
||||||
--black-90: #000000e6; /* 90% black */
|
--black-90: #000000e6; /* 90% black */
|
||||||
|
|
||||||
--white-10: #ffffff1a; /* 10% white */
|
--white-10: #ffffff1a; /* 10% white */
|
||||||
--white-20: #ffffff33; /* 20% white */
|
--white-20: #ffffff33; /* 20% white */
|
||||||
--white-30: #ffffff4d; /* 30% white */
|
--white-30: #ffffff4d; /* 30% white */
|
||||||
--white-40: #ffffff66; /* 40% white */
|
--white-40: #ffffff66; /* 40% white */
|
||||||
--white-50: #ffffff80; /* 50% white */
|
--white-50: #ffffff80; /* 50% white */
|
||||||
--white-60: #ffffff99; /* 60% white */
|
--white-60: #ffffff99; /* 60% white */
|
||||||
--white-80: #ffffffcc; /* 80% white */
|
--white-80: #ffffffcc; /* 80% white */
|
||||||
--white-90: #ffffffe6; /* 90% white */
|
--white-90: #ffffffe6; /* 90% white */
|
||||||
|
|
||||||
--confirmFontSize: 0.8rem;
|
--confirmFontSize: 0.8rem;
|
||||||
--confirmBg: rgba(0, 0, 0, 0.15);
|
--confirmBg: rgba(0, 0, 0, 0.15);
|
||||||
--confirmBtnColor: #000000cc;
|
--confirmBtnColor: #000000cc;
|
||||||
}
|
}
|
||||||
|
html {
|
||||||
body {
|
background-color: var(--note-title);
|
||||||
margin: 0;
|
}
|
||||||
padding: 0;
|
body {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
margin: 0;
|
||||||
background-color: white;
|
padding: 0;
|
||||||
background: url('/assets/icons/drawable-xxhdpi/note_setting_bg.png');
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||||
color: var(--text-primary);
|
background: url('/assets/icons/drawable-xxhdpi/note_setting_bg.png');
|
||||||
/* 适配iPhone X及更新机型的刘海屏 */
|
color: var(--text-primary);
|
||||||
padding-top: env(safe-area-inset-top);
|
/* 适配iPhone X及更新机型的刘海屏 */
|
||||||
padding-right: env(safe-area-inset-right);
|
padding-top: env(safe-area-inset-top);
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
padding-right: env(safe-area-inset-right);
|
||||||
padding-left: env(safe-area-inset-left);
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
}
|
padding-left: env(safe-area-inset-left);
|
||||||
|
}
|
||||||
#app {
|
|
||||||
height: 100vh;
|
#app {
|
||||||
overflow: hidden;
|
height: 100vh;
|
||||||
/* 适配iPhone X及更新机型的刘海屏 */
|
overflow: hidden;
|
||||||
padding-top: env(safe-area-inset-top);
|
/* 适配iPhone X及更新机型的刘海屏 */
|
||||||
padding-right: env(safe-area-inset-right);
|
padding-top: env(safe-area-inset-top);
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
padding-right: env(safe-area-inset-right);
|
||||||
padding-left: env(safe-area-inset-left);
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
}
|
padding-left: env(safe-area-inset-left);
|
||||||
</style>
|
}
|
||||||
</head>
|
</style>
|
||||||
<body>
|
</head>
|
||||||
<div id="app"></div>
|
<body>
|
||||||
<script type="module" src="/src/main.js"></script>
|
<div id="app"></div>
|
||||||
</body>
|
<script type="module" src="/src/main.js"></script>
|
||||||
</html>
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
@@ -114,6 +114,12 @@ onUnmounted(() => {
|
|||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-color: #f5f5f5; // 设置默认背景色,防止闪烁
|
background-color: #f5f5f5; // 设置默认背景色,防止闪烁
|
||||||
|
touch-action: pan-y;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-ms-touch-action: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 网络状态指示器
|
// 网络状态指示器
|
||||||
|
|||||||
1084
src/common/base.css
1084
src/common/base.css
File diff suppressed because it is too large
Load Diff
@@ -1999,6 +1999,12 @@ defineExpose({
|
|||||||
background-size: 100% calc(var(--editor-font-size, 1rem) * var(--editor-line-height, 1.6)); /* var(--editor-font-size) * var(--editor-line-height) */
|
background-size: 100% calc(var(--editor-font-size, 1rem) * var(--editor-line-height, 1.6)); /* var(--editor-font-size) * var(--editor-line-height) */
|
||||||
background-repeat: repeat-y;
|
background-repeat: repeat-y;
|
||||||
background-position: 0 calc((var(--editor-font-size, 1rem) * var(--editor-line-height, 1.6) - var(--editor-font-size, 1rem)) / 2);
|
background-position: 0 calc((var(--editor-font-size, 1rem) * var(--editor-line-height, 1.6) - var(--editor-font-size, 1rem)) / 2);
|
||||||
|
touch-action: pan-y;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-content::before {
|
.editor-content::before {
|
||||||
|
|||||||
@@ -1,152 +1,153 @@
|
|||||||
<template>
|
<template>
|
||||||
<ion-page>
|
<ion-page>
|
||||||
<Header title="文件夹" :onBack="() => window.history.back()" />
|
<Header title="文件夹" :onBack="() => window.history.back()" />
|
||||||
<div class="folder-page-container">
|
<div class="folder-page-container">
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
<ion-icon :icon="search" class="search-icon"></ion-icon>
|
<ion-icon :icon="search" class="search-icon"></ion-icon>
|
||||||
<ion-input placeholder="搜索文件夹..." :value="searchQuery" @ionChange="e => setSearchQuery(e.detail.value)" class="search-input"></ion-input>
|
<ion-input placeholder="搜索文件夹..." :value="searchQuery" @ionChange="e => setSearchQuery(e.detail.value)" class="search-input"></ion-input>
|
||||||
<ion-button v-if="searchQuery.length > 0" fill="clear" @click="() => setSearchQuery('')">
|
<ion-button v-if="searchQuery.length > 0" fill="clear" @click="() => setSearchQuery('')">
|
||||||
<ion-icon :icon="closeCircle" class="clear-icon"></ion-icon>
|
<ion-icon :icon="closeCircle" class="clear-icon"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<ion-list class="folder-list">
|
<ion-list class="folder-list">
|
||||||
<FolderManage
|
<FolderManage
|
||||||
:allCount="allNotesCount"
|
:allCount="allNotesCount"
|
||||||
:starredCount="starredNotesCount"
|
:starredCount="starredNotesCount"
|
||||||
:trashCount="trashNotesCount"
|
:trashCount="trashNotesCount"
|
||||||
:archiveCount="archiveCount"
|
:archiveCount="archiveCount"
|
||||||
:selectedFolder="selectedFolder"
|
:selectedFolder="selectedFolder"
|
||||||
:onAllClick="() => handleFolderPress('all')"
|
:onAllClick="() => handleFolderPress('all')"
|
||||||
:onStarredClick="() => handleFolderPress('starred')"
|
:onStarredClick="() => handleFolderPress('starred')"
|
||||||
:onTrashClick="() => handleFolderPress('trash')"
|
:onTrashClick="() => handleFolderPress('trash')"
|
||||||
:onArchiveClick="() => handleFolderPress('archive')" />
|
:onArchiveClick="() => handleFolderPress('archive')" />
|
||||||
</ion-list>
|
</ion-list>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
</ion-page>
|
</ion-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useAppStore } from '../stores/useAppStore'
|
import { useAppStore } from '../stores/useAppStore'
|
||||||
import { search, closeCircle } from 'ionicons/icons'
|
import { search, closeCircle } from 'ionicons/icons'
|
||||||
import FolderManage from '../components/FolderManage.vue'
|
import FolderManage from '../components/FolderManage.vue'
|
||||||
import Header from '../components/Header.vue'
|
import Header from '../components/Header.vue'
|
||||||
|
|
||||||
const store = useAppStore()
|
const store = useAppStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
// 加载初始数据
|
// 加载初始数据
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
store.loadData()
|
store.loadData()
|
||||||
})
|
})
|
||||||
|
|
||||||
const searchQuery = ref('')
|
const searchQuery = ref('')
|
||||||
const selectedFolder = ref('all')
|
const selectedFolder = ref('all')
|
||||||
|
|
||||||
// 计算每个文件夹中的便签数量
|
// 计算每个文件夹中的便签数量
|
||||||
// 遍历所有自定义文件夹,统计每个文件夹中的便签数量
|
// 遍历所有自定义文件夹,统计每个文件夹中的便签数量
|
||||||
const foldersWithCount = computed(() => {
|
const foldersWithCount = computed(() => {
|
||||||
return store.folders.map(folder => {
|
return store.folders.map(folder => {
|
||||||
const noteCount = store.notes.filter(note => note.folderId === folder.id).length
|
const noteCount = store.notes.filter(note => note.folderId === folder.id).length
|
||||||
return {
|
return {
|
||||||
...folder,
|
...folder,
|
||||||
noteCount,
|
noteCount,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 添加默认文件夹(全部便签、加星便签、回收站)到列表开头
|
// 添加默认文件夹(全部便签、加星便签、回收站)到列表开头
|
||||||
// 计算全部便签数量
|
// 计算全部便签数量
|
||||||
const allNotesCount = computed(() => store.notes.length)
|
const allNotesCount = computed(() => store.notes.length)
|
||||||
// 计算加星便签数量
|
// 计算加星便签数量
|
||||||
const starredNotesCount = computed(() => store.notes.filter(note => note.isStarred).length)
|
const starredNotesCount = computed(() => store.notes.filter(note => note.isStarred).length)
|
||||||
// 回收站便签数量(暂未实现完整功能)
|
// 回收站便签数量(暂未实现完整功能)
|
||||||
const trashNotesCount = 0
|
const trashNotesCount = 0
|
||||||
// 归档便签数量(暂未实现完整功能)
|
// 归档便签数量(暂未实现完整功能)
|
||||||
const archiveCount = 0
|
const archiveCount = 0
|
||||||
|
|
||||||
// 合并默认文件夹和自定义文件夹
|
// 合并默认文件夹和自定义文件夹
|
||||||
const foldersWithAllNotes = computed(() => {
|
const foldersWithAllNotes = computed(() => {
|
||||||
return [
|
return [
|
||||||
{ id: 'all', name: '全部便签', noteCount: allNotesCount.value, createdAt: new Date() },
|
{ id: 'all', name: '全部便签', noteCount: allNotesCount.value, createdAt: new Date() },
|
||||||
{ id: 'starred', name: '加星便签', noteCount: starredNotesCount.value, createdAt: new Date() },
|
{ id: 'starred', name: '加星便签', noteCount: starredNotesCount.value, createdAt: new Date() },
|
||||||
{ id: 'trash', name: '回收站', noteCount: trashNotesCount, createdAt: new Date() },
|
{ id: 'trash', name: '回收站', noteCount: trashNotesCount, createdAt: new Date() },
|
||||||
...foldersWithCount.value,
|
...foldersWithCount.value,
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleFolderPress = folderId => {
|
const handleFolderPress = folderId => {
|
||||||
// 更新选中的文件夹状态
|
// 更新选中的文件夹状态
|
||||||
selectedFolder.value = folderId
|
selectedFolder.value = folderId
|
||||||
// 使用vue-router导航回便签列表页面,并传递文件夹参数
|
// 使用vue-router导航回便签列表页面,并传递文件夹参数
|
||||||
router.push(`/notes?folder=${folderId}`)
|
router.push(`/notes?folder=${folderId}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理添加文件夹按钮点击事件
|
// 处理添加文件夹按钮点击事件
|
||||||
// 在完整实现中,这里会打开文件夹创建对话框
|
// 在完整实现中,这里会打开文件夹创建对话框
|
||||||
const handleAddFolder = () => {
|
const handleAddFolder = () => {
|
||||||
console.log('Add folder pressed')
|
console.log('Add folder pressed')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理搜索功能
|
// 处理搜索功能
|
||||||
// 在完整实现中,这里会根据搜索关键词过滤文件夹
|
// 在完整实现中,这里会根据搜索关键词过滤文件夹
|
||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
console.log('Search for:', searchQuery.value)
|
console.log('Search for:', searchQuery.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleBackPress = () => {
|
const handleBackPress = () => {
|
||||||
router.back()
|
router.back()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据搜索关键词过滤文件夹
|
// 根据搜索关键词过滤文件夹
|
||||||
// 将文件夹名称转换为小写进行模糊匹配
|
// 将文件夹名称转换为小写进行模糊匹配
|
||||||
const filteredFolders = computed(() => {
|
const filteredFolders = computed(() => {
|
||||||
return foldersWithAllNotes.value.filter(folder => folder.name.toLowerCase().includes(searchQuery.value.toLowerCase()))
|
return foldersWithAllNotes.value.filter(folder => folder.name.toLowerCase().includes(searchQuery.value.toLowerCase()))
|
||||||
})
|
})
|
||||||
|
|
||||||
const setSearchQuery = value => {
|
const setSearchQuery = value => {
|
||||||
searchQuery.value = value
|
searchQuery.value = value
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.folder-page-container {
|
.folder-page-container {
|
||||||
padding: 0.625rem;
|
padding: 0.625rem;
|
||||||
background-color: var(--background);
|
background-color: var(--background);
|
||||||
}
|
touch-action: pan-y;
|
||||||
|
}
|
||||||
.search-container {
|
|
||||||
display: flex;
|
.search-container {
|
||||||
align-items: center;
|
display: flex;
|
||||||
background-color: var(--search-bar-background);
|
align-items: center;
|
||||||
border-radius: 0.5rem;
|
background-color: var(--search-bar-background);
|
||||||
padding: 0 0.625rem;
|
border-radius: 0.5rem;
|
||||||
}
|
padding: 0 0.625rem;
|
||||||
|
}
|
||||||
.search-icon {
|
|
||||||
font-size: 1.25rem;
|
.search-icon {
|
||||||
color: var(--text-tertiary);
|
font-size: 1.25rem;
|
||||||
}
|
color: var(--text-tertiary);
|
||||||
|
}
|
||||||
.search-input {
|
|
||||||
--padding-start: 0.625rem;
|
.search-input {
|
||||||
--padding-end: 0.625rem;
|
--padding-start: 0.625rem;
|
||||||
flex: 1;
|
--padding-end: 0.625rem;
|
||||||
font-size: 1rem;
|
flex: 1;
|
||||||
color: var(--text-primary);
|
font-size: 1rem;
|
||||||
}
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
.clear-icon {
|
|
||||||
font-size: 1.25rem;
|
.clear-icon {
|
||||||
color: var(--text-tertiary);
|
font-size: 1.25rem;
|
||||||
}
|
color: var(--text-tertiary);
|
||||||
|
}
|
||||||
.folder-list {
|
|
||||||
background-color: var(--background);
|
.folder-list {
|
||||||
padding: 0 1rem;
|
background-color: var(--background);
|
||||||
--ion-item-background: var(--background);
|
padding: 0 1rem;
|
||||||
}
|
--ion-item-background: var(--background);
|
||||||
</style>
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -438,9 +438,12 @@ onBeforeUnmount(async () => {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-color: var(--background);
|
background-color: var(--background);
|
||||||
|
overflow: hidden;
|
||||||
section {
|
section {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.offline-banner {
|
.offline-banner {
|
||||||
@@ -467,8 +470,15 @@ onBeforeUnmount(async () => {
|
|||||||
}
|
}
|
||||||
.note-container {
|
.note-container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: scroll;
|
overflow-y: auto;
|
||||||
background-color: var(--background);
|
background-color: var(--background);
|
||||||
|
touch-action: pan-y;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rich-text-editor {
|
||||||
|
min-height: 100%;
|
||||||
|
touch-action: pan-y;
|
||||||
}
|
}
|
||||||
.rich-text-editor {
|
.rich-text-editor {
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
|
|||||||
@@ -67,440 +67,442 @@
|
|||||||
</ion-content>
|
</ion-content>
|
||||||
</div>
|
</div>
|
||||||
</ion-page>
|
</ion-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted, watch } from 'vue'
|
import { ref, computed, onMounted, watch } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useAppStore } from '../stores/useAppStore'
|
import { useAppStore } from '../stores/useAppStore'
|
||||||
import NoteItem from '../components/NoteItem.vue'
|
import NoteItem from '../components/NoteItem.vue'
|
||||||
import Header from '../components/Header.vue'
|
import Header from '../components/Header.vue'
|
||||||
import FolderManage from '../components/FolderManage.vue'
|
import FolderManage from '../components/FolderManage.vue'
|
||||||
import SearchBar from '../components/Search.vue'
|
import SearchBar from '../components/Search.vue'
|
||||||
import { formatNoteListDate } from '../utils/dateUtils'
|
import { formatNoteListDate } from '../utils/dateUtils'
|
||||||
import { IonContent, IonPage } from '@ionic/vue'
|
import { IonContent, IonPage } from '@ionic/vue'
|
||||||
|
|
||||||
const store = useAppStore()
|
const store = useAppStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const noteItemRefs = ref({})
|
const noteItemRefs = ref({})
|
||||||
|
|
||||||
// 页面挂载时加载初始数据
|
// 页面挂载时加载初始数据
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 检查URL参数是否包含mock数据加载指令,用于开发和演示
|
// 检查URL参数是否包含mock数据加载指令,用于开发和演示
|
||||||
const urlParams = new URLSearchParams(window.location.search)
|
const urlParams = new URLSearchParams(window.location.search)
|
||||||
if (urlParams.get('mock') === 'true') {
|
if (urlParams.get('mock') === 'true') {
|
||||||
// 加载预设的模拟数据
|
// 加载预设的模拟数据
|
||||||
store.loadMockData()
|
store.loadMockData()
|
||||||
} else {
|
} else {
|
||||||
// 从Storage加载用户数据
|
// 从Storage加载用户数据
|
||||||
store.loadData()
|
store.loadData()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const searchQuery = ref('')
|
const searchQuery = ref('')
|
||||||
const sortBy = ref('date') // 排序方式:'date'(按日期)、'title'(按标题)、'starred'(按星标)
|
const sortBy = ref('date') // 排序方式:'date'(按日期)、'title'(按标题)、'starred'(按星标)
|
||||||
const isFolderExpanded = ref(false) // 文件夹列表是否展开
|
const isFolderExpanded = ref(false) // 文件夹列表是否展开
|
||||||
const currentFolder = ref('all') // 当前选中的文件夹,默认是"全部便签"
|
const currentFolder = ref('all') // 当前选中的文件夹,默认是"全部便签"
|
||||||
const noteToDelete = ref(null)
|
const noteToDelete = ref(null)
|
||||||
|
|
||||||
// 计算加星便签数量(未删除的)
|
// 计算加星便签数量(未删除的)
|
||||||
const starredNotesCount = computed(() => {
|
const starredNotesCount = computed(() => {
|
||||||
return store.notes.filter(note => note.isStarred && !note.isDeleted).length
|
return store.notes.filter(note => note.isStarred && !note.isDeleted).length
|
||||||
})
|
})
|
||||||
|
|
||||||
// 计算回收站便签数量
|
// 计算回收站便签数量
|
||||||
const trashNotesCount = computed(() => {
|
const trashNotesCount = computed(() => {
|
||||||
return store.notes.filter(note => note.isDeleted).length
|
return store.notes.filter(note => note.isDeleted).length
|
||||||
})
|
})
|
||||||
|
|
||||||
// 根据当前文件夹过滤便签
|
// 根据当前文件夹过滤便签
|
||||||
const filteredNotes = computed(() => {
|
const filteredNotes = computed(() => {
|
||||||
// 预处理搜索查询,提高性能
|
// 预处理搜索查询,提高性能
|
||||||
const lowerCaseQuery = searchQuery.value?.toLowerCase().trim() || ''
|
const lowerCaseQuery = searchQuery.value?.toLowerCase().trim() || ''
|
||||||
|
|
||||||
return store.notes.filter(note => {
|
return store.notes.filter(note => {
|
||||||
// 先检查搜索条件
|
// 先检查搜索条件
|
||||||
const matchesSearch =
|
const matchesSearch =
|
||||||
!lowerCaseQuery || (note.title && typeof note.title === 'string' && note.title.toLowerCase().includes(lowerCaseQuery)) || (note.content && typeof note.content === 'string' && note.content.toLowerCase().includes(lowerCaseQuery))
|
!lowerCaseQuery || (note.title && typeof note.title === 'string' && note.title.toLowerCase().includes(lowerCaseQuery)) || (note.content && typeof note.content === 'string' && note.content.toLowerCase().includes(lowerCaseQuery))
|
||||||
|
|
||||||
if (!matchesSearch) return false
|
if (!matchesSearch) return false
|
||||||
|
|
||||||
// 再检查文件夹条件
|
// 再检查文件夹条件
|
||||||
switch (currentFolder.value) {
|
switch (currentFolder.value) {
|
||||||
case 'all':
|
case 'all':
|
||||||
// 全部便签中不显示已删除的便签
|
// 全部便签中不显示已删除的便签
|
||||||
return !note.isDeleted
|
return !note.isDeleted
|
||||||
case 'starred':
|
case 'starred':
|
||||||
// 加星便签中只显示未删除的加星便签
|
// 加星便签中只显示未删除的加星便签
|
||||||
return note.isStarred && !note.isDeleted
|
return note.isStarred && !note.isDeleted
|
||||||
case 'trash':
|
case 'trash':
|
||||||
// 回收站中只显示已删除的便签
|
// 回收站中只显示已删除的便签
|
||||||
return note.isDeleted
|
return note.isDeleted
|
||||||
default:
|
default:
|
||||||
// 自定义文件夹中不显示已删除的便签
|
// 自定义文件夹中不显示已删除的便签
|
||||||
return note.folderId === currentFolder.value && !note.isDeleted
|
return note.folderId === currentFolder.value && !note.isDeleted
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 过滤并排序便签列表
|
// 过滤并排序便签列表
|
||||||
// 首先按置顶状态排序,置顶的便签排在前面
|
// 首先按置顶状态排序,置顶的便签排在前面
|
||||||
// 然后根据sortBy的值进行二次排序
|
// 然后根据sortBy的值进行二次排序
|
||||||
const filteredAndSortedNotes = computed(() => {
|
const filteredAndSortedNotes = computed(() => {
|
||||||
return [...filteredNotes.value].sort((a, b) => {
|
return [...filteredNotes.value].sort((a, b) => {
|
||||||
// 置顶的便签排在前面
|
// 置顶的便签排在前面
|
||||||
if (a.isTop && !b.isTop) return -1
|
if (a.isTop && !b.isTop) return -1
|
||||||
if (!a.isTop && b.isTop) return 1
|
if (!a.isTop && b.isTop) return 1
|
||||||
|
|
||||||
// 根据排序方式排序
|
// 根据排序方式排序
|
||||||
switch (sortBy.value) {
|
switch (sortBy.value) {
|
||||||
case 'title':
|
case 'title':
|
||||||
// 按标题字母顺序排序
|
// 按标题字母顺序排序
|
||||||
return a.title.localeCompare(b.title)
|
return a.title.localeCompare(b.title)
|
||||||
case 'starred':
|
case 'starred':
|
||||||
// 按星标状态排序,加星的便签排在前面
|
// 按星标状态排序,加星的便签排在前面
|
||||||
return (b.isStarred ? 1 : 0) - (a.isStarred ? 1 : 0)
|
return (b.isStarred ? 1 : 0) - (a.isStarred ? 1 : 0)
|
||||||
case 'date':
|
case 'date':
|
||||||
default:
|
default:
|
||||||
// 按更新时间倒序排列(最新的在前)
|
// 按更新时间倒序排列(最新的在前)
|
||||||
return new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()
|
return new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 计算头部标题
|
// 计算头部标题
|
||||||
const headerTitle = computed(() => {
|
const headerTitle = computed(() => {
|
||||||
switch (currentFolder.value) {
|
switch (currentFolder.value) {
|
||||||
case 'all':
|
case 'all':
|
||||||
return '全部便签'
|
return '全部便签'
|
||||||
case 'starred':
|
case 'starred':
|
||||||
return '加星便签'
|
return '加星便签'
|
||||||
case 'trash':
|
case 'trash':
|
||||||
return '回收站'
|
return '回收站'
|
||||||
default:
|
default:
|
||||||
// 查找自定义文件夹的名称
|
// 查找自定义文件夹的名称
|
||||||
const folder = store.folders.find(f => f.id === currentFolder.value)
|
const folder = store.folders.find(f => f.id === currentFolder.value)
|
||||||
return folder ? folder.name : '全部便签'
|
return folder ? folder.name : '全部便签'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 计算全部便签数量(未删除的)
|
// 计算全部便签数量(未删除的)
|
||||||
const allNotesCount = computed(() => {
|
const allNotesCount = computed(() => {
|
||||||
return store.notes.filter(note => !note.isDeleted).length
|
return store.notes.filter(note => !note.isDeleted).length
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleNotePress = noteId => {
|
const handleNotePress = noteId => {
|
||||||
// 检查是否有便签条处于展开状态
|
// 检查是否有便签条处于展开状态
|
||||||
let hasSlidedNote = false
|
let hasSlidedNote = false
|
||||||
Object.values(noteItemRefs.value).forEach(noteItem => {
|
Object.values(noteItemRefs.value).forEach(noteItem => {
|
||||||
// 注意:isSlided是ref值,需要通过.value访问
|
// 注意:isSlided是ref值,需要通过.value访问
|
||||||
if (noteItem && noteItem.getSlideState()) {
|
if (noteItem && noteItem.getSlideState()) {
|
||||||
hasSlidedNote = true
|
hasSlidedNote = true
|
||||||
noteItem.resetSlideState()
|
noteItem.resetSlideState()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 如果有便签条处于展开状态,不跳转到编辑页面
|
// 如果有便签条处于展开状态,不跳转到编辑页面
|
||||||
if (hasSlidedNote) {
|
if (hasSlidedNote) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用vue-router导航到编辑页面
|
// 使用vue-router导航到编辑页面
|
||||||
router.push(`/editor/${noteId}`)
|
router.push(`/editor/${noteId}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleAddNote = () => {
|
const handleAddNote = () => {
|
||||||
// 使用vue-router导航到新建便签页面
|
// 使用vue-router导航到新建便签页面
|
||||||
router.push('/editor')
|
router.push('/editor')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理Header组件的操作按钮点击事件
|
// 处理Header组件的操作按钮点击事件
|
||||||
const handleHeaderAction = actionType => {
|
const handleHeaderAction = actionType => {
|
||||||
if (actionType === 'create') {
|
if (actionType === 'create') {
|
||||||
handleAddNote()
|
handleAddNote()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleStarToggle = async noteId => {
|
const handleStarToggle = async noteId => {
|
||||||
const note = store.notes.find(n => n.id === noteId)
|
const note = store.notes.find(n => n.id === noteId)
|
||||||
if (note) {
|
if (note) {
|
||||||
try {
|
try {
|
||||||
await store.updateNote(noteId, { isStarred: !note.isStarred })
|
await store.updateNote(noteId, { isStarred: !note.isStarred })
|
||||||
console.log(`便签 ${noteId} 星标状态已更新`)
|
console.log(`便签 ${noteId} 星标状态已更新`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('更新便签星标状态失败:', error)
|
console.error('更新便签星标状态失败:', error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleTopToggle = async noteId => {
|
const handleTopToggle = async noteId => {
|
||||||
const note = store.notes.find(n => n.id === noteId)
|
const note = store.notes.find(n => n.id === noteId)
|
||||||
if (note) {
|
if (note) {
|
||||||
try {
|
try {
|
||||||
await store.updateNote(noteId, { isTop: !note.isTop })
|
await store.updateNote(noteId, { isTop: !note.isTop })
|
||||||
console.log(`便签 ${noteId} 置顶状态已更新`)
|
console.log(`便签 ${noteId} 置顶状态已更新`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('更新便签置顶状态失败:', error)
|
console.error('更新便签置顶状态失败:', error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const confirmDeleteNote = async noteId => {
|
const confirmDeleteNote = async noteId => {
|
||||||
noteToDelete.value = noteId
|
noteToDelete.value = noteId
|
||||||
if (noteToDelete.value) {
|
if (noteToDelete.value) {
|
||||||
try {
|
try {
|
||||||
// 检查当前是否在回收站中
|
// 检查当前是否在回收站中
|
||||||
if (currentFolder.value === 'trash') {
|
if (currentFolder.value === 'trash') {
|
||||||
// 在回收站中删除便签,彻底删除
|
// 在回收站中删除便签,彻底删除
|
||||||
await store.permanentlyDeleteNote(noteToDelete.value)
|
await store.permanentlyDeleteNote(noteToDelete.value)
|
||||||
console.log(`便签 ${noteToDelete.value} 已彻底删除`)
|
console.log(`便签 ${noteToDelete.value} 已彻底删除`)
|
||||||
} else {
|
} else {
|
||||||
// 不在回收站中,将便签移至回收站
|
// 不在回收站中,将便签移至回收站
|
||||||
await store.moveToTrash(noteToDelete.value)
|
await store.moveToTrash(noteToDelete.value)
|
||||||
console.log(`便签 ${noteToDelete.value} 已移至回收站`)
|
console.log(`便签 ${noteToDelete.value} 已移至回收站`)
|
||||||
}
|
}
|
||||||
noteToDelete.value = null
|
noteToDelete.value = null
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('删除便签失败:', error)
|
console.error('删除便签失败:', error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理排序方式切换
|
// 处理排序方式切换
|
||||||
// 循环切换排序选项:按日期 -> 按标题 -> 按星标 -> 按日期...
|
// 循环切换排序选项:按日期 -> 按标题 -> 按星标 -> 按日期...
|
||||||
const handleSort = () => {
|
const handleSort = () => {
|
||||||
const sortOptions = ['date', 'title', 'starred']
|
const sortOptions = ['date', 'title', 'starred']
|
||||||
const currentIndex = sortOptions.indexOf(sortBy.value)
|
const currentIndex = sortOptions.indexOf(sortBy.value)
|
||||||
const nextIndex = (currentIndex + 1) % sortOptions.length
|
const nextIndex = (currentIndex + 1) % sortOptions.length
|
||||||
sortBy.value = sortOptions[nextIndex]
|
sortBy.value = sortOptions[nextIndex]
|
||||||
console.log('当前排序方式:', sortOptions[nextIndex])
|
console.log('当前排序方式:', sortOptions[nextIndex])
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleAllNotesClick = () => {
|
const handleAllNotesClick = () => {
|
||||||
setCurrentFolder('all')
|
setCurrentFolder('all')
|
||||||
setIsFolderExpanded(false)
|
setIsFolderExpanded(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleStarredNotesClick = () => {
|
const handleStarredNotesClick = () => {
|
||||||
setCurrentFolder('starred')
|
setCurrentFolder('starred')
|
||||||
setIsFolderExpanded(false)
|
setIsFolderExpanded(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleTrashNotesClick = () => {
|
const handleTrashNotesClick = () => {
|
||||||
setCurrentFolder('trash')
|
setCurrentFolder('trash')
|
||||||
setIsFolderExpanded(false)
|
setIsFolderExpanded(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleFolderClick = folderId => {
|
const handleFolderClick = folderId => {
|
||||||
setCurrentFolder(folderId)
|
setCurrentFolder(folderId)
|
||||||
setIsFolderExpanded(false)
|
setIsFolderExpanded(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleAddFolder = () => {
|
const handleAddFolder = () => {
|
||||||
// 文件夹添加功能已在FolderManage组件中实现
|
// 文件夹添加功能已在FolderManage组件中实现
|
||||||
// 这里只需关闭文件夹列表
|
// 这里只需关闭文件夹列表
|
||||||
setIsFolderExpanded(false)
|
setIsFolderExpanded(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleFolderPress = () => {
|
const handleFolderPress = () => {
|
||||||
// 使用vue-router导航到文件夹页面
|
// 使用vue-router导航到文件夹页面
|
||||||
router.push('/folders')
|
router.push('/folders')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSettingsPress = () => {
|
const handleSettingsPress = () => {
|
||||||
// 使用vue-router导航到设置页面
|
// 使用vue-router导航到设置页面
|
||||||
router.push('/settings')
|
router.push('/settings')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleFolderToggle = () => {
|
const handleFolderToggle = () => {
|
||||||
// 在实际应用中,这里会触发文件夹列表的展开/收起
|
// 在实际应用中,这里会触发文件夹列表的展开/收起
|
||||||
isFolderExpanded.value = !isFolderExpanded.value
|
isFolderExpanded.value = !isFolderExpanded.value
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSearch = query => {
|
const handleSearch = query => {
|
||||||
// 搜索功能已在computed属性filteredAndSortedNotes中实现
|
// 搜索功能已在computed属性filteredAndSortedNotes中实现
|
||||||
console.log('搜索:', query)
|
console.log('搜索:', query)
|
||||||
|
|
||||||
// 可以在这里添加搜索统计或其它功能
|
// 可以在这里添加搜索统计或其它功能
|
||||||
if (query && query.length > 0) {
|
if (query && query.length > 0) {
|
||||||
console.log(`找到 ${filteredAndSortedNotes.value.length} 个匹配的便签`)
|
console.log(`找到 ${filteredAndSortedNotes.value.length} 个匹配的便签`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleClearSearch = () => {
|
const handleClearSearch = () => {
|
||||||
// 清除搜索已在v-model中处理
|
// 清除搜索已在v-model中处理
|
||||||
console.log('搜索已清除')
|
console.log('搜索已清除')
|
||||||
|
|
||||||
// 清除搜索后可以重置一些状态
|
// 清除搜索后可以重置一些状态
|
||||||
setSearchQuery('')
|
setSearchQuery('')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSearchFocus = () => {
|
const handleSearchFocus = () => {
|
||||||
console.log('搜索栏获得焦点')
|
console.log('搜索栏获得焦点')
|
||||||
// 可以在这里添加获得焦点时的特殊处理
|
// 可以在这里添加获得焦点时的特殊处理
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSearchBlur = () => {
|
const handleSearchBlur = () => {
|
||||||
console.log('搜索栏失去焦点')
|
console.log('搜索栏失去焦点')
|
||||||
// 可以在这里添加失去焦点时的特殊处理
|
// 可以在这里添加失去焦点时的特殊处理
|
||||||
}
|
}
|
||||||
|
|
||||||
// 防抖函数,用于避免频繁触发搜索
|
// 防抖函数,用于避免频繁触发搜索
|
||||||
// 通过延迟执行函数,只在最后一次调用后执行
|
// 通过延迟执行函数,只在最后一次调用后执行
|
||||||
const debounceSearch = (func, delay) => {
|
const debounceSearch = (func, delay) => {
|
||||||
let timeoutId
|
let timeoutId
|
||||||
return function (...args) {
|
return function (...args) {
|
||||||
clearTimeout(timeoutId)
|
clearTimeout(timeoutId)
|
||||||
timeoutId = setTimeout(() => func.apply(this, args), delay)
|
timeoutId = setTimeout(() => func.apply(this, args), delay)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 防抖搜索处理函数,延迟300ms执行搜索
|
// 防抖搜索处理函数,延迟300ms执行搜索
|
||||||
const debouncedHandleSearch = debounceSearch(query => {
|
const debouncedHandleSearch = debounceSearch(query => {
|
||||||
handleSearch(query)
|
handleSearch(query)
|
||||||
}, 300)
|
}, 300)
|
||||||
|
|
||||||
// 改进的日期格式化函数
|
// 改进的日期格式化函数
|
||||||
const formatDate = dateString => {
|
const formatDate = dateString => {
|
||||||
return formatNoteListDate(dateString)
|
return formatNoteListDate(dateString)
|
||||||
}
|
}
|
||||||
|
|
||||||
const setCurrentFolder = folder => {
|
const setCurrentFolder = folder => {
|
||||||
currentFolder.value = folder
|
currentFolder.value = folder
|
||||||
}
|
}
|
||||||
|
|
||||||
const setIsFolderExpanded = expanded => {
|
const setIsFolderExpanded = expanded => {
|
||||||
isFolderExpanded.value = expanded
|
isFolderExpanded.value = expanded
|
||||||
}
|
}
|
||||||
|
|
||||||
const setSearchQuery = query => {
|
const setSearchQuery = query => {
|
||||||
searchQuery.value = query
|
searchQuery.value = query
|
||||||
}
|
}
|
||||||
|
|
||||||
const notes = computed(() => store.notes)
|
const notes = computed(() => store.notes)
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.container {
|
.container {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background: url(/assets/icons/drawable-xxhdpi/note_background.png);
|
background: url(/assets/icons/drawable-xxhdpi/note_background.png);
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
.offline-banner {
|
.offline-banner {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 10000;
|
z-index: 10000;
|
||||||
background-color: #ff6b6b;
|
background-color: #ff6b6b;
|
||||||
color: white;
|
color: white;
|
||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.offline-content {
|
.offline-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.offline-icon {
|
.offline-icon {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.folder-list {
|
.folder-list {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 3.125rem;
|
top: 3.125rem;
|
||||||
left: 10%;
|
left: 10%;
|
||||||
right: 10%;
|
right: 10%;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
background-color: var(--background-card);
|
background-color: var(--background-card);
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
box-shadow: 0 0.125rem 0.25rem var(--shadow);
|
box-shadow: 0 0.125rem 0.25rem var(--shadow);
|
||||||
border: 1px solid #f0ece7;
|
border: 1px solid #f0ece7;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.folder-overlay {
|
.folder-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
}
|
}
|
||||||
.content {
|
.content {
|
||||||
--background: transparent;
|
--background: transparent;
|
||||||
--padding-top: 4.5rem;
|
--padding-top: 4.5rem;
|
||||||
--padding-bottom: 2rem;
|
--padding-bottom: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-container {
|
.search-container {
|
||||||
padding: 0.8rem 0.5rem;
|
padding: 0.8rem 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notes-container {
|
.notes-container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
overflow: hidden;
|
||||||
|
touch-action: pan-y;
|
||||||
.notes-list {
|
}
|
||||||
position: relative;
|
|
||||||
}
|
.notes-list {
|
||||||
|
position: relative;
|
||||||
.note-item {
|
}
|
||||||
margin: 0.6rem 0;
|
|
||||||
transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
.note-item {
|
||||||
}
|
margin: 0.6rem 0;
|
||||||
|
transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
||||||
/* 便签列表动画 */
|
}
|
||||||
.note-list-enter-active,
|
|
||||||
.note-list-leave-active {
|
/* 便签列表动画 */
|
||||||
transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
.note-list-enter-active,
|
||||||
}
|
.note-list-leave-active {
|
||||||
|
transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
||||||
.note-list-leave-to {
|
}
|
||||||
opacity: 0;
|
|
||||||
transform: translateX(-30px);
|
.note-list-leave-to {
|
||||||
}
|
opacity: 0;
|
||||||
|
transform: translateX(-30px);
|
||||||
.note-list-move {
|
}
|
||||||
transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
||||||
}
|
.note-list-move {
|
||||||
|
transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
||||||
.note-list-leave-active {
|
}
|
||||||
position: absolute;
|
|
||||||
width: calc(100% - 1rem);
|
.note-list-leave-active {
|
||||||
}
|
position: absolute;
|
||||||
|
width: calc(100% - 1rem);
|
||||||
/* 文件夹列表动画 */
|
}
|
||||||
.folder-slide-enter-active,
|
|
||||||
.folder-slide-leave-active {
|
/* 文件夹列表动画 */
|
||||||
transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
.folder-slide-enter-active,
|
||||||
}
|
.folder-slide-leave-active {
|
||||||
|
transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
||||||
.folder-slide-enter-from {
|
}
|
||||||
opacity: 0;
|
|
||||||
transform: scale(0.8) translateY(-20px);
|
.folder-slide-enter-from {
|
||||||
}
|
opacity: 0;
|
||||||
|
transform: scale(0.8) translateY(-20px);
|
||||||
.folder-slide-enter-to {
|
}
|
||||||
opacity: 1;
|
|
||||||
transform: scale(1) translateY(0);
|
.folder-slide-enter-to {
|
||||||
}
|
opacity: 1;
|
||||||
|
transform: scale(1) translateY(0);
|
||||||
.folder-slide-leave-from {
|
}
|
||||||
opacity: 1;
|
|
||||||
transform: scale(1) translateY(0);
|
.folder-slide-leave-from {
|
||||||
}
|
opacity: 1;
|
||||||
|
transform: scale(1) translateY(0);
|
||||||
.folder-slide-leave-to {
|
}
|
||||||
opacity: 0;
|
|
||||||
transform: scale(0.8) translateY(-20px);
|
.folder-slide-leave-to {
|
||||||
}
|
opacity: 0;
|
||||||
</style>
|
transform: scale(0.8) translateY(-20px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -115,16 +115,8 @@ const settings = computed(() => store.settings)
|
|||||||
background: url('/assets/icons/drawable-xxhdpi/note_setting_bg.png');
|
background: url('/assets/icons/drawable-xxhdpi/note_setting_bg.png');
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
overflow-y: scroll;
|
overflow-y: auto;
|
||||||
|
touch-action: pan-y;
|
||||||
.item-text-primary {
|
-webkit-overflow-scrolling: touch;
|
||||||
font-size: 1rem;
|
|
||||||
color: #8e8e8e;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item-text-tertiary {
|
|
||||||
font-size: 0.9375rem;
|
|
||||||
color: #b4b4b4;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user