tencent/imutils

Namespaces

msgTools
selectionHandler
storage

Members

(static, constant) CourseType :string

Properties:
Name Type Description
6 string

讲座课

7 string

系统课

1 string

系统课

2 string

讲座课

辅导课程的类型

Type:
  • string

(static, constant) GRADES :string

Properties:
Name Type Description
"5001,5002,5003,6001,6002,6003" string

全年级

"6001,6002,6003,5001,5002,5003" string

全年级

"5001,5002,5003" string

高中全部

"6001,6002,6003" string

初中全部

"5001,5002" string

高中

"5001,5003" string

高中

"5002,5003" string

高中

"6001,6002" string

初中

"6001,6003" string

初中

"6002,6003" string

初中

5001 string

高一

5002 string

高二

5003 string

高三

6001 string

初一

6002 string

初二

6003 string

初三

7001 string

一年级

7002 string

二年级

7003 string

三年级

7004 string

四年级

7005 string

五年级

7006 string

六年级

年级代码

Type:
  • string

(static, constant) NEW

各种环境下打开页面

(static, constant) SUBJECTS :string

Properties:
Name Type Description
6001 string

语文

6002 string

数学

6003 string

化学

6004 string

物理

6005 string

英语

6006 string

生物

6007 string

政治

6008 string

历史

6009 string

地理

6010 string

讲座

科目的代码

Type:
  • string

Methods

(static) addEvent(target, eventType, callback, capture)

添加事件

参数:
Name Type Description
target any
eventType any
callback any
capture any

(static) addPageShowListener(listener) → {null}

部分手机,'webkitvisibilitychange' in document === false 但是是支持 document.addEventListener('webkitvisibilitychange')

Example
// ref https://stackoverflow.com/a/2877424
// payton 测试了兼容性,请继续补充
|-----------+----------+------------------|
| 浏览器    | pageshow | visibilitychange |
|-----------+----------+------------------|
| ios  微信 | y        | n                |
|-----------+----------+------------------|
| ios  自带 | y        | n                |
|-----------+----------+------------------|
| vivo 微信 | ?        | ?                |
|-----------+----------+------------------|
| vivo 自带 | n        | y                |
|-----------+----------+------------------|
| 魅族 微信 | y        | n                |
|-----------+----------+------------------|
| 魅族 自带 | n        | n                |
|-----------+----------+------------------|
参数:
Name Type Description
listener function

监听的函数

返回:

(static) addQuickBackWV(url) → {string}

统一给 url 添加 wv 值

Example
// 统一给 url 添加 wv 值
// 手Q750-阅读内容与消息列表快捷切换
// eg.
addQuickBackWV('http://m.ke.qq.com/index.html?_bid=1671')
// => http://m.ke.qq.com/index.html?_bid=1671&_wv=2147483648
addQuickBackWV('http://m.ke.qq.com/index.html?_bid=1671#header')
// => http://m.ke.qq.com/index.html?_bid=1671&_wv=2147483648#header
addQuickBackWV('http://m.ke.qq.com/index.html?_bid=1671&_wv=7')
// => http://m.ke.qq.com/index.html?_bid=1671&_wv=2147483655
addQuickBackWV('http://m.ke.qq.com/index.html?_bid=1671&_wv=2181046767')
// => http://m.ke.qq.com/index.html?_bid=1671&_wv=2181046767
参数:
Name Type Description
url string

需要添加wv值得url

返回:
Type
string

处理后的url

(static) callBussinessQQ(serviceQQ)

尝试呼起企业QQ

参数:
Name Type Description
serviceQQ string

企业QQ号

(static) callQQGroup(url)

尝试呼起QQ群

参数:
Name Type Description
url string

qq群的地址

(static) callService(serviceQQ)

请求QQ服务

参数:
Name Type Description
serviceQQ string

企业QQ号

(static) clickLock(callback)

点击锁定?

参数:
Name Type Description
callback function

回调函数

(static) closest(element, selector) → {null|DOM}

参数:
Name Type Description
element DOM
selector string

选择器

返回:

(static) ensureVisible(elem, container)

保证元素可见

参数:
Name Type Description
elem DOM

DOM元素

container DOM

父container

(static) getAppVersion() → {number|string}

获取当前辅导APP的版本

返回:
Type
number | string

如果不是在辅导APP的环境下就返回0,否则返回版本号

(static) getBitMapValue(v, map) → {string}

getBitMapValue

参数:
Name Type Description
v string
map Array
返回:

(static) getCourseUrl(cid) → {string}

根据cid获取课程的URl

参数:
Name Type Description
cid number | string
返回:
Type
string

当前cid的课程Url

(static) getFirefoxVer() → {bool|string}

获取Firefox版本号

返回:
Type
bool | string

如果是Firefox就返回Firefox的版本号,否则返回false

(static) getGradeName(str) → {string}

获取年级名

参数:
Name Type Description
str string
返回:

(static) getIEVer() → {bool|string}

获取IE版本号

See:
返回:
Type
bool | string

如果是IE就返回IE的版本号,否则返回false

(static) getImgUrl(url) → {string}

获取ImgUrl

参数:
Name Type Description
url string

需要获取Img的URl

返回:

(static) getIOSVersion() → {bool|string}

获取IOS的版本

返回:
Type
bool | string

返回当前IOS的版本号,如果不是IOS则返回false

