bug修复

This commit is contained in:
xiaoxiao
2025-08-05 16:59:58 +08:00
parent 76b7785d84
commit 68c33cf3a5
11 changed files with 145 additions and 103 deletions
@@ -1,15 +1,89 @@
import { HdNav, ScanUtil } from '@itcast/basic'
import { promptAction } from '@kit.ArkUI'
import { AESEncryptionDecryption, authStore, BasicConstant, HdNav, ScanUtil } from '@itcast/basic'
import { promptAction, router } from '@kit.ArkUI'
import { http } from '@kit.NetworkKit'
@Component
export struct CustomScanResultComp {
aboutToAppear(): void {
}
@State params:Record<string,string> = router.getParams() as Record<string,string>
build() {
Column() {
HdNav({isLeftAction:false,title:'扫描二维码',showRightIcon:false,showRightText:false})
HdNav({isLeftAction:false,title:'扫描登录',showRightIcon:false,showRightText:false})
Image($r('app.media.scan_success_icon'))
.objectFit(ImageFit.Contain)
.width(210)
.height(74)
.margin({top:70})
Text('确认电脑登录\n为确保账号安全,请确认是您本人操作')
.textAlign(TextAlign.Center)
.fontSize(16)
.fontColor('rgba(102,102,102,1)')
.margin({top:50})
Text('确认登录')
.textAlign(TextAlign.Center)
.fontSize(18)
.fontColor(Color.White)
.width('90%')
.height(40)
.backgroundColor($r('app.color.main_color'))
.borderRadius(3)
.margin({left:15,right:15,top:100})
.onClick(()=>isAuthorization(this.params.id,true))
Text('确认登录')
.textAlign(TextAlign.Center)
.fontSize(18)
.fontColor('rgba(153,153,153,1)')
.borderWidth(1)
.borderColor('rgba(153,153,153,1)')
.width('90%')
.height(40)
.backgroundColor(Color.White)
.borderRadius(3)
.margin({left:15,right:15,top:20})
.onClick(()=>isAuthorization(this.params.id,false))
}
}
}
async function isAuthorization(str:string,type:boolean) {
let scanString = ''
if (type) {
scanString = `watchliveTo}${str}}${authStore.getUser().uuid},${authStore.getUser().realName},${authStore.getUser().photo}`
} else {
scanString = `watchliveCancel}${str}}${authStore.getUser().uuid},${authStore.getUser().realName},${authStore.getUser().photo}`
}
const scanData = await AESEncryptionDecryption.aesEncrypt(scanString,BasicConstant.ExpertAesKey)
const encodedString = encodeURIComponent(scanData)
let httpRequest = http.createHttp();
let data = "message="+encodedString;
httpRequest.request(
BasicConstant.sendWebsocketMsg,
{
method: http.RequestMethod.POST,
header: { 'Content-Type': 'application/x-www-form-urlencoded' },
extraData: data,
connectTimeout: 60000,
readTimeout: 60000,
}, (err, data) => {
if (!err) {
console.info('Result:' + JSON.stringify(data.result));
let json:Record<string,string> = JSON.parse(data.result+'') as Record<string,string>
if (type) {
promptAction.showToast({ message: String(json.message), duration: 1000 })
}
if(json.code == '1') {
router.back()
} else {
console.error('获取患者信息失败:'+json.message)
}
} else {
console.info('error:' + JSON.stringify(err))
httpRequest.off('headersReceive')
httpRequest.destroy()
}
})
}
@@ -2,7 +2,9 @@ import { FlipperOptions,FlipperView,FlipperOptionsBuilder } from '@hshare/hshare
import { promptAction } from '@kit.ArkUI';
import { router } from '@kit.ArkUI'
import { meetingModel } from '../model/HomeModel'
import { TimestampUtil } from '@itcast/basic'
import { AESEncryptionDecryption, authStore, Base64Util, BasicConstant,
DataWebModels,
TimestampUtil } from '@itcast/basic'
@Component
export struct FlipperComp {
@@ -10,13 +12,18 @@ export struct FlipperComp {
@State processedData: meetingModel[] = [];
options: FlipperOptions = FlipperOptionsBuilder.getInstance()
.setHeight(56)//View高度
.setInterval(3000)//上下滚动间隔,单位为毫秒
.setAnimateParam(500)//动画持续时间,单位为毫秒
.setHeight(56)
.setInterval(3000)
.setAnimateParam(500)
.setOnItemClicked((item: meetingModel, index: number) => {
let paramsInfo: DataWebModels = {
url:item.liveurl ,
title:'肝胆直播',
type:'live'
};
router.pushUrl({
url: 'pages/WebView/WebPage', // 目标url
params: {url:item.liveurl,title:item.title}
url: 'pages/WebView/LivebroadcastPages', // 目标url
params: paramsInfo // 添加params属性,传递自定义参数
})
})
.setOnItemScrolled((item: meetingModel, index: number) => {
@@ -56,13 +63,13 @@ export struct FlipperComp {
Column() {
Row({space:2}){
Image($r('app.media.meeting_live_icon')).width(30).height(13)
if (item.state === '1') {
if (item.state == '1') {
if (TimestampUtil.isToday(item.begin_date_timestamp)) {
Image($r('app.media.meeting_begin_play_icon')).width(16).height(16)
} else {
Image($r('app.media.meeting_noPlay_icon')).width(16).height(16)
}
} else if (item.state === '0' || item.state === '3') {
} else if (item.state == '0' || item.state == '3') {
if (TimestampUtil.isToday(item.begin_date_timestamp)) {
Image($r('app.media.meeting_begin_play_icon')).width(16).height(16)
} else {
@@ -74,20 +81,20 @@ export struct FlipperComp {
}
Stack({alignContent:Alignment.Center}){
Image($r('app.media.meeting_timeBack_icon')).width(74).height(15).margin({top:-3})
if (item.state === '1') {
if (item.state == '1') {
if (TimestampUtil.isToday(item.begin_date_timestamp)) {
Text('开播'+TimestampUtil.format(item.begin_date_timestamp,'HH:mm'))
.fontSize(12).fontColor(Color.White)
} else {
Text(TimestampUtil.format(item.begin_date_timestamp,'MM月dd日'))
Text(TimestampUtil.format(item.begin_date_timestamp,'MM月DD日'))
.fontSize(12).fontColor(Color.White)
}
} else if (item.state === '0' || item.state === '3') {
} else if (item.state == '0' || item.state == '3') {
if (TimestampUtil.isToday(item.begin_date_timestamp)) {
Text('开播'+TimestampUtil.format(item.begin_date_timestamp,'HH:mm'))
.fontSize(12).fontColor(Color.White)
} else {
Text(TimestampUtil.format(item.begin_date_timestamp,'MM月dd日'))
Text(TimestampUtil.format(item.begin_date_timestamp,'MM月DD日'))
.fontSize(12).fontColor(Color.White)
}
} else {
@@ -101,7 +108,10 @@ export struct FlipperComp {
Text(item.title)
.fontSize(14)
.fontColor('#333333')
.margin({left:9})
.width('70%')
.margin({left:9,right:10})
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.margin({top:10}).width('100%').height(46)
}
}
+13 -73
View File
@@ -7,7 +7,6 @@ import cryptoFramework from '@ohos.security.cryptoFramework';
import util from '@ohos.util';
import { BusinessError } from '@kit.BasicServicesKit';
import { rcp } from '@kit.RemoteCommunicationKit';
import { HashMap } from '@kit.ArkTS';
import { http } from '@kit.NetworkKit';
@Entry
@@ -267,26 +266,10 @@ async function decryptString(str:string) {
console.error("解密失败:", error)
}
}
//liveScanSuccess}8c30fb02189a44ed95d856f39a1fe792}1CBMDQbuOX3xbxAcxE5,Ios测试,expert/2025-07-09/7a4e8aa78bcb495b87ede343b7763ef9.jpg
//liveScanSuccess}8c30fb02189a44ed95d856f39a1fe792}1CBMDQbuOX3xbxAcxE5,Ios测试,expert/2025-07-09/7a4e8aa78bcb495b87ede343b7763ef9.jpg
//liveScanSuccess}8c30fb02189a44ed95d856f39a1fe792}1CBMDQbuOX3xbxAcxE5,Ios测试,expert/2025-07-09/7a4e8aa78bcb495b87ede343b7763ef9.jpg
// PfLvaZPedZHfbA0uwxOiOF76Du652Bsm89X1x1BlPoADdXYM1Tvg4PHHXXhK7BP1XSBDBc5aQbgw9+K9+Vr4HZfYQ9BKFtpz1bDPF+FiIsb+P6hXUwIYu5dy9EJjZUZBFJr8GQibSH3XwyqjqmsHAW3AVOWYZY6qvNenjoGjmjR0Msts21E+E31RBCK3Kvaj
// PfLvaZPedZHfbA0uwxOiOF76Du652Bsm89X1x1BlPoADdXYM1Tvg4PHHXXhK7BP1XSBDBc5aQbgw9+K9+Vr4HZfYQ9BKFtpz1bDPF+FiIsb+P6hXUwIYu5dy9EJjZUZBFJr8GQibSH3XwyqjqmsHAW3AVOWYZY6qvNenjoGjmjR0Msts21E+E31RBCK3Kvaj
// PfLvaZPedZHfbA0uwxOiOF76Du652Bsm89X1x1BlPoADdXYM1Tvg4PHHXXhK7BP1XSBDBc5aQbgw9%2BK9%2BVr4HZfYQ9BKFtpz1bDPF%2BFiIsb%2BP6hXUwIYu5dy9EJjZUZBFJr8GQibSH3XwyqjqmsHAW3AVOWYZY6qvNenjoGjmjR0Msts21E%2BE31RBCK3Kvaj
// B2e%2B96mEodDQ5EIsmcpfh6cJbH7WhjSkXrIz8JtGf2gREqwSckolodE2%2FdNTTssxvwLTAltHlphKiSYWT91IpBUkt30diwj0VF1elbS193JwyOF4AU%2FhJ%2FRYQtxUHrB%2BlRo65QEhktb7z79lsRuJwUKISPEbTkrCVzRx9QDGcihdsOe44ABgLH%2BmyFhgEsMC
// B2e%2B96mEodDQ5EIsmcpfh6cJbH7WhjSkXrIz8JtGf2gREqwSckolodE2%2FdNTTssxvwLTAltHlphKiSYWT91IpBUkt30diwj0VF1elbS193JwyOF4AU%2FhJ%2FRYQtxUHrB%2BlRo65QEhktb7z79lsRuJwUKISPEbTkrCVzRx9QDGcihdsOe44ABgLH%2BmyFhgEsMC
// B2e+96mEodDQ5EIsmcpfh6cJbH7WhjSkXrIz8JtGf2gREqwSckolodE2/dNTTssxvwLTAltHlphKiSYWT91IpBUkt30diwj0VF1elbS193JwyOF4AU/hJ/RYQtxUHrB+lRo65QEhktb7z79lsRuJwUKISPEbTkrCVzRx9QDGcihdsOe44ABgLH+myFhgEsMC
async function pushScanPage(str:string) {
const liceScanSuccess = `videoScanSuccess}${str}}${authStore.getUser().uuid},${authStore.getUser().realName},${authStore.getUser().photo}`
// const textEncoder = new util.TextEncoder()
// const inputData: Uint8Array = textEncoder.encodeInto(liceScanSuccess)
// const scanData = await AESEncryptionDecryption.aes128Encrypt(inputData,BasicConstant.ExpertAesKey)
// const base64Data = AESEncryptionDecryption.customBase64Encode(scanData)
// const encodedString = encodeURIComponent(base64Data)
// let hashMap: HashMap<string, string> = new HashMap()
// hashMap.set('message',this.code)
const scanData =await AESEncryptionDecryption.aesEncrypt(liceScanSuccess,"deoep09_klodLdAo")
async function pushScanPage(str:string) {
const liceScanSuccess = `liveScanSuccess}${str}}${authStore.getUser().uuid},${authStore.getUser().realName},${authStore.getUser().photo}`
const scanData = await AESEncryptionDecryption.aesEncrypt(liceScanSuccess,BasicConstant.ExpertAesKey)
const encodedString = encodeURIComponent(scanData)
let httpRequest = http.createHttp();
let data = "message="+encodedString;
@@ -294,69 +277,26 @@ async function pushScanPage(str:string) {
BasicConstant.sendWebsocketMsg,
{
method: http.RequestMethod.POST,
// Optional, default is http.RequestMethod.GET//Developers can add header fields according to their own business needs
header: { 'Content-Type': 'application/x-www-form-urlencoded' }, // This field is used to pass content when using POST requests
header: { 'Content-Type': 'application/x-www-form-urlencoded' },
extraData: data,
connectTimeout: 60000, // Optional, default is 60000ms
readTimeout: 60000, // Optional, default is 60000ms
connectTimeout: 60000,
readTimeout: 60000,
}, (err, data) => {
if (!err) {
// Data.read is the HTTP response content, which can be parsed according to business needs
console.info('Result:' + JSON.stringify(data.result));
console.info('code:' +
JSON.stringify(data.responseCode)); // Data.reader is an HTTP response header that can be parsed according to business needs
console.info('header:' + JSON.stringify(data.header));
console.info('cookies:' +
JSON.stringify(data.cookies)); // Starting from API8
let json:Record<string,string> = JSON.parse(data.result+'') as Record<string,string>
if(json.code == '1') {
router.pushUrl({url:'pages/VideoPage/CustomScanResultPage',params: {"id":str}})
} else {
console.error('获取患者信息失败:'+json.message)
promptAction.showToast({ message: String(json.message), duration: 1000 })
}
} else {
console.info('error:' + JSON.stringify(err)); // Unsubscribe from HTTP response header events
httpRequest.off('headersReceive'); // When the request is exhausted, call the destroy method to actively destroy it.
httpRequest.destroy();
}
})
// const postContent = new rcp.MultipartForm({
// 'message': encodedString
// })
// const postContent: rcp.RequestContent = {
// fields: {
// 'message': encodedString,
//
// }
// }
// const session = rcp.createSession()
// session.post(BasicConstant.sendWebsocketMsg, {
// data: postContent,
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded'
// }
// })
// .then((response) => {
// let json:Record<string,string> = JSON.parse(response+'') as Record<string,string>
// if(json.code == '1') {
// router.pushUrl({url:'pages/VideoPage/CustomScanPage'})
// } else {
// promptAction.showToast({ message: String(json.message), duration: 1000 })
// }
// })
// .catch((err: BusinessError) => {
// console.error(`Response err: Code is ${JSON.stringify(err.code)}, message is ${JSON.stringify(err)}`);
// })
// hdHttp.post<string>(BasicConstant.sendWebsocketMsg, {
// "message":base64Data
// } as Record<string,string>).then(async (res: HdResponse<string>) => {
// console.info('Response caseUuid'+res);
// let json:Record<string,string | Record<string,string> | Array<Record<string,string>>> = JSON.parse(res+'') as Record<string,string | Record<string,string> | Array<Record<string,string>>>;
// if(json.code == '1') {
//
// } else {
// console.error('获取患者信息失败:'+json.message)
// promptAction.showToast({ message: String(json.message), duration: 1000 })
// }
// }).catch((err: BusinessError) => {
// console.error(`Response fails: ${err}`);
// })
}