Merge branch 'fanpeng' into 'develop'
Fanpeng See merge request StarlockTeam/wx-starlock!45
This commit is contained in:
commit
bc00f73b6f
@ -30,6 +30,38 @@ module.exports = {
|
|||||||
'plugin:prettier/recommended'
|
'plugin:prettier/recommended'
|
||||||
],
|
],
|
||||||
ignorePatterns: ['utils/log.js', 'unpackage/**/*'],
|
ignorePatterns: ['utils/log.js', 'unpackage/**/*'],
|
||||||
|
// 针对不同文件类型使用不同配置
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['**/*.uts'],
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
plugins: ['@typescript-eslint'],
|
||||||
|
extends: ['plugin:@typescript-eslint/recommended'],
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
sourceType: 'module'
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
IUniError: 'readonly',
|
||||||
|
UniError: 'readonly',
|
||||||
|
uni: 'readonly',
|
||||||
|
getApp: 'readonly',
|
||||||
|
wx: 'readonly',
|
||||||
|
getCurrentPages: 'readonly',
|
||||||
|
requirePlugin: 'readonly',
|
||||||
|
plus: 'readonly'
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'func-names': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': 'warn',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'warn',
|
||||||
|
eqeqeq: 'warn',
|
||||||
|
'no-undef': 'off',
|
||||||
|
'prettier/prettier': 'off',
|
||||||
|
'import/no-unresolved': 'off' // 禁用模块解析检查
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
/**
|
/**
|
||||||
* "off" 或 0 ==> 关闭规则
|
* "off" 或 0 ==> 关闭规则
|
||||||
* "warn" 或 1 ==> 打开的规则作为警告(不影响代码执行)
|
* "warn" 或 1 ==> 打开的规则作为警告(不影响代码执行)
|
||||||
|
|||||||
2
App.vue
2
App.vue
@ -31,7 +31,7 @@
|
|||||||
return 'XHJ'
|
return 'XHJ'
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
return 'XHJ'
|
return 'DEV'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@ -2,9 +2,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": ["./*"]
|
||||||
"./*"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"target": "es2020",
|
"target": "es2020",
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
@ -15,14 +13,6 @@
|
|||||||
"strict": true,
|
"strict": true,
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["**/*.js", "**/*.jsx", "**/*.vue", "pages/p2p/p2pPlayer.nvue"],
|
||||||
"**/*.js",
|
"exclude": ["node_modules", "unpackage", "dist"]
|
||||||
"**/*.jsx",
|
|
||||||
"**/*.vue"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"unpackage",
|
|
||||||
"dist"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
@ -15,7 +15,6 @@
|
|||||||
"desc" : "蓝牙将用于控制和管理您的智能门锁"
|
"desc" : "蓝牙将用于控制和管理您的智能门锁"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requiredPrivateInfos" : [ "getLocation" ],
|
|
||||||
"usingComponents" : true,
|
"usingComponents" : true,
|
||||||
"lazyCodeLoading" : "requiredComponents",
|
"lazyCodeLoading" : "requiredComponents",
|
||||||
"optimization" : {
|
"optimization" : {
|
||||||
@ -90,7 +89,10 @@
|
|||||||
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />",
|
"<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />",
|
||||||
"<uses-permission android:name=\"android.permission.BLUETOOTH\" />",
|
"<uses-permission android:name=\"android.permission.BLUETOOTH\" />",
|
||||||
"<uses-permission android:name=\"android.permission.BLUETOOTH_SCAN\" />",
|
"<uses-permission android:name=\"android.permission.BLUETOOTH_SCAN\" />",
|
||||||
"<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\" />"
|
"<uses-permission android:name=\"android.permission.BLUETOOTH_CONNECT\" />",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.MANAGE_EXTERNAL_STORAGE\"/>"
|
||||||
],
|
],
|
||||||
"targetSdkVersion" : 34,
|
"targetSdkVersion" : 34,
|
||||||
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ]
|
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ]
|
||||||
@ -100,7 +102,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"modules" : {
|
"modules" : {
|
||||||
"Bluetooth" : {}
|
"Bluetooth" : {},
|
||||||
|
"VideoPlayer" : {},
|
||||||
|
"LivePusher" : {},
|
||||||
|
"Camera" : {},
|
||||||
|
"Record" : {}
|
||||||
},
|
},
|
||||||
"splashscreen" : {
|
"splashscreen" : {
|
||||||
"waiting" : false
|
"waiting" : false
|
||||||
|
|||||||
299
package-lock.json
generated
299
package-lock.json
generated
@ -16,6 +16,8 @@
|
|||||||
"@iconify-json/material-symbols": "^1.2.22",
|
"@iconify-json/material-symbols": "^1.2.22",
|
||||||
"@iconify-json/solar": "^1.2.2",
|
"@iconify-json/solar": "^1.2.2",
|
||||||
"@iconify/utils": "^2.3.0",
|
"@iconify/utils": "^2.3.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^8.34.0",
|
||||||
|
"@typescript-eslint/parser": "^8.34.0",
|
||||||
"@unocss/preset-icons": "^66.1.2",
|
"@unocss/preset-icons": "^66.1.2",
|
||||||
"commitizen": "^4.3.1",
|
"commitizen": "^4.3.1",
|
||||||
"crc": "^4.3.2",
|
"crc": "^4.3.2",
|
||||||
@ -37,6 +39,7 @@
|
|||||||
"stylelint-config-recess-order": "^6.0.0",
|
"stylelint-config-recess-order": "^6.0.0",
|
||||||
"stylelint-config-recommended-scss": "^14.1.0",
|
"stylelint-config-recommended-scss": "^14.1.0",
|
||||||
"stylelint-config-standard": "^37.0.0",
|
"stylelint-config-standard": "^37.0.0",
|
||||||
|
"typescript": "^5.8.3",
|
||||||
"unocss": "^65.4.3",
|
"unocss": "^65.4.3",
|
||||||
"unocss-preset-weapp": "^65.4.1",
|
"unocss-preset-weapp": "^65.4.1",
|
||||||
"vite-plugin-eslint": "^1.8.1"
|
"vite-plugin-eslint": "^1.8.1"
|
||||||
@ -930,9 +933,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@eslint-community/eslint-utils": {
|
"node_modules/@eslint-community/eslint-utils": {
|
||||||
"version": "4.5.1",
|
"version": "4.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz",
|
||||||
"integrity": "sha512-soEIOALTfTK6EjmKMMoLugwaP0rzkad90iIWd1hMO9ARkSAyjfMfkRRhLvD5qH7vvM0Cg72pieUfR6yh6XxC4w==",
|
"integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -1639,6 +1642,276 @@
|
|||||||
"undici-types": "~6.20.0"
|
"undici-types": "~6.20.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||||
|
"version": "8.34.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.34.0.tgz",
|
||||||
|
"integrity": "sha512-QXwAlHlbcAwNlEEMKQS2RCgJsgXrTJdjXT08xEgbPFa2yYQgVjBymxP5DrfrE7X7iodSzd9qBUHUycdyVJTW1w==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@eslint-community/regexpp": "^4.10.0",
|
||||||
|
"@typescript-eslint/scope-manager": "8.34.0",
|
||||||
|
"@typescript-eslint/type-utils": "8.34.0",
|
||||||
|
"@typescript-eslint/utils": "8.34.0",
|
||||||
|
"@typescript-eslint/visitor-keys": "8.34.0",
|
||||||
|
"graphemer": "^1.4.0",
|
||||||
|
"ignore": "^7.0.0",
|
||||||
|
"natural-compare": "^1.4.0",
|
||||||
|
"ts-api-utils": "^2.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@typescript-eslint/parser": "^8.34.0",
|
||||||
|
"eslint": "^8.57.0 || ^9.0.0",
|
||||||
|
"typescript": ">=4.8.4 <5.9.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {
|
||||||
|
"version": "7.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz",
|
||||||
|
"integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/parser": {
|
||||||
|
"version": "8.34.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.34.0.tgz",
|
||||||
|
"integrity": "sha512-vxXJV1hVFx3IXz/oy2sICsJukaBrtDEQSBiV48/YIV5KWjX1dO+bcIr/kCPrW6weKXvsaGKFNlwH0v2eYdRRbA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@typescript-eslint/scope-manager": "8.34.0",
|
||||||
|
"@typescript-eslint/types": "8.34.0",
|
||||||
|
"@typescript-eslint/typescript-estree": "8.34.0",
|
||||||
|
"@typescript-eslint/visitor-keys": "8.34.0",
|
||||||
|
"debug": "^4.3.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"eslint": "^8.57.0 || ^9.0.0",
|
||||||
|
"typescript": ">=4.8.4 <5.9.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/project-service": {
|
||||||
|
"version": "8.34.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.34.0.tgz",
|
||||||
|
"integrity": "sha512-iEgDALRf970/B2YExmtPMPF54NenZUf4xpL3wsCRx/lgjz6ul/l13R81ozP/ZNuXfnLCS+oPmG7JIxfdNYKELw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@typescript-eslint/tsconfig-utils": "^8.34.0",
|
||||||
|
"@typescript-eslint/types": "^8.34.0",
|
||||||
|
"debug": "^4.3.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": ">=4.8.4 <5.9.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/scope-manager": {
|
||||||
|
"version": "8.34.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.34.0.tgz",
|
||||||
|
"integrity": "sha512-9Ac0X8WiLykl0aj1oYQNcLZjHgBojT6cW68yAgZ19letYu+Hxd0rE0veI1XznSSst1X5lwnxhPbVdwjDRIomRw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@typescript-eslint/types": "8.34.0",
|
||||||
|
"@typescript-eslint/visitor-keys": "8.34.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/tsconfig-utils": {
|
||||||
|
"version": "8.34.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.34.0.tgz",
|
||||||
|
"integrity": "sha512-+W9VYHKFIzA5cBeooqQxqNriAP0QeQ7xTiDuIOr71hzgffm3EL2hxwWBIIj4GuofIbKxGNarpKqIq6Q6YrShOA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": ">=4.8.4 <5.9.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/type-utils": {
|
||||||
|
"version": "8.34.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.34.0.tgz",
|
||||||
|
"integrity": "sha512-n7zSmOcUVhcRYC75W2pnPpbO1iwhJY3NLoHEtbJwJSNlVAZuwqu05zY3f3s2SDWWDSo9FdN5szqc73DCtDObAg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@typescript-eslint/typescript-estree": "8.34.0",
|
||||||
|
"@typescript-eslint/utils": "8.34.0",
|
||||||
|
"debug": "^4.3.4",
|
||||||
|
"ts-api-utils": "^2.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"eslint": "^8.57.0 || ^9.0.0",
|
||||||
|
"typescript": ">=4.8.4 <5.9.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/types": {
|
||||||
|
"version": "8.34.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.34.0.tgz",
|
||||||
|
"integrity": "sha512-9V24k/paICYPniajHfJ4cuAWETnt7Ssy+R0Rbcqo5sSFr3QEZ/8TSoUi9XeXVBGXCaLtwTOKSLGcInCAvyZeMA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/typescript-estree": {
|
||||||
|
"version": "8.34.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.34.0.tgz",
|
||||||
|
"integrity": "sha512-rOi4KZxI7E0+BMqG7emPSK1bB4RICCpF7QD3KCLXn9ZvWoESsOMlHyZPAHyG04ujVplPaHbmEvs34m+wjgtVtg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@typescript-eslint/project-service": "8.34.0",
|
||||||
|
"@typescript-eslint/tsconfig-utils": "8.34.0",
|
||||||
|
"@typescript-eslint/types": "8.34.0",
|
||||||
|
"@typescript-eslint/visitor-keys": "8.34.0",
|
||||||
|
"debug": "^4.3.4",
|
||||||
|
"fast-glob": "^3.3.2",
|
||||||
|
"is-glob": "^4.0.3",
|
||||||
|
"minimatch": "^9.0.4",
|
||||||
|
"semver": "^7.6.0",
|
||||||
|
"ts-api-utils": "^2.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": ">=4.8.4 <5.9.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"balanced-match": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {
|
||||||
|
"version": "9.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
|
||||||
|
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"brace-expansion": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16 || 14 >=14.17"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/utils": {
|
||||||
|
"version": "8.34.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.34.0.tgz",
|
||||||
|
"integrity": "sha512-8L4tWatGchV9A1cKbjaavS6mwYwp39jql8xUmIIKJdm+qiaeHy5KMKlBrf30akXAWBzn2SqKsNOtSENWUwg7XQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@eslint-community/eslint-utils": "^4.7.0",
|
||||||
|
"@typescript-eslint/scope-manager": "8.34.0",
|
||||||
|
"@typescript-eslint/types": "8.34.0",
|
||||||
|
"@typescript-eslint/typescript-estree": "8.34.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"eslint": "^8.57.0 || ^9.0.0",
|
||||||
|
"typescript": ">=4.8.4 <5.9.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/visitor-keys": {
|
||||||
|
"version": "8.34.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.34.0.tgz",
|
||||||
|
"integrity": "sha512-qHV7pW7E85A0x6qyrFn+O+q1k1p3tQCsqIZ1KZ5ESLXY57aTvUd3/a4rdPTeXisvhXn2VQG0VSKUqs8KHF2zcA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@typescript-eslint/types": "8.34.0",
|
||||||
|
"eslint-visitor-keys": "^4.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": {
|
||||||
|
"version": "4.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
|
||||||
|
"integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://opencollective.com/eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@ungap/structured-clone": {
|
"node_modules/@ungap/structured-clone": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz",
|
||||||
@ -9164,6 +9437,19 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ts-api-utils": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.12"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": ">=4.8.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/tsconfig-paths": {
|
"node_modules/tsconfig-paths": {
|
||||||
"version": "3.15.0",
|
"version": "3.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
|
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
|
||||||
@ -9299,12 +9585,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "5.8.2",
|
"version": "5.8.3",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
|
||||||
"integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==",
|
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
|
|||||||
@ -11,6 +11,8 @@
|
|||||||
"@iconify-json/material-symbols": "^1.2.22",
|
"@iconify-json/material-symbols": "^1.2.22",
|
||||||
"@iconify-json/solar": "^1.2.2",
|
"@iconify-json/solar": "^1.2.2",
|
||||||
"@iconify/utils": "^2.3.0",
|
"@iconify/utils": "^2.3.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^8.34.0",
|
||||||
|
"@typescript-eslint/parser": "^8.34.0",
|
||||||
"@unocss/preset-icons": "^66.1.2",
|
"@unocss/preset-icons": "^66.1.2",
|
||||||
"commitizen": "^4.3.1",
|
"commitizen": "^4.3.1",
|
||||||
"crc": "^4.3.2",
|
"crc": "^4.3.2",
|
||||||
@ -32,15 +34,16 @@
|
|||||||
"stylelint-config-recess-order": "^6.0.0",
|
"stylelint-config-recess-order": "^6.0.0",
|
||||||
"stylelint-config-recommended-scss": "^14.1.0",
|
"stylelint-config-recommended-scss": "^14.1.0",
|
||||||
"stylelint-config-standard": "^37.0.0",
|
"stylelint-config-standard": "^37.0.0",
|
||||||
|
"typescript": "^5.8.3",
|
||||||
"unocss": "^65.4.3",
|
"unocss": "^65.4.3",
|
||||||
"unocss-preset-weapp": "^65.4.1",
|
"unocss-preset-weapp": "^65.4.1",
|
||||||
"vite-plugin-eslint": "^1.8.1"
|
"vite-plugin-eslint": "^1.8.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,vue,json,css,scss}\"",
|
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,vue,uts,json,css,scss}\"",
|
||||||
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,vue,json,css,scss}\"",
|
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,vue,uts,json,css,scss}\"",
|
||||||
"lint": "eslint --fix \"**/*.{js,jsx,ts,tsx,vue}\"",
|
"lint": "eslint --fix \"**/*.{js,jsx,ts,tsx,vue,uts}\"",
|
||||||
"lint:style": "stylelint --fix \"**/*.{css,scss,vue}\"",
|
"lint:style": "stylelint --fix \"**/*.{css,scss,vue}\"",
|
||||||
"lint:all": "npm run format && npm run lint && npm run lint:style"
|
"lint:all": "npm run format && npm run lint && npm run lint:style"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,7 +175,7 @@
|
|||||||
<view
|
<view
|
||||||
v-if="$bluetooth.currentLockInfo.transportType === transportType.TRANSPORT_TENCENT_YUN"
|
v-if="$bluetooth.currentLockInfo.transportType === transportType.TRANSPORT_TENCENT_YUN"
|
||||||
class="menu-main-view"
|
class="menu-main-view"
|
||||||
@click="$basic.routeJump({ name: 'p2pPlayer' })"
|
@click="jumpToPlayer"
|
||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
class="menu-main-image transform-scale-140"
|
class="menu-main-image transform-scale-140"
|
||||||
@ -309,6 +309,10 @@
|
|||||||
await getServeTime()
|
await getServeTime()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const jumpToPlayer = () => {
|
||||||
|
$basic.routeJump({ name: 'p2pPlayer' })
|
||||||
|
}
|
||||||
|
|
||||||
const openDoorOperate = async type => {
|
const openDoorOperate = async type => {
|
||||||
const timestamp = new Date().getTime()
|
const timestamp = new Date().getTime()
|
||||||
if (
|
if (
|
||||||
|
|||||||
@ -42,6 +42,12 @@
|
|||||||
<view v-if="requestFinish" class="mt-4 text-center text-base font-bold text-[#999]">
|
<view v-if="requestFinish" class="mt-4 text-center text-base font-bold text-[#999]">
|
||||||
微信会收到视频通话请求
|
微信会收到视频通话请求
|
||||||
</view>
|
</view>
|
||||||
|
<view
|
||||||
|
class="fixed bottom-120rpx w-400rpx h-88rpx rounded-md leading-88rpx left-1/2 -translate-x-1/2 bg-[#63b8af] text-center text-base font-bold text-[#ffffff]"
|
||||||
|
@click="getTicket"
|
||||||
|
>
|
||||||
|
获取ticket
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -100,6 +106,41 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const getTicket = async () => {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...'
|
||||||
|
})
|
||||||
|
const result = await getInfo()
|
||||||
|
uni.hideLoading()
|
||||||
|
if (result.code === 0) {
|
||||||
|
const ticket = result.data.WXIoTDeviceInfo.SNTicket
|
||||||
|
uni.showModal({
|
||||||
|
title: '票据',
|
||||||
|
content: ticket,
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: '复制',
|
||||||
|
success: ({ confirm }) => {
|
||||||
|
if (confirm) {
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: ticket,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '复制成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: result.message,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const getDeviceVoIPList = async () => {
|
const getDeviceVoIPList = async () => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
wx.getDeviceVoIPList({
|
wx.getDeviceVoIPList({
|
||||||
|
|||||||
@ -1,48 +1,67 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<iot-p2p-player-with-mjpg
|
<view>
|
||||||
v-if="deviceInfo"
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
id="playerRef"
|
<iot-p2p-player-with-mjpg
|
||||||
:deviceInfo="deviceInfo"
|
v-if="deviceInfo"
|
||||||
:xp2pInfo="xp2pInfo"
|
id="playerRef"
|
||||||
:rotate="90"
|
:deviceInfo="deviceInfo"
|
||||||
:muted="isMute"
|
:xp2pInfo="xp2pInfo"
|
||||||
mode="RTC"
|
:rotate="90"
|
||||||
:acceptPlayerEvents="true"
|
:muted="isMute"
|
||||||
soundMode="speaker"
|
mode="RTC"
|
||||||
sceneType="live"
|
:acceptPlayerEvents="true"
|
||||||
:streamQuality="range[index].value"
|
soundMode="speaker"
|
||||||
:minCache="0.2"
|
sceneType="live"
|
||||||
:maxCache="0.8"
|
:streamQuality="range[index].value"
|
||||||
:fill="true"
|
:minCache="0.2"
|
||||||
orientation="horizontal"
|
:maxCache="0.8"
|
||||||
@playsuccess="handlePlaySuccess"
|
:fill="true"
|
||||||
>
|
orientation="horizontal"
|
||||||
</iot-p2p-player-with-mjpg>
|
@playsuccess="handlePlaySuccess"
|
||||||
<view
|
>
|
||||||
v-if="buttonInfo"
|
</iot-p2p-player-with-mjpg>
|
||||||
:style="{
|
<!-- #endif -->
|
||||||
top: buttonInfo.bottom + 15 + 'px'
|
|
||||||
}"
|
<!-- #ifdef APP-PLUS -->
|
||||||
class="bg-[rgba(0,0,0,0.35)] rounded-full px-2 py-1.5 fixed right-32"
|
<video
|
||||||
>
|
autoplay
|
||||||
<picker :value="index" mode="selector" :range="range" range-key="name" @change="changeEvent">
|
id="playerRef"
|
||||||
<up-icon
|
v-if="url"
|
||||||
:label="range[index].name"
|
:muted="isMute"
|
||||||
color="#ffffff"
|
:src="urlPrefix"
|
||||||
label-color="#ffffff"
|
object-fit="cover"
|
||||||
labelPos="left"
|
class="w-[100vw] h-[100vh]"
|
||||||
name="arrow-down-fill"
|
:is-live="true"
|
||||||
size="32rpx"
|
:play-strategy="2"
|
||||||
space="16rpx"
|
:controls="false"
|
||||||
></up-icon>
|
:show-progress="false"
|
||||||
</picker>
|
:show-fullscreen-btn="false"
|
||||||
|
:show-play-btn="false"
|
||||||
|
:enable-progress-gesture="false"
|
||||||
|
:vslide-gesture="true"
|
||||||
|
/>
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
<image
|
<image
|
||||||
v-if="!isVideoLoaded"
|
v-if="!isVideoLoaded"
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/background_monitor.png"
|
src="https://oss-lock.xhjcn.ltd/mp/background_monitor.png"
|
||||||
class="w-full h-full absolute top-0 left-0"
|
class="w-full h-full absolute top-0 left-0"
|
||||||
></image>
|
></image>
|
||||||
|
|
||||||
|
<cover-view
|
||||||
|
v-if="isApp || buttonInfo"
|
||||||
|
:style="{
|
||||||
|
top: isApp ? '60px' : buttonInfo.bottom + 15 + 'px'
|
||||||
|
}"
|
||||||
|
class="bg-[rgba(0,0,0,0.35)] rounded-full px-4 py-1.5 fixed right-32"
|
||||||
|
>
|
||||||
|
<cover-view class="text-white text-xs" @click="showQualitySelector">
|
||||||
|
{{ range[index].name }}
|
||||||
|
</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<iot-p2p-voice
|
<iot-p2p-voice
|
||||||
v-if="deviceInfo"
|
v-if="deviceInfo"
|
||||||
id="voiceComponent"
|
id="voiceComponent"
|
||||||
@ -51,58 +70,94 @@
|
|||||||
voiceType="Pusher"
|
voiceType="Pusher"
|
||||||
>
|
>
|
||||||
</iot-p2p-voice>
|
</iot-p2p-voice>
|
||||||
|
<!-- #endif -->
|
||||||
|
|
||||||
<view
|
<cover-view
|
||||||
v-if="isVideoLoaded"
|
v-if="isVideoLoaded"
|
||||||
class="fixed bottom-[calc(32rpx+env(safe-area-inset-bottom))] bg-[rgba(0,0,0,0.3)] rounded-xl p-4 shadow-lg left-1/2 -translate-x-1/2 w-622"
|
class="fixed bottom-[calc(32rpx+env(safe-area-inset-bottom))] bg-[rgba(0,0,0,0.3)] rounded-xl p-4 shadow-lg left-1/2 -translate-x-1/2 w-622"
|
||||||
>
|
>
|
||||||
<view class="flex items-center justify-around mx-15">
|
<cover-view class="flex items-center justify-around mx-15">
|
||||||
<image
|
<cover-view class="relative">
|
||||||
@click="isMute = !isMute"
|
<cover-image
|
||||||
:src="
|
v-show="isMute"
|
||||||
isMute
|
src="https://oss-lock.xhjcn.ltd/mp/icon_mute.png"
|
||||||
? 'https://oss-lock.xhjcn.ltd/mp/icon_mute.png'
|
:class="isApp ? 'size-48' : 'size-48 p-2'"
|
||||||
: 'https://oss-lock.xhjcn.ltd/mp/icon_not_mute.png'
|
></cover-image>
|
||||||
"
|
<cover-image
|
||||||
class="w-48 h-48 p-2"
|
v-show="!isMute"
|
||||||
></image>
|
src="https://oss-lock.xhjcn.ltd/mp/icon_not_mute.png"
|
||||||
<image
|
:class="isApp ? 'size-48' : 'size-48 p-2'"
|
||||||
@click="handleScreenshot"
|
></cover-image>
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_screenshot.png"
|
<cover-view
|
||||||
class="w-48 h-48 p-2"
|
@click="toggleMute"
|
||||||
></image>
|
class="absolute top-0 left-0 w-full h-full size-48 p-2"
|
||||||
</view>
|
></cover-view>
|
||||||
<view class="flex items-center justify-between text-white mt-2 px-10">
|
</cover-view>
|
||||||
<view class="flex flex-col items-center" @longpress="startVoice" @touchend="stopVoice">
|
<cover-view class="relative">
|
||||||
<view class="bg-white w-80 h-80 rounded-full flex items-center justify-center">
|
<cover-image
|
||||||
<image
|
src="https://oss-lock.xhjcn.ltd/mp/icon_screenshot.png"
|
||||||
|
:class="isApp ? 'size-48' : 'size-48 p-2'"
|
||||||
|
></cover-image>
|
||||||
|
<cover-view
|
||||||
|
@click="handleScreenshot"
|
||||||
|
class="absolute top-0 left-0 w-full h-full"
|
||||||
|
></cover-view>
|
||||||
|
</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
<cover-view class="flex items-center justify-between text-white mt-2 px-10">
|
||||||
|
<cover-view class="flex flex-col items-center">
|
||||||
|
<cover-view
|
||||||
|
class="bg-white w-80 h-80 rounded-full flex items-center justify-center relative"
|
||||||
|
>
|
||||||
|
<cover-image
|
||||||
:src="
|
:src="
|
||||||
isVoice
|
isVoice
|
||||||
? 'https://oss-lock.xhjcn.ltd/mp/icon_microphone.png'
|
? 'https://oss-lock.xhjcn.ltd/mp/icon_microphone.png'
|
||||||
: 'https://oss-lock.xhjcn.ltd/mp/icon_no_microphone.png'
|
: 'https://oss-lock.xhjcn.ltd/mp/icon_no_microphone.png'
|
||||||
"
|
"
|
||||||
class="w-55 h-55"
|
class="w-55 h-55"
|
||||||
></image>
|
></cover-image>
|
||||||
</view>
|
<cover-view
|
||||||
<view class="mt-2 text-center whitespace-nowrap text-xs">长按说话</view>
|
@click="toggleVoice"
|
||||||
</view>
|
class="absolute top-0 left-0 w-full h-full"
|
||||||
<view class="flex flex-col items-center" @click="handleHangUp">
|
></cover-view>
|
||||||
<view class="bg-[#eb292b] w-80 h-80 rounded-full flex items-center justify-center">
|
</cover-view>
|
||||||
<image src="https://oss-lock.xhjcn.ltd/mp/icon_hang_up.png" class="w-60 h-60"></image>
|
<cover-view class="mt-2 text-center whitespace-nowrap text-xs">{{
|
||||||
</view>
|
isVoice ? '点击停止' : '点击说话'
|
||||||
<view class="mt-2 text-center whitespace-nowrap text-xs">挂断</view>
|
}}</cover-view>
|
||||||
</view>
|
</cover-view>
|
||||||
<view class="flex flex-col items-center" @click="handleLock">
|
<cover-view class="flex flex-col items-center">
|
||||||
<view class="bg-[#63b8af] w-80 h-80 rounded-full flex items-center justify-center">
|
<cover-view
|
||||||
<image
|
class="bg-[#eb292b] w-80 h-80 rounded-full flex items-center justify-center relative"
|
||||||
|
>
|
||||||
|
<cover-image
|
||||||
|
src="https://oss-lock.xhjcn.ltd/mp/icon_hang_up.png"
|
||||||
|
class="w-60 h-60"
|
||||||
|
></cover-image>
|
||||||
|
<cover-view
|
||||||
|
@click="handleHangUp"
|
||||||
|
class="absolute top-0 left-0 w-full h-full"
|
||||||
|
></cover-view>
|
||||||
|
</cover-view>
|
||||||
|
<cover-view class="mt-2 text-center whitespace-nowrap text-xs">挂断</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
<cover-view class="flex flex-col items-center">
|
||||||
|
<cover-view
|
||||||
|
class="bg-[#63b8af] w-80 h-80 rounded-full flex items-center justify-center relative"
|
||||||
|
>
|
||||||
|
<cover-image
|
||||||
src="https://oss-lock.xhjcn.ltd/mp/icon_lock_white.png"
|
src="https://oss-lock.xhjcn.ltd/mp/icon_lock_white.png"
|
||||||
class="w-60 h-60"
|
class="w-60 h-60"
|
||||||
></image>
|
></cover-image>
|
||||||
</view>
|
<cover-view
|
||||||
<view class="mt-2 text-center whitespace-nowrap text-xs">开锁</view>
|
@click="handleLock"
|
||||||
</view>
|
class="absolute top-0 left-0 w-full h-full"
|
||||||
</view>
|
></cover-view>
|
||||||
</view>
|
</cover-view>
|
||||||
|
<cover-view class="mt-2 text-center whitespace-nowrap text-xs">开锁</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
</cover-view>
|
||||||
|
</cover-view>
|
||||||
<view
|
<view
|
||||||
v-if="!isVideoLoaded"
|
v-if="!isVideoLoaded"
|
||||||
class="fixed bottom-[calc(48rpx+env(safe-area-inset-bottom))] w-full flex justify-center"
|
class="fixed bottom-[calc(48rpx+env(safe-area-inset-bottom))] w-full flex justify-center"
|
||||||
@ -119,7 +174,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref, computed } from 'vue'
|
||||||
import { onUnload } from '@dcloudio/uni-app'
|
import { onUnload } from '@dcloudio/uni-app'
|
||||||
import { useBluetoothStore } from '@/stores/bluetooth'
|
import { useBluetoothStore } from '@/stores/bluetooth'
|
||||||
import { useBasicStore } from '@/stores/basic'
|
import { useBasicStore } from '@/stores/basic'
|
||||||
@ -131,17 +186,27 @@
|
|||||||
import * as B from './exportForPlayerPlugin'
|
import * as B from './exportForPlayerPlugin'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
import {
|
||||||
|
startService,
|
||||||
|
getLiveUrl,
|
||||||
|
stopService,
|
||||||
|
runSendService,
|
||||||
|
stopSendService,
|
||||||
|
dataSend
|
||||||
|
} from '@/uni_modules/xhj-tencent-xp2p'
|
||||||
|
// #endif
|
||||||
|
|
||||||
const $bluetooth = useBluetoothStore()
|
const $bluetooth = useBluetoothStore()
|
||||||
const $basic = useBasicStore()
|
const $basic = useBasicStore()
|
||||||
const $user = useUserStore()
|
const $user = useUserStore()
|
||||||
const buttonInfo = ref(null)
|
const buttonInfo = ref(null)
|
||||||
|
|
||||||
|
const isApp = ref(false)
|
||||||
|
|
||||||
const onlineToken = ref('0')
|
const onlineToken = ref('0')
|
||||||
|
|
||||||
const lockId = ref()
|
const lockId = ref()
|
||||||
|
|
||||||
const time = ref(0)
|
const time = ref(0)
|
||||||
|
|
||||||
const pending = ref(false)
|
const pending = ref(false)
|
||||||
|
|
||||||
const index = ref(1)
|
const index = ref(1)
|
||||||
@ -153,13 +218,22 @@
|
|||||||
|
|
||||||
const deviceInfo = ref()
|
const deviceInfo = ref()
|
||||||
const xp2pInfo = ref()
|
const xp2pInfo = ref()
|
||||||
|
const url = ref()
|
||||||
const isVoice = ref(false)
|
const isVoice = ref(false)
|
||||||
|
|
||||||
const isMute = ref(false)
|
const isMute = ref(false)
|
||||||
const isVideoLoaded = ref(false)
|
const isVideoLoaded = ref(false)
|
||||||
|
|
||||||
|
const urlPrefix = computed(() => {
|
||||||
|
return url.value + `ipc.flv?action=live&channel=0&quality=${range.value[index.value].value}`
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
isApp.value = true
|
||||||
|
// 初始化录音管理器
|
||||||
|
initRecorder()
|
||||||
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
console.log(A, B)
|
console.log(A, B)
|
||||||
// #endif
|
// #endif
|
||||||
@ -173,6 +247,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
deviceInfo.value = {
|
deviceInfo.value = {
|
||||||
deviceId: `${data.productId}/${data.deviceName}`,
|
deviceId: `${data.productId}/${data.deviceName}`,
|
||||||
@ -183,23 +258,76 @@
|
|||||||
} else {
|
} else {
|
||||||
$basic.backAndToast(message)
|
$basic.backAndToast(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
await getServeTime()
|
await getServeTime()
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (code === 0) {
|
||||||
|
deviceInfo.value = data
|
||||||
|
const result = await startService({
|
||||||
|
appKey: 'aanuJXFtISXFYVVsd',
|
||||||
|
appSecret: 'SsnOMHJUcazCvpULSVWY',
|
||||||
|
productId: deviceInfo.value.productId,
|
||||||
|
deviceName: deviceInfo.value.deviceName,
|
||||||
|
xp2pInfo: deviceInfo.value.xp2pInfo
|
||||||
|
})
|
||||||
|
if (result.code === 0) {
|
||||||
|
setTimeout(async () => {
|
||||||
|
const urlResult = await getLiveUrl({
|
||||||
|
id: `${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`
|
||||||
|
})
|
||||||
|
if (urlResult.code === 0) {
|
||||||
|
url.value = urlResult.data.url
|
||||||
|
runSendService(
|
||||||
|
`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`,
|
||||||
|
'channel=0',
|
||||||
|
true
|
||||||
|
)
|
||||||
|
handlePlaySuccess()
|
||||||
|
} else {
|
||||||
|
$basic.backAndToast(message)
|
||||||
|
}
|
||||||
|
}, 200)
|
||||||
|
} else {
|
||||||
|
$basic.backAndToast(message)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$basic.backAndToast(message)
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnload(() => {
|
onUnload(() => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
// 停止录音
|
||||||
|
if (isVoice.value && recorderManager.value) {
|
||||||
|
stopRecording()
|
||||||
|
}
|
||||||
|
|
||||||
|
stopSendService(`${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`)
|
||||||
|
stopService({
|
||||||
|
id: `${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
const page = getCurrentPages().pop()
|
const page = getCurrentPages().pop()
|
||||||
const player = page.selectComponent('#playerRef')
|
const player = page.selectComponent('#playerRef')
|
||||||
if (player.stopAll) {
|
if (player.stopAll) {
|
||||||
player.stopAll()
|
player.stopAll()
|
||||||
}
|
}
|
||||||
|
// #endif
|
||||||
})
|
})
|
||||||
|
|
||||||
const changeEvent = e => {
|
const showQualitySelector = () => {
|
||||||
index.value = e.detail.value
|
uni.showActionSheet({
|
||||||
|
itemList: range.value.map(item => item.name),
|
||||||
|
success: res => {
|
||||||
|
index.value = res.tapIndex
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleScreenshot = () => {
|
const handleScreenshot = () => {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
const page = getCurrentPages().pop()
|
const page = getCurrentPages().pop()
|
||||||
const player = page.selectComponent('#playerRef')
|
const player = page.selectComponent('#playerRef')
|
||||||
|
|
||||||
@ -220,14 +348,26 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content:
|
||||||
|
'由于技术限制,APP端无法直接截取视频画面。请使用手机系统截图功能:\n\niOS:同时按下电源键+音量上键\nAndroid:同时按下电源键+音量下键',
|
||||||
|
confirmText: '我知道了',
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleHangUp = () => {
|
const handleHangUp = () => {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
const page = getCurrentPages().pop()
|
const page = getCurrentPages().pop()
|
||||||
const player = page.selectComponent('#playerRef')
|
const player = page.selectComponent('#playerRef')
|
||||||
if (player.stopAll) {
|
if (player.stopAll) {
|
||||||
player.stopAll()
|
player.stopAll()
|
||||||
}
|
}
|
||||||
|
// #endif
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,24 +480,144 @@
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const startVoice = () => {
|
// #ifdef APP-PLUS
|
||||||
uni.vibrateLong()
|
const recorderManager = ref(null)
|
||||||
isVoice.value = true
|
const recordingFilePath = ref('')
|
||||||
const page = getCurrentPages().pop()
|
// #endif
|
||||||
const voice = page.selectComponent('#voiceComponent')
|
|
||||||
voice.startVoice()
|
const convertAudioFileToUint8Array = filePath => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
try {
|
||||||
|
plus.io.resolveLocalFileSystemURL(filePath, entry => {
|
||||||
|
entry.file(
|
||||||
|
file => {
|
||||||
|
console.log(11111, file)
|
||||||
|
if (file.size === 0) return
|
||||||
|
|
||||||
|
const fileReader = new plus.io.FileReader()
|
||||||
|
|
||||||
|
fileReader.onloadend = async evt => {
|
||||||
|
try {
|
||||||
|
console.log(evt)
|
||||||
|
const base64 = evt.target.result.split(',')[1]
|
||||||
|
|
||||||
|
const binaryString = atob(base64)
|
||||||
|
const byteArray = []
|
||||||
|
|
||||||
|
for (let i = 0; i < binaryString.length; i++) {
|
||||||
|
byteArray[i] = binaryString.charCodeAt(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
const id = `${deviceInfo.value.productId}/${deviceInfo.value.deviceName}`
|
||||||
|
|
||||||
|
await dataSend(id, byteArray)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('音频数据转换失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileReader.onerror = () => {
|
||||||
|
console.error('音频文件读取失败')
|
||||||
|
}
|
||||||
|
|
||||||
|
fileReader.readAsDataURL(file)
|
||||||
|
},
|
||||||
|
error => console.error('获取文件对象失败:', error)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.error('音频文件处理异常:', error)
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const stopVoice = () => {
|
const initRecorder = () => {
|
||||||
isVoice.value = false
|
// #ifdef APP-PLUS
|
||||||
const page = getCurrentPages().pop()
|
recorderManager.value = uni.getRecorderManager()
|
||||||
const voice = page.selectComponent('#voiceComponent')
|
|
||||||
voice.stopVoice()
|
recorderManager.value.onStart(() => {
|
||||||
|
console.log('录音开始')
|
||||||
|
})
|
||||||
|
|
||||||
|
recorderManager.value.onError(error => {
|
||||||
|
console.error('录音出错:', error)
|
||||||
|
})
|
||||||
|
|
||||||
|
recorderManager.value.onStop(res => {
|
||||||
|
console.log('录音结束:', res)
|
||||||
|
recordingFilePath.value = res.tempFilePath
|
||||||
|
|
||||||
|
convertAudioFileToUint8Array(res.tempFilePath)
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始录音
|
||||||
|
const startRecording = () => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (!recorderManager.value) {
|
||||||
|
initRecorder()
|
||||||
|
}
|
||||||
|
|
||||||
|
recorderManager.value.start({
|
||||||
|
duration: 60000,
|
||||||
|
sampleRate: 16000,
|
||||||
|
format: 'aac'
|
||||||
|
})
|
||||||
|
console.log('开始录音')
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// 停止录音
|
||||||
|
const stopRecording = () => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (recorderManager.value) {
|
||||||
|
recorderManager.value.stop()
|
||||||
|
console.log('停止录音')
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
const toggleVoice = () => {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
if (isVoice.value) {
|
||||||
|
isVoice.value = false
|
||||||
|
const page = getCurrentPages().pop()
|
||||||
|
const voice = page.selectComponent('#voiceComponent')
|
||||||
|
if (voice) {
|
||||||
|
voice.stopVoice()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.vibrateLong()
|
||||||
|
isVoice.value = true
|
||||||
|
const page = getCurrentPages().pop()
|
||||||
|
const voice = page.selectComponent('#voiceComponent')
|
||||||
|
if (voice) {
|
||||||
|
voice.startVoice()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (isVoice.value) {
|
||||||
|
isVoice.value = false
|
||||||
|
|
||||||
|
stopRecording()
|
||||||
|
} else {
|
||||||
|
uni.vibrateLong()
|
||||||
|
isVoice.value = true
|
||||||
|
// 初始化并开始录音
|
||||||
|
startRecording()
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePlaySuccess = () => {
|
const handlePlaySuccess = () => {
|
||||||
isVideoLoaded.value = true
|
isVideoLoaded.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const toggleMute = () => {
|
||||||
|
isMute.value = !isMute.value
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -21,7 +21,12 @@
|
|||||||
>
|
>
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
<view class="w-80 h-full flex items-center justify-center">
|
<view class="w-80 h-full flex items-center justify-center">
|
||||||
<up-icon v-if="isAllDay === 0" name="checkbox-mark" color="#2a85ec" size="40rpx"></up-icon>
|
<up-icon
|
||||||
|
v-if="isAllDay === 0"
|
||||||
|
name="checkbox-mark"
|
||||||
|
color="#2a85ec"
|
||||||
|
size="40rpx"
|
||||||
|
></up-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-1">
|
<view class="flex-1">
|
||||||
<view class="text-lg font-bold" :class="[isAllDay === 0 ? 'text-#2a85ec' : 'text-black']">
|
<view class="text-lg font-bold" :class="[isAllDay === 0 ? 'text-#2a85ec' : 'text-black']">
|
||||||
|
|||||||
16
tsconfig.json
Normal file
16
tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"strict": false,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"moduleResolution": "bundler"
|
||||||
|
},
|
||||||
|
"include": ["**/*.vue", "**/*.js", "**/*.uts", "uni_modules/**/*.uts"],
|
||||||
|
"exclude": ["node_modules", "unpackage", "dist"]
|
||||||
|
}
|
||||||
0
uni_modules/xhj-tencent-xp2p/changelog.md
Normal file
0
uni_modules/xhj-tencent-xp2p/changelog.md
Normal file
72
uni_modules/xhj-tencent-xp2p/package.json
Normal file
72
uni_modules/xhj-tencent-xp2p/package.json
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"id": "xhj-tencent-xp2p",
|
||||||
|
"displayName": "xhj-tencent-xp2p",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "xhj-tencent-xp2p",
|
||||||
|
"keywords": [
|
||||||
|
"xhj-tencent-xp2p"
|
||||||
|
],
|
||||||
|
"repository": "",
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": "^3.6.8"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"type": "uts",
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "",
|
||||||
|
"data": "",
|
||||||
|
"permissions": ""
|
||||||
|
},
|
||||||
|
"npmurl": ""
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "u",
|
||||||
|
"aliyun": "u",
|
||||||
|
"alipay": "u"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "u",
|
||||||
|
"vue3": "u"
|
||||||
|
},
|
||||||
|
"App": {
|
||||||
|
"app-android": "u",
|
||||||
|
"app-ios": "u",
|
||||||
|
"app-harmony": "u"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "u",
|
||||||
|
"Android Browser": "u",
|
||||||
|
"微信浏览器(Android)": "u",
|
||||||
|
"QQ浏览器(Android)": "u"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "u",
|
||||||
|
"IE": "u",
|
||||||
|
"Edge": "u",
|
||||||
|
"Firefox": "u",
|
||||||
|
"Safari": "u"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "u",
|
||||||
|
"联盟": "u"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
uni_modules/xhj-tencent-xp2p/readme.md
Normal file
7
uni_modules/xhj-tencent-xp2p/readme.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# xhj-tencent-xp2p
|
||||||
|
### 开发文档
|
||||||
|
[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html)
|
||||||
|
[UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html)
|
||||||
|
[UTS uni-app兼容模式组件](https://uniapp.dcloud.net.cn/plugin/uts-component.html)
|
||||||
|
[UTS 标准模式组件](https://doc.dcloud.net.cn/uni-app-x/plugin/uts-vue-component.html)
|
||||||
|
[Hello UTS](https://gitcode.net/dcloud/hello-uts)
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"minSdkVersion": "21",
|
||||||
|
"dependencies": ["com.tencent.iot.thirdparty.android:xp2p-sdk:2.4.54"]
|
||||||
|
}
|
||||||
160
uni_modules/xhj-tencent-xp2p/utssdk/app-android/index.uts
Normal file
160
uni_modules/xhj-tencent-xp2p/utssdk/app-android/index.uts
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
import { UTSAndroid } from 'io.dcloud.uts'
|
||||||
|
import { XP2PAppConfig, XP2P } from 'com.tencent.xnet'
|
||||||
|
import { Result, InitParams, IdParams } from '../interface.uts'
|
||||||
|
|
||||||
|
export const startService = async function (params: InitParams): Promise<Result> {
|
||||||
|
try {
|
||||||
|
const context = UTSAndroid.getAppContext()
|
||||||
|
|
||||||
|
let xp2pConfig: XP2PAppConfig = new XP2PAppConfig()
|
||||||
|
|
||||||
|
xp2pConfig.appKey = params.appKey
|
||||||
|
xp2pConfig.appSecret = params.appSecret
|
||||||
|
|
||||||
|
await XP2P.startService(
|
||||||
|
context,
|
||||||
|
params.productId,
|
||||||
|
params.deviceName,
|
||||||
|
params.xp2pInfo,
|
||||||
|
xp2pConfig
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
code: 0,
|
||||||
|
data: {},
|
||||||
|
message: '成功'
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
code: -1,
|
||||||
|
data: {},
|
||||||
|
message: error.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getLiveUrl = async function (params: IdParams): Promise<Result> {
|
||||||
|
try {
|
||||||
|
const liveUrl = await XP2P.delegateHttpFlv(params.id)
|
||||||
|
|
||||||
|
return {
|
||||||
|
code: 0,
|
||||||
|
data: {
|
||||||
|
url: liveUrl
|
||||||
|
},
|
||||||
|
message: '成功'
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
code: -1,
|
||||||
|
data: {},
|
||||||
|
message: error.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const stopService = async function (params: IdParams): Promise<Result> {
|
||||||
|
try {
|
||||||
|
await XP2P.stopService(params.id)
|
||||||
|
return {
|
||||||
|
code: 0,
|
||||||
|
data: {},
|
||||||
|
message: '成功'
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
code: -1,
|
||||||
|
data: {},
|
||||||
|
message: error.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// export const setCallback = function (callback: XP2PCallback) {
|
||||||
|
// try {
|
||||||
|
// XP2P.setCallback(callback)
|
||||||
|
// } catch (error) {
|
||||||
|
// console.log(2, error)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
export const runSendService = async function (
|
||||||
|
id: string,
|
||||||
|
cmd: string,
|
||||||
|
crypto: boolean
|
||||||
|
): Promise<Result> {
|
||||||
|
try {
|
||||||
|
await XP2P.runSendService(id, cmd, crypto)
|
||||||
|
console.log('开始发送服务')
|
||||||
|
return {
|
||||||
|
code: 0,
|
||||||
|
data: {},
|
||||||
|
message: '成功'
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
code: -1,
|
||||||
|
data: {},
|
||||||
|
message: error.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const stopSendService = async function (id: string): Promise<Result> {
|
||||||
|
try {
|
||||||
|
await XP2P.stopSendService(id, null)
|
||||||
|
console.log('停止发送服务')
|
||||||
|
return {
|
||||||
|
code: 0,
|
||||||
|
data: {},
|
||||||
|
message: '成功'
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
code: -1,
|
||||||
|
data: {},
|
||||||
|
message: error.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const dataSend = async function (id: string, data: Array<number>): Promise<Result> {
|
||||||
|
try {
|
||||||
|
let byteTest = new ByteArray(data.length.toInt())
|
||||||
|
// byteTest.set(0, (0xff).toByte())
|
||||||
|
// byteTest.set(1, (0xf9).toByte())
|
||||||
|
|
||||||
|
// let profile = 2
|
||||||
|
// let freqIdx = 8
|
||||||
|
// let chanCfg = 1
|
||||||
|
// let packetLen = data.length + 7
|
||||||
|
|
||||||
|
// byteTest.set(2, (((profile - 1) << 6) + (freqIdx << 2) + (chanCfg >> 2)).toByte())
|
||||||
|
// byteTest.set(3, (((chanCfg & 3) << 6) + (packetLen >> 11)).toByte())
|
||||||
|
// byteTest.set(4, ((packetLen & 0x7ff) >> 3).toByte())
|
||||||
|
// byteTest.set(5, (((packetLen & 7) << 5) + 0x1f).toByte())
|
||||||
|
// byteTest.set(6, (0xfc).toByte())
|
||||||
|
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
byteTest.set(i.toInt(), data[i].toByte())
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(byteTest)
|
||||||
|
console.log(1, id, byteTest[0], byteTest[1], data.length.toInt())
|
||||||
|
|
||||||
|
const result = await XP2P.dataSend(id, byteTest, data.length.toInt())
|
||||||
|
|
||||||
|
console.log('发送数据', result)
|
||||||
|
|
||||||
|
return {
|
||||||
|
code: 0,
|
||||||
|
data: {},
|
||||||
|
message: '成功'
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return {
|
||||||
|
code: -1,
|
||||||
|
data: {},
|
||||||
|
message: error.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17
uni_modules/xhj-tencent-xp2p/utssdk/interface.uts
Normal file
17
uni_modules/xhj-tencent-xp2p/utssdk/interface.uts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
export type Result = {
|
||||||
|
code: number
|
||||||
|
data: object
|
||||||
|
message: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type InitParams = {
|
||||||
|
appKey: string
|
||||||
|
appSecret: string
|
||||||
|
productId: string
|
||||||
|
deviceName: string
|
||||||
|
xp2pInfo: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type IdParams = {
|
||||||
|
id: string
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user