|
|
|
@@ -1,7 +1,13 @@
|
|
|
|
|
import { HdNav,BasicConstant } from '@itcast/basic'
|
|
|
|
|
import { HdNav,BasicConstant, ScanUtil, AESEncryptionDecryption, hdHttp, HdResponse, authStore,
|
|
|
|
|
Base64Util } from '@itcast/basic'
|
|
|
|
|
|
|
|
|
|
import { ListComp } from '../components/ListComp'
|
|
|
|
|
import { router } from '@kit.ArkUI'
|
|
|
|
|
import { promptAction, router } from '@kit.ArkUI'
|
|
|
|
|
import cryptoFramework from '@ohos.security.cryptoFramework';
|
|
|
|
|
import util from '@ohos.util';
|
|
|
|
|
import { BusinessError } from '@kit.BasicServicesKit';
|
|
|
|
|
import { rcp } from '@kit.RemoteCommunicationKit';
|
|
|
|
|
|
|
|
|
|
@Entry
|
|
|
|
|
@Component
|
|
|
|
|
export struct VideoPage {
|
|
|
|
@@ -35,7 +41,15 @@ export struct VideoPage {
|
|
|
|
|
{
|
|
|
|
|
Column()
|
|
|
|
|
{
|
|
|
|
|
HdNav({ title: '肝胆会议', showRightIcon: false, showLeftIcon: false,showRightText:false,rightText:'扫一扫' })
|
|
|
|
|
HdNav({ title: '肝胆会议', showRightIcon: false, showLeftIcon: false,showRightText:true,rightText:'扫一扫',rightTextColor:$r('app.color.main_color'),rightItemAction:()=>{
|
|
|
|
|
if (ScanUtil.canIUseScan()) {
|
|
|
|
|
ScanUtil.startScanForResult().then((scanResult) => {
|
|
|
|
|
decryptString(scanResult.originalValue)
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
promptAction.showToast({message:'当前设备不支持扫码能力!',duration:1500})
|
|
|
|
|
}
|
|
|
|
|
} })
|
|
|
|
|
Row() {
|
|
|
|
|
|
|
|
|
|
Row() {
|
|
|
|
@@ -230,4 +244,78 @@ function Line() {
|
|
|
|
|
.height(0.5).width('100%').backgroundColor($r('app.color.devider_line'))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function decryptString(str:string) {
|
|
|
|
|
try {
|
|
|
|
|
const decodedData = Base64Util.decodeSync(str)
|
|
|
|
|
const decryptedData = await AESEncryptionDecryption.aes128Decrypt(decodedData, BasicConstant.ExpertAesKey)
|
|
|
|
|
const textDecoder = new util.TextDecoder()
|
|
|
|
|
const decryptedStr = textDecoder.decodeToString(decryptedData)
|
|
|
|
|
if (decryptedStr.includes("watchliveFrom:") || decryptedStr.includes("watchvideoFrom:")) {
|
|
|
|
|
const arrB = decryptedStr.split(":")
|
|
|
|
|
if (arrB.length === 2) {
|
|
|
|
|
const secondStr = arrB[1]
|
|
|
|
|
console.log("解密成功,第二部分字符串:", secondStr)
|
|
|
|
|
pushScanPage(secondStr)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
console.error("您扫描的不是有效的肝胆相照平台二维码")
|
|
|
|
|
promptAction.showToast({message:'您扫描的不是有效的肝胆相照平台二维码',duration:1500})
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
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 = `liveScanSuccess}${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)
|
|
|
|
|
const postContent = new rcp.MultipartForm({
|
|
|
|
|
'message': encodedString
|
|
|
|
|
})
|
|
|
|
|
const session = rcp.createSession()
|
|
|
|
|
session.post(BasicConstant.sendWebsocketMsg, {
|
|
|
|
|
data: postContent,
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.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}`);
|
|
|
|
|
// })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|