初次提交

master
付刚 3 years ago
commit 294494874e

@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead

@ -0,0 +1,15 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab

@ -0,0 +1,5 @@
/src/sdk
/bin
/node_modules
/dist
/src/lib

@ -0,0 +1,276 @@
// ESlint 检查配置
module.exports = {
root: true,
parserOptions: {
parser: "babel-eslint",
sourceType: "module"
},
env: {
browser: true,
node: true,
es6: true
},
extends: ["plugin:vue/recommended", "eslint:recommended"],
// add your custom rules here
//it is base on https://github.com/vuejs/eslint-config-vue
rules: {
"vue/max-attributes-per-line": [
2,
{
singleline: 10,
multiline: {
max: 1,
allowFirstLine: false
}
}
],
"vue/singleline-html-element-content-newline": "off",
"vue/multiline-html-element-content-newline": "off",
"vue/name-property-casing": ["error", "PascalCase"],
"vue/no-v-html": "off",
"accessor-pairs": 2,
"arrow-spacing": [
2,
{
before: true,
after: true
}
],
"block-spacing": [2, "always"],
"brace-style": [
2,
"1tbs",
{
allowSingleLine: true
}
],
camelcase: [
0,
{
properties: "always"
}
],
"comma-dangle": [2, "never"],
"comma-spacing": [
2,
{
before: false,
after: true
}
],
"comma-style": [2, "last"],
"constructor-super": 2,
curly: [2, "multi-line"],
"dot-location": [2, "property"],
"eol-last": 2,
eqeqeq: ["error", "always", { null: "ignore" }],
"generator-star-spacing": [
2,
{
before: true,
after: true
}
],
"handle-callback-err": [2, "^(err|error)$"],
indent: [
2,
2,
{
SwitchCase: 1
}
],
"jsx-quotes": [2, "prefer-single"],
"key-spacing": [
2,
{
beforeColon: false,
afterColon: true
}
],
"keyword-spacing": [
2,
{
before: true,
after: true
}
],
"new-cap": [
2,
{
newIsCap: true,
capIsNew: false
}
],
"new-parens": 2,
"no-array-constructor": 2,
"no-caller": 2,
"no-console": "off",
"no-class-assign": 2,
"no-cond-assign": 2,
"no-const-assign": 2,
"no-control-regex": 0,
"no-delete-var": 2,
"no-dupe-args": 2,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty-character-class": 2,
"no-empty-pattern": 2,
"no-eval": 2,
"no-ex-assign": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-extra-boolean-cast": 2,
"no-extra-parens": [2, "functions"],
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-func-assign": 2,
"no-implied-eval": 2,
"no-inner-declarations": [2, "functions"],
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-iterator": 2,
"no-label-var": 2,
"no-labels": [
2,
{
allowLoop: false,
allowSwitch: false
}
],
"no-lone-blocks": 2,
"no-mixed-spaces-and-tabs": 2,
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-multiple-empty-lines": [
2,
{
max: 1
}
],
"no-native-reassign": 2,
"no-negated-in-lhs": 2,
"no-new-object": 2,
"no-new-require": 2,
"no-new-symbol": 2,
"no-new-wrappers": 2,
"no-obj-calls": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-path-concat": 2,
"no-proto": 2,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-return-assign": [2, "except-parens"],
"no-self-assign": 2,
"no-self-compare": 2,
"no-sequences": 2,
"no-shadow-restricted-names": 2,
"no-spaced-func": 2,
"no-sparse-arrays": 2,
"no-this-before-super": 2,
"no-throw-literal": 2,
"no-trailing-spaces": 2,
"no-undef": 2,
"no-undef-init": 2,
"no-unexpected-multiline": 2,
"no-unmodified-loop-condition": 2,
"no-unneeded-ternary": [
2,
{
defaultAssignment: false
}
],
"no-unreachable": 2,
"no-unsafe-finally": 2,
"no-unused-vars": [
2,
{
vars: "all",
args: "none"
}
],
"no-useless-call": 2,
"no-useless-computed-key": 2,
"no-useless-constructor": 2,
"no-useless-escape": 0,
"no-whitespace-before-property": 2,
"no-with": 2,
"one-var": [
2,
{
initialized: "never"
}
],
"operator-linebreak": [
2,
"after",
{
overrides: {
"?": "before",
":": "before"
}
}
],
"padded-blocks": [2, "never"],
quotes: [
2,
"single",
{
avoidEscape: true,
allowTemplateLiterals: true
}
],
semi: [2, "never"],
"semi-spacing": [
2,
{
before: false,
after: true
}
],
"space-before-blocks": [2, "always"],
"space-before-function-paren": [2, "never"],
"space-in-parens": [2, "never"],
"space-infix-ops": 2,
"space-unary-ops": [
2,
{
words: true,
nonwords: false
}
],
"spaced-comment": [
2,
"always",
{
markers: [
"global",
"globals",
"eslint",
"eslint-disable",
"*package",
"!",
","
]
}
],
"template-curly-spacing": [2, "never"],
"use-isnan": 2,
"valid-typeof": 2,
"wrap-iife": [2, "any"],
"yield-star-spacing": [2, "both"],
yoda: [2, "never"],
"prefer-const": 2,
"no-debugger": process.env.NODE_ENV === "production" ? 2 : 0,
"object-curly-spacing": [
2,
"always",
{
objectsInObjects: false
}
],
"array-bracket-spacing": [2, "never"]
}
};

23
.gitignore vendored

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
yarn.lock

@ -0,0 +1,4 @@
{
"semi": false,
"singleQuote": true
}

