零基礎開始學習鴻蒙開發-智能家居APP離線版介紹

目錄

1.我的小屋

2.查找設備

3.個人主頁


前言

? ? ? ? 好久不發博文了,最近都忙于面試,忙于找工作,這段時間終于找到工作了。我對鴻蒙開發的激情依然沒有減退,前幾天做了一個鴻蒙的APP,現在給大家分享一下!

? ? ? 具體功能如下圖:

1.我的小屋

? ? ? ??1.1 鎖門:對大門開關鎖的控制

? ? ? ? 1.2設備狀態:展示了某臺設備的詳細信息

? ? ? ? 1.3 控制面板:房門開關、車庫門開關、窗簾開關、燈開關

? ? ? ? 1.4 添加設備:根據設備信息添加設備

我的小屋

鎖門

設備狀態

2.查找設備

? ? ? ? 2.1 搜索:對已經添加的設備進行搜索

? ? ? ? 2.2 搜索歷史:可以查看到搜索過的信息

查找設備

3.個人主頁

? ? 3.1 個人資料:展示個人的資料信息,支持修改

? ? 3.2賬號與安全:包含修改密碼和退出登錄

注冊頁面代碼

// 導入必要的模塊
import router from '@ohos.router';
import Preferences from '@ohos.data.preferences';
import UserBean from '../common/bean/UserBean';// 注冊頁面
@Entry
@Component
struct RegisterPage {@State username: string = '';@State password: string = '';@State confirmPwd: string = '';@State errorMsg: string = '';private prefKey: string = 'userData'private context = getContext(this)// 保存用戶數據(保持原邏輯)async saveUser() {try {let prefs = await Preferences.getPreferences(this.context, this.prefKey)const newUser: UserBean = {// @ts-ignoreusername: this.username,password: this.password}await prefs.put(this.username, JSON.stringify(newUser))await prefs.flush()router.back()} catch (e) {console.error('注冊失敗:', e)}}// 注冊驗證(保持原邏輯)handleRegister() {if (!this.username || !this.password) {this.errorMsg = '用戶名和密碼不能為空'return}if (this.password !== this.confirmPwd) {this.errorMsg = '兩次密碼不一致'return}this.saveUser()}build() {Column() {// 用戶名輸入框TextInput({ placeholder: '用戶名' }).width('80%').height(50).margin({ bottom: 20 }).backgroundColor('#FFFFFF')  // 新增白色背景.onChange(v => this.username = v)// 密碼輸入框// @ts-ignoreTextInput({ placeholder: '密碼', type: InputType.Password }).width('80%').height(50).margin({ bottom: 20 }).backgroundColor('#FFFFFF')  // 新增白色背景.onChange(v => this.password = v)// 確認密碼輸入框// @ts-ignoreTextInput({ placeholder: '確認密碼', type: InputType.Password }).width('80%').height(50).margin({ bottom: 20 }).backgroundColor('#FFFFFF')  // 新增白色背景.onChange(v => this.confirmPwd = v)// 錯誤提示(保持原樣)if (this.errorMsg) {Text(this.errorMsg).fontColor('red').margin({ bottom: 10 })}// 注冊按鈕(保持原樣)Button('注冊', { type: ButtonType.Capsule }).width('80%').height(50).backgroundColor('#007AFF').onClick(() => this.handleRegister())// 返回按鈕(保持原樣)Button('返回登錄', { type: ButtonType.Capsule }).width('80%').height(40).margin({ top: 20 }).backgroundColor('#34C759').onClick(() => router.back())}.width('100%').height('100%').padding(20).justifyContent(FlexAlign.Center).backgroundColor('#1A1A1A')  // 新增暗黑背景色}
}

登錄頁面代碼

