diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 457d7c5..37c8fbb 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -30,6 +30,38 @@ module.exports = { 'plugin:prettier/recommended' ], 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 ==> 关闭规则 * "warn" 或 1 ==> 打开的规则作为警告(不影响代码执行) diff --git a/App.vue b/App.vue index 2bfcb22..04a7a20 100644 --- a/App.vue +++ b/App.vue @@ -31,7 +31,7 @@ return 'XHJ' } // #endif - return 'XHJ' + return 'DEV' } }, computed: { diff --git a/jsconfig.json b/jsconfig.json index eb0cdc9..8a31a45 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -2,9 +2,7 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "@/*": [ - "./*" - ] + "@/*": ["./*"] }, "target": "es2020", "module": "esnext", @@ -15,14 +13,6 @@ "strict": true, "skipLibCheck": true }, - "include": [ - "**/*.js", - "**/*.jsx", - "**/*.vue" - ], - "exclude": [ - "node_modules", - "unpackage", - "dist" - ] -} \ No newline at end of file + "include": ["**/*.js", "**/*.jsx", "**/*.vue", "pages/p2p/p2pPlayer.nvue"], + "exclude": ["node_modules", "unpackage", "dist"] +} diff --git a/manifest.json b/manifest.json index fff662f..3afe025 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,6 @@ "desc" : "蓝牙将用于控制和管理您的智能门锁" } }, - "requiredPrivateInfos" : [ "getLocation" ], "usingComponents" : true, "lazyCodeLoading" : "requiredComponents", "optimization" : { @@ -90,7 +89,10 @@ "", "", "", - "" + "", + "", + "", + "" ], "targetSdkVersion" : 34, "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ] @@ -100,7 +102,11 @@ } }, "modules" : { - "Bluetooth" : {} + "Bluetooth" : {}, + "VideoPlayer" : {}, + "LivePusher" : {}, + "Camera" : {}, + "Record" : {} }, "splashscreen" : { "waiting" : false diff --git a/package-lock.json b/package-lock.json index c5dbe72..52e2014 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,8 @@ "@iconify-json/material-symbols": "^1.2.22", "@iconify-json/solar": "^1.2.2", "@iconify/utils": "^2.3.0", + "@typescript-eslint/eslint-plugin": "^8.34.0", + "@typescript-eslint/parser": "^8.34.0", "@unocss/preset-icons": "^66.1.2", "commitizen": "^4.3.1", "crc": "^4.3.2", @@ -37,6 +39,7 @@ "stylelint-config-recess-order": "^6.0.0", "stylelint-config-recommended-scss": "^14.1.0", "stylelint-config-standard": "^37.0.0", + "typescript": "^5.8.3", "unocss": "^65.4.3", "unocss-preset-weapp": "^65.4.1", "vite-plugin-eslint": "^1.8.1" @@ -930,9 +933,9 @@ } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.5.1.tgz", - "integrity": "sha512-soEIOALTfTK6EjmKMMoLugwaP0rzkad90iIWd1hMO9ARkSAyjfMfkRRhLvD5qH7vvM0Cg72pieUfR6yh6XxC4w==", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", + "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", "dev": true, "license": "MIT", "dependencies": { @@ -1639,6 +1642,276 @@ "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": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", @@ -9164,6 +9437,19 @@ "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": { "version": "3.15.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", @@ -9299,12 +9585,11 @@ } }, "node_modules/typescript": { - "version": "5.8.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz", - "integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==", + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "devOptional": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index e055ba6..a6b80ef 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,8 @@ "@iconify-json/material-symbols": "^1.2.22", "@iconify-json/solar": "^1.2.2", "@iconify/utils": "^2.3.0", + "@typescript-eslint/eslint-plugin": "^8.34.0", + "@typescript-eslint/parser": "^8.34.0", "@unocss/preset-icons": "^66.1.2", "commitizen": "^4.3.1", "crc": "^4.3.2", @@ -32,15 +34,16 @@ "stylelint-config-recess-order": "^6.0.0", "stylelint-config-recommended-scss": "^14.1.0", "stylelint-config-standard": "^37.0.0", + "typescript": "^5.8.3", "unocss": "^65.4.3", "unocss-preset-weapp": "^65.4.1", "vite-plugin-eslint": "^1.8.1" }, "scripts": { "prepare": "husky install", - "format": "prettier --write \"**/*.{js,jsx,ts,tsx,vue,json,css,scss}\"", - "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,vue,json,css,scss}\"", - "lint": "eslint --fix \"**/*.{js,jsx,ts,tsx,vue}\"", + "format": "prettier --write \"**/*.{js,jsx,ts,tsx,vue,uts,json,css,scss}\"", + "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,vue,uts,json,css,scss}\"", + "lint": "eslint --fix \"**/*.{js,jsx,ts,tsx,vue,uts}\"", "lint:style": "stylelint --fix \"**/*.{css,scss,vue}\"", "lint:all": "npm run format && npm run lint && npm run lint:style" } diff --git a/pages/main/lockDetail.vue b/pages/main/lockDetail.vue index 2b85cb3..bd4ee91 100644 --- a/pages/main/lockDetail.vue +++ b/pages/main/lockDetail.vue @@ -175,7 +175,7 @@ { + $basic.routeJump({ name: 'p2pPlayer' }) + } + const openDoorOperate = async type => { const timestamp = new Date().getTime() if ( diff --git a/pages/p2p/authorizeWechat.vue b/pages/p2p/authorizeWechat.vue index 4068106..b9de33e 100644 --- a/pages/p2p/authorizeWechat.vue +++ b/pages/p2p/authorizeWechat.vue @@ -42,6 +42,12 @@ 微信会收到视频通话请求 + + 获取ticket + @@ -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 () => { return new Promise(resolve => { wx.getDeviceVoIPList({ diff --git a/pages/p2p/p2pPlayer.vue b/pages/p2p/p2pPlayer.vue index 12f1afb..03df80b 100644 --- a/pages/p2p/p2pPlayer.vue +++ b/pages/p2p/p2pPlayer.vue @@ -1,48 +1,67 @@