鸿蒙HarmonyOS 地图定位到当前位置 site查询等操作

应用服务Map使用 地图定位 地点查询及导航 周边查询 点位标记定义等

地图定位 

前提地图已经能正常显示,若不能显示请大家参考之前的那篇如何显示地图的博文

地图相关的api  

位置效果图:

 module.json5配置权限

"requestPermissions": [{"name": "ohos.permission.LOCATION","reason": "$string:dependency_reason","usedScene": {"abilities": ["EntryAbility"],"when": "always"}},{"name": "ohos.permission.APPROXIMATELY_LOCATION","reason": "$string:dependency_reason","usedScene": {"abilities": ["EntryAbility"],"when": "always"}},{"name": "ohos.permission.LOCATION_IN_BACKGROUND","reason": "$string:dependency_reason","usedScene": {"abilities": ["EntryAbility"],"when": "always"}},{"name": "ohos.permission.INTERNET","reason": "$string:dependency_reason","usedScene": {"when": "always"}},{"name": "ohos.permission.GET_NETWORK_INFO","reason": "$string:dependency_reason","usedScene": {"when": "always"}},{"name": "ohos.permission.CAMERA","reason": "$string:dependency_reason","usedScene": {"abilities": ["EntryAbility"],"when": "always"}}]

确认在AGC中已配置地图权限 这里就不截图了!

MapUtil.ets

地图相关的代码 logger文件若无用则可以删除

