From 7d7167f4ba2cf03236b643f673803b47830c1faa Mon Sep 17 00:00:00 2001 From: yutent Date: Sun, 19 Feb 2023 20:21:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=94=B9=E7=94=A8vue?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E3=80=81=E5=88=A0=E9=99=A4=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=94=99=E5=88=AB=E5=AD=97=E8=AF=8D=E7=BB=84=E3=80=81=E5=A2=9E?= =?UTF-8?q?=E5=8A=A076=E4=B8=AA=E5=B8=B8=E7=94=A8=E8=AF=8D=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- about.html | 96 ----- index.html | 2 +- package.json | 4 +- {src => public}/data/code.txt | 0 {src => public}/data/dy.txt | 0 {src => public}/data/emoji.txt | 0 {src => public}/data/gb2312.txt | 0 {src => public}/data/gbk.txt | 0 {src => public}/data/nethot.txt | 0 {src => public}/data/words.txt | 78 +++- src/app.vue | 85 ++-- src/assets/common.scss | 89 ----- src/assets/index.css | 1 + src/assets/index.scss | 180 --------- src/components/footer.vue | 20 + src/components/hello.vue | 40 -- src/components/topbar.vue | 56 +++ src/lib/core.js | 11 +- src/lib/index.js | 385 ------------------ src/main.js | 12 +- src/router.js | 10 +- src/views/about.vue | 107 ++++- src/views/home.vue | 689 +++++++++++++++++++++++++++++++- vue.live.js | 5 +- 25 files changed, 1008 insertions(+), 864 deletions(-) delete mode 100644 about.html rename {src => public}/data/code.txt (100%) rename {src => public}/data/dy.txt (100%) rename {src => public}/data/emoji.txt (100%) rename {src => public}/data/gb2312.txt (100%) rename {src => public}/data/gbk.txt (100%) rename {src => public}/data/nethot.txt (100%) rename {src => public}/data/words.txt (99%) delete mode 100644 src/assets/common.scss create mode 100644 src/assets/index.css delete mode 100644 src/assets/index.scss create mode 100644 src/components/footer.vue delete mode 100644 src/components/hello.vue create mode 100644 src/components/topbar.vue delete mode 100644 src/lib/index.js diff --git a/.gitignore b/.gitignore index 2dde5ab..b129cef 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ node_modules *.sublime-project *.sublime-workspace package-lock.json - +test.js ._* .Spotlight-V100 diff --git a/about.html b/about.html deleted file mode 100644 index d209675..0000000 --- a/about.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - 关于 - 五笔输入法86版 - - - - - - - -
-
- -
- - -
-
-

更新日志

- -
- -
@2022.04.10
-
-
    -
  1. 修复编码生成
  2. -
  3. 删除部分错别字词组
  4. -
-
- -
@2022.03.22
-
-
    -
  1. 调整gbk大字符集的排序
  2. -
  3. 删除词组`加德满都、嗲嗲、所列、新特`, 增加词组`握草、摆烂、封板`
  4. -
-
- -
@2022.03.21
-
-
    -
  1. 修复字库字典顺序
  2. -
  3. 增加基础词汇23465个、计算机词汇221个、emoji表情181个、网络热词186个
  4. -
  5. 查询功能支持词组
  6. -
  7. 词库下载功能完成(个人词库暂未支持、拼音反查暂未支持)
  8. -
-
- - -
@2022.03.15
-
-
    -
  1. 增加以下单字【䗪、㳇、㕮、㬊、㿠、䝙、㠇、㮾、㫰、㛹、㧑、㙦、䓨、㳚、䏲、䗖、䃅、㙍、䏡、䓛、䃎、䓬、㽏、䢼、㸌、㛃、㬚、㵐、䢺、䓫、䌹、䐃、㸆、㥄、䂮、㰀、㠓、㭕、䎃、䒤、㴔、㟃、䗴、㻬、䣘、㛚、㳘、㬎、䗛、㑊、㺄、㶲、㙘、䎖、㩼、㹴、䜰、䜮、鿏】
  2. -
  3. 增加以下异型字【𠮷、𠙶、𨭉、𨚕、𠳐、𥕢、𤧛、𣗋、𨱏、𦭜、𨙸、𣸣、𦙶、𨐈、𤩽、𨱑、𨟠、𩾌、𡐓、𦝼、𧿹、𩾃、𨺙、𦰡、𡎚、𨱇、𦈡、𦒍、𣲘、𥻗、𣲗、𤫉、𥔲、𩽾、𠅤、𤞤、𨱔、𥖨、𫍣、𬶍、𫍣、𫘦、𫘜、𬭩、𫇭、𬭬】
  4. -
-
- -
@2022.03.10
-
-
    -
  1. 完成基础字典生成GB2312(6763)个 + GBK(14295)个
  2. -
  3. 完成基本词组生成
  4. -