// 導入必要的模塊
import router from '@ohos.router';
import Preferences from '@ohos.data.preferences';
import DeviceBean from '../common/bean/DeviceBean';// 用戶數據模型
class User {username: string = '';password: string = '';
}// 登錄頁面
@Entry
@Component
struct LoginPage {@State username: string = '';@State password: string = '';@State errorMsg: string = '';@State deviceList:Array<DeviceBean> =[new DeviceBean(0,'設備1',0,0,0,0,0,0,0,0,0,0,),new DeviceBean(1,'設備2',0,0,0,0,0,0,0,0,0,0,),new DeviceBean(3,'設備3',0,0,0,0,0,0,0,0,0,0,)];private prefKey: string = 'userData'// 獲取本地存儲上下文private context = getContext(this)// 獲取用戶數據async getUser(): Promise<User | null> {try {// @ts-ignorereturn userData ? JSON.parse(userData) : null} catch (e) {console.error('讀取失敗:', e)return null}}// 登錄處理async handleLogin(username:string,password:string,) {if (!this.username || !this.password) {this.errorMsg = '用戶名和密碼不能為空'return}const user = await this.getUser()if ( username == 'admin' && password=='123456') {AppStorage.SetOrCreate("deviceList",this.deviceList);AppStorage.SetOrCreate("signature","金克斯的含義就是金克斯")AppStorage.SetOrCreate("nickName","金克斯")AppStorage.SetOrCreate("nickname","金克斯")AppStorage.SetOrCreate("login_username",this.username)// 登錄成功跳轉主頁router.pushUrl({ url: 'pages/MainPages', params: { username: this.username } })} else {this.errorMsg = '用戶名或密碼錯誤'}}build() {Column() {// 新增歡迎語Text('歡迎登錄智能家庭app').fontSize(24).margin({ bottom: 40 }).fontColor('#FFFFFF') // 白色文字TextInput({ placeholder: '用戶名' }).width('80%').height(50).margin({ bottom: 20 }).onChange(v => this.username = v).fontColor(Color.White).placeholderColor(Color.White)// @ts-ignoreTextInput({ placeholder: '密碼', type: InputType.Password}).fontColor(Color.White).placeholderColor(Color.White).width('80%').height(50).margin({ bottom: 20 }).onChange(v => this.password = v)if (this.errorMsg) {Text(this.errorMsg).fontColor('red').margin({ bottom: 10 })}Button('登錄', { type: ButtonType.Capsule }).width('80%').height(50).backgroundColor('#007AFF').onClick(() => this.handleLogin(this.username,this.password))Button('注冊', { type: ButtonType.Capsule }).width('80%').height(40).margin({ top: 20 }).backgroundColor('#34C759').onClick(() => router.pushUrl({ url: 'pages/RegisterPage' }))}.width('100%').height('100%').padding(20).justifyContent(FlexAlign.Center).backgroundColor('#1A1A1A') // 新增暗黑背景色}
}

主頁代碼

import prompt from '@ohos.prompt';
import { TabID, TabItemList } from '../model/TabItem'
import { DeviceSearchComponent } from '../view/DeviceSearchComponent';
import HouseStateComponent from '../view/HouseStateComponent';
import { MineComponent } from '../view/MineComponent';
import { NotLogin } from '../view/NotLogin';
@Entry
@Component
struct MainPages {@State pageIndex:number = 0;//頁面索引private tabController:TabsController = new TabsController();//tab切換控制器@Builder MyTabBuilder(idx:number){Column(){Image(idx === this.pageIndex ? TabItemList[idx].icon_selected:TabItemList[idx].icon).width(32).height(32)// .margin({top:5})Text(TabItemList[idx].title).fontSize(14).fontWeight(FontWeight.Bold).fontColor(this.pageIndex === idx ? '#006eee':'#888')}}build() {Tabs({barPosition:BarPosition.End}){TabContent(){// Text('小屋狀態')HouseStateComponent()}// .tabBar('小屋狀態').tabBar(this.MyTabBuilder(TabID.HOUSE)) //調用自定義的TabBarTabContent(){// Text('搜索設備')DeviceSearchComponent()//調用設備搜索組件}// .tabBar('搜索設備').tabBar(this.MyTabBuilder(TabID.SEARCH_DEVICE)) //調用自定義的TabBarTabContent(){// Text('我的')MineComponent();//個人主頁// NotLogin()}// .tabBar('我的').tabBar(this.MyTabBuilder(TabID.MINE)) //調用自定義的TabBar}.barWidth('100%').barMode(BarMode.Fixed).width('100%').height('100%').onChange((index)=>{//綁定onChange函數切換頁簽this.pageIndex = index;}).backgroundColor('#000')}
}