import { map, mapCommon, navi } from '@kit.MapKit';
import { geoLocationManager } from '@kit.LocationKit';
import { abilityAccessCtrl, bundleManager, Permissions } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
import Logger from './Logger';export class MapUtil {public static initializeMapWithLocation(mapController: map.MapComponentController): void {mapController?.setMyLocationEnabled(true);mapController?.setMyLocationControlsEnabled(true);let requestInfo: geoLocationManager.CurrentLocationRequest = {'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX,'scenario': geoLocationManager.LocationRequestScenario.UNSET,'maxAccuracy': 0};geoLocationManager.getCurrentLocation(requestInfo).then(async (result) => {let mapPosition: mapCommon.LatLng =await map.convertCoordinate(mapCommon.CoordinateType.WGS84, mapCommon.CoordinateType.GCJ02, result);AppStorage.setOrCreate('longitude', mapPosition.longitude);AppStorage.setOrCreate('latitude', mapPosition.latitude);let cameraPosition: mapCommon.CameraPosition = {target: mapPosition,zoom: 15,tilt: 0,bearing: 0};let cameraUpdate = map.newCameraPosition(cameraPosition);mapController?.moveCamera(cameraUpdate);})}public static async walkingRoutes(position: mapCommon.LatLng, myPosition?: mapCommon.LatLng) {let params: navi.RouteParams = {origins: [myPosition!],destination: position,language: 'zh_CN'};try {const result = await navi.getWalkingRoutes(params);Logger.info('naviDemo', 'getWalkingRoutes success result =' + JSON.stringify(result));return result;} catch (err) {Logger.error('naviDemo', 'getWalkingRoutes fail err =' + JSON.stringify(err));}return undefined;}public static async paintRoute(routeResult: navi.RouteResult, mapPolyline?: map.MapPolyline,mapController?: map.MapComponentController) {mapPolyline?.remove();let polylineOption: mapCommon.MapPolylineOptions = {points: routeResult.routes[0].overviewPolyline!,clickable: true,startCap: mapCommon.CapStyle.BUTT,endCap: mapCommon.CapStyle.BUTT,geodesic: false,jointType: mapCommon.JointType.BEVEL,visible: true,width: 20,zIndex: 10,gradient: false,color: 0xFF2970FF}mapPolyline = await mapController?.addPolyline(polylineOption);}public static async addMarker(position: mapCommon.LatLng,mapController?: map.MapComponentController): Promise<map.Marker | undefined> {let markerOptions: mapCommon.MarkerOptions = {position: position,rotation: 0,visible: true,zIndex: 0,alpha: 1,anchorU: 0.35,anchorV: 1,clickable: true,draggable: true,flat: false};return await mapController?.addMarker(markerOptions);}public static async checkPermissions(mapController?: map.MapComponentController): Promise<boolean> {const permissions: Permissions[] = ['ohos.permission.LOCATION', 'ohos.permission.APPROXIMATELY_LOCATION'];for (let permission of permissions) {let grantStatus: abilityAccessCtrl.GrantStatus = await MapUtil.checkAccessToken(permission);if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {mapController?.setMyLocationEnabled(true);mapController?.setMyLocationControlsEnabled(true);return true;}}return false;}public static async checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;let tokenId: number = 0;try {let bundleInfo: bundleManager.BundleInfo =await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;tokenId = appInfo.accessTokenId;} catch (error) {let err: BusinessError = error as BusinessError;Logger.error(`Failed to get bundle info for self. Code is ${err.code}, message is ${err.message}`);}try {grantStatus = await atManager.checkAccessToken(tokenId, permission);} catch (error) {let err: BusinessError = error as BusinessError;Logger.error(`Failed to check access token. Code is ${err.code}, message is ${err.message}`);}return grantStatus;}
}

 Map.ets

import { MapComponent, mapCommon, map , sceneMap,site} from '@kit.MapKit';
import { geoLocationManager } from '@kit.LocationKit';
import { AsyncCallback ,BusinessError} from '@kit.BasicServicesKit';
import { abilityAccessCtrl,common } from '@kit.AbilityKit';
import { JSON } from '@kit.ArkTS';
import { http } from '@kit.NetworkKit';
import Logger from '../utils/Logger';import { MapUtil } from '../utils/MapUtil';
interface testListType {name: string;latitude: string | number,longitude: string | number,color:string
}@Entry
@Component
export  struct Map {private TAG = "HuaweiMapDemo";private mapOptions?: mapCommon.MapOptions;private callback?: AsyncCallback<map.MapComponentController>;private mapController?: map.MapComponentController;private mapEventManager?: map.MapEventManager;private marker?: map.Marker;// 重庆// @State longitude:number = 106.45952// @State latitude:number = 29.567283// 北京@State longitude:number = 116.4@State latitude:number = 39.9@State testList:testListType[] = []aboutToAppear(): void {console.log('result0', 'result0')let http1 = http.createHttp();
// 替换成大家公司自己的接口地址let responseResult = 
http1.request('xxxxx/water/app/estuary/listRhpwk?typeId=13&riverId=1', {method: http.RequestMethod.GET,header: {'Content-Type': 'application/json'},readTimeout: 20000,connectTimeout: 10000});responseResult.then((value: http.HttpResponse) => {let res = JSON.stringify(value)let result = `${value.result}`;let resCode = `${value.code}`console.log('result1', result)// let resultObj: Object = JSON.parse(result)let resultObj: object = JSON.parse(result) as objectconsole.log('result2', JSON.stringify(resultObj['data']))this.testList = resultObj['data']}).catch(() => {})// 地图初始化参数,设置地图中心点坐标及层级this.mapOptions = {position: {target: {latitude: this.latitude,longitude: this.longitude},zoom: 10},mapType: mapCommon.MapType.STANDARD};// 地图初始化的回调this.callback = async (err, mapController) => {if (!err) {// 获取地图的控制器类,用来操作地图this.mapController = mapController;this.mapEventManager = this.mapController.getEventManager();let callback = () => {console.info(this.TAG, `on-mapLoad`);}this.mapEventManager.on("mapLoad", callback);//确认是否已配置权限(AGC中配置) 无权限则拉起位置let hasPermissions = await MapUtil.checkPermissions(this.mapController);console.log('hasPermissions==>',hasPermissions)if (!hasPermissions) {this.requestPermissions();}if (hasPermissions) {let requestInfo: geoLocationManager.CurrentLocationRequest = {'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX,'scenario': geoLocationManager.LocationRequestScenario.UNSET,'maxAccuracy': 0};let locationChange = async (): Promise<void> => {};geoLocationManager.on('locationChange', requestInfo, locationChange);// 获取当前用户位置geoLocationManager.getCurrentLocation(requestInfo).then(async (result) => {let mapPosition: mapCommon.LatLng =await map.convertCoordinate(mapCommon.CoordinateType.WGS84, mapCommon.CoordinateType.GCJ02, result);AppStorage.setOrCreate('longitude', mapPosition.longitude);AppStorage.setOrCreate('latitude', mapPosition.latitude);console.log('longitude==>',mapPosition.latitude,mapPosition.longitude)// 飞入 类似setView flyTo cameralet cameraPosition: mapCommon.CameraPosition = {target: mapPosition,zoom: 15,tilt: 0,bearing: 0};let cameraUpdate = map.newCameraPosition(cameraPosition);mapController?.animateCamera(cameraUpdate, 1000);})}//点击事件let callback1 = (position: mapCommon.LatLng) => {console.info("mapClick", `on-mapClick position = ${position.longitude} -${position.latitude}`);};this.mapEventManager.on("mapClick", callback1);};}// 页面每次显示时触发一次,包括路由过程、应用进入前台等场景,仅@Entry装饰的自定义组件生效onPageShow(): void {// 将地图切换到前台if (this.mapController !== undefined) {this.mapController.show();}}// 页面每次隐藏时触发一次,包括路由过程、应用进入后台等场景,仅@Entry装饰的自定义组件生效。onPageHide(): void {// 将地图切换到后台if (this.mapController !== undefined) {this.mapController.hide();}}build() {Stack() {// 调用MapComponent组件初始化地图MapComponent({ mapOptions: this.mapOptions, mapCallback: this.callback }).width('100%').height('100%');// 当前位置// LocationButton().onClick((event: ClickEvent, result: LocationButtonOnClickResult)=>{//   console.info("result " + result)// })}.height('100%')}
// 点击是否允许的位置权限页面requestPermissions(): void {let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();atManager.requestPermissionsFromUser(getContext() as common.UIAbilityContext,['ohos.permission.LOCATION', 'ohos.permission.APPROXIMATELY_LOCATION']).then(() => {this.mapController?.setMyLocationEnabled(true);this.mapController?.setMyLocationControlsEnabled(true);this.mapController?.setCompassControlsEnabled(false);this.mapController?.setMyLocationStyle({ displayType: mapCommon.MyLocationDisplayType.FOLLOW });geoLocationManager.getCurrentLocation().then(async (result) => {let mapPosition: mapCommon.LatLng =await map.convertCoordinate(mapCommon.CoordinateType.WGS84, mapCommon.CoordinateType.GCJ02, result);AppStorage.setOrCreate('longitude', mapPosition.longitude);AppStorage.setOrCreate('latitude', mapPosition.latitude);let cameraPosition: mapCommon.CameraPosition = {target: mapPosition,zoom: 15,tilt: 0,bearing: 0};let cameraUpdate = map.newCameraPosition(cameraPosition);this.mapController?.animateCamera(cameraUpdate, 1000);})}).catch((err: BusinessError) => {Logger.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`);})}
}

地点查询

 地点查询效果图:

完整示例代码:

import { MapComponent, mapCommon, map , sceneMap,site} from '@kit.MapKit';
import { geoLocationManager } from '@kit.LocationKit';
import { AsyncCallback ,BusinessError} from '@kit.BasicServicesKit';
import { abilityAccessCtrl,common } from '@kit.AbilityKit';
import { JSON } from '@kit.ArkTS';
import { http } from '@kit.NetworkKit';
import Logger from '../utils/Logger';import { MapUtil } from '../utils/MapUtil';
interface testListType {name: string;latitude: string | number,longitude: string | number,color:string
}@Entry
@Component
export  struct Map {private TAG = "HuaweiMapDemo";private mapOptions?: mapCommon.MapOptions;private callback?: AsyncCallback<map.MapComponentController>;private mapController?: map.MapComponentController;private mapEventManager?: map.MapEventManager;private marker?: map.Marker;// 重庆// @State longitude:number = 106.45952// @State latitude:number = 29.567283// 北京@State longitude:number = 116.4@State latitude:number = 39.9@State testList:testListType[] = []aboutToAppear(): void {console.log('result0', 'result0')let http1 = http.createHttp();let responseResult = http1.request('xxxxx/water/app/estuary/listRhpwk?typeId=13&riverId=1', {method: http.RequestMethod.GET,header: {'Content-Type': 'application/json'},readTimeout: 20000,connectTimeout: 10000});responseResult.then((value: http.HttpResponse) => {let res = JSON.stringify(value)let result = `${value.result}`;let resCode = `${value.code}`console.log('result1', result)// let resultObj: Object = JSON.parse(result)let resultObj: object = JSON.parse(result) as objectconsole.log('result2', JSON.stringify(resultObj['data']))this.testList = resultObj['data']}).catch(() => {})// 地图初始化参数,设置地图中心点坐标及层级this.mapOptions = {position: {target: {latitude: this.latitude,longitude: this.longitude},zoom: 10},mapType: mapCommon.MapType.STANDARD};// 地图初始化的回调this.callback = async (err, mapController) => {if (!err) {// 获取地图的控制器类,用来操作地图this.mapController = mapController;this.mapEventManager = this.mapController.getEventManager();let callback = () => {console.info(this.TAG, `on-mapLoad`);}this.mapEventManager.on("mapLoad", callback);//确认是否已配置权限(AGC中配置) 无权限则拉起位置let hasPermissions = await MapUtil.checkPermissions(this.mapController);console.log('hasPermissions==>',hasPermissions)if (!hasPermissions) {this.requestPermissions();}if (hasPermissions) {let requestInfo: geoLocationManager.CurrentLocationRequest = {'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX,'scenario': geoLocationManager.LocationRequestScenario.UNSET,'maxAccuracy': 0};let locationChange = async (): Promise<void> => {};geoLocationManager.on('locationChange', requestInfo, locationChange);// 获取当前用户位置geoLocationManager.getCurrentLocation(requestInfo).then(async (result) => {let mapPosition: mapCommon.LatLng =await map.convertCoordinate(mapCommon.CoordinateType.WGS84, mapCommon.CoordinateType.GCJ02, result);AppStorage.setOrCreate('longitude', mapPosition.longitude);AppStorage.setOrCreate('latitude', mapPosition.latitude);console.log('longitude==>',mapPosition.latitude,mapPosition.longitude)// 飞入 类似setView flyTo cameralet cameraPosition: mapCommon.CameraPosition = {target: mapPosition,zoom: 15,tilt: 0,bearing: 0};let cameraUpdate = map.newCameraPosition(cameraPosition);mapController?.animateCamera(cameraUpdate, 1000);})}// Marker初始化参数for (let i = 0; i < this.testList.length - 1; i++) {console.log('this.testList[i].color',this.testList[i].color)let markerOptions: mapCommon.MarkerOptions = {position: {latitude:  this.testList[i].latitude as number,longitude: this.testList[i].longitude as number,},rotation: 0,visible: true,zIndex: 0,alpha: 1,anchorU: 2.5,anchorV: 10.5,clickable: true,draggable: true,flat: false,title:this.testList[i].name,icon: `icon_rhkpwk_blue.png`,};// 创建Markerthis.marker = await this.mapController.addMarker(markerOptions);let callbackMarker = (marker: map.Marker) => {console.info(`on-markerClick marker = ${JSON.stringify(marker)}`);// 设置信息窗的标题// marker.setTitle('南京');// 设置信息窗的子标题// marker.setSnippet('华东地区');// 设置标记可点击marker.setClickable(true);// 设置信息窗的锚点位置marker.setInfoWindowAnchor(1, 1);// 设置信息窗可见marker.setInfoWindowVisible(true);};this.mapEventManager.on("markerClick", callbackMarker);}/*let initNumber = 0;let position: geoLocationManager.Location = {"latitude": this.latitude,"longitude":this.longitude,"altitude": 0,"accuracy": 0,"speed": 0,"timeStamp": 0,"direction": 0,"timeSinceBoot": 0,altitudeAccuracy: 0,speedAccuracy: 0,directionAccuracy: 0,uncertaintyOfTimeSinceBoot: 0,sourceType: 1};let count = 0;const intervalId = setInterval(async () => {position.direction = initNumber + count * 3;position.accuracy = initNumber + count * 100;position.latitude = initNumber + count * 0.1;position.longitude = initNumber + count * 0.1;this.mapController?.setMyLocation(position);if (count++ === 10) {clearInterval(intervalId);}}, 200);*///点击事件let callback1 = (position: mapCommon.LatLng) => {console.info("mapClick", `on-mapClick position = ${position.longitude} -${position.latitude}`);};this.mapEventManager.on("mapClick", callback1);// 获取siteid 并显示地点详情 及地图导航let callback2 = (poi: mapCommon.Poi) => {console.info("poiClick", `callback1 poi = ${poi.id}`);let siteId:string = poi.idlet queryLocationOptions: sceneMap.LocationQueryOptions = { siteId };// 拉起地点详情页sceneMap.queryLocation(getContext(this) as common.UIAbilityContext, queryLocationOptions).then(() => {console.info("QueryLocation", "Succeeded in querying location.");}).catch((err: BusinessError) => {console.error("QueryLocation", `Failed to query Location, code: ${err.code}, message: ${err.message}`);});};this.mapEventManager.on("poiClick", callback2);// 周边搜索,通过用户传入自己的位置,可以返回周边地点列表。let params: site.NearbySearchParams = {// 指定关键字query: "hotel",// 经纬度坐标location: {latitude: 31.984410259206815,longitude: 118.76625379397866},// 指定地理位置的范围半径radius: 5000,// 指定需要展示的poi类别poiTypes: ["NATIONAL_RAILWAY_STATION"],language: "en",pageIndex: 1,pageSize: 1};// 返回周边搜索结果const result = await site.nearbySearch(params);console.info("Succeeded in searching nearby.",JSON.stringify(result))}};}// 页面每次显示时触发一次,包括路由过程、应用进入前台等场景,仅@Entry装饰的自定义组件生效onPageShow(): void {// 将地图切换到前台if (this.mapController !== undefined) {this.mapController.show();}}// 页面每次隐藏时触发一次,包括路由过程、应用进入后台等场景,仅@Entry装饰的自定义组件生效。onPageHide(): void {// 将地图切换到后台if (this.mapController !== undefined) {this.mapController.hide();}}build() {Stack() {// 调用MapComponent组件初始化地图MapComponent({ mapOptions: this.mapOptions, mapCallback: this.callback }).width('100%').height('100%');// 当前位置// LocationButton().onClick((event: ClickEvent, result: LocationButtonOnClickResult)=>{//   console.info("result " + result)// })}.height('100%')}requestPermissions(): void {let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();atManager.requestPermissionsFromUser(getContext() as common.UIAbilityContext,['ohos.permission.LOCATION', 'ohos.permission.APPROXIMATELY_LOCATION']).then(() => {this.mapController?.setMyLocationEnabled(true);this.mapController?.setMyLocationControlsEnabled(true);this.mapController?.setCompassControlsEnabled(false);this.mapController?.setMyLocationStyle({ displayType: mapCommon.MyLocationDisplayType.FOLLOW });geoLocationManager.getCurrentLocation().then(async (result) => {let mapPosition: mapCommon.LatLng =await map.convertCoordinate(mapCommon.CoordinateType.WGS84, mapCommon.CoordinateType.GCJ02, result);AppStorage.setOrCreate('longitude', mapPosition.longitude);AppStorage.setOrCreate('latitude', mapPosition.latitude);let cameraPosition: mapCommon.CameraPosition = {target: mapPosition,zoom: 15,tilt: 0,bearing: 0};let cameraUpdate = map.newCameraPosition(cameraPosition);this.mapController?.animateCamera(cameraUpdate, 1000);})}).catch((err: BusinessError) => {Logger.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`);})}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/474296.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

编程语言02:语法基础

一、注释 (一)单行注释 java&#xff1a;//&#xff0c;快捷键 Ctrl/ package Summarize;public class L01_01 {public static void main(String[] args) {// 单行注释&#xff0c;快捷键Ctrl/} }python:#,快捷键Ctrl/ # python单行注释 (二)多行注释 java /*java多行注释…

ubuntu24.04网卡配置

vim /etc/netplan/01-netcfg.yaml /24表示子网掩码的长度。这种表示法称为CIDR&#xff08;无类别域间路由&#xff09;记法。CIDR记法将IP地址和它们的子网掩码合并为一个单一的值&#xff0c;其中斜杠/后面的数字表示子网掩码中连续的1的位数。 对于/24&#xff1a; 24表示…

基于普中51单片机开发板的电子门铃设计( proteus仿真+程序+设计报告+讲解视频)

基于普中51单片机开发板的电子门铃设计( proteus仿真程序设计报告讲解视频&#xff09; 仿真图proteus8.15(有低版本) 程序编译器&#xff1a;keil 4/keil 5 编程语言&#xff1a;C语言 设计编号&#xff1a;P17 1. 主要功能&#xff1a; 基于51单片机的电子门铃设计 1、…

HTML and CSS Support HTML 和 CSS 支持

GoTo DevExpress Data Grid 数据网格 HTML and CSS Support HTML 和 CSS 支持 HTML和CSS支持允许您创建完全自定义的UI元素&#xff0c;并消除使用基于属性的UI自定义和CustomDraw事件。您可以构建 HTML 格式的 UI&#xff0c;并使用 CSS 样式自定义 UI 元素的外观设置、大小、…

掌握Golang中的数据竞争检测:runtime/race包全面教程

掌握Golang中的数据竞争检测&#xff1a;runtime/race包全面教程 引言数据竞争问题概述数据竞争的定义数据竞争对程序的影响常见数据竞争场景 Golang runtime/race包概述runtime/race包简介启用数据竞争检测使用 go run使用 go build使用 go test 基本用法与示例单元测试中的使…

Ascend C算子性能优化实用技巧05——API使用优化

Ascend C是CANN针对算子开发场景推出的编程语言&#xff0c;原生支持C和C标准规范&#xff0c;兼具开发效率和运行性能。使用Ascend C&#xff0c;开发者可以基于昇腾AI硬件&#xff0c;高效的实现自定义的创新算法。 目前已经有越来越多的开发者使用Ascend C&#xff0c;我们…

【HCIP]——OSPF综合实验

题目 实验需求 根据上图可得&#xff0c;实验需求为&#xff1a; 1.R5作为ISP&#xff1a;其上只能配置IP地址&#xff1b;R4作为企业边界路由器&#xff0c;出口公网地址需要通过PPP协议获取&#xff0c;并进行CHAP认证。&#xff08;PS&#xff1a;因PPP协议尚未学习&#…

深入理解Redis(七)----Redis实现分布式锁

基于Redis的实现方式 1、选用Redis实现分布式锁原因&#xff1a; &#xff08;1&#xff09;Redis有很高的性能&#xff1b; &#xff08;2&#xff09;Redis命令对此支持较好&#xff0c;实现起来比较方便 2、使用命令介绍&#xff1a; &#xff08;1&#xff09;SETNX SETNX …

Python-简单病毒程序合集(一)

前言&#xff1a;简单又有趣的Python恶搞代码&#xff0c;往往能给我们枯燥无味的生活带来一点乐趣&#xff0c;激发我们对编程的最原始的热爱。那么话不多说&#xff0c;我们直接开始今天的编程之路。 编程思路&#xff1a;本次我们将会用到os,paltform,threading,ctypes,sys,…

Web3浪潮下的区块链应用:从理论到实践的全面解析

随着Web3的兴起&#xff0c;区块链技术作为其核心支撑&#xff0c;正迎来前所未有的应用爆发。Web3不仅仅是技术的革新&#xff0c;更代表了一种去中心化、开放、透明的互联网愿景。在这一背景下&#xff0c;区块链技术的应用正从理论走向实践&#xff0c;推动着各行各业的数字…

网络安全:我们的安全防线

在数字化时代&#xff0c;网络安全已成为国家安全、经济发展和社会稳定的重要组成部分。网络安全不仅仅是技术问题&#xff0c;更是一个涉及政治、经济、文化、社会等多个层面的综合性问题。从宏观到微观&#xff0c;网络安全的重要性不言而喻。 宏观层面&#xff1a;国家安全与…

鸿蒙北向开发环境安装指南

境界一&#xff1a;昨夜西风凋碧树。独上高楼&#xff0c;望尽天涯路。----------王静安《人间词话》 单元一&#xff1a;鸿蒙开发工具的安装 学习目标 &#xff08;1&#xff09;完成鸿蒙开发工具Deveco Studio的安装。 任务1.1 下载DevEcoStudio 任务描述 DevEco Studi…

51单片机基础01 单片机最小系统

目录 一、什么是51单片机 二、51单片机的引脚介绍 1、VCC GND 2、XTAL1 2 3、RST 4、EA 5、PSEN 6、ALE 7、RXD、TXD 8、INT0、INT1 9、T0、T1 10、MOSI、MISO、SCK 11、WR、RD 12、通用IO P0 13、通用IO P1 14、通用IO P2 三、51单片机的最小系统 1、供电与…

golang开源框架:go开源验证框架validator

validator 单个字段格式验证 先来一个单个字段格式的验证 目录结构 在main函数中 package mainimport "awesomeProject/validate"func main() {validate.SingleFieldValidate() }在validator.go中 package validateimport ("github.com/go-playground/val…

计算机网络-MSTP基础实验一(单域多实例)

前面我们已经大致了解了MSTP的基本概念和工作原理&#xff0c;但是我自己也觉得MSTP的理论很复杂不结合实验是很难搞懂的&#xff0c;今天来做一个配套的小实验以及一些配置命令。 一、网络拓扑 单域多实例拓扑 基本需求&#xff1a;SW1为VLAN10的网关&#xff0c;SW2为VLAN20的…

智谱AI清影升级:引领AI视频进入音效新时代

前几天智谱推出了新清影,该版本支持4k、60帧超高清画质、任意尺寸&#xff0c;并且自带音效的10秒视频,让ai生视频告别了"哑巴时代"。 智谱AI视频腾空出世&#xff0c;可灵遭遇强劲挑战&#xff01;究竟谁是行业翘楚&#xff1f;(附测评案例)之前智谱出世那时体验了一…

商业物联网详细指南:优势与挑战

物联网是信息技术行业最具前景的领域之一。为什么它如此热门呢&#xff1f;原因在于全球连接性。设备可以像人群一样相互协作。正如我们所知&#xff0c;协作能显著提高生产力。 物联网对普通用户和企业都有益处。许多日常流程可以通过传感器、扫描仪、摄像头和其他设备实现自…

css uniapp背景图宽度固定高度自适应可以重复

page {height: 100%;background-image: url(https://onlinekc.a.hlidc.cn/uploads/20241115/350f94aaf493d05625a7ddbc86c7804e.png);background-repeat: repeat;background-size: contain;} 如果不要重复 把background-repeat: repeat;替换background-repeat: no-repeat;

学习日志012--python中多进程,多线程

简简单单小练习 1.线程的并发执行 import threading import time# 创建要执行的两个函数 def print_hello():for _ in range(10):print("hello")time.sleep(1)def print_world():for _ in range(10):print("world")time.sleep(1)# 创建线程对象 注意这里…

网络传输:网卡、IP、网关、子网掩码、MAC、ARP、路由器、NAT、交换机

目录 网卡IP网络地址主机地址子网子网掩码网关默认网关 MACARPARP抓包分析 路由器NATNAPT 交换机 网卡 网卡(Network Interface Card&#xff0c;简称NIC)&#xff0c;也称网络适配器。 OSI模型&#xff1a; 1、网卡工作在OSI模型的最后两层&#xff0c;物理层和数据链路层。物…