1.0.3 • Published 3 years ago

kit-callcenter-web v1.0.3

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

Kit-CallCenter-Web

web呼叫中心组件

下载依赖

$ npm install kit-callcenter-web react react-dom react-router react-router-dom axios antd styled-components --save

使用

import { CallCenter } from "kit-callcenter-web";

const App = () => {
  return (
    <CallCenter {...props} />
  )
}

// props声明:
interface CallCenterProps {
	appkey: string,
	appId: string, // 即云信服务的唯一标识appKey, 在云信管理后台应用信息中查看
	account: string, // 帐号, 应用内唯一
	token: string, // 生成该accout的认证token,采用sha1算法,参数是:appSecret、sipPassword、nonce、curTime组成的字符串
	sipPassword?: string, // 该账号对应的密码
	appSecret?: string, // 该应用对应的凭证,在云信管理后台应用信息中查看
	curTime: number, // 用于生成token,当前时间戳
	debug?: boolean, // 是否开启调试模式
	componentTag?: number | string // 保证组件的唯一性
	didNumber?: string // 配置的运营商出局号码,没有设置为''即可
	register: boolean, // 初始化完成后是否主动登陆,该值如果设置为false,需要用户在ua.init({})之后,主动调用ua.register()接口
	no_answer_timeout?: number // 接收呼叫时,自己应答的超时时间,sdk默认是60秒(即60s之内,ua不应答,sdk会主动挂断该呼叫)  
	onKicked?: () => void // 被踢回调
	onLogout?: () => void // 退出登录
	onDisconnect?: () => void // 断线回调
	baseDomain: string // 请求domain
}

其他方法

import { render, unmountComponentAtNode } from 'kit-callcenter-web'

// render 用于在非react框架中渲染
const view = document.getElementById('view')
render(view: HTMLElement, props: CallCenterProps)

// unmountComponentAtNode 用于卸载组件
unmountComponentAtNode(view)

除此之外,组件还提供了 commonjs 与 umd 的输出方式。

// commonjs
const { CallCenter, render } = require('kit-callcenter-web')

// umd
const { CallCenter, render } = window.NECallCenter

FAQ

如果遇到样式丢失问题,需要手动导入 antd 的样式

import 'antd/dist/index.less'

组件预览