@ -0,0 +1,63 @@
# h5
## 1.项目简介
这个开源示例项目演示了如何快速集成 网易云信 新一代G2音视频 SDK实现移动端浏览器的音视频通话。
## 2.功能包含
- 加入房间
- 静音、取消静音
- 离开房间
- 多人通话
[在线体验](https://app.yunxin.163.com/webdemo/g2web/index.html#/?path=h5)
## 3.技术栈
vue vue-cli 4.x
## 4.获取AppKey
1. 首先在 [网易云信](https://id.163yun.com/register?h=media&t=media&clueFrom=nim&from=bdjjnim0035&referrer=https://app.yunxin.163.com/?clueFrom=nim&from=bdjjnim0035) 注册账号
2. 于「应用」一栏中创建您的项目
3. 于应用详情页中找到「App Key」管理即可查看Appkey
4. 此时您的Appkey缺乏权限申请试用「音视频通话」专属客户经理会联系您并为您开通权限
5. 将AppKey填写进 `/config/index`
## 5.开始运行项目
- node开发环境 version 8+
## 6.开始运行项目
### 安装依赖
```
npm install
```
### 本地启动
```
npm run dev
```
运行后通过 https://localhost:8020/index.html#/?path=h5 进行访问
### 正式环境打包
```
npm run build
```
### 代码检查及修复
```
npm run lint
```
## 7.注意事项
- 当前功能内部署了云信的3.7.0版本的sdk如需要最新版本的sdk请主动去[云信官网](https://yunxin.163.com/)下载
- 从云信获取到应用appkey和appSecret之后需要使用者主动去代码中添加`/config/index`中
- 云信sdk音视频功能需要运行在安全环境中https链接或者本地链接localhost、127.0.0.1
- 更多内容请访问[云信官网](https://yunxin.163.com/)了解

@ -0,0 +1,9 @@
const path = require('path')
const resolve = dir => path.resolve(__dirname, dir)
module.exports = {
resolve: {
alias: {
'@': resolve('src')
}
}
}

@ -0,0 +1,13 @@
module.exports = {
presets: [
// https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
"@vue/cli-plugin-babel/preset"
],
env: {
development: {
// babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
// This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
plugins: ["dynamic-import-node"]
}
}
};

Binary file not shown.

@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDtTCCAp2gAwIBAgIJALykaRpGZk6vMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
aWRnaXRzIFB0eSBMdGQwHhcNMTUwNjAzMDIyNDIzWhcNMjMwODIxMDIyNDIzWjBF
MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
CgKCAQEAsOueIOoAJHm1Gb5Itu9jpwwl070n7RH/4JYoffNOdUA2edtAk3lgOX/E
HSTuuOyO0a2O3duBu/6V+t5Aqg7/frgqXzuuzb27y35jXq0APWzrzucDYPdQazuf
XUc2pf/TzyVj8IzA+Gphz7W6VE4SAdg4nyNlshms189ZJUwcILFRcwurqV3dwPbs
0nbND8JkZgymTfXgVxjLDh320p+xFv/Om2zMWw5QUvWkFvjtUXO9wMewsNsDa0Ks
gQLfRZ+0Un85QHJjKMh9etRmr/yIR2kDVx2m1upw378R19S2xxHA+zaIFQZ1lFvr
/eZ6rvq5jQvO/FAng3kEgxThdW7F4wIDAQABo4GnMIGkMB0GA1UdDgQWBBQXg42o
XYjpiz0cwUdpjVRNUS6CWzB1BgNVHSMEbjBsgBQXg42oXYjpiz0cwUdpjVRNUS6C
W6FJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV
BAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJALykaRpGZk6vMAwGA1UdEwQF
MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAItFRLyUnE7hl9jgO/C0DNW78Nf8SC4c
ee9+kmwLsaqeIGk6ek4/kOw4eRnidlQBSgjiKk+YmFrTO6K4e/4i3kGs+IDSRq03
JxgY3q7IHXd0fmDDkE20M8rzL9FQF6YQxSpZfc7/ZoByOXLZ6S8i0tiwzpAzKnba
xeu+Hr+k9TiR5yBRyQCSXTqlra2r2WEFmLaL22Rs0GklDITGtWtsgstJZm/AcE2C
HqY4sVOZCxuB1h+ppVD2cdhzOXEdqU+ZY5828hLkqbx9YJLMH3Cb5sDaXoaY2lUE
VDRu9ghurS2F/JvSLmEFZRc2g2paTAKpAuDO0o01lCLX7JkeaArbm18=
-----END CERTIFICATE-----

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAsOueIOoAJHm1Gb5Itu9jpwwl070n7RH/4JYoffNOdUA2edtA
k3lgOX/EHSTuuOyO0a2O3duBu/6V+t5Aqg7/frgqXzuuzb27y35jXq0APWzrzucD
YPdQazufXUc2pf/TzyVj8IzA+Gphz7W6VE4SAdg4nyNlshms189ZJUwcILFRcwur
qV3dwPbs0nbND8JkZgymTfXgVxjLDh320p+xFv/Om2zMWw5QUvWkFvjtUXO9wMew
sNsDa0KsgQLfRZ+0Un85QHJjKMh9etRmr/yIR2kDVx2m1upw378R19S2xxHA+zaI
FQZ1lFvr/eZ6rvq5jQvO/FAng3kEgxThdW7F4wIDAQABAoIBAQCvBcj/gr71VroE
Z6yD3TtWjLv3Ro/zBfV+9s3EHCkn8Yhy8KZnvpGlEHKw6lKH+u4nHG3TqU4k7uzs
q2aJViEH+aVhZSe/Pc5EuBoSFU/BdLmri/pZuRCDpQ45NzQm8HlX2gOOe5CDsKpm
078rm7hQvtj1Bg2bLa9CKExmi27gHyWUSeMwFewcvCtmen6/lzdX21r7MadFc5tF
njhoa6wmq2JI/F9w/gpnPhI/YBqi2XTPknPlNVYuhLKjgi7oEfhV8uiNucWLj516
4xc3BB5RlFQN9ybpPHjU1i8UI8NMhA1Qfwxe4qt/Oa05oKcHp7589lmjgtBMYKOG
Jf2pq15BAoGBAN6slC1XKNkZlHdZMl/3fi2Myg4ueqBLi7akEyxnjJlievfvwEFz
7KTrTFDD6f7nyD2w2TaPwJoJFey7K1CE6ldhxx2/ghbAzwdbTsim7RJM2s1atk9S
yM0HjRp5thaa110o0f7R/nVLU8lFv5NVvZVsQU9fGbboMbF6q+MrbOgRAoGBAMtm
DaSVJ31buLHQFJawPPwXD1zMQGIn/CxUZfJb9ZAoe0uLzHoLigYrRT9m+zZT68Si
8ltM50nNuMid4ywwLCQ/VnM0zTDdHYX4efoDK/rZNiDQDIGNApqruwVH8v0SswjS
Te5odZhuWUrQzJ0ZUxo04L4Cc5qFBVo5V6jyUmKzAoGAYraE9dimvh+N5p6/KzXv
VMgOJt1J9VeoNy5jZZL+DF1RACrjwuBeLvo0mbVQPXWJGngUwxBVJLQUaR7MY+SY
cmZhO/nS9L1CyhMbSO5fOHajpNeq7F1ZsTLAxdTg+QJpqN3Ywitbr6nWGer2s50V
73DPPx18q84hgXlNS+bLX9ECgYAgtWGeROoby6Mw3QBilybHd0HeL25vGnT///aA
+e7MZuYk6O9R9QcWJOE25+2f9/DjJz0IF57eDHoZsOI2WezPS2wwjJ4urHAx+hpL
bTUmWsXMkwhf0PhJPTKPD9nwfpBR69fibePzRlOPp3IwFUF65mP5ylUi1R9eOfhx
z74V5wKBgGQbrvjZsLLYk5uY672fRaknz+iHW2yRcR9peb9WYqSRBAQHx3tW1rVS
jUw8ZthQqZd2zPRaLIZVWGQ4dFpgEvavVPZKraIXnQ6CC3UMjQYWIxCapdTUJO+3
QAuMDIIQApR7mMJMhTb7SgyHOJuzaozid3M8mfRMMwhJTnDeLkiV
-----END RSA PRIVATE KEY-----

@ -0,0 +1,6 @@
export default {
// 请输入自己的appkey
appkey: '2428212a7f52c661655aa6370e8ed817',
// 请输入自己的appSecret
appSecret: 'fcb5e539e78f'
}

@ -0,0 +1,3 @@
module.exports = {
preset: '@vue/cli-plugin-unit-jest'
}

15196
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,61 @@
{
"name": "web",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"dev": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint",
"sync-demo:test": "sh ./bin/sync-demo.sh test",
"sync-demo:online": "sh ./bin/sync-demo.sh master",
"sync-source:test": "node ./bin/sync-source.js --branch develop",
"sync-source:online": "node ./bin/sync-source.js --branch master",
"sync:test": "npm run sync-demo:test && npm run sync-source:test",
"sync:online": "npm run sync-demo:online && npm run sync-source:online"
},
"dependencies": {
"axios": "^0.20.0",
"caniuse-lite": "^1.0.30001332",
"core-js": "^3.6.5",
"echarts": "^5.3.3",
"element-ui": "^2.13.2",
"jssha": "^3.1.2",
"nertc-web-sdk": "latest",
"sm4-128-ecb": "^1.4.0",
"vant": "^2.12.48",
"vue": "^2.6.11",
"vue-router": "^3.2.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.4.0",
"@vue/cli-plugin-eslint": "~4.4.0",
"@vue/cli-plugin-router": "~4.4.0",
"@vue/cli-plugin-unit-jest": "~4.4.0",
"@vue/cli-service": "~4.4.0",
"@vue/eslint-config-standard": "^5.1.2",
"@vue/test-utils": "^1.0.3",
"babel-eslint": "^10.1.0",
"commander": "^6.1.0",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.2.2",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"lint-staged": "^9.5.0",
"vue-template-compiler": "^2.6.11"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,vue}": [
"vue-cli-service lint",
"git add"
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<title>网易云信</title>
<!-- uni 的 SDK必须引用。 -->
<script
type="text/javascript"
src="//js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.1.js"
></script>
</head>
<body>
<noscript>
<strong
>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
properly without JavaScript enabled. Please enable it to
continue.</strong
>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<!-- <script type="text/javascript">
// 待触发 `UniAppJSBridgeReady` 事件后,即可调用 uni 的 API。
document.addEventListener('UniAppJSBridgeReady', function() {
uni.getEnv(function(res) {
console.log('当前环境:' + JSON.stringify(res))
})
Vue.prototype.$uni = uni
})
</script> -->
</body>
</html>

@ -0,0 +1,9 @@
<template>
<div id="app">
<router-view/>
</div>
</template>
<style lang="less">
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Binary file not shown.

@ -0,0 +1,55 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.el-drawer__header span:focus {
outline: 0!important;
}
html{
-webkit-font-smoothing: antialiased;
}
.mb20 {
margin-bottom: 20px;
}
.mt20 {
margin-top: -20px;
}
.mr10 {
margin-right: 10px;
}
.ml10 {
margin-left: 10px;
}
.mr20 {
margin-right: 20px;
}
.pl20 {
padding-left: 20px;
}
.pr20 {
padding-right: 20px;
}
.t-center {
text-align: center;
}
.flex {
display: flex;
}
.jcb {
justify-content: space-between;
}
.jce {
justify-content: space-evenly;
}
.jcc{
justify-content: center;
}
.aic{
align-items: center;
}
.f1 {
flex: 1;
}

@ -0,0 +1,61 @@
import axios from 'axios'
import JsSha from 'jssha'
/**
* interface Options {
* uid: string // 用户账号
* channelName: string // 频道名称
* appkey: string // 你的 appkey
* appSecret: string // 你的 appsecret
* }
*/
export const getToken = ({
uid,
channelName,
appkey,
appSecret
}) => {
const getTokenUrl = 'https://api.netease.im/nimserver/user/getToken.action'
const Nonce = Math.ceil(Math.random() * 1e9)
const CurTime = Math.ceil(Date.now() / 1000)
const aaa = `${appSecret}${Nonce}${CurTime}`
const sha1 = new JsSha('SHA-1', 'TEXT', { encoding: 'UTF8' })
sha1.update(aaa)
const CheckSum = sha1.getHash('HEX')
return new Promise((resolve, reject) => {
axios
.post(getTokenUrl,
`uid=${uid}&channelName=${channelName}`, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
AppKey: appkey,
Nonce,
CurTime,
CheckSum,
}
})
.then(function (data) {
var d = data.data;
if (d.code !== 200) {
reject(new Error('getChecksum code: ' + d.code));
return
}
resolve(d.token)
})
.catch((error) => {
reject(new Error('getChecksum error: ', error));
});
})
}
export const checkBrowser = (type) => {
const ua = navigator.userAgent.toLowerCase();
const info = {
ie: /msie/.test(ua) && !/opera/.test(ua),
opera: /opera/.test(ua),
safari: /version.*safari/.test(ua),
chrome: /chrome/.test(ua),
firefox: /gecko/.test(ua) && !/webkit/.test(ua)
};
return info[type] || false;
}

@ -0,0 +1,17 @@
import MessageComponent from './index.vue'
import Vue from 'vue'
export function message (content, duration) {
const Instance = new Vue({
render (h) {
return h(MessageComponent, {
props: {
content,
duration
}
})
}
})
const component = Instance.$mount()
document.body.appendChild(component.$el)
}

@ -0,0 +1,87 @@
<template>
<div
:class="`message ${show?'active':''}`"
ref="message"
>
<span class="icon"></span>
<p>{{content}}</p>
</div>
</template>
<script>
export default {
name: 'message',
props: {
content: { //
type: String,
default: ''
},
duration: { //
type: Number,
default: 2000
}
},
data () {
return {
show: false
}
},
mounted () {
setTimeout(() => {
this.show = true
setTimeout(() => {
this.destory()
}, this.duration)
}, 20)
},
methods: {
destory () {
this.show = false
setTimeout(() => { // css200ms
this.$refs.message.remove()
}, 200)
}
}
}
</script>
<style scoped lang="less">
.message {
display: flex;
align-items: center;
height: 40px;
padding: 0 16px;
background: #FFFFFF;
border: 1px solid #EBEDF0;
box-shadow: 0 2px 6px 0 rgba(23, 23, 26, 0.10);
border-radius: 2px;
position: fixed;
left: 50%;
top: 20px;
transform: translate(-50%, -30px);
opacity: 0;
transition: all .2s;
&.active {
transform: translate(-50%, 0);
opacity: 1;
}
.icon {
display: block;
width: 14px;
height: 14px;
margin-right: 8px;
background: url("../../assets/img/icon/error.png") no-repeat center;
background-size: 14px;
}
p {
font-family: PingFangSC-Regular;
font-size: 14px;
color: #333333;
letter-spacing: 0;
white-space: nowrap;
}
}
</style>

@ -0,0 +1,652 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.browserDetect = factory());
}(this, (function () { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var __assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
var browsers = [
['firefox', /Firefox\/([0-9\.]+)(?:\s|$)/],
['opera', /Opera\/([0-9\.]+)(?:\s|$)/],
['opera', /OPR\/([0-9\.]+)(:?\s|$)$/],
['edge', /Edge\/([0-9\._]+)/],
['ie', /Trident\/7\.0.*rv\:([0-9\.]+)\).*Gecko$/],
['ie', /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],
['ie', /MSIE\s(7\.0)/],
['safari', /Version\/([0-9\._]+).*Safari/],
['chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],
['bb10', /BB10;\sTouch.*Version\/([0-9\.]+)/],
['android', /Android\s([0-9\.]+)/],
['ios', /Version\/([0-9\._]+).*Mobile.*Safari.*/],
['yandexbrowser', /YaBrowser\/([0-9\._]+)/],
['crios', /CriOS\/([0-9\.]+)(:?\s|$)/]
];
var os = [
'Windows Phone',
'Android',
'CentOS',
{ name: 'Chrome OS', pattern: 'CrOS' },
'Debian',
'Fedora',
'FreeBSD',
'Gentoo',
'Haiku',
'Kubuntu',
'Linux Mint',
'OpenBSD',
'Red Hat',
'SuSE',
'Ubuntu',
'Xubuntu',
'Cygwin',
'Symbian OS',
'hpwOS',
'webOS ',
'webOS',
'Tablet OS',
'Tizen',
'Linux',
'Mac OS X',
'Macintosh',
'Mac',
'Windows 98;',
'Windows '
];
var osVersions = {
'10.0': '10',
'6.4': '10 Technical Preview',
'6.3': '8.1',
'6.2': '8',
'6.1': 'Server 2008 R2 / 7',
'6.0': 'Server 2008 / Vista',
'5.2': 'Server 2003 / XP 64-bit',
'5.1': 'XP',
'5.01': '2000 SP1',
'5.0': '2000',
'4.0': 'NT',
'4.90': 'ME'
};
var mobileRegExp = new RegExp(['(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|',
'compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|',
'midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)',
'\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|',
'wap|windows ce|xda|xiino'].join(''), 'i');
var mobilePrefixRegExp = new RegExp(['1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|',
'ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|',
'avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|',
'cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|',
'ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|',
'g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|',
'hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|',
'i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|',
'kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])',
'|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|',
'mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|',
'n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|',
'op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|',
'po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|',
'raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|',
'se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|k\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|',
'so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|',
'tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|',
'veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|',
'w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-'].join(''), 'i');
var Detector = /** @class */ (function () {
function Detector(userAgent, navigator, process) {
this.navigator = navigator;
this.process = process;
this.userAgent = userAgent
? userAgent
: this.navigator ? (navigator.userAgent || navigator.vendor) : '';
}
Detector.prototype.detect = function () {
if (this.process && !this.userAgent) {
var version = this.process.version.slice(1).split('.').slice(0, 3);
var versionTail = Array.prototype.slice.call(version, 1).join('') || '0';
return {
name: 'node',
version: version.join('.'),
versionNumber: parseFloat(version[0] + "." + versionTail),
mobile: false,
os: this.process.platform
};
}
if (!this.userAgent)
this.handleMissingError();
return __assign({}, this.checkBrowser(), this.checkMobile(), this.checkOs());
};
Detector.prototype.checkBrowser = function () {
var _this = this;
return browsers
.filter(function (definition) { return definition[1].test(_this.userAgent); })
.map(function (definition) {
var match = definition[1].exec(_this.userAgent);
var version = match && match[1].split(/[._]/).slice(0, 3);
var versionTails = Array.prototype.slice.call(version, 1).join('') || '0';
if (version && version.length < 3)
Array.prototype.push.apply(version, version.length === 1 ? [0, 0] : [0]);
return {
name: String(definition[0]),
version: version.join('.'),
versionNumber: Number(version[0] + "." + versionTails)
};
})
.shift();
};
Detector.prototype.checkMobile = function () {
var agentPrefix = this.userAgent.substr(0, 4);
var mobile = mobileRegExp.test(this.userAgent) || mobilePrefixRegExp.test(agentPrefix);
return { mobile: mobile };
};
Detector.prototype.checkOs = function () {
var _this = this;
return os
.map(function (definition) {
var name = definition.name || definition;
var pattern = _this.getOsPattern(definition);
return {
name: name,
pattern: pattern,
value: RegExp("\\b" + pattern.replace(/([ -])(?!$)/g, '$1?') + "(?:x?[\\d._]+|[ \\w.]*)", 'i').exec(_this.userAgent)
};
})
.filter(function (definition) { return definition.value; })
.map(function (definition) {
var os$$1 = definition.value[0] || '';
var osSuffix;
if (definition.pattern &&
definition.name &&
/^Win/i.test(os$$1) &&
!/^Windows Phone /i.test(os$$1) &&
(osSuffix = osVersions[os$$1.replace(/[^\d.]/g, '')]))
os$$1 = "Windows " + osSuffix;
if (definition.pattern && definition.name)
os$$1 = os$$1.replace(RegExp(definition.pattern, 'i'), definition.name);
os$$1 = os$$1
.replace(/ ce$/i, ' CE')
.replace(/\bhpw/i, 'web')
.replace(/\bMacintosh\b/, 'Mac OS')
.replace(/_PowerPC\b/i, ' OS')
.replace(/\b(OS X) [^ \d]+/i, '$1')
.replace(/\bMac (OS X)\b/, '$1')
.replace(/\/(\d)/, ' $1')
.replace(/_/g, '.')
.replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '')
.replace(/\bx86\.64\b/gi, 'x86_64')
.replace(/\b(Windows Phone) OS\b/, '$1')
.replace(/\b(Chrome OS \w+) [\d.]+\b/, '$1')
.split(' on ')[0]
.trim();
os$$1 = /^(?:webOS|i(?:OS|P))/.test(os$$1)
? os$$1
: (os$$1.charAt(0).toUpperCase() + os$$1.slice(1));
return { os: os$$1 };
})
.shift();
};
Detector.prototype.getOsPattern = function (definition) {
var definitionInterface = definition;
return (typeof definition === 'string'
? definition
: undefined) ||
definitionInterface.pattern ||
definitionInterface.name;
};
Detector.prototype.handleMissingError = function () {
throw new Error('Please give user-agent.\n> browser(navigator.userAgent or res.headers[\'user-agent\']).');
};
return Detector;
}());
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var _global = createCommonjsModule(function (module) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self
// eslint-disable-next-line no-new-func
: Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
});
var _core = createCommonjsModule(function (module) {
var core = module.exports = { version: '2.5.7' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
});
var _core_1 = _core.version;
var _isObject = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
var _anObject = function (it) {
if (!_isObject(it)) throw TypeError(it + ' is not an object!');
return it;
};
var _fails = function (exec) {
try {
return !!exec();
} catch (e) {
return true;
}
};
// Thank's IE8 for his funny defineProperty
var _descriptors = !_fails(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
var document = _global.document;
// typeof document.createElement is 'object' in old IE
var is = _isObject(document) && _isObject(document.createElement);
var _domCreate = function (it) {
return is ? document.createElement(it) : {};
};
var _ie8DomDefine = !_descriptors && !_fails(function () {
return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
});
// 7.1.1 ToPrimitive(input [, PreferredType])
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
var _toPrimitive = function (it, S) {
if (!_isObject(it)) return it;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
throw TypeError("Can't convert object to primitive value");
};
var dP = Object.defineProperty;
var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
_anObject(O);
P = _toPrimitive(P, true);
_anObject(Attributes);
if (_ie8DomDefine) try {
return dP(O, P, Attributes);
} catch (e) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
var _objectDp = {
f: f
};
var _propertyDesc = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
var _hide = _descriptors ? function (object, key, value) {
return _objectDp.f(object, key, _propertyDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
var hasOwnProperty = {}.hasOwnProperty;
var _has = function (it, key) {
return hasOwnProperty.call(it, key);
};
var id = 0;
var px = Math.random();
var _uid = function (key) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
var _redefine = createCommonjsModule(function (module) {
var SRC = _uid('src');
var TO_STRING = 'toString';
var $toString = Function[TO_STRING];
var TPL = ('' + $toString).split(TO_STRING);
_core.inspectSource = function (it) {
return $toString.call(it);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) _has(val, 'name') || _hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === _global) {
O[key] = val;
} else if (!safe) {
delete O[key];
_hide(O, key, val);
} else if (O[key]) {
O[key] = val;
} else {
_hide(O, key, val);
}
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
});
var _aFunction = function (it) {
if (typeof it != 'function') throw TypeError(it + ' is not a function!');
return it;
};
// optional / simple context binding
var _ctx = function (fn, that, length) {
_aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
};
};
var PROTOTYPE = 'prototype';
var $export = function (type, name, source) {
var IS_FORCED = type & $export.F;
var IS_GLOBAL = type & $export.G;
var IS_STATIC = type & $export.S;
var IS_PROTO = type & $export.P;
var IS_BIND = type & $export.B;
var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
var key, own, out, exp;
if (IS_GLOBAL) source = name;
for (key in source) {
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
// export native or passed
out = (own ? target : source)[key];
// bind timers to global for call from export context
exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
// extend global
if (target) _redefine(target, key, out, type & $export.U);
// export
if (exports[key] != out) _hide(exports, key, exp);
if (IS_PROTO && expProto[key] != out) expProto[key] = out;
}
};
_global.core = _core;
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
var _export = $export;
var toString = {}.toString;
var _cof = function (it) {
return toString.call(it).slice(8, -1);
};
// fallback for non-array-like ES3 and non-enumerable old V8 strings
// eslint-disable-next-line no-prototype-builtins
var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
return _cof(it) == 'String' ? it.split('') : Object(it);
};
// 7.2.1 RequireObjectCoercible(argument)
var _defined = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
// 7.1.13 ToObject(argument)
var _toObject = function (it) {
return Object(_defined(it));
};
// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
var _toInteger = function (it) {
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
// 7.1.15 ToLength
var min = Math.min;
var _toLength = function (it) {
return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
// 7.2.2 IsArray(argument)
var _isArray = Array.isArray || function isArray(arg) {
return _cof(arg) == 'Array';
};
var _shared = createCommonjsModule(function (module) {
var SHARED = '__core-js_shared__';
var store = _global[SHARED] || (_global[SHARED] = {});
(module.exports = function (key, value) {
return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
version: _core.version,
mode: 'global',
copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
});
});
var _wks = createCommonjsModule(function (module) {
var store = _shared('wks');
var Symbol = _global.Symbol;
var USE_SYMBOL = typeof Symbol == 'function';
var $exports = module.exports = function (name) {
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));
};
$exports.store = store;
});
var SPECIES = _wks('species');
var _arraySpeciesConstructor = function (original) {
var C;
if (_isArray(original)) {
C = original.constructor;
// cross-realm fallback
if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined;
if (_isObject(C)) {
C = C[SPECIES];
if (C === null) C = undefined;
}
} return C === undefined ? Array : C;
};
// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
var _arraySpeciesCreate = function (original, length) {
return new (_arraySpeciesConstructor(original))(length);
};
// 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
// 4 -> Array#every
// 5 -> Array#find
// 6 -> Array#findIndex
var _arrayMethods = function (TYPE, $create) {
var IS_MAP = TYPE == 1;
var IS_FILTER = TYPE == 2;
var IS_SOME = TYPE == 3;
var IS_EVERY = TYPE == 4;
var IS_FIND_INDEX = TYPE == 6;
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
var create = $create || _arraySpeciesCreate;
return function ($this, callbackfn, that) {
var O = _toObject($this);
var self = _iobject(O);
var f = _ctx(callbackfn, that, 3);
var length = _toLength(self.length);
var index = 0;
var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
var val, res;
for (;length > index; index++) if (NO_HOLES || index in self) {
val = self[index];
res = f(val, index, O);
if (TYPE) {
if (IS_MAP) result[index] = res; // map
else if (res) switch (TYPE) {
case 3: return true; // some
case 5: return val; // find
case 6: return index; // findIndex
case 2: result.push(val); // filter
} else if (IS_EVERY) return false; // every
}
}
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
};
};
var _strictMethod = function (method, arg) {
return !!method && _fails(function () {
// eslint-disable-next-line no-useless-call
arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);
});
};
var $filter = _arrayMethods(2);
_export(_export.P + _export.F * !_strictMethod([].filter, true), 'Array', {
// 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
filter: function filter(callbackfn /* , thisArg */) {
return $filter(this, callbackfn, arguments[1]);
}
});
var filter = _core.Array.filter;
var $map = _arrayMethods(1);
_export(_export.P + _export.F * !_strictMethod([].map, true), 'Array', {
// 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
map: function map(callbackfn /* , thisArg */) {
return $map(this, callbackfn, arguments[1]);
}
});
var map = _core.Array.map;
var _stringWs = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' +
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
var space = '[' + _stringWs + ']';
var non = '\u200b\u0085';
var ltrim = RegExp('^' + space + space + '*');
var rtrim = RegExp(space + space + '*$');
var exporter = function (KEY, exec, ALIAS) {
var exp = {};
var FORCE = _fails(function () {
return !!_stringWs[KEY]() || non[KEY]() != non;
});
var fn = exp[KEY] = FORCE ? exec(trim) : _stringWs[KEY];
if (ALIAS) exp[ALIAS] = fn;
_export(_export.P + _export.F * FORCE, 'String', exp);
};
// 1 -> String#trimLeft
// 2 -> String#trimRight
// 3 -> String#trim
var trim = exporter.trim = function (string, TYPE) {
string = String(_defined(string));
if (TYPE & 1) string = string.replace(ltrim, '');
if (TYPE & 2) string = string.replace(rtrim, '');
return string;
};
var _stringTrim = exporter;
// 21.1.3.25 String.prototype.trim()
_stringTrim('trim', function ($trim) {
return function trim() {
return $trim(this, 3);
};
});
var trim$1 = _core.String.trim;
var injectableNavigator = typeof window !== 'undefined'
? window.navigator
: undefined;
var injectableProcess = typeof process !== 'undefined'
? process
: undefined;
function browserDetect (userAgent) {
var detector = new Detector(userAgent, injectableNavigator, injectableProcess);
return detector.detect();
}
return browserDetect;
})));
//# sourceMappingURL=browser-detect.umd.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
!(function(e, n){typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = n() : typeof define === 'function' && define.amd ? define(n) : (e = e || self).wasmFeatureDetect = n()}(this, function(){'use strict'; return { bigInt: () => (async e => {try {return (await WebAssembly.instantiate(e)).instance.exports.b(BigInt(0)) === BigInt(0)} catch (e){return !1}})(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 1, 126, 1, 126, 3, 2, 1, 0, 7, 5, 1, 1, 98, 0, 0, 10, 6, 1, 4, 0, 32, 0, 11])), bulkMemory: async() => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 3, 1, 0, 1, 10, 14, 1, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11])), exceptions: async() => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 8, 1, 6, 0, 6, 64, 25, 11, 11])), multiValue: async() => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 0, 2, 127, 127, 3, 2, 1, 0, 10, 8, 1, 6, 0, 65, 0, 65, 0, 11])), mutableGlobals: async() => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 2, 8, 1, 1, 97, 1, 98, 3, 127, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 5, 1, 1, 97, 3, 1])), referenceTypes: async() => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 7, 1, 5, 0, 208, 112, 26, 11])), saturatedFloatToInt: async() => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 12, 1, 10, 0, 67, 0, 0, 0, 0, 252, 0, 26, 11])), signExtensions: async() => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 8, 1, 6, 0, 65, 0, 192, 26, 11])), simd: async() => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 9, 1, 7, 0, 65, 0, 253, 15, 26, 11])), tailCall: async() => WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 6, 1, 4, 0, 18, 0, 11])), threads: () => (async e => {try {return typeof MessageChannel !== 'undefined' && (new MessageChannel()).port1.postMessage(new SharedArrayBuffer(1)), WebAssembly.validate(e)} catch (e){return !1}})(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5, 4, 1, 3, 1, 1, 10, 11, 1, 9, 0, 65, 0, 254, 16, 2, 0, 26, 11])) }}));

