# Conflicts:
#	features/register/src/main/ets/view/LoginComp.ets
This commit is contained in:
XiuYun CHEN
2025-08-05 09:58:30 +08:00
15 changed files with 785 additions and 8 deletions
+3 -1
View File
@@ -28,4 +28,6 @@ export { MeetingItemModel,MeetingModel,MeetingModels,ItemModel } from './src/mai
export { VideoSelected } from './src/main/ets/pages/VideoSelected'
export { videoTools } from './src/main/ets/polyv/VideoUtil'
export { videoTools } from './src/main/ets/polyv/VideoUtil'
export { CustomScanResultComp }from './src/main/ets/components/CustomScanResultComp'
@@ -0,0 +1,15 @@
import { HdNav, ScanUtil } from '@itcast/basic'
import { promptAction } from '@kit.ArkUI'
@Component
export struct CustomScanResultComp {
aboutToAppear(): void {
}
build() {
Column() {
HdNav({isLeftAction:false,title:'扫描二维码',showRightIcon:false,showRightText:false})
}
}
}
@@ -117,7 +117,7 @@ export struct HomePage {
Scroll(this.scroller) {
Column() {
if (this.homeData.news_list && this.homeData.news_list.length > 0) {
HomeSwiperComp({ newslist: this.homeData.news_list, expertData: this.homeData.expertDetail })
HomeSwiperComp({ newslist: this.homeData.news_list?this.homeData.news_list:[], expertData: this.homeData.expertDetail })
.height(getDisplayWindowWidth().vp / 16 * 9)
}
if (this.homeData.icons_list && this.homeData.icons_list.length > 0) {
+91 -3
View File
@@ -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}`);
// })
}
@@ -125,7 +125,9 @@ export struct LoginComp {
}
})
} else {
this.loadPatients()//登录成功后获取患者数据存入数据库
this.loginstatus=true
authStore.setUser(objs.data)
// emitter.emit({ eventId: 100401 })
logger.info('Response state'+state);
@@ -170,6 +172,14 @@ export struct LoginComp {
console.info(`Response login succeeded: ${err}`);
})
}
async loadPatients() {
try {
await patientDbManager.patientsToFMDB();
} catch (error) {
console.error('加载患者数据失败:', error);
}
}
build() {
Column() {
HdNav({ title: '登录', showRightIcon: false,showLeftIcon:false })