我的小屋代碼

import router from '@ohos.router';
import { Action } from '@ohos.multimodalInput.keyEvent';
import DeviceBean from '../common/bean/DeviceBean';
import MainViewModel from '../model/MainViewModel';
import promptAction from '@ohos.promptAction';// 自定義彈窗組件
@CustomDialog
struct SimpleDialog {@State deviceList:Array<DeviceBean> =[new DeviceBean(0,'設備1',0,0,0,0,0,0,0,0,0,0,),new DeviceBean(1,'設備2',0,0,0,0,0,0,0,0,0,0,),new DeviceBean(3,'設備3',0,0,0,0,0,0,0,0,0,0,)];// @ts-ignore@State deviceId: number=1; //設備ID@State name: string=''; //設備名@State temperator: number=25.3; //室內溫度@State humidity: number =20; //室內濕度@State lumination: number =10; //光照@State isRain: number =30; //下雨預警 0:正常 1:觸發報警@State isSmoke: number =0; //煙霧報警 0:正常 1:觸發報警@State isFire: number=0; //火災報警 0:正常 1:觸發報警@State doorStatus: number=0; //門開關狀態 0:正常 1:開啟@State garageStatus: number=0; //車庫門開關 0:正常 1:開啟@State curtainStatus: number=0; //窗簾開關 0:正常 1:開啟@State lightStatus: number=0; //燈開關 0:正常 1:開啟@State  tempDevice: DeviceBean =  new DeviceBean(0,'',0,0,0,0,0,0,0,0,0,0,);tmpMap:Map<string, string> = new Map();controller:CustomDialogController;build() {Column() {// 設備基本信息TextInput({ placeholder: '設備ID(數字)' }).onChange(v => this.tempDevice.deviceId = Number(v))TextInput({ placeholder: '設備名稱' }).onChange(v => this.tempDevice.name = v)// 環境參數/*  TextInput({ placeholder: '溫度(0-100)' }).onChange(v => this.tempDevice.temperator = Number(v))TextInput({ placeholder: '濕度(0-100)' }).onChange(v => this.tempDevice.humidity = Number(v))TextInput({ placeholder: '光照強度' }).onChange(v => this.tempDevice.lumination = Number(v))*/Button('保存').onClick(()=>{promptAction.showToast({message:'保存成功!',duration:2000,})// 添加新設備到列表//this.deviceList = [...this.deviceList, {...this.tempDevice}];console.log(JSON.stringify(this.tempDevice))this.deviceList.push(this.tempDevice); // 關鍵步驟:創建新數組AppStorage.SetOrCreate("deviceList",this.deviceList);this.controller.close()})/*   .onClick(() => {this.deviceList = [...this.deviceList, {// @ts-ignoreid: this.id,name: this.name,}]this.controller.close()})*/}.padding(20)}
}@Component
export default struct HouseStateComponent{private exitDialog() {  }@State handlePopup: boolean = false@State devices: DeviceBean[]=[]// 確保控制器正確初始化private dialogController: CustomDialogController = new CustomDialogController({builder: SimpleDialog(),  // 確認組件正確引用cancel: this.exitDialog,  // 關閉回調autoCancel: true          // 允許點擊外部關閉})@Builder AddMenu(){Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {Column(){Text('掃一掃').fontSize(20).width('100%').height(30).align(Alignment.Center)Divider().width('80%').color('#ccc')Text('添加設備').fontSize(20).width('100%').height(30).align(Alignment.Center).onClick(()=>{this.dialogController.open()})}.padding(5).height(65)}.width(100)}build(){Column({space:8}){Row() {Text('小屋狀態').fontSize(24).fontWeight(FontWeight.Bold).fontColor(Color.White).margin({ top: 10 }).textAlign(TextAlign.Start)Image($r('app.media.jiahao_0')).width(32).height(32).margin({top:10,left:160}).bindMenu(this.AddMenu())Image($r('app.media.news')).fillColor(Color.Black).width(32).height(32).margin({top:10}).onClick(() => {this.handlePopup = !this.handlePopup}).bindPopup(this.handlePopup,{message:'當前暫無未讀消息',})// .onClick({//// })}.width('95%').justifyContent(FlexAlign.SpaceBetween)Divider().width('95%').color(Color.White)Flex({ wrap: FlexWrap.Wrap }){Button()Row() {Shape() {Circle({ width: 60, height: 60 }).fill('#494848').margin({left:15,top:'32%'}).opacity(0.7)Image($r('app.media.lock')).width(30).margin({ left: 30 ,top:'42%'})}.height('100%')Column() {Text('大門').fontSize(25).fontColor('#838383').fontWeight(FontWeight.Bold).margin({ left: 20, top: 0 })Text('已鎖').fontSize(25).fontColor('#838383').fontWeight(FontWeight.Bold).margin({ left: 20, top: 0 })}}.borderRadius(20).backgroundColor('#1c1c1e')// .backgroundImage($r('app.media.Button_img'))// .backgroundImageSize(ImageSize.Cover)// .border({ width: 1 })// .borderColor('#b9b9b9').width('47%').height(160).onClick(()=>{router.pushUrl({url:"house/HomeGate"})})Button()Row() {Shape() {Circle({ width: 60, height: 60 }).fill('#494848').margin({left:15,top:'32%'}).opacity(0.7)Image($r('app.media.Device_icon')).width(30).margin({ left: 30 ,top:'42%'})}.height('100%')Column() {Text('設備').fontSize(25).fontColor('#838383').fontWeight(FontWeight.Bold).margin({ left: 20, top: 0 })Text('狀態').fontSize(25).fontColor('#838383').fontWeight(FontWeight.Bold).margin({ left: 20, top: 0 })}}.onClick(()=>{router.pushUrl({url:"house/DeviceStatus"})}).borderRadius(20).backgroundColor('#1c1c1e').margin({left:20})// .border({ width: 1 })// .borderColor('#b9b9b9').width('47%').height(160)}.width('95%').padding(10)Flex() {Button()Row() {Shape() {Circle({ width: 60, height: 60 }).fill('#494848').margin({ left: 15, top: '32%' }).opacity(0.7)Image($r('app.media.console_1')).width(30).margin({ left: 30, top: '47%' })}.height('100%')Column() {Text('控制').fontSize(25).fontColor('#838383').fontWeight(FontWeight.Bold).margin({ left: 20, top: 0 })Text('面板').fontSize(25).fontColor('#838383').fontWeight(FontWeight.Bold).margin({ left: 20, top: 0 })}}.onClick(() => {router.pushUrl({url: "house/ControlConsole"})}).borderRadius(20).backgroundColor('#1c1c1e')// .border({ width: 1 })// .borderColor('#b9b9b9').width('47%').height(160)}.width('95%').padding(10)}.width('100%').height('100%').backgroundImage($r('app.media.index_background1')).backgroundImageSize(ImageSize.Cover)}
}