@ -0,0 +1,18 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/styles/common.less'
import * as echarts from 'echarts'
//全局引入echarts
Vue.prototype.$echarts = echarts
Vue.config.productionTip = false
Vue.use(ElementUI)
new Vue({
router,
render: h => h(App)
}).$mount('#app')

@ -0,0 +1,27 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import Join from '../views/join/index.vue'
Vue.use(VueRouter)
const router = new VueRouter({
mode: 'hash',
base: process.env.BASE_URL,
routes: [{
path: '/',
name: 'join',
component: Join
}].concat(routes)
})
router.onError((error) => {
const pattern = /Loading chunk (\w)+ failed/g;
const isChunkLoadFailed = error.message.match(pattern);
const targetPath = router.history.pending.fullPath;
if (isChunkLoadFailed) {
router.replace(targetPath);
}
})
export default router

@ -0,0 +1,7 @@
import H5 from '../views/h5/index.vue'
export default [{
path: '/h5',
name: 'h5',
component: H5
}]

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -0,0 +1,403 @@
<template>
<div class="join">
<div class="content">
<img src="../../assets/img/logo.png" alt="" class="logo">
<input
v-model.trim="channelName"
type="text"
placeholder="请输入房间号"
>
<input
v-if="isShowExtraInput"
v-model.trim="extraChannelName"
class="extra-input"
type="text"
placeholder="请输入房间号"
>
<el-checkbox
v-if="isShowProxyCheck"
v-model="cloudProxy"
class="extra-check"
>开启云代理</el-checkbox>
<el-checkbox
v-if="isShowDualStreamCheck"
v-model="dualStream"
class="extra-check"
>开启大小流</el-checkbox>
<el-checkbox
v-if="isShowBeautyCheck"
v-model="beauty"
class="extra-check"
>开启美颜</el-checkbox>
<div v-if="isShowRoleRadio" class="extra-check">
<span class="mr10">角色</span>
<el-radio v-model="role" label="host"></el-radio>
<el-radio v-model="role" label="audience"></el-radio>
</div>
<!-- <div class="custom-encryption" v-if="isShowScreenShareOption">
<span class="mr10">NERTC</span
><el-input v-model="maxBitrate" placeholder="请输入最大码率"></el-input
><br />
<span class="mr10">策略选择</span>
<el-select v-model="contentHint" placeholder="请选择内容类型">
<el-option
v-for="item in screenShareOptions"
:key="item.value"
:value="item.value"
:label="item.label"
/>
</el-select>
</div> -->
<div v-if="isShowCustomEncryptionOption" class="custom-encryption">
<span class="mr10">自定义密钥</span><el-input v-model="customSecret" placeholder="请输入密钥" /><br>
<span class="mr10">自定义加密</span>
<el-select v-model="customEncryption" placeholder="请选择加密类型">
<el-option
v-for="item in customEncryptionOptions"
:key="item.value"
:value="item.value"
:label="item.label"
/>
</el-select>
</div>
<div v-if="isShowVideoEncodingOption" class="video-encoding">
<span class="mr10">视频质量</span>
<el-select v-model="videoQuality">
<el-option
v-for="item in videoQualityOptions"
:key="item.value"
:value="item.value"
:label="item.label"
/>
</el-select>
<br>
<span class="mr10">视频帧率</span>
<el-select v-model="videoFrameRate">
<el-option
v-for="item in videoFrameRateOptions"
:key="item.value"
:value="item.value"
:label="item.label"
/>
</el-select>
</div>
<button :disabled="!isSupport" class="submit-btn" @click="handleSubmit">
加入房间
</button>
<div v-show="!isSupport" class="errorMsg">
当前浏览器不支持体验建议下载安装最新chrome浏览器
</div>
</div>
</div>
</template>
<script>
import { message } from '../../components/message'
// import { checkBrowser } from '../../common'
import NERTC from 'nertc-web-sdk'
export default {
name: 'Join',
data() {
return {
channelName: '',
extraChannelName: '',
isSupport: true,
isShowCustomEncryptionOption: false,
isShowExtraInput: false,
isShowProxyCheck: false,
isShowBeautyCheck: false,
isShowDualStreamCheck: false,
isShowRoleRadio: false,
isShowVideoEncodingOption: false,
isShowScreenShareOption: false,
role: 'host',
customEncryption: '',
cloudProxy: true,
dualStream: true,
beauty: true,
customSecret: '',
customEncryptionOptions: [
{
value: 'rc4',
label: 'rc4'
},
{
value: 'sm4',
label: 'sm4-128-ecb'
}
],
screenShareOptions: [
{
value: 'detail',
label: '清晰度优先'
},
{
value: 'motion',
label: '流畅度优先'
}
],
videoQuality: NERTC.VIDEO_QUALITY_480p,
videoQualityOptions: [
{
value: NERTC.VIDEO_QUALITY_180p,
label: '320x180'
},
{
value: NERTC.VIDEO_QUALITY_480p,
label: '640x480'
},
{
value: NERTC.VIDEO_QUALITY_720p,
label: '1280x720'
},
{
value: NERTC.VIDEO_QUALITY_1080p,
label: '1920x1080'
}
],
videoFrameRate: 15,
videoFrameRateOptions: [
{
value: NERTC.CHAT_VIDEO_FRAME_RATE_5,
label: 5
},
{
value: NERTC.CHAT_VIDEO_FRAME_RATE_10,
label: 10
},
{
value: NERTC.CHAT_VIDEO_FRAME_RATE_15,
label: 15
},
{
value: NERTC.CHAT_VIDEO_FRAME_RATE_20,
label: 20
},
{
value: NERTC.CHAT_VIDEO_FRAME_RATE_25,
label: 25
}
]
}
},
mounted() {
if (!NERTC.checkSystemRequirements()) {
this.isSupport = false
}
//
if (this.$route.query.path === 'customEncryption') {
this.isShowCustomEncryptionOption = true
} else if (this.$route.query.path === 'multipleInstances') {
this.isShowExtraInput = true
} else if (this.$route.query.path === 'cloudProxy') {
this.isShowProxyCheck = true
} else if (this.$route.query.path === 'dualStream') {
this.isShowDualStreamCheck = true
} else if (this.$route.query.path === 'beauty') {
this.isShowBeautyCheck = true
} else if (this.$route.query.path === 'basicLive') {
this.isShowRoleRadio = true
} else if (this.$route.query.path === 'videoEncoding') {
this.isShowVideoEncodingOption = true
} else if (this.$route.query.path === 'screenShare') {
this.isShowScreenShareOption = true
}
},
methods: {
handleSubmit() {
const {
channelName,
isShowExtraInput,
extraChannelName,
isShowCustomEncryptionOption,
customEncryption,
isShowProxyCheck,
cloudProxy,
customSecret,
isShowDualStreamCheck,
dualStream,
isShowBeautyCheck,
beauty,
isShowRoleRadio,
role,
isShowVideoEncodingOption,
videoQuality,
videoFrameRate,
isShowScreenShareOption
} = this
if (!channelName) {
message('请输入房间号')
return
} else if (!/^[0-9]{1,12}$/.test(channelName)) {
message('房间号为12位以内的数字')
return
}
if (isShowExtraInput) {
if (!extraChannelName) {
message('请输入房间号')
return
} else if (!/^[0-9]{1,12}$/.test(extraChannelName)) {
message('房间号为12位以内的数字')
return
}
}
if (isShowCustomEncryptionOption && !customSecret) {
message('请输入密钥')
return
}
if (isShowCustomEncryptionOption && !customEncryption) {
message('请选择加密类型')
return
}
const { path = 'single' } = this.$route.query
if (isShowCustomEncryptionOption) {
this.$router.push({
path: `/${path}`,
query: { channelName, customEncryption, customSecret }
})
} else if (isShowExtraInput) {
this.$router.push({
path: `/${path}`,
query: { channelName, extraChannelName }
})
} else if (isShowProxyCheck) {
this.$router.push({
path: `/${path}`,
query: { channelName, cloudProxy }
})
} else if (isShowDualStreamCheck) {
this.$router.push({
path: `/${path}`,
query: { channelName, dualStream }
})
} else if (isShowBeautyCheck) {
this.$router.push({
path: `/${path}`,
query: { channelName, beauty }
})
} else if (isShowRoleRadio) {
this.$router.push({
path: `/${path}`,
query: { channelName, role }
})
} else if (isShowVideoEncodingOption) {
this.$router.push({
path: `/${path}`,
query: { channelName, videoQuality, videoFrameRate }
})
} else if (isShowScreenShareOption) {
this.$router.push({
path: `/${path}`,
query: { channelName }
})
} else {
this.$router.push({
path: `/${path}`,
query: { channelName }
})
}
}
}
}
</script>
<style scoped lang="less">
.join {
height: 100vh;
background: #f7f8fa;
display: flex;
align-items: center;
justify-content: center;
.content {
width: 400px;
height: 400px;
padding-top: 60px;
background: #fff;
box-shadow: 0 4px 10px 0 rgba(47, 56, 111, 0.1);
border-radius: 8px;
.extra-check {
margin-left: 40px;
margin-bottom: 20px;
}
.extra-check {
margin-left: 40px;
margin-bottom: 20px;
}
.extra-check {
margin-left: 40px;
margin-bottom: 20px;
}
.custom-encryption {
margin-top: -20px;
margin-left: 40px;
margin-bottom: 20px;
.el-input {
width: 193px;
margin-bottom: 10px;
}
}
.video-encoding {
margin-top: -20px;
margin-left: 40px;
margin-bottom: 20px;
}
.logo {
display: block;
height: 55px;
margin: 0 auto;
}
input {
display: block;
width: 315px;
height: 44px;
margin: 50px auto 40px;
border: none;
outline: medium;
border-bottom: 1px solid #dcdfe5;
font-family: PingFangSC-Regular;
font-size: 17px;
&::placeholder {
color: #b0b6be;
}
}
.extra-input{
margin-top: -20px;
}
.submit-btn {
display: block;
display: block;
width: 315px;
height: 50px;
margin: 0 auto;
border: none;
outline: medium;
background: #337eff;
border-radius: 25px;
font-family: PingFangSC-Regular;
font-size: 16px;
color: #ffffff;
cursor: pointer;
&:active {
background: darken(#337eff, 5%);
}
&:disabled {
background: #dddddd;
cursor: not-allowed;
}
}
.errorMsg {
font-size: 14px;
text-align: center;
color: red;
margin-top: 10px;
}
}
}
</style>

@ -0,0 +1,12 @@
import { shallowMount } from '@vue/test-utils'
import HelloWorld from '@/components/HelloWorld.vue'
describe('HelloWorld.vue', () => {
it('renders props.msg when passed', () => {
const msg = 'new message'
const wrapper = shallowMount(HelloWorld, {
propsData: { msg }
})
expect(wrapper.text()).toMatch(msg)
})
})

@ -0,0 +1,20 @@
/*
* vue config
* */
const fs = require('fs-extra')
module.exports = {
lintOnSave: true,
publicPath: '/call/',
devServer: {
port: 8020,
https: true,
key: fs.readFileSync('./cert/key.pem'),
cert: fs.readFileSync('./cert/cert.pem')
// openPage: '#/?path=h5'
},
configureWebpack: config => {
if (process.env.NODE_ENV === 'development') {
config.devtool = 'eval-source-map'
}
}
}
Loading…
Cancel
Save