(static) getNetworkType(callback异步回调函数) → {string}

微信和APP里获取网络类型

参数:
Name Type Description
callback异步回调函数 string
返回:
Type
string

网络类型:'', 'wifi', '2G', '3G', '4G'

(static) getParams()

To Do:
  • 跟 getQuery 重复了

(static) getPlatForm() → {string}

获取当前环境如:IOS、Android、H5

返回:
Type
string

ios/android/h5

(static) getSafariVer() → {bool|string}

获取safari版本号

返回:
Type
bool | string

如果是safari就返回safari的版本号,否则返回false

(static) getSavedSubject() → {object}

获取被保存的科目

返回:
Type
object

会返回这样的格式{subject,subjectIndex}

(static) getStrLength(strTemp) → {any}

获取字符串的长度

参数:
Name Type Description
strTemp any
返回:

(static) getSubjectName(num) → {object}

获取科目的名称

参数:
Name Type Description
num number
返回:

(static) getSubjectShortName(num) → {object}

获取科目的简称

参数:
Name Type Description
num number
返回:

(static) getTeacherClient() → {number|string}

获取老师端的版本号

返回:
Type
number | string

版本号

(static) getTeacherUrl(tid) → {string}

获取老师的Url

参数:
Name Type Description
tid number | string
返回:
Type
string

老师的Url

(static) getTencentURL(type, obj) → {string}

获取tencent串

参数:
Name Type Description
type string
obj object
Properties
Name Type Description
gc string
guin string
appId string
courseId string
To Do:
  • 看着晕,重构
返回:

(static) getTerminal() → {string}

获取在哪个环境下的H5

返回:
Type
string

ios_h5/android_h5/pc_h5/h5

(static) getTutorial()

(static) gotoNativePage(url, prefix)

跳转到Native端的地址

参数:
Name Type Default Description
url string

url地址

prefix string tencentk12://openpage/webview?url=

(static) hideTips()

隐藏Tips

(static) imgHashCache()

缓存,跟 webp 相关的

To Do:
  • fix 放这个模块不合适

(static) isAppInstalled()

检查 辅导 APP 是否已安装

(static) isArray(obj) → {boolean}

参数:
Name Type Description
obj array
返回:

(static) isBoolean(obj) → {boolean}

参数:
Name Type Description
obj boolean
返回:

(static) isClientInTest() → {boolean}

判断是否在PC客户端的测试模式

返回:
Type
boolean

true: 表示在PC客户端的测试模式

(static) isDate(obj) → {boolean}

参数:
Name Type Description
obj date
返回:

(static) isFudaoClient() → {boolean}

获取是否PC老师或学生客户端

返回:
Type
boolean

true: 是,false: 否

(static) isIphoneX() → {bool}

检测是否是iPhone X

返回:
Type
bool

是否是iPhone X

(static) isNumerical(obj) → {boolean}

参数:
Name Type Description
obj number
返回:

(static) isRegExp(obj) → {boolean}

参数:
Name Type Description
obj regexp
返回:

(static) isVisible(DOM) → {bool}

检查元素是否可见

参数:
Name Type Description
DOM Object

元素

返回:

(static) jsonp(url, callback, optopt)

jsonp?

参数:
Name Type Attributes Default Description
url any
callback any
opt any <optional>
{}

(static) jumpToNativePage(url地址)

跳转到Native页面

参数:
Name Type Description
url地址 url

(static) loadScript()

To Do:
  • 重构

(static) login()

跳转到登录页

(static) logout()

退出QQ登录态

(static) normalizeWheel()

计算鼠标滑动动,导致的页面滚动量

(static) objectToQueryString(obj) → {string}

把传入的 object 转成 queryString

参数:
Name Type Description
obj object

需要被转换的 object

返回:

(static) openApp()

打开 辅导 app

(static) openAppPage(page, params)

打开APP的页面

参数:
Name Type Description
page string
params object

(static) openUrlByIframe(url, onfail)

通过Iframe打开链接地址

参数:
Name Type Description
url string

需要打开的链接

onfail function

失败的回调

(static) qqLogin(succUrl)

QQ登录的地址

参数:
Name Type Description
succUrl string

成功登录的回调地址

(static) reLogin()

重新登录

(static) removeEvent(target, eventType, callback, capture)

删除事件

参数:
Name Type Description
target any
eventType any
callback any
capture any

(static) setRightTitleShare(按钮信息, listener)

设置app右上角按扭

参数:
Name Type Description
按钮信息 object
listener function

监听的函数

(static) setShareInfomation(title, desc, link, imgUrl)

设置分享的信息

参数:
Name Type Description
title string

标题

desc string

描述

link string

链接

imgUrl string

图片地址

(static) showTips(text)

根据传入的text生成tips

参数:
Name Type Description
text string

需要生成tips的text

(static) showTopTips(text)

显示顶部的tips

参数:
Name Type Description
text string

需要在顶部显示的text

(static) updateQueryString()

To Do:
  • 重构,基于正则的,可能有 bug

(static) versionfunegt(ver1, ver2) → {bool}

比较版本号

参数:
Name Type Description
ver1 string

版本1

ver2 string

版本2

返回:
Type
bool

如果版本1大于版本2则为true,否则返回false

(static) weiXinApply(callback)

微信什么?没看懂

参数:
Name Type Description
callback func

回调函数

(static) wxLogin()

微信登录