设备信息

This commit is contained in:
shikong 2024-10-17 12:45:37 +08:00
parent c1f5d7fbd3
commit 20f7f5a433
Signed by: Shikong
GPG Key ID: BD85FF18B373C341
11 changed files with 245 additions and 84 deletions

View File

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="cn.fjdmy.uniapp.UniappProjectDataService"> <component name="cn.fjdmy.uniapp.UniappProjectDataService">
<option name="basePath" value="$PROJECT_DIR$" /> <option name="basePath" value="$PROJECT_DIR$/src" />
<option name="generalBasePath" value="$PROJECT_DIR$" /> <option name="generalBasePath" value="$PROJECT_DIR$" />
<option name="manifestPath" value="$PROJECT_DIR$/manifest.json" /> <option name="manifestPath" value="$PROJECT_DIR$/src/manifest.json" />
<option name="pagesPath" value="$PROJECT_DIR$/pages.json" /> <option name="pagesPath" value="$PROJECT_DIR$/src/pages.json" />
<option name="scanNum" value="1" /> <option name="scanNum" value="1" />
<option name="type" value="store" /> <option name="type" value="store" />
<option name="uniapp" value="true" /> <option name="uniapp" value="true" />
<option name="uniappCli" value="true" />
<option name="vueVersion" value="3" /> <option name="vueVersion" value="3" />
</component> </component>
</project> </project>

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="graalvm-17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="graalvm-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />

View File

@ -74,6 +74,9 @@
"@dcloudio/vite-plugin-uni": "3.0.0-4020920240930001", "@dcloudio/vite-plugin-uni": "3.0.0-4020920240930001",
"@uni-helper/uni-app-types": "1.0.0-alpha.4", "@uni-helper/uni-app-types": "1.0.0-alpha.4",
"@uni-helper/uni-ui-types": "1.0.0-alpha.4", "@uni-helper/uni-ui-types": "1.0.0-alpha.4",
"@vicons/ionicons5": "^0.12.0",
"@vicons/material": "^0.12.0",
"@vicons/utils": "^0.1.4",
"@vue/runtime-core": "^3.4.21", "@vue/runtime-core": "^3.4.21",
"sass": "^1.79.5", "sass": "^1.79.5",
"sass-loader": "10.1.1", "sass-loader": "10.1.1",

View File