-
-
- -
- -
- - - -
-
- ©2022, Yutent™. - Power by JavaScript -
-
-
- - - - \ No newline at end of file diff --git a/index.html b/index.html index 94daac9..5a0a518 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@ -
+
diff --git a/package.json b/package.json index 9c2b39a..52cad5c 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,6 @@ "build": "vue-live build" }, "devDependencies": { - "@bytedo/vue-live": "^0.1.9" + "@bytedo/vue-live": "^0.2.0" } -} \ No newline at end of file +} diff --git a/src/data/code.txt b/public/data/code.txt similarity index 100% rename from src/data/code.txt rename to public/data/code.txt diff --git a/src/data/dy.txt b/public/data/dy.txt similarity index 100% rename from src/data/dy.txt rename to public/data/dy.txt diff --git a/src/data/emoji.txt b/public/data/emoji.txt similarity index 100% rename from src/data/emoji.txt rename to public/data/emoji.txt diff --git a/src/data/gb2312.txt b/public/data/gb2312.txt similarity index 100% rename from src/data/gb2312.txt rename to public/data/gb2312.txt diff --git a/src/data/gbk.txt b/public/data/gbk.txt similarity index 100% rename from src/data/gbk.txt rename to public/data/gbk.txt diff --git a/src/data/nethot.txt b/public/data/nethot.txt similarity index 100% rename from src/data/nethot.txt rename to public/data/nethot.txt diff --git a/src/data/words.txt b/public/data/words.txt similarity index 99% rename from src/data/words.txt rename to public/data/words.txt index ac2e4b6..c063e22 100644 --- a/src/data/words.txt +++ b/public/data/words.txt @@ -2428,6 +2428,7 @@ 包罗 包罗万象 包茂 +包名 包膜 包你 包年 @@ -4267,6 +4268,7 @@ 边缘人 边远 边寨 +边长 边走边 编办 编成 @@ -6234,6 +6236,7 @@ 不能自拔 不能自已 不能做 +不腻 不念旧恶 不宁 不宁唯是 @@ -7271,6 +7274,7 @@ 踩断 踩过界 踩坏 +踩坑 踩雷 踩死 踩踏 @@ -8910,6 +8914,7 @@ 超凡入圣 超凡脱俗 超负荷 +超纲 超高 超高频 超高速 @@ -11700,6 +11705,7 @@ 传真 传真机 传正 +传值 传中 传宗接代 船帮 @@ -13326,6 +13332,7 @@ 达喀尔 达卡 达拉 +达拉崩吧 达拉斯 达赖 达赖喇嘛 @@ -14942,6 +14949,7 @@ 单就 单句 单据 +单卡 单靠 单科 单孔 @@ -15669,6 +15677,7 @@ 到点 到顶 到访 +到付 到该 到港 到过 @@ -17757,6 +17766,7 @@ 调温 调息 调戏 +调校 调笑 调协 调谐 @@ -18555,6 +18565,7 @@ 冻得 冻饿 冻害 +冻鸡 冻僵 冻结 冻裂 @@ -19054,6 +19065,7 @@ 读数 读诵 读速 +读条 读图 读完 读万卷书 @@ -20297,6 +20309,7 @@ 饿鬼 饿虎扑食 饿坏 +饿了 饿了吧 饿了么 饿殍 @@ -20791,6 +20804,7 @@ 发嗲 发动 发动机 +发冻鸡 发抖 发端 发短信 @@ -21811,6 +21825,7 @@ 方伯 方步 方才 +方仓 方差 方成 方城 @@ -22047,6 +22062,7 @@ 房客 房款 房里 +房梁 房门 房内 房奴 @@ -24898,6 +24914,7 @@ 敢问 敢想 敢言 +敢用 敢于 敢作敢当 敢作敢为 @@ -27089,6 +27106,7 @@ 宫殿 宫斗剧 宫娥 +宫格 宫颈 宫颈癌 宫颈糜烂 @@ -29598,6 +29616,7 @@ 果腹 果敢 果果 +果号 果核 果迹 果酱 @@ -29866,6 +29885,7 @@ 哈喽 哈罗 哈马斯 +哈曼 哈密 哈密瓜 哈姆 @@ -29910,6 +29930,7 @@ 还不错 还不够 还不清 +还不如 还不是 还不知道 还差 @@ -34209,6 +34230,7 @@ 换衣服 换喻 换元 +换源 换证 换住 换装 @@ -34429,6 +34451,7 @@ 黄绿 黄绿色 黄麻 +黄码 黄毛 黄毛丫头 黄玫瑰 @@ -34463,6 +34486,7 @@ 黄山 黄衫 黄鳝 +黄少天 黄圣依 黄石 黄书 @@ -36711,7 +36735,6 @@ 几座 己方 己见 -己经 己任 己所不欲 挤挨 @@ -37222,6 +37245,7 @@ 加上 加上去 加深 +加湿 加湿器 加时 加时赛 @@ -38606,6 +38630,7 @@ 江洋大盗 江阴 江油 +江鱼儿 江月 江泽民 江浙 @@ -39501,6 +39526,7 @@ 教民 教你 教派 +教培 教区 教人 教师 @@ -42593,6 +42619,7 @@ 焗油 菊豆 菊花 +菊苣 橘柑 橘红 橘黄 @@ -43451,7 +43478,6 @@ 卡拉 卡拉奇 卡拉什尼科夫 -卡拉OK 卡了 卡勒 卡类 @@ -49972,6 +49998,7 @@ 灵秀 灵验 灵药 +灵耀 灵异 灵隐 灵应 @@ -50409,6 +50436,7 @@ 流年不利 流年似水 流脓 +流拍 流派 流盼 流配 @@ -51590,6 +51618,7 @@ 乱晃 乱记 乱纪 +乱加 乱箭攒心 乱讲 乱叫 @@ -52426,6 +52455,7 @@ 买了 买辆 买楼 +买买买 买卖 买卖合同 买卖双方 @@ -52670,6 +52700,7 @@ 满腹狐疑 满腹经纶 满腹疑团 +满格 满贯 满汉 满汉全席 @@ -52874,6 +52905,7 @@ 芒鞋 芒种 杧果 +盲猜 盲肠 盲从 盲打 @@ -54645,6 +54677,7 @@ 秒内 秒拍 秒杀 +秒删 秒针 秒钟 淼淼 @@ -55162,6 +55195,7 @@ 明码标价 明媒正娶 明媚 +明面 明灭 明敏 明明 @@ -57149,6 +57183,7 @@ 内镜 内疚 内聚 +内卷 内眷 内卡 内刊 @@ -59468,6 +59503,7 @@ 袍子 跑遍 跑表 +跑不掉 跑步 跑步机 跑车 @@ -60246,6 +60282,7 @@ 屁股 屁滚尿流 屁话 +屁民 屁屁 屁事 屁眼 @@ -61842,6 +61879,7 @@ 奇形怪状 奇秀 奇勋 +奇艺 奇异 奇遇 奇缘 @@ -63111,6 +63149,7 @@ 强杀 强上 强身 +强升 强生 强省 强盛 @@ -69058,6 +69097,8 @@ 傻仔 傻子 唼血 +啥的 +啥都 啥时 啥时候 啥事 @@ -70533,6 +70574,7 @@ 涉嫌 涉险过关 涉县 +涉政 涉足 赦令 赦免 @@ -71022,6 +71064,7 @@ 神经元 神经质 神经组织 +神剧 神君 神龛 神来 @@ -71641,6 +71684,7 @@ 声说 声嘶力竭 声讨 +声网 声望 声威 声威大震 @@ -71961,6 +72005,7 @@ 失乐 失礼 失利 +失联 失恋 失恋了 失灵 @@ -74181,6 +74226,7 @@ 受骗 受聘 受其 +受奇艺 受气 受气包 受穷 @@ -75134,6 +75180,7 @@ 双枪 双抢 双亲 +双擎 双曲线 双全 双拳 @@ -76636,6 +76683,7 @@ 松阳 松叶 松一口气 +松语 松原 松赞干布 松针 @@ -78816,6 +78864,7 @@ 套路 套路深 套马 +套内 套弄 套牌 套票 @@ -78951,6 +79000,7 @@ 特殊性 特殊要求 特爽 +特斯拉 特提 特为 特务 @@ -79090,6 +79140,7 @@ 提包 提笔 提笔忘字 +提测 提倡 提车 提成 @@ -79684,6 +79735,7 @@ 天悬地隔 天旋 天旋地转 +天选 天崖 天涯 天涯海角 @@ -79869,6 +79921,7 @@ 填街塞巷 填进 填具 +填坑 填空 填料 填列 @@ -89339,6 +89392,7 @@ 小品 小品文 小平 +小屏 小瓶 小坡 小破孩 @@ -90031,6 +90085,7 @@ 写实 写手 写书 +写死 写完 写文章 写下 @@ -90540,6 +90595,7 @@ 新寡 新官上任 新官上任三把火 +新冠 新光 新规 新贵 @@ -90591,6 +90647,7 @@ 新康 新科 新科技 +新客 新课 新课标 新快报 @@ -91214,6 +91271,7 @@ 形骸 形迹 形迹可疑 +形近 形码 形貌 形旁 @@ -94094,6 +94152,7 @@ 羊羹 羊倌 羊角 +羊了 羊毛 羊毛出在羊身上 羊毛衫 @@ -94112,6 +94171,7 @@ 羊汤 羊头 羊腿 +羊驼 羊蝎子 羊羊 羊腰子 @@ -94470,6 +94530,7 @@ 腰肌劳损 腰际 腰间 +腰砍 腰里 腰链 腰牌 @@ -94877,6 +94938,7 @@ 也别 也不 也不错 +也不会 也不可能 也不例外 也不是 @@ -95025,6 +95087,7 @@ 野叟 野蔌山肴 野塘 +野图 野兔 野外 野望 @@ -101647,6 +101710,7 @@ 砸伤 砸死 砸碎 +砸砸乐 砸在 咋办 咋滴 @@ -101888,6 +101952,7 @@ 在旁 在其 在前 +在群里 在任 在日 在商言商 @@ -102731,6 +102796,7 @@ 窄窄 债多不愁 债户 +债基 债家 债款 债利 @@ -103491,6 +103557,7 @@ 涨滩 涨停 涨停板 +涨薪 涨涨 掌班 掌鞭 @@ -104927,7 +104994,9 @@ 整天 整条 整晚 +整行 整形 +整型 整修 整训 整夜 @@ -107678,6 +107747,7 @@ 朱丽叶 朱莉 朱令 +朱罗纪 朱门 朱门酒肉臭 朱墨 @@ -107881,6 +107951,7 @@ 主办方 主办权 主办者 +主包 主笔 主编 主表 @@ -108631,6 +108702,7 @@ 转移话题 转移支付 转义 +转译 转引 转印 转用 @@ -109696,6 +109768,7 @@ 自寻烦恼 自寻死路 自言自语 +自研 自业自得 自已 自以为 @@ -109819,6 +109892,7 @@ 子集 子键 子句 +子卷 子爵 子口 子类 diff --git a/src/app.vue b/src/app.vue index 5902604..0fdb003 100644 --- a/src/app.vue +++ b/src/app.vue @@ -1,63 +1,70 @@ - - - diff --git a/src/assets/common.scss b/src/assets/common.scss deleted file mode 100644 index b41e3f3..0000000 --- a/src/assets/common.scss +++ /dev/null @@ -1,89 +0,0 @@ -body { - line-height: 1.5; - font-size: 14px; - color: var(--color-dark-1); -} -a { - color: inherit; - text-decoration: none; -} -wc-switch { - cursor: pointer; -} - -.app { - width: 100%; - height: 100vh; -} - -.flex { - display: flex; - - &.wrap { - flex-wrap: wrap; - } - - &.column { - flex-direction: column; - } - - &.ac { - justify-content: center; - } - - &.alc { - align-items: center; - } - - &.acc { - justify-content: center; - align-items: center; - } - - &.asc { - justify-content: space-between; - align-items: center; - } -} - -.wrapper { - width: 1024px; -} - -.topbar { - width: 100%; - height: 64px; - background: #fff; - box-shadow: 0 6px 12px rgba(0, 0, 0, 0.05); - - .logo { - font-size: 24px; - color: var(--color-red-1); - - span { - font-size: 14px; - } - } - - .navs { - font-size: 16px; - - .nav { - margin-left: 32px; - cursor: pointer; - transition: color 0.2s linear; - - &.active, - &:hover { - text-decoration: underline; - color: var(--color-red-1); - } - } - } -} - -.footer { - width: 100%; - height: 64px; - border-top: 1px solid var(--color-plain-2); -} diff --git a/src/assets/index.css b/src/assets/index.css new file mode 100644 index 0000000..fb74e34 --- /dev/null +++ b/src/assets/index.css @@ -0,0 +1 @@ +body{line-height:1.5;font-size:14px;color:var(--color-dark-1)}a{color:inherit;text-decoration:none}wc-switch{cursor:pointer}.app{width:100%;height:100vh}.flex{display:flex}.flex.wrap{flex-wrap:wrap}.flex.column{flex-direction:column}.flex.ac{justify-content:center}.flex.alc{align-items:center}.flex.acc{justify-content:center;align-items:center}.flex.asc{justify-content:space-between;align-items:center}.wrapper{width:1024px}.topbar{width:100%;height:64px;background:#fff;box-shadow:0 6px 12px rgba(0,0,0,.05)}.topbar .logo{font-size:24px;color:var(--color-red-1)}.topbar .logo span{font-size:14px}.topbar .navs{font-size:16px}.topbar .navs .nav{margin-left:32px;cursor:pointer;transition:color .2s linear}.topbar .navs .nav.active,.topbar .navs .nav:hover{text-decoration:underline;color:var(--color-red-1)}.footer{width:100%;height:64px;border-top:1px solid var(--color-plain-2)}.main{overflow:hidden;flex:1}.main .wrapper{height:100%}.main .table-info{width:100%;height:64px}.main .table-info b{color:var(--color-red-1)}.main .table-info .download{margin-left:32px}.main .search{width:100%}.main .search .field{margin-top:16px}.main .search .field.result{line-height:2;font-family:Menlo;word-wrap:break-word;white-space:pre-wrap}.main .search .field.result b{letter-spacing:2px;color:var(--color-blue-1)}.main .search .field wc-input{flex:1}.main .panel{overflow:hidden;flex:1;margin-top:32px}.main .panel .custom-file{position:relative;width:160px}.main .panel .custom-file input{position:absolute;width:100%;height:100%;opacity:0}.main .panel .tips{color:var(--color-orange-3)}.main .panel .scroll-view{overflow:hidden;flex:1}.main .panel .preview{margin-top:16px;font-family:Menlo;word-break:keep-all;white-space:pre-wrap}.github{position:fixed;right:-30px;top:20px;z-index:9;width:120px;height:22px;line-height:22px;text-align:center;color:#fff;background:var(--color-dark-1);transform:rotate(45deg)}.download-layer{width:640px;padding-bottom:64px;background:#fff}.download-layer .field{margin-top:16px;padding:0 16px}.download-layer .field .label{min-width:120px;padding-right:16px;line-height:32px;text-align:right;font-weight:bold;color:var(--color-grey-3)}.download-layer .field .label::after{content:" : "}.download-layer .field .value{line-height:32px}.download-layer .field .tips{margin-left:16px;line-height:32px;color:var(--color-orange-3)}.download-layer .field.ctrol{padding:0 128px;margin-top:64px}@media screen and (max-width: 1024px){.topbar,.main{padding:0 16px}.wrapper{width:100%}.footer .wrapper{flex-direction:column;align-items:center;justify-content:center}} \ No newline at end of file diff --git a/src/assets/index.scss b/src/assets/index.scss deleted file mode 100644 index 96146a5..0000000 --- a/src/assets/index.scss +++ /dev/null @@ -1,180 +0,0 @@ -@import './common.scss'; - -.main { - overflow: hidden; - flex: 1; - - .wrapper { - height: 100%; - } - - .table-info { - width: 100%; - height: 64px; - - b { - color: var(--color-red-1); - } - - .download { - margin-left: 32px; - } - } - - .search { - width: 100%; - - .field { - margin-top: 16px; - - &.result { - line-height: 2; - font-family: Menlo; - word-wrap: break-word; - white-space: pre-wrap; - - b { - letter-spacing: 2px; - color: var(--color-blue-1); - } - } - - wc-input { - flex: 1; - } - } - } - - .panel { - overflow: hidden; - flex: 1; - margin-top: 32px; - - .custom-file { - position: relative; - width: 160px; - - input { - position: absolute; - width: 100%; - height: 100%; - opacity: 0; - } - } - - .tips { - color: var(--color-orange-3); - } - - .scroll-view { - overflow: hidden; - flex: 1; - } - - .preview { - margin-top: 16px; - font-family: Menlo; - word-break: keep-all; - white-space: pre-wrap; - } - } - - /* */ - .about { - padding: 32px 16px; - - h2 { - font-size: 24px; - } - - .logs { - .version { - margin-top: 32px; - line-height: 2; - font-weight: bold; - font-size: 18px; - } - - dd { - color: var(--color-grey-3); - } - - ol { - padding-left: 2em; - list-style: decimal; - } - } - } -} - -.github { - position: fixed; - right: -30px; - top: 20px; - z-index: 9; - width: 120px; - height: 22px; - line-height: 22px; - text-align: center; - color: #fff; - background: var(--color-dark-1); - transform: rotate(45deg); -} - -.download-layer { - width: 640px; - padding-bottom: 64px; - background: #fff; - - .field { - margin-top: 16px; - padding: 0 16px; - - .label { - min-width: 120px; - padding-right: 16px; - line-height: 32px; - text-align: right; - font-weight: bold; - color: var(--color-grey-3); - - &::after { - content: ' : '; - } - } - - .value { - line-height: 32px; - } - - .tips { - margin-left: 16px; - line-height: 32px; - color: var(--color-orange-3); - } - - &.ctrol { - padding: 0 128px; - margin-top: 64px; - } - } -} - -@media screen and (max-width: 1024px) { - .topbar, - .main { - padding: 0 16px; - } - - .wrapper { - width: 100%; - } - - .footer { - .wrapper { - flex-direction: column; - align-items: center; - justify-content: center; - } - } -} diff --git a/src/components/footer.vue b/src/components/footer.vue new file mode 100644 index 0000000..620c6cd --- /dev/null +++ b/src/components/footer.vue @@ -0,0 +1,20 @@ + + + + + diff --git a/src/components/hello.vue b/src/components/hello.vue deleted file mode 100644 index db00953..0000000 --- a/src/components/hello.vue +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - diff --git a/src/components/topbar.vue b/src/components/topbar.vue new file mode 100644 index 0000000..2f2d3bd --- /dev/null +++ b/src/components/topbar.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/src/lib/core.js b/src/lib/core.js index ca28e8b..e6eaa5d 100644 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -55,6 +55,7 @@ export function createCode(dict, word) { let c2 = dict.get(word[1])?.pop() let c3 = dict.get(word[2])?.pop() let ce = dict.get(word[word.length - 1])?.pop() + if (c1 && c2 && c3 && ce) { return c1[0] + c2[0] + c3[0] + ce[0] } else { @@ -136,7 +137,6 @@ export class Enum { add(k, v) { if (this.#dict_k[k]) { var _v = this.#dict_k[k] - for (let t of _v) { this.#dict_v[t] = this.#dict_v[t].filter(i => i !== k) } @@ -154,7 +154,13 @@ export class Enum { } } } else { - this.#dict_v[v] = [k] + if (this.#dict_v[v]) { + if (!this.#dict_v[v].includes(k)) { + this.#dict_v[v].push(k) + } + } else { + this.#dict_v[v] = [k] + } } } @@ -176,6 +182,7 @@ export class Enum { if (this.#dict_k[k]) { return [...this.#dict_k[k]] } else if (this.#dict_v[k]) { + console.log(this.#dict_v[k]) return [...this.#dict_v[k]] } } diff --git a/src/lib/index.js b/src/lib/index.js deleted file mode 100644 index bb11549..0000000 --- a/src/lib/index.js +++ /dev/null @@ -1,385 +0,0 @@ -/** - * - * @author yutent - * @date 2022/03/11 12:03:59 - */ - -import '//jscdn.ink/anot/2.2.3/anot.js' -import '//jscdn.ink/@bytedo/wcui/1.0.12/layer/index.js' -import '//jscdn.ink/@bytedo/wcui/1.0.12/form/input.js' -import '//jscdn.ink/@bytedo/wcui/1.0.12/form/button.js' -import '//jscdn.ink/@bytedo/wcui/1.0.12/form/link.js' -import '//jscdn.ink/@bytedo/wcui/1.0.12/form/radio.js' -import '//jscdn.ink/@bytedo/wcui/1.0.12/form/checkbox.js' -import '//jscdn.ink/@bytedo/wcui/1.0.12/form/switch.js' -import fetch from '//jscdn.ink/@bytedo/fetch/2.1.1/index.js' - -import { Enum, saveFile, SString, createCode } from './lib/core.js' -import FIXED_86F from './lib/86_fixed.js' - -const VER_86 = '86' -const VER_86F = '86f' - -const WB_CODE_NAME = { 1: '一级简码', 2: '二级简码', 3: '三级简码', 4: '四级简码' } -const WB_TABLE_2312 = new Enum() -const WB_TABLE_GBK = new Enum() -const WB_TABLE_GBK_TEMP = new Enum() -const WB_TABLE_86F = new Enum(FIXED_86F) -const WB_WORDS = new Enum() -const WB_DY = new Enum() -const WB_EMOJI = new Enum() -const WB_NET = new Enum() -const WB_CODE = new Enum() - -Anot({ - $id: 'app', - state: { - gb2312: 0, - gbk: 0, - words: 0, - dy: 0, - emoji: 0, - nethot: 0, - code: 0, - result: '', - filter: { - text: '', - version: VER_86 - }, - dlOpt: { - pos: 'front', - version: VER_86, - reverse: true, - pinyin: false, - tables: ['2312', 'words'] - }, - total: 0, - preview: '' - }, - - watch: { - 'dlOpt.tables'() { - this.calculate() - } - }, - - mounted() { - Promise.all([ - fetch('./data/gb2312.txt').then(r => r.text()), - fetch('./data/gbk.txt').then(r => r.text()), - fetch('./data/words.txt').then(r => r.text()), - fetch('./data/dy.txt').then(r => r.text()), - fetch('./data/emoji.txt').then(r => r.text()), - fetch('./data/nethot.txt').then(r => r.text()), - fetch('./data/code.txt').then(r => r.text()) - ]).then(([gb2312, gbk, words, dy, emoji, nethot, code]) => { - // - - gb2312.split('\n').forEach(it => { - it = it.split(' ') - - let k = it.shift() - - if (k) { - WB_TABLE_2312.add(k, it) - } - }) - - // 先使用gb2312, 目的是为了词库顺序以gb2312优先 - WB_TABLE_GBK_TEMP.concat(WB_TABLE_2312) - - gbk.split('\n').forEach(it => { - it = it.split(' ') - - let k = it.shift() - - if (k) { - WB_TABLE_GBK.add(k, it) - WB_TABLE_GBK_TEMP.add(k, it) - } - }) - - // - words.split('\n').forEach(it => { - it = it.split(' ') - - let k = it.shift() - - if (k) { - WB_WORDS.add(k, createCode(WB_TABLE_GBK_TEMP, k)) - } - }) - - dy.split('\n').forEach(it => { - it = it.split(' ') - - let k = it.shift() - - if (k) { - WB_DY.add(k, it) - } - }) - - emoji.split('\n').forEach(it => { - it = it.split(' ') - - let k = it.shift() - - if (k) { - WB_EMOJI.add(k, it) - } - }) - - nethot.split('\n').forEach(it => { - it = it.split(' ') - - let k = it.shift() - - if (k) { - WB_NET.add(k, createCode(WB_TABLE_GBK_TEMP, k)) - } - }) - code.split('\n').forEach(it => { - it = it.split(' ') - - let k = it.shift() - - if (k) { - WB_CODE.add(k, createCode(WB_TABLE_GBK_TEMP, k)) - } - }) - - this.gb2312 = WB_TABLE_2312.length - this.gbk = WB_TABLE_GBK.length - this.words = WB_WORDS.length - this.dy = WB_DY.length - this.emoji = WB_EMOJI.length - this.nethot = WB_NET.length - this.code = WB_CODE.length - - this.calculate() - }) - }, - - methods: { - search() { - var { text, version } = this.filter - var reverse = false - var res, resf - - text = text.trim().toLowerCase() - - if (!text) { - this.result = '' - return - } - - reverse = /^[a-z]{1,4}$/.test(text) - - if (!reverse) { - text = text.replace(/[\sa-z]/g, '') - } - - text = new SString(text) - - if (reverse || text.length === 1) { - console.log(text, text + '') - res = [WB_TABLE_GBK.get(text)] - if (version === VER_86F) { - resf = [WB_TABLE_86F.get(text)] - } - } else { - res = text.split().map(t => WB_TABLE_GBK.get(t)) - if (version === VER_86F) { - resf = text.split().map(t => WB_TABLE_86F.get(t)) - } - } - - if (reverse) { - text = text.toUpperCase() - // 反查时, 直接替换结果 - if (resf && resf[0]) { - res = resf - } - if (res[0]) { - res = `【 ${text} 】👉\t${res[0] - .map( - t => - `${t}(${(resf && resf[0] ? WB_TABLE_86F.get(t) : WB_TABLE_GBK.get(t)) - .join('、') - .toUpperCase()})` - ) - .join('\t\t')}` - } else { - res = `【 ${text} 】👉\t无结果, 请检查你的输入是否正确, 如果确认无误, 可以反馈缺失字库。` - } - } else { - if (resf) { - resf.forEach((it, i) => { - if (it) { - res[i] = it - } - }) - } - res = res - .map((it, i) => { - if (it) { - return `【 ${text.at(i)} 】👉\t${it - .map(t => `${WB_CODE_NAME[t.length]}: ${t.toUpperCase()}`) - .join('\t\t')}` - } else { - return `【 ${text.at( - i - )} 】👉\t无结果, 请检查你的输入是否正确, 如果确认无误, 可以反馈缺失字库。` - } - }) - .join('\n') - // 词库查询 - { - let extra = - WB_WORDS.get(text) || - WB_DY.get(text) || - WB_EMOJI.get(text) || - WB_NET.get(text) || - WB_CODE.get(text) - - if (extra) { - let t = extra.shift() - res += `\n\n${'-'.repeat(6)} 词库查询结果 ${'-'.repeat(32)}\n【 ${text} 】👉\t${ - WB_CODE_NAME[t.length] - }: ${t.toUpperCase()}` - } - } - } - - this.result = `${'-'.repeat(6)} 字库查询结果 ${'-'.repeat(32)}\n${res}` - }, - - calculate() { - var num = this.gb2312 - - if (this.dlOpt.tables.includes('gbk')) { - num += this.gbk - } - num += this.words - num += this.dy - - if (this.dlOpt.tables.includes('emoji')) { - num += this.emoji - } - if (this.dlOpt.tables.includes('nethot')) { - num += this.nethot - } - - if (this.dlOpt.tables.includes('code')) { - num += this.code - } - - this.total = num - }, - - fileChange(ev) { - var reader = new FileReader() - var file = ev.target.files[0] - var all = new Set() - var unknow = new Set() - - ev.target.value = '' - - reader.onload = () => { - let arr = reader.result - .trim() - .split('\n') - .map(_ => _.trim()) - - for (let it of arr) { - it = it.replace(/[\w\s\t]+/g, '') - all.add(it) - if (!WB_TABLE_GBK.get(it) && !WB_WORDS.get(it) && !WB_DY.get(it)) { - unknow.add(it) - } - } - - all = Array.from(all) - unknow = Array.from(unknow) - - this.preview = - `【${file.name}】\n本次上传, 含有 ${arr.length} 个词条(有效词条 ${all.length} 个)。\n` + - `其中字库中已经存在 ${all.length - unknow.length}个, 未存在词条 ${ - unknow.length - } 个, 如下:\n\n${unknow.join('\t')}` - - // window.unknow = unknow - // console.log(unknow) - - // navigator.clipboard.writeText(Array.from(all).join('\n')) - } - - reader.readAsText(file) - }, - - openDownloadPanel() { - this.$refs.dl.show() - }, - - closeDownloadPanel() { - this.$refs.dl.close() - }, - - download() { - var opt = { ...this.dlOpt } - var temp = new Enum() - - temp.concat(WB_TABLE_2312) - - // 生成反查字库 - if (opt.reverse) { - if (opt.tables.includes('gbk')) { - let bin = new Blob([WB_TABLE_GBK_TEMP.toString()], { type: 'text/plain' }) - saveFile(bin, 'wb_table_gbk_reverse.txt') - } else { - let bin = new Blob([WB_TABLE_2312.toString()], { type: 'text/plain' }) - saveFile(bin, 'wb_table_gb2312_reverse.txt') - } - } - - // 默认词库 - temp.concat(WB_WORDS) - - // emoji表情 - if (opt.tables.includes('emoji')) { - temp.concat(WB_EMOJI) - } - - // 网络热词 - if (opt.tables.includes('nethot')) { - temp.concat(WB_NET) - } - - // 计算机术语 - if (opt.tables.includes('code')) { - temp.concat(WB_CODE) - } - - // gbk 大字符集, 顺序往后调 - if (opt.tables.includes('gbk')) { - temp.concat(WB_TABLE_GBK) - } - - // 异形字库 - if (opt.tables.includes('dy')) { - temp.concat(WB_DY) - } - - // 暂未支持 - // if (opt.tables.includes('personal')) { - // temp.concat(WB_PERSONAL) - // } - - let bin = new Blob([temp.toString(opt.pos === 'front')], { type: 'text/plain' }) - saveFile(bin, `wb_table_${opt.pos}.txt`) - - this.closeDownloadPanel() - } - } -}) diff --git a/src/main.js b/src/main.js index e926443..e5daa05 100644 --- a/src/main.js +++ b/src/main.js @@ -1,11 +1,17 @@ - import { createApp } from 'vue' +import '//jscdn.ink/@bytedo/wcui/1.0.12/layer/index.js' +import '//jscdn.ink/@bytedo/wcui/1.0.12/form/input.js' +import '//jscdn.ink/@bytedo/wcui/1.0.12/form/button.js' +import '//jscdn.ink/@bytedo/wcui/1.0.12/form/link.js' +import '//jscdn.ink/@bytedo/wcui/1.0.12/form/radio.js' +import '//jscdn.ink/@bytedo/wcui/1.0.12/form/checkbox.js' +import '//jscdn.ink/@bytedo/wcui/1.0.12/form/switch.js' + import App from './app.vue' import router from './router' import store from './store' - + const app = createApp(App) app.use(router).use(store).mount('.app') - diff --git a/src/router.js b/src/router.js index ea669d0..34aac2c 100644 --- a/src/router.js +++ b/src/router.js @@ -1,9 +1,9 @@ - -import { createRouter, createWebHistory } from 'vue-router' +import { createRouter, createWebHashHistory } from 'vue-router' import Home from './views/home.vue' +import About from './views/about.vue' const router = createRouter({ - history: createWebHistory(), + history: createWebHashHistory(), routes: [ { path: '/', @@ -13,11 +13,9 @@ const router = createRouter({ { path: '/about', name: 'about', - component: () => import('./views/about.vue') + component: About } ] }) export default router - - diff --git a/src/views/about.vue b/src/views/about.vue index 24aa159..b45d0a2 100644 --- a/src/views/about.vue +++ b/src/views/about.vue @@ -1,18 +1,107 @@ + - - + diff --git a/src/views/home.vue b/src/views/home.vue index 987c694..133e89d 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -1,17 +1,690 @@ + - - + diff --git a/vue.live.js b/vue.live.js index e7417e1..3ad1201 100644 --- a/vue.live.js +++ b/vue.live.js @@ -1,6 +1,7 @@ import { resolve } from 'path' export default { + base: '/wb-table/', devServer: { port: 8080, domain: '', @@ -18,7 +19,9 @@ export default { // 这里的resolve可将相对路径转为绝对路径 // 如果传入的路径已经是绝对路径的, 可不需要resolve entry: resolve('./src/main.js'), - title: 'vue-live 应用示例' + title: '五笔输入法86版', + keywords: '五笔输入法86版', + description: '五笔输入法86版' } }, // 以下cdn地址, 可自行修改为适合的