diff --git a/src/utils/language.js b/src/utils/language.js index db438c2..eb263a3 100644 --- a/src/utils/language.js +++ b/src/utils/language.js @@ -4,7 +4,7 @@ export function lang() { CHS: { title: '密码本', search: '搜索...', - menu: ['按首字母', '按最常使用'], + menu: ['按首字母', '按创建顺序', '按最常使用'], drawer: ['账户', '设置', '生成密码', '更新日志', '分享链接', '下载apk', '立即锁定', '加入用户群'], empty_state: { label: '创建你的第一个密码', @@ -23,7 +23,7 @@ export function lang() { EN: { title: 'Codebook', search: 'Search...', - menu: ['Alphabetically', 'Recently Used'], + menu: ['Alphabetically', 'Set Up Time', 'Recently Used'], drawer: ['Account', 'Settings', 'Generate Password', 'Update Log', 'Share', 'Download apk', 'Lock Now', 'Join US'], empty_state: { label: 'Create your first code', @@ -310,6 +310,14 @@ export function lang() { CHS: { title: '更新日志', timeline: [ + { + label: '设置密码本默认显示顺序为使用频率', + tag:'功能更新', + content: [ + '用多了还是觉得使用频率多的在上边好一些', + '2020-12-29' + ] + }, { label: '新增导入导出功能', tag: '功能更新', @@ -459,6 +467,14 @@ export function lang() { EN: { title: 'Update Log', timeline: [ + { + label: 'Set the default display order of the password book to use frequency', + tag:'Feature update', + content: [ + 'Use much still feel to use frequency much in above a few better', + '2020-12-29' + ] + }, { label: 'New import and export function', tag: 'Feature update', diff --git a/src/views/Home/Home.vue b/src/views/Home/Home.vue index fc045ee..4a6c057 100644 --- a/src/views/Home/Home.vue +++ b/src/views/Home/Home.vue @@ -19,7 +19,8 @@ {{ lang.menu[0] }} - {{ lang.menu[1] }} + {{ lang.menu[1] }} + {{ lang.menu[2] }} @@ -164,6 +165,8 @@ export default { clientHeight: "", // 显示的密码列表 show_list: [], + // 原始顺序密码列表 + row_list: [], // 搜索暂存list cache_list: [], unlock: false, @@ -244,7 +247,10 @@ export default { this.turnToUnlock("密码错误"); return; } - this.show_list = data_list; + // 设置原始数据 + this.row_list = JSON.parse(JSON.stringify(data_list)) + // 设置默认显示顺序是常用的在最上边 + this.show_list = data_list.sort((a, b) => b['open_count'] - a['open_count']); // 抽离title this.separateTitle(data_list); // 恢复原先状态 @@ -299,12 +305,13 @@ export default { this.show_list = this.show_list.sort((a, b) => a["title"].localeCompare(b["title"]) ); + } else if (type == "Default") { + // 按密码创建时间排序 + this.show_list = JSON.parse(JSON.stringify(this.row_list)); } else { - // 按使用频率排序 - this.show_list = this.show_list.sort( - (a, b) => b["open_count"] - a["open_count"] - ); - } + // 按使用频率排序 + this.show_list = this.show_list.sort((a, b) => b['open_count'] - a['open_count']); + } }, // 跳转到解锁界面