設備搜索代碼

import DeviceBean from '../common/bean/DeviceBean'
@Component
export struct DeviceSearchComponent {@State submitValue: string = '' //獲取歷史記錄數據@State allDevices:Array<DeviceBean> =[new DeviceBean(0,'設備1',0,0,0,0,0,0,0,0,0,0,),new DeviceBean(1,'設備2',0,0,0,0,0,0,0,0,0,0,)];@State all_devices:Array<DeviceBean> =AppStorage.Get("deviceList");@State filteredDevices:Array<DeviceBean>=[];controller: SearchController = new SearchController()scroll: Scroller = new Scroller()@State historyValueArr: Array<string> = [] //歷史記錄存放private swiperController: SwiperController = new SwiperController()build() {Column({ space: 8 }) {Row({space:1}){Search({placeholder:'搜索一下',controller: this.controller}).searchButton('搜索').margin(15).width('80%').height(40).backgroundColor('#F5F5F5').placeholderColor(Color.Grey).placeholderFont({ size: 14, weight: 400 }).textFont({ size: 14, weight: 400 }).onSubmit((value: string) => { //綁定 輸入內容添加到submit中this.submitValue = valuefor (let i = 0; i < this.historyValueArr.length; i++) {if (this.historyValueArr[i] === this.submitValue) {this.historyValueArr.splice(i, 1);break;}}this.historyValueArr.unshift(this.submitValue) //將輸入數據添加到歷史數據// 若歷史記錄超過10條,則移除最后一項if (this.historyValueArr.length > 10) {this.historyValueArr.splice(this.historyValueArr.length - 1);}let devices: Array<DeviceBean> = AppStorage.Get("deviceList") as Array<DeviceBean>JSON.stringify(devices);// 增加過濾邏輯this.filteredDevices = devices.filter(item =>item.name.includes(value))})// 搜索結果列表?:ml-citation{ref="7" data="citationList"}//二維碼Scroll(this.scroll){Image($r('app.media.saomiao')).width(35).height(35).objectFit(ImageFit.Contain)}}.margin({top:20})// 輪播圖Swiper(this.swiperController) {Image($r('app.media.lunbotu1' )).width('100%').height('100%').objectFit(ImageFit.Auto)     //讓圖片自適應大小 剛好沾滿// .backgroundImageSize(ImageSize.Cover)Image($r('app.media.lbt2' )).width('100%').height('100%').objectFit(ImageFit.Auto)Image($r('app.media.lbt3' )).width('100%').height('100%').objectFit(ImageFit.Auto)Image($r('app.media.lbt4' )).width('100%').height('100%').objectFit(ImageFit.Auto)Image($r('app.media.tips' )).width('100%').height('100%').objectFit(ImageFit.Auto)}.loop(true).autoPlay(true).interval(5000)    //每隔5秒換一張.width('90%').height('25%').borderRadius(20)// 歷史記錄Row() {// 搜索歷史標題Text('搜索歷史').fontSize('31lpx').fontColor("#828385")// 清空記錄按鈕Text('清空記錄').fontSize('27lpx').fontColor("#828385")// 清空記錄按鈕點擊事件,清空歷史記錄數組.onClick(() => {this.historyValueArr.length = 0;})}.margin({top:30})// 設置Row組件的寬度、對齊方式和內外邊距.width('100%').justifyContent(FlexAlign.SpaceBetween).padding({left: '37lpx',top: '11lpx',bottom: '11lpx',right: '37lpx'})Row(){// 搜索結果列表?:ml-citation{ref="7" data="citationList"}List({ space: 10 }) {if (this.filteredDevices.length===0){ListItem() {Text(`暫時未找到任何設備..`).fontColor(Color.White)}}ForEach(this.filteredDevices, (item: DeviceBean) => {ListItem() {Text(`${item.deviceId} (${item.name})`).fontColor(Color.White)}}, item => item.deviceId)}/* List({ space: 10 }) {ForEach(this.filteredDevices, (item: DeviceBean) => {ListItem() {Text('模擬設備1').fontColor(Color.White)}ListItem() {Text('模擬設備2').fontColor(Color.White)}}, item => item.id)}*/}.margin({top:50,left:30})// 使用Flex布局,包裹搜索歷史記錄Flex({direction: FlexDirection.Row,wrap: FlexWrap.Wrap,}) {// 遍歷歷史記錄數組,創建Text組件展示每一條歷史記錄ForEach(this.historyValueArr, (item: string, value: number) => {Text(item).padding({left: '15lpx',right: '15lpx',top: '7lpx',bottom: '7lpx'})// 設置背景顏色、圓角和間距.backgroundColor("#EFEFEF").borderRadius(10)// .margin('11lpx').margin({top:5,left:20})})}// 設置Flex容器的寬度和內外邊距.width('100%').padding({top: '11lpx',bottom: '11lpx',right: '26lpx'})}.width('100%').height('100%')// .backgroundColor('#f1f2f3').backgroundImage($r('app.media.index_background1')).backgroundImageSize(ImageSize.Cover)}
}
// }

