You've already forked SmartisanNote.Remake
移除了无用的资源;
头部图片资源修改;
This commit is contained in:
@@ -26,14 +26,105 @@ export const useAppStore = defineStore('app', {
|
||||
const loadedFolders = await storage.getFolders();
|
||||
const loadedSettings = await storage.getSettings();
|
||||
|
||||
this.notes = loadedNotes;
|
||||
this.folders = loadedFolders;
|
||||
this.settings = loadedSettings;
|
||||
// 如果没有数据,则加载mock数据
|
||||
if (loadedNotes.length === 0 && loadedFolders.length === 0) {
|
||||
this.loadMockData();
|
||||
} else {
|
||||
this.notes = loadedNotes;
|
||||
this.folders = loadedFolders;
|
||||
this.settings = loadedSettings;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error loading data:', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 加载mock数据
|
||||
async loadMockData() {
|
||||
// Mock notes
|
||||
const mockNotes = [
|
||||
{
|
||||
id: '1',
|
||||
title: '欢迎使用锤子便签',
|
||||
content: '这是一个功能强大的便签应用,您可以在这里记录您的想法、待办事项等。',
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
folderId: null,
|
||||
isStarred: true
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
title: '待办事项',
|
||||
content: '1. 完成项目报告\n2. 购买 groceries\n3. 预约医生\n4. 给朋友打电话',
|
||||
createdAt: new Date(Date.now() - 86400000).toISOString(), // 昨天
|
||||
updatedAt: new Date(Date.now() - 86400000).toISOString(),
|
||||
folderId: null,
|
||||
isStarred: true
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
title: '购物清单',
|
||||
content: '苹果\n牛奶\n面包\n鸡蛋\n西红柿\n咖啡',
|
||||
createdAt: new Date(Date.now() - 172800000).toISOString(), // 前天
|
||||
updatedAt: new Date(Date.now() - 172800000).toISOString(),
|
||||
folderId: null,
|
||||
isStarred: false
|
||||
},
|
||||
{
|
||||
id: '4',
|
||||
title: '项目想法',
|
||||
content: '1. 实现云同步功能\n2. 添加深色模式\n3. 支持Markdown语法\n4. 添加标签功能',
|
||||
createdAt: new Date(Date.now() - 259200000).toISOString(), // 3天前
|
||||
updatedAt: new Date(Date.now() - 259200000).toISOString(),
|
||||
folderId: null,
|
||||
isStarred: false
|
||||
},
|
||||
{
|
||||
id: '5',
|
||||
title: '读书笔记',
|
||||
content: '《Vue.js实战》\n- 组件化思想是Vue的核心\n- 理解响应式原理很重要\n- Pinia是Vue 3的推荐状态管理库',
|
||||
createdAt: new Date(Date.now() - 345600000).toISOString(), // 4天前
|
||||
updatedAt: new Date(Date.now() - 345600000).toISOString(),
|
||||
folderId: null,
|
||||
isStarred: false
|
||||
}
|
||||
];
|
||||
|
||||
// Mock folders
|
||||
const mockFolders = [
|
||||
{
|
||||
id: 'folder1',
|
||||
name: '工作',
|
||||
createdAt: new Date().toISOString()
|
||||
},
|
||||
{
|
||||
id: 'folder2',
|
||||
name: '个人',
|
||||
createdAt: new Date().toISOString()
|
||||
},
|
||||
{
|
||||
id: 'folder3',
|
||||
name: '学习',
|
||||
createdAt: new Date().toISOString()
|
||||
}
|
||||
];
|
||||
|
||||
// Mock settings
|
||||
const mockSettings = {
|
||||
cloudSync: false,
|
||||
darkMode: false
|
||||
};
|
||||
|
||||
this.notes = mockNotes;
|
||||
this.folders = mockFolders;
|
||||
this.settings = mockSettings;
|
||||
|
||||
// 保存到localStorage
|
||||
await storage.saveNotes(mockNotes);
|
||||
await storage.saveFolders(mockFolders);
|
||||
await storage.saveSettings(mockSettings);
|
||||
},
|
||||
|
||||
// 保存notes到localStorage
|
||||
async saveNotes() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user