知识分享
分享创造价值 合作实现共赢

知识分享

当前位置: 首页 > 知识分享

微信小程序 -- 英语词典 (小程序插件)

发布时间:2021-08-04 09:12:06作者:顺晟科技点击:

英语词典小程序

基于英语词典小程序插件 - 提供开源地址

项目地址

英语词典小程序插件: 微信小程序 词典 真题基础服务插件(gitee.com)

功能特色

  • [x] 全面详实的经典词库,详细释义覆盖约1.2w词,精简释义覆盖基本全部词汇
  • [x] 提供多语言识别翻译功能接口
  • [x] 不断完善的例句库,涵盖四六级和考研英语例句
  • [x] 详实的单词分类,针对不同需求,提供单词记背需要
  • [x] 单词例句以组件形式呈现,方便小程序引入使用
  • [x] 提供第三方插件API供调用,可自定义展现形式

功能预览

插件提供部分可以直接调用的组件或功能页

单词册 & 单词详情

顶部栏查词组件 & 英汉互译功能

插件使用文档


申请权限

  • 请在小程序后台搜索本插件(AppID=wx2facb7b57eedf7e6) 设置-第三方服务-添加插件英语词典

调用限制

  • 插件无调用限制
  • API需要发邮件申请 kindear@foxmail.com(暂未开放)

调用方式

插件最新版本为 1.8.1

全局app.json配置

"plugins": {
    "edict-plugin": {
      "version": "1.8.1",
      "provider": "wx2facb7b57eedf7e6"
    }
}

功能页

单词册

需要携带参数userId,一般为用户openid

wx.navigateTo({
      url: 'plugin://edict-plugin/index?userId=xxxxxxxxx',
})

词句详情页

需要携带参数word

wx.navigateTo({
      url: 'plugin://edict-plugin/word?word=xxxxxxx',
})

英汉互译页

wx.navigateTo({
      url: 'plugin://edict-plugin/en-zh',
})

组件

插件提供了对外暴露的组件,可以由外部页面直接引入使用

顶部查词栏

引入方式

{
  "usingComponents": {
    "nav-search":"plugin://edict-plugin/nav-search"
  }
}

使用方式

  • Props
navshow 是否展示该组件 Boolean
参数 说明 类型
  • Events
wordselect 单词选择事件,可与词句功能页组合使用 Event
参数 说明 类型
<nav-search navshow="true" bind:wordselect="wordselect"></nav-search>

单词盒子

引入方式

{
  "usingComponents": {
    "word-box":"plugin://edict-plugin/word-box"
  }
}

使用方式

word 传入单词 string
参数 说明 类型
<word-box word="equal"></word-box>

例句盒子

引入方式

{
  "usingComponents": {
    "sentence-box":"plugin://edict-plugin/sentence-box"
  }
}

使用方式

word 传入单词 string
参数 说明 类型
<sentence-box word="mindful"></sentence-box>

接口

使用插件内部接口需要在页面引入插件

var plugin = requirePlugin("edict-plugin");

单词前缀匹配

prefix 单词前缀 string
参数 说明 类型
plugin.preMatchWord(prefix).then(res=>{
      console.log(res)
})

英汉互译(自动检测)

sentence 待翻译句子 string
参数 说明 类型
plugin.translationEnZh(sentence).then(res=>{
      console.log(res)
})

定向翻译(自动检测源语言)

target 目标语言代码,详见底部附录语言对照表Code string sentence 待翻译句子 string
参数 说明 类型
plugin.translationTo(target, sentence).then(res=>{
      console.log(res)
})

单词查询

word 待查询单词 string
参数 说明 类型
plugin.wordQuery(word).then(res=>{
      console.log(res)
})

例句查询

word 待查询单词 string
参数 说明 类型
plugin.sentenceQuery(word).then(res=>{
      console.log(res)
})

获取用户收藏列表

openId 用户唯一openId string
参数 说明 类型
plugin.getFavorWord(openId).then(res=>{
      console.log(res)
})

判断用户是否收藏单词

openId 用户唯一openId string word 待查询单词 string
参数 说明 类型
plugin.isFavor(openId,word).then(res=>{
      console.log(res)
})

用户新增收藏单词

openId 用户唯一openId string word 待查询单词 string
参数 说明 类型
plugin.addFavor(openId,word).then(res=>{
      console.log(res)
})

用户移除收藏单词

openId 用户唯一openId string word 待查询单词 string
参数 说明 类型
plugin.pullFavor(openId,word).then(res=>{
      console.log(res)
})

更新日志

1.8.1

发布时间:2021-07-26

  1. 使用云开发CloudBase 重构项目
  2. 提供第三方访问API

1.7.0

发布时间: 2021-04-20

  1. 请求重定向整合,优化了数据获取速度
  2. 缓存数据获取 bug fixed
  3. 提供了几个可供小程序调用的接口

1.6.1

发布时间:2021-03-15

  1. 部分单词查询 404 情况的处理 bug fixed
  2. 调整了API接口规则

1.6.0

发布时间:2021-03-08

  1. 此后的接口地址为长期维护,不会废弃(LTS)

1.5.2(接口已废弃)

发布时间:2021-03-02

1.5.1(接口已废弃)

发布时间:2021-03-01

  1. 初始版本

交流群

小程序开发/插件开发交流群: 625756936

附录

语言参数对照表

Afrikaans af Albanian sq Amharic am Arabic ar Armenian hy Azeerbaijani az Basque eu Belarusian be Bengali bn Bosnian bs Bulgarian bg Catalan ca Cebuano ceb Chinese (Simplified) zh-CN Chinese (Traditional) zh-TW Corsican co Croatian hr Czech cs Danish da Dutch nl English en Esperanto eo Estonian et Finnish fi French fr Frisian fy Galician gl Georgian ka German de Greek el Gujarati gu Haitian Creole ht Hausa ha Hawaiian haw (ISO-639-2) Hebrew iw Hindi hi Hmong hmn (ISO-639-2) Hungarian hu Icelandic is Igbo ig Indonesian id Irish ga Italian it Japanese ja Javanese jw Kannada kn Kazakh kk Khmer km Korean ko Kurdish ku Kyrgyz ky Lao lo Latin la Latvian lv Lithuanian lt Luxembourgish lb Macedonian mk Malagasy mg Malay ms Malayalam ml Maltese mt Maori mi Marathi mr Mongolian mn Myanmar (Burmese) my Nepali ne Norwegian no Nyanja (Chichewa) ny Pashto ps Persian fa Polish pl Portuguese (Portugal, Brazil) pt Punjabi pa Romanian ro Russian ru Samoan sm Scots Gaelic gd Serbian sr Sesotho st Shona sn Sindhi sd Sinhala (Sinhalese) si Slovak sk Slovenian sl Somali so Spanish es Sundanese su Swahili sw Swedish sv Tagalog (Filipino) tl Tajik tg Tamil ta Telugu te Thai th Turkish tr Ukrainian uk Urdu ur Uzbek uz Vietnamese vi Welsh cy Xhosa xh Yiddish yi Yoruba yo Zulu zu
Language Code

TOP

QQ客服

18910140161