個人主頁代碼

import router from '@ohos.router';
import promptAction from '@ohos.promptAction';
import UserBean from '../common/bean/UserBean';
import { InfoItem, MineItemList } from '../model/MineItemList';
@Entry
@Component
export struct MineComponent{@State userBean:UserBean = new UserBean()@State nickname:string = this.userBean.getNickName();//昵稱@State signature:string = this.userBean.getSignature();//簽名build(){Column() {Image($r('app.media.user_avtar1')).width('100%').height('25%').opacity(0.5)Column() {Shape() {Circle({ width: 80, height: 80 }).fill('#3d3f46')Image($r('app.media.user_avtar1')).width(68).height(68).margin({ top: 6, left: 6 }).borderRadius(34)}Text(`${this.nickname}`).fontSize(18).fontWeight(FontWeight.Bold).fontColor(Color.White)Text(`${this.signature}`).fontSize(14).fontColor(Color.Orange)}.width('95%').margin({ top: -34 })//功能列表Shape() {Rect().width('100%').height(240).fill('#3d3f46').radius(40).opacity(0.5)Column() {List() {ForEach(MineItemList, (item: InfoItem) => {ListItem() {// Text(item.title)Row() {Row() {Image(item.icon).width(30).height(30)if (item.title == '個人資料') {Shape() {Rect().width('80%').height(30).opacity(0)Text(item.title).fontSize(22).fontColor(Color.White).margin({ left: 10 })}.onClick(() => {router.pushUrl({url:"myhomepage/PersonalData"})})}else if (item.title == '賬號與安全') {Shape() {Rect().width('80%').height(30).opacity(0)Text(item.title).fontSize(22).fontColor(Color.White).margin({ left: 10 })}.onClick(() => {router.pushUrl({url:"myhomepage/AccountSecurity"})})}else if (item.title == '檢查更新') {Shape() {Rect().width('80%').height(30).opacity(0)Text(item.title).fontSize(22).fontColor(Color.White).margin({ left: 10 })}.onClick(()=>{promptAction.showToast({message:"當前暫無更新",duration:2000,})})}else if (item.title == '關于') {Shape() {Rect().width('80%').height(30).opacity(0)Text(item.title).fontSize(22).fontColor(Color.White).margin({ left: 10 })}.onClick(()=>{promptAction.showToast({message:"當前版本為1.0.0",duration:2000,})})}else{Text(item.title).fontSize(22).fontColor(Color.White).margin({ left: 10 })}}Image($r('app.media.right')).width(38).height(38)}.width('100%').height(52).justifyContent(FlexAlign.SpaceBetween)}// .border({//   width: { bottom: 1 },//   color: Color.Orange// })}, item => JSON.stringify(item))}.margin(10).border({radius: {topLeft: 24,topRight: 24}})// .backgroundColor('#115f7691').width('95%')// .height('100%').margin({ top: '5%', left: '5%' })}}.margin({ top: 20 }).width('90%')}.width('100%').height('100%').backgroundImage($r('app.media.index_background1')).backgroundImageSize(ImageSize.Cover)}
}

