From 68c33cf3a5dbeff851d7f05eb13245cd9876e202 Mon Sep 17 00:00:00 2001 From: xiaoxiao Date: Tue, 5 Aug 2025 16:59:58 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/src/main/ets/components/HdGrid.ets | 1 + .../ets/components/CustomScanResultComp.ets | 86 +++++++++++++++++-- .../src/main/ets/components/FlipperComp.ets | 36 +++++--- .../Home/src/main/ets/pages/VideoPage.ets | 86 +++---------------- .../mypage/src/main/ets/view/HeaderView.ets | 9 +- .../src/main/ets/view/MyPageSectionItem.ets | 9 +- .../components/GroupMessageSendingComp.ets | 2 +- .../main/ets/components/PatientApplyPage.ets | 8 +- .../src/main/ets/pages/Tabbar/TabBarComp.ets | 2 +- .../pages/VideoPage/CustomScanResultPage.ets | 2 +- .../src/main/ets/pages/WebView/WebPage.ets | 7 +- 11 files changed, 145 insertions(+), 103 deletions(-) diff --git a/commons/basic/src/main/ets/components/HdGrid.ets b/commons/basic/src/main/ets/components/HdGrid.ets index b4840ff..0d865b3 100644 --- a/commons/basic/src/main/ets/components/HdGrid.ets +++ b/commons/basic/src/main/ets/components/HdGrid.ets @@ -60,6 +60,7 @@ export struct HdGrid { .fontColor(Color.Gray) .fontSize($r('app.float.hd_list_load_font')) } + .visibility(Visibility.None) .height($r('app.float.hd_list_load_height')) .width('100%') .justifyContent(FlexAlign.Center) diff --git a/features/Home/src/main/ets/components/CustomScanResultComp.ets b/features/Home/src/main/ets/components/CustomScanResultComp.ets index 5ae52b0..1ac45b0 100644 --- a/features/Home/src/main/ets/components/CustomScanResultComp.ets +++ b/features/Home/src/main/ets/components/CustomScanResultComp.ets @@ -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 = router.getParams() as Record 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 = JSON.parse(data.result+'') as Record + 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() + } + }) +} \ No newline at end of file diff --git a/features/Home/src/main/ets/components/FlipperComp.ets b/features/Home/src/main/ets/components/FlipperComp.ets index 8f6154c..96d3a84 100644 --- a/features/Home/src/main/ets/components/FlipperComp.ets +++ b/features/Home/src/main/ets/components/FlipperComp.ets @@ -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) } } diff --git a/features/Home/src/main/ets/pages/VideoPage.ets b/features/Home/src/main/ets/pages/VideoPage.ets index eafb5db..9a5aed1 100644 --- a/features/Home/src/main/ets/pages/VideoPage.ets +++ b/features/Home/src/main/ets/pages/VideoPage.ets @@ -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 = 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 = JSON.parse(data.result+'') as Record + 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 = JSON.parse(response+'') as Record - // 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(BasicConstant.sendWebsocketMsg, { - // "message":base64Data - // } as Record).then(async (res: HdResponse) => { - // console.info('Response caseUuid'+res); - // let json:Record | Array>> = JSON.parse(res+'') as Record | Array>>; - // 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}`); - // }) } - diff --git a/features/mypage/src/main/ets/view/HeaderView.ets b/features/mypage/src/main/ets/view/HeaderView.ets index 36e1bb5..3d0da02 100644 --- a/features/mypage/src/main/ets/view/HeaderView.ets +++ b/features/mypage/src/main/ets/view/HeaderView.ets @@ -137,7 +137,7 @@ export struct HeaderView { ForEach([{'title':'随访患者数','content':this.expertData['expert_apply_num'] || '0'}, {'title':'公益咨询数','content':this.expertData['consult_total_num'] || '0'}], // {'title':'患者送花数','content':this.expertData['ping_flowewr_num'] || '0'}], - (item:object)=>{ + (item:object,index:number)=>{ Column(){ Text(item['content']?.toString() || '0') .fontSize(20) @@ -148,6 +148,13 @@ export struct HeaderView { .fontColor('#333333') .height(17) }.height('100%').justifyContent(FlexAlign.Center) + .onClick(()=>{ + if (index == 0) { + router.pushUrl({url:'pages/Netease/imTabPage'}) + } else { + router.pushUrl({ url: 'pages/Netease/PublicConsultationPage' }) + } + }) }) } }.width('95%').height(65).borderRadius(5).backgroundColor(Color.White) diff --git a/features/mypage/src/main/ets/view/MyPageSectionItem.ets b/features/mypage/src/main/ets/view/MyPageSectionItem.ets index dc0261c..f45df56 100644 --- a/features/mypage/src/main/ets/view/MyPageSectionItem.ets +++ b/features/mypage/src/main/ets/view/MyPageSectionItem.ets @@ -11,11 +11,14 @@ export struct MyPageSectionItem { .width(24).height(24) .objectFit(ImageFit.Auto) Text(this.sectionItem.title) - .maxFontSize(14) - .minFontSize(6) - .maxLines(1) + // .maxFontSize(14) + // .minFontSize(6) + .fontSize(14) + // .maxLines(1) .fontColor('#333333') .margin({ top: 10 }) + .textAlign(TextAlign.Center) + .width('120%') }.width('100%') if (this.sectionItem.status) { Text().backgroundColor(Color.Red).width(10).height(10).borderRadius(5) diff --git a/features/patient/src/main/ets/components/GroupMessageSendingComp.ets b/features/patient/src/main/ets/components/GroupMessageSendingComp.ets index 1b58541..c442879 100644 --- a/features/patient/src/main/ets/components/GroupMessageSendingComp.ets +++ b/features/patient/src/main/ets/components/GroupMessageSendingComp.ets @@ -276,7 +276,7 @@ export struct GroupMessageSendingComp { .scrollBar(BarState.Off) .layoutWeight(1) - EmptyViewComp({promptText:'暂无随访计划',isVisibility:true}) + EmptyViewComp({promptText:'暂无群发消息',isVisibility:true}) .width('100%') .height('100%') .visibility(this.messageList.length>0?Visibility.None:Visibility.Visible) diff --git a/features/patient/src/main/ets/components/PatientApplyPage.ets b/features/patient/src/main/ets/components/PatientApplyPage.ets index 0769727..9ca7517 100644 --- a/features/patient/src/main/ets/components/PatientApplyPage.ets +++ b/features/patient/src/main/ets/components/PatientApplyPage.ets @@ -1,5 +1,5 @@ import { ApplyViews } from '../views/ApplyViews' -import { authStore, HdNav } from '@itcast/basic'; +import { authStore, EmptyViewComp, HdNav } from '@itcast/basic'; import { applyListCallBacl,applyListModel,applyHistoryCallBacl,historyModel } from '../models/ApplyModel' import HashMap from '@ohos.util.HashMap'; import { HdLoadingDialog } from '@itcast/basic' @@ -227,10 +227,14 @@ export struct PatientApplyPage { }) }.width('100%').alignItems(HorizontalAlign.Start) } + EmptyViewComp({promptText:'暂无新随访申请患者',isVisibility:true}) + .visibility(this.historyArray.length>0||this.applyArray.length>0?Visibility.None:Visibility.Visible) + .width('100%') + .height('90%') }.width('100%').height('100%').backgroundColor('#f4f4f4') } - submintMessage(patient_user_uuid:string) { + submintMessage(patient_user_uuid:string) {//使用群发 const hashMap: HashMap = new HashMap(); hashMap.set('msg_type','1') hashMap.set('msg_content','你好,我已经是你的随访医生了') diff --git a/products/expert/src/main/ets/pages/Tabbar/TabBarComp.ets b/products/expert/src/main/ets/pages/Tabbar/TabBarComp.ets index f6ea502..acb4c6c 100644 --- a/products/expert/src/main/ets/pages/Tabbar/TabBarComp.ets +++ b/products/expert/src/main/ets/pages/Tabbar/TabBarComp.ets @@ -38,7 +38,7 @@ export struct TabBarComp { .width($r('app.float.tab_bar_item_icon_size')) Text(item.label) .fontSize($r('app.float.tab_bar_item_font_size')) - .fontColor(this.activeIndex === index ? $r('app.color.black') : $r('app.color.common_gray_01')) + .fontColor(this.activeIndex === index ? $r('app.color.main_color') : $r('app.color.common_gray_01')) .animation({ duration: 300 }) } } diff --git a/products/expert/src/main/ets/pages/VideoPage/CustomScanResultPage.ets b/products/expert/src/main/ets/pages/VideoPage/CustomScanResultPage.ets index 147bbfe..a3b64da 100644 --- a/products/expert/src/main/ets/pages/VideoPage/CustomScanResultPage.ets +++ b/products/expert/src/main/ets/pages/VideoPage/CustomScanResultPage.ets @@ -2,7 +2,7 @@ import { CustomScanResultComp } from 'home' @Entry @Component -struct CustomScanPage { +struct CustomScanResultPage { build() { RelativeContainer() { CustomScanResultComp() diff --git a/products/expert/src/main/ets/pages/WebView/WebPage.ets b/products/expert/src/main/ets/pages/WebView/WebPage.ets index a4e7b31..93bf727 100644 --- a/products/expert/src/main/ets/pages/WebView/WebPage.ets +++ b/products/expert/src/main/ets/pages/WebView/WebPage.ets @@ -14,11 +14,14 @@ struct WebPage { private controller: webview.WebviewController = new webview.WebviewController(); @State params:RouteParams = router.getParams() as RouteParams; + // 修改为移动端User-Agent,解决链接中有视频的问题 + private customUserAgent: string = 'Mozilla/5.0 (Linux; Android 10; HarmonyOS) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 gdxz-expert'; + @State contentWidth: number = 0; @State contentHeight: number = 0; @State url: string = this.params.url; @State title: string = this.params.title; - customUserAgent: string = 'gdxz-expert'; + // customUserAgent: string = 'gdxz-expert'; onBackPress(): boolean | void { if (this.controller.accessStep(-1)) { @@ -61,7 +64,7 @@ struct WebPage { }) }) .width('100%') - .layoutWeight(1)// 占据剩余空间 + .layoutWeight(1) .height('100%') if (this.title == '随访二维码') { Row(){