@ -99,6 +99,15 @@ importers:
'@uni-helper/uni-ui-types': '@uni-helper/uni-ui-types':
specifier: 1.0.0-alpha.4 specifier: 1.0.0-alpha.4
version: 1.0.0-alpha.4(@uni-helper/uni-app-types@1.0.0-alpha.4(typescript@5.6.3)(vue@3.5.12(typescript@5.6.3)))(typescript@5.6.3)(vue@3.5.12(typescript@5.6.3)) version: 1.0.0-alpha.4(@uni-helper/uni-app-types@1.0.0-alpha.4(typescript@5.6.3)(vue@3.5.12(typescript@5.6.3)))(typescript@5.6.3)(vue@3.5.12(typescript@5.6.3))
'@vicons/ionicons5':
specifier: ^0.12.0
version: 0.12.0
'@vicons/material':
specifier: ^0.12.0
version: 0.12.0
'@vicons/utils':
specifier: ^0.1.4
version: 0.1.4(vue@3.5.12(typescript@5.6.3))
'@vue/runtime-core': '@vue/runtime-core':
specifier: ^3.4.21 specifier: ^3.4.21
version: 3.5.12 version: 3.5.12
@ -825,6 +834,9 @@ packages:
peerDependencies: peerDependencies:
vite: ^5.2.8 vite: ^5.2.8
'@emotion/hash@0.8.0':
resolution: {integrity: sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==}
'@esbuild/aix-ppc64@0.20.2': '@esbuild/aix-ppc64@0.20.2':
resolution: {integrity: sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==} resolution: {integrity: sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==}
engines: {node: '>=12'} engines: {node: '>=12'}
@ -1494,6 +1506,9 @@ packages:
'@types/json-schema@7.0.15': '@types/json-schema@7.0.15':
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
'@types/node@14.14.45':
resolution: {integrity: sha512-DssMqTV9UnnoxDWu959sDLZzfvqCF0qDNRjaWeYSui9xkFe61kKo4l1TWNTQONpuXEm+gLMRvdlzvNHBamzmEw==}
'@types/node@22.7.5': '@types/node@22.7.5':
resolution: {integrity: sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==} resolution: {integrity: sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==}
@ -1524,6 +1539,17 @@ packages:
typescript: ^5.0.0 typescript: ^5.0.0
vue: ^3.0.0 vue: ^3.0.0
'@vicons/ionicons5@0.12.0':
resolution: {integrity: sha512-Iy1EUVRpX0WWxeu1VIReR1zsZLMc4fqpt223czR+Rpnrwu7pt46nbnC2ycO7ItI/uqDLJxnbcMC7FujKs9IfFA==}
'@vicons/material@0.12.0':
resolution: {integrity: sha512-chv1CYAl8P32P3Ycwgd5+vw/OFNc2mtkKdb1Rw4T5IJmKy6GVDsoUKV3N2l208HATn7CCQphZtuPDdsm7K2kmA==}
'@vicons/utils@0.1.4':
resolution: {integrity: sha512-OHI19qVNN6i+uPQ+Y3f2s0dUxwsYnOCcKBW7XOU4yXXO1aU3ZoKpblCc3+4N0qmgoJs5rWKRAaMisipqEXJwAg==}
peerDependencies:
vue: ^3.0.6
'@vitejs/plugin-legacy@5.3.2': '@vitejs/plugin-legacy@5.3.2':
resolution: {integrity: sha512-8moCOrIMaZ/Rjln0Q6GsH6s8fAt1JOI3k8nmfX4tXUxE5KAExVctSyOBk+A25GClsdSWqIk2yaUthH3KJ2X4tg==} resolution: {integrity: sha512-8moCOrIMaZ/Rjln0Q6GsH6s8fAt1JOI3k8nmfX4tXUxE5KAExVctSyOBk+A25GClsdSWqIk2yaUthH3KJ2X4tg==}
engines: {node: ^18.0.0 || >=20.0.0} engines: {node: ^18.0.0 || >=20.0.0}
@ -1662,6 +1688,9 @@ packages:
'@webassemblyjs/wast-printer@1.12.1': '@webassemblyjs/wast-printer@1.12.1':
resolution: {integrity: sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==} resolution: {integrity: sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA==}
'@xicons/utils@0.1.4':
resolution: {integrity: sha512-uXxKDLz9abr80yJC05XSTq6wlyFcdW+N/1IYJkeHjzzXVc4VQ0sEYMoMMTjAH7HQBOyOkzOB4pf5NGF72lwa8Q==}
'@xtuc/ieee754@1.2.0': '@xtuc/ieee754@1.2.0':
resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==}
@ -2039,6 +2068,9 @@ packages:
css-list-helpers@2.0.0: css-list-helpers@2.0.0:
resolution: {integrity: sha512-9Bj8tZ0jWbAM3u/U6m/boAzAwLPwtjzFvwivr2piSvyVa3K3rChJzQy4RIHkNkKiZCHrEMWDJWtTR8UyVhdDnQ==} resolution: {integrity: sha512-9Bj8tZ0jWbAM3u/U6m/boAzAwLPwtjzFvwivr2piSvyVa3K3rChJzQy4RIHkNkKiZCHrEMWDJWtTR8UyVhdDnQ==}
css-render@0.13.9:
resolution: {integrity: sha512-n3C4ZH59rveBrUlAD7n0Ze9/gUMKa4dlH1C9CWKpGcIHR/xRcIVXzBGy1iw8WWq2ySmn2/ZqOpySQNAK5Pb6sw==}
css-system-font-keywords@1.0.0: css-system-font-keywords@1.0.0:
resolution: {integrity: sha512-1umTtVd/fXS25ftfjB71eASCrYhilmEsvDEI6wG/QplnmlfmVM5HkZ/ZX46DT5K3eblFPgLUHt5BRCb0YXkSFA==} resolution: {integrity: sha512-1umTtVd/fXS25ftfjB71eASCrYhilmEsvDEI6wG/QplnmlfmVM5HkZ/ZX46DT5K3eblFPgLUHt5BRCb0YXkSFA==}
@ -2057,6 +2089,9 @@ packages:
resolution: {integrity: sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==} resolution: {integrity: sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==}
engines: {node: '>=8'} engines: {node: '>=8'}
csstype@3.0.11:
resolution: {integrity: sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==}
csstype@3.1.3: csstype@3.1.3:
resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}
@ -5353,6 +5388,8 @@ snapshots:
- vue - vue
- webpack-sources - webpack-sources
'@emotion/hash@0.8.0': {}
'@esbuild/aix-ppc64@0.20.2': '@esbuild/aix-ppc64@0.20.2':
optional: true optional: true
@ -6153,6 +6190,8 @@ snapshots:
'@types/json-schema@7.0.15': {} '@types/json-schema@7.0.15': {}
'@types/node@14.14.45': {}
'@types/node@22.7.5': '@types/node@22.7.5':
dependencies: dependencies:
undici-types: 6.19.8 undici-types: 6.19.8
@ -6178,6 +6217,15 @@ snapshots:
typescript: 5.6.3 typescript: 5.6.3
vue: 3.5.12(typescript@5.6.3) vue: 3.5.12(typescript@5.6.3)
'@vicons/ionicons5@0.12.0': {}
'@vicons/material@0.12.0': {}
'@vicons/utils@0.1.4(vue@3.5.12(typescript@5.6.3))':
dependencies:
'@xicons/utils': 0.1.4
vue: 3.5.12(typescript@5.6.3)
'@vitejs/plugin-legacy@5.3.2(terser@5.34.1)(vite@5.2.8(@types/node@22.7.5)(sass@1.79.5)(terser@5.34.1))': '@vitejs/plugin-legacy@5.3.2(terser@5.34.1)(vite@5.2.8(@types/node@22.7.5)(sass@1.79.5)(terser@5.34.1))':
dependencies: dependencies:
'@babel/core': 7.25.8 '@babel/core': 7.25.8
@ -6410,6 +6458,10 @@ snapshots:
'@webassemblyjs/ast': 1.12.1 '@webassemblyjs/ast': 1.12.1
'@xtuc/long': 4.2.2 '@xtuc/long': 4.2.2
'@xicons/utils@0.1.4':
dependencies:
css-render: 0.13.9
'@xtuc/ieee754@1.2.0': {} '@xtuc/ieee754@1.2.0': {}
'@xtuc/long@4.2.2': {} '@xtuc/long@4.2.2': {}
@ -6814,6 +6866,12 @@ snapshots:
css-list-helpers@2.0.0: {} css-list-helpers@2.0.0: {}
css-render@0.13.9:
dependencies:
'@emotion/hash': 0.8.0
'@types/node': 14.14.45
csstype: 3.0.11
css-system-font-keywords@1.0.0: {} css-system-font-keywords@1.0.0: {}
cssesc@3.0.0: {} cssesc@3.0.0: {}
@ -6826,6 +6884,8 @@ snapshots:
dependencies: dependencies:
cssom: 0.3.8 cssom: 0.3.8
csstype@3.0.11: {}
csstype@3.1.3: {} csstype@3.1.3: {}
data-urls@2.0.0: data-urls@2.0.0:

View File

@ -12,7 +12,9 @@ export default {
} }
</script> </script>
<style> <style lang="scss">
@import '@dcloudio/uni-ui/lib/uni-scss/index.scss';
/*每个页面公共css */ /*每个页面公共css */
button { button {

View File

@ -1,80 +1,94 @@
{ {
"easycom": { "easycom": {
"autoscan": true, "autoscan": true,
"custom": { "custom": {
// uni-ui // uni-ui
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue" "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
} }
}, },
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages "pages": [
{ //pageshttps://uniapp.dcloud.io/collocation/pages
"path": "pages/index/index", {
"style": { "path": "pages/index/index",
"navigationBarTitleText": "首页", "style": {
"navigationStyle": "custom" "navigationBarTitleText": "首页",
} "navigationStyle": "custom"
}, }
{ },
"path": "pages/my-info/my-info", {
"style": { "path": "pages/my-info/my-info",
"navigationBarTitleText": "我的" "style": {
} "navigationBarTitleText": "我的"
}, }
{ },
"path": "pages/category/category", {
"style": { "path": "pages/category/category",
"navigationBarTitleText": "分类" "style": {
} "navigationBarTitleText": "分类"
}, }
{ },
"path": "pages/test-page/test-page", {
"style": { "path": "pages/test-page/test-page",
"navigationBarTitleText": "测试页面" "style": {
} "navigationBarTitleText": "测试页面"
}, }
{ },
"path": "pages/test-page/test-camera", {
"style": { "path": "pages/test-page/test-camera",
"navigationBarTitleText": "摄像头测试" "style": {
} "navigationBarTitleText": "摄像头测试"
}, }
{ },
"path": "pages/test-page/test-crypto", {
"style": { "path": "pages/test-page/test-crypto",
"navigationBarTitleText": "加密测试" "style": {
} "navigationBarTitleText": "加密测试"
} }
], },
"globalStyle": { {
"navigationBarTextStyle": "white", "path": "pages/device-info/device-info",
"navigationBarTitleText": "uni-app", "style": {
"navigationBarBackgroundColor": "#1296db", "navigationBarTitleText": "设备信息",
"backgroundColor": "#F8F8F8" "enablePullDownRefresh": false
}, }
"tabBar": { }
"selectedColor": "#1296db", ],
"list": [ "globalStyle": {
{ "navigationBarTextStyle": "white",
"iconPath": "static/icon/Home.png", "navigationBarTitleText": "uni-app",
"selectedIconPath": "static/icon/Home-select.png", "navigationBarBackgroundColor": "#1296db",
"pagePath": "pages/index/index", "backgroundColor": "#F8F8F8"
"text": "首页" },
}, "tabBar": {
{ "selectedColor": "#1296db",
"iconPath": "static/icon/category.png", "list": [
"selectedIconPath": "static/icon/category-select.png", {
"pagePath": "pages/category/category", "iconPath": "static/icon/Home.png",
"text": "分类" "selectedIconPath": "static/icon/Home-select.png",
}, "pagePath": "pages/index/index",
{ "text": "首页"
"iconPath": "static/icon/My.png", },
"selectedIconPath": "static/icon/My-select.png", {
"pagePath": "pages/my-info/my-info", "iconPath": "static/icon/category.png",
"text": "我的" "selectedIconPath": "static/icon/category-select.png",
} "pagePath": "pages/category/category",
], "text": "分类"
"color": "", },
"backgroundColor": "" {
}, "iconPath": "static/icon/device.png",
"uniIdRouter": {} "selectedIconPath": "static/icon/device-select.png",
"pagePath": "pages/device-info/device-info",
"text": "设备信息"
},
{
"iconPath": "static/icon/My.png",
"selectedIconPath": "static/icon/My-select.png",
"pagePath": "pages/my-info/my-info",
"text": "我的"
}
],
"color": "",
"backgroundColor": ""
},
"uniIdRouter": {}
} }

View File

@ -0,0 +1,58 @@
<template>
<view class="container">
<uni-section title="电池信息" type="line">
<uni-row>
<uni-col span="24">
<view class="uni-ma-2">
<view>
电量
</view>
<view>
<progress :percent="ctx.batteryInfo.level" show-info stroke-width="5" />
</view>
</view>
</uni-col>
<uni-col span="24">
<view class="uni-ma-2">
<uni-row>
<uni-col span="12">
<view>
是否充电中
</view>
</uni-col>
<uni-col span="12" style="text-align: right;">
<view>
<uni-tag v-if="ctx.batteryInfo.isCharging" text="是" type="success" />
<uni-tag v-else text="否" type="error" />
</view>
</uni-col>
</uni-row>
</view>
</uni-col>
</uni-row>
</uni-section>
</view>
</template>
<script setup lang="ts">
import { onLoad } from "@dcloudio/uni-app"
import {reactive} from "vue"
const ctx = reactive({
batteryInfo: {
isCharging: false,
level: 0,
errMsg: "",
}
})
uni.getBatteryInfo({
success: (res)=>{
ctx.batteryInfo = res
}
})
</script>
<style scoped lang="scss">
</style>

View File

@ -41,6 +41,22 @@
</text> </text>
</view> </view>
<view>
<uni-row>
<uni-col span="12">
<view>
<button @tap="vibrateShortHandler">短振动</button>
</view>
</uni-col>
<uni-col span="12">
<view>
<button @tap="vibrateLongHandler">长振动</button>
</view>
</uni-col>
</uni-row>
</view>
<button @tap="back">返回上一页</button> <button @tap="back">返回上一页</button>
<button @tap="mockRequest">模拟请求</button> <button @tap="mockRequest">模拟请求</button>
<button type="primary" @tap="mockLogin">模拟登录</button> <button type="primary" @tap="mockLogin">模拟登录</button>
@ -56,6 +72,13 @@ const ctx = reactive({
} }
}) })
function vibrateShortHandler() {
uni.vibrateShort({})
}
function vibrateLongHandler() {
uni.vibrateLong({})
}
function mockRequest(){ function mockRequest(){
uni.request({ uni.request({

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

BIN
src/static/icon/device.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

View File

@ -11,7 +11,8 @@
* *
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件 * 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件
*/ */
/* 需要放到文件最上面 */
@import '@dcloudio/uni-ui/lib/uni-scss/variables.scss';
/* 颜色变量 */ /* 颜色变量 */
/* 行为相关颜色 */ /* 行为相关颜色 */