感謝大家的閱讀和點贊,你們的支持 是我前進的動力,我會繼續保持熱愛,貢獻自己的微薄碼力!

????????

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/77579.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/77579.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/77579.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

C++的*了又*

先看下面一段代碼 class HeapWord {friend class VMStructs;private:char *i; };主函數 #include "HeapWord.hpp" int main() {HeapWord *heapword new HeapWord();HeapWord *p new HeapWord();HeapWord **p1 new HeapWord *();heapword 3;*(HeapWord **)p he…

yolov8在windows系統的C++版本的onnxruntime部署方法

1.各個軟件的的環境需要保持在統一的版本。 onnxruntime需要和cuda的版本對應上,版本號:onnxruntime-win-x64-gpu-1.18.1 ,鏈接: NVIDIA - CUDA | onnxruntime cuda:本機顯卡支持的版本,cuda11.7,鏈接:CUDA Toolkit Archive | NVIDIA Developer cudnn:需要對應到cud…

js chrome 插件,下載微博視頻

修改說明&#xff1a; 代碼資源&#xff0c;免積分下載 起因&#xff0c; 目的: 最初是想下載微博上的NBA視頻&#xff0c;因為在看網頁上看視頻很不方便&#xff0c;快進一次是10秒&#xff0c;而本地 VLC 播放器&#xff0c;快進一次是5秒。另外我還想做點視頻剪輯。 對比…

【vue3】@click函數傳動態變量參數

根據java的學習&#xff0c;摸索了一下vue3 函數傳參的方式。以此作為記錄。有更好的其它方式&#xff0c;可以評論區補充。 <script> const tmpref(); </script><button click"tmpFunction(傳遞參數:tmp)">按鈕</button> // 直接【字符串…

jmeter 集成ZAP進行接口測試中的安全掃描 實現方案

以下是將 JMeter 集成 ZAP(OWASP Zed Attack Proxy)進行接口測試中安全掃描的實現方案: 1. 環境準備 JMeter 安裝:從 JMeter 官方網站(https://jmeter.apache.org/download_jmeter.cgi)下載并安裝 JMeter,確保其版本穩定。ZAP 安裝:從 ZAP 官方網站(https://www.zapr…

全能格式轉換器v16.3.0.159綠色便攜版

前言 全能格式轉換器具有音視頻格式轉換、合并視頻、壓縮視頻、錄制視頻、下載視頻、DVD刻錄等功能。以超快的轉換速度及強大的功能在國外名聲大噪&#xff0c;轉換速度是市面同類產品的30倍&#xff0c;操作簡便&#xff0c;支持158種視頻格式無損轉換&#xff0c;批量轉換高…

【基于開源insightface的人臉檢測,人臉識別初步測試】

簡介 InsightFace是一個基于深度學習的開源人臉識別項目,由螞蟻金服的深度學習團隊開發。該項目提供了人臉檢測、人臉特征提取、人臉識別等功能,支持多種操作系統和深度學習框架。本文將詳細介紹如何在Ubuntu系統上安裝和實戰InsightFace項目。 目前github有非常多的人臉識…

設計一個簡單的權限管理系統

針對大規模服務器集群的權限管理系統設計&#xff0c;需結合 角色分層、最小權限原則 和 動態權限控制 來實現安全高效的權限管理。以下是分階段設計方案&#xff1a; 一、核心設計思路 基于角色的訪問控制&#xff08;RBAC&#xff09; 定義角色層級&#xff08;如董事長 >…

使用 nano 文本編輯器修改 ~/.bashrc 文件與一些快捷鍵

目錄 使用 nano 編輯器保存并關閉文件使用 sed 命令直接修改文件驗證更改 如果你正在使用 nano 文本編輯器來修改 ~/.bashrc 文件&#xff0c;以下是保存并關閉文件的具體步驟&#xff1a; 使用 nano 編輯器保存并關閉文件 打開 ~/.bashrc 文件 在終端中運行以下命令&#xf…

spm12_fMRI 2*4混合方差分析 Flexible factorial 對比矩陣

實驗設計&#xff1a;2*4被試內設計 分析模型&#xff1a;spm 二階分析中的 Flexible factorial 問題&#xff1a;Flexible factorial交互作用對比矩陣如何編寫&#xff1f; 老師&#xff1a;deepseek老師【大神們看看這個矩陣是否可以如下編寫&#xff1f;】 以下是來自de…

用Python修改字體字形與提取矢量數據:fontTools實戰指南

字體設計與分析是NLP和視覺領域的交叉應用&#xff0c;而**fontTools** 是一款強大的Python庫&#xff0c;可以讓我們直接操作字體文件的底層結構。本文將通過兩個實用函數&#xff0c;展示如何修改特定字形和提取所有字形的矢量數據&#xff0c;幫助開發者快速上手字體編輯與分…

Windows 11 PowerShell重定向文本文件的編碼問題

目錄 問題的由來 編碼導致的問題 解決辦法 VSCode進行轉換 記事本進行轉換 直接指定輸出的文本編碼 總結 問題的由來 在我的嵌入式系統的課程中有一個裸機開發的實驗&#xff0c;其中需要把圖片等文件轉換為C語言數組保存在程序中。課程中&#xff0c;我推薦了CodePlea的…

SQL開發的智能助手:通義靈碼在IntelliJ IDEA中的應用

SQL 是一種至關重要的數據庫操作語言&#xff0c;盡管其語法與通用編程語言有所不同&#xff0c;但因其在眾多應用中的廣泛使用&#xff0c;大多數程序員都具備一定的 SQL 編寫能力。然而&#xff0c;當面對復雜的 SQL 語句或優化需求時&#xff0c;往往需要專業數據庫開發工程…

算法——分支限界

學習目標&#xff1a; 掌握算法入門知識 學習內容&#xff1a; 分支限界的定義例題詳細步驟講解&#xff08;找牛&#xff09; 1. 分支限界的定義 分支限界法是一種用于求解 組合優化問題 的算法框架&#xff0c;通過 系統性地搜索解空間樹&#xff0c;并結合 剪枝策略 來避…

對接日本金融市場數據全指南:K線、實時行情與IPO新股

一、日本金融市場特色與數據價值 日本作為全球第三大經濟體&#xff0c;其金融市場具有以下顯著特點&#xff1a; 成熟穩定&#xff1a;日經225指數包含日本頂級藍籌股獨特交易時段&#xff1a;上午9:00-11:30&#xff0c;下午12:30-15:00&#xff08;JST&#xff09;高流動性…

解決opencv中文路徑問題

見cv_imread函數和cv_imwrite函數 import cv2 import os import matplotlib.pyplot as plt from paddleocr import PaddleOCR, draw_ocr import numpy as np import urllib.parse # Add this import statementfrom txt_get import ImageTextExtractor# 初始化OCR&#xff0c;…

Linux中的Vim與Nano編輯器命令詳解

&#x1f4e2; 友情提示&#xff1a; 本文由銀河易創AI&#xff08;https://ai.eaigx.com&#xff09;平臺gpt-4-turbo模型輔助創作完成&#xff0c;旨在提供靈感參考與技術分享&#xff0c;文中代碼與命令建議通過官方渠道驗證。 在Linux系統中&#xff0c;文本編輯是最常用的…

寶馬集團加速 ERP 轉型和上云之旅

寶馬集團&#xff08;BMW Group&#xff09;作為全球領先的豪華汽車和摩托車制造商&#xff0c;致力于構建更加智能、綠色、人性化的出行體驗。為了支持其全球化、數字化業務戰略&#xff0c;寶馬集團正在進行大規模的 IT 體系升級和 ERP 云轉型。該項目以“RISE with SAP S/4H…

大數據學習(105)-Hbase

&#x1f34b;&#x1f34b;大數據學習&#x1f34b;&#x1f34b; &#x1f525;系列專欄&#xff1a; &#x1f451;哲學語錄: 用力所能及&#xff0c;改變世界。 &#x1f496;如果覺得博主的文章還不錯的話&#xff0c;請點贊&#x1f44d;收藏??留言&#x1f4dd;支持一…

【數學建模】

全國大學生數學建模競賽(CUMCM)歷年試題速瀏(查看超級方便)_全國大學生數學建模競賽真題-CSDN博客 高教社杯全國大學生數學建模競賽歷年賽題&#xff08;含解析、評閱&#xff09; - 賽氪教育 年份 賽題 真題 問題類型 對應算法及模型 2023年 A題 定日鏡場的優化設計 …