首页、患者分组、审核、列表等
This commit is contained in:
@@ -2,6 +2,11 @@
|
||||
import { TabBarCompModel } from '../models/TabBarCompModel'
|
||||
|
||||
export const TabBarItems: TabBarCompModel[] = [
|
||||
{
|
||||
defaultIcon: $r('app.media.home_default_icon'),
|
||||
activeIcon: $r('app.media.home_selected_icon'),
|
||||
label: '首页'
|
||||
},
|
||||
{
|
||||
defaultIcon: $r('app.media.home_my_meeting_nor'),
|
||||
activeIcon: $r('app.media.home_my_meeting_sel'),
|
||||
|
||||
@@ -4,12 +4,15 @@ import { window } from '@kit.ArkUI';
|
||||
import notificationManager from '@ohos.notificationManager';
|
||||
import { PLVMediaPlayerStartUp } from '../startup/PLVMediaPlayerStartUp';
|
||||
import contextConstant from '@ohos.app.ability.contextConstant';
|
||||
import { patientDbManager } from '@itcast/basic';
|
||||
const DOMAIN = 0x0000;
|
||||
|
||||
export default class EntryAbility extends UIAbility {
|
||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
||||
AppStorage.Set('notificationEnabled', false); // 假设默认关闭
|
||||
this.checkNotificationStatus(); // 首次检查
|
||||
// 初始化患者数据库
|
||||
this.initPatientDatabase();
|
||||
|
||||
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
|
||||
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate');
|
||||
@@ -19,6 +22,15 @@ export default class EntryAbility extends UIAbility {
|
||||
PLVMediaPlayerStartUp.start(this.context)
|
||||
}
|
||||
|
||||
private async initPatientDatabase() {
|
||||
try {
|
||||
await patientDbManager.initDatabase(this.context);
|
||||
console.info('患者数据库初始化成功');
|
||||
} catch (error) {
|
||||
console.error('患者数据库初始化失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy');
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { TabBarComp } from '../pages/Tabbar/TabBarComp';
|
||||
import { BasicConstant, themeManager } from '@itcast/basic';
|
||||
import { BasicConstant, themeManager,hdHttp, HdResponse, authStore } from '@itcast/basic';
|
||||
import { emitter } from '@kit.BasicServicesKit';
|
||||
import { common } from '@kit.AbilityKit';
|
||||
import { promptAction } from '@kit.ArkUI';
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { patientDbManager, PatientEntity } from '@itcast/basic';
|
||||
import { NimRepository } from '../entryability/NimRepository'
|
||||
import { AppConfig } from '../constants/AppConfig'
|
||||
|
||||
@@ -12,6 +14,7 @@ struct Home {
|
||||
@State
|
||||
@Watch('onChangeIndex')
|
||||
activeIndex: number = 0
|
||||
@State patients: PatientEntity[] = [];
|
||||
|
||||
|
||||
login = async (accountId: string, token: string) => {
|
||||
@@ -37,11 +40,20 @@ struct Home {
|
||||
else themeManager.settingStatusBarBlack()
|
||||
}
|
||||
|
||||
async loadPatients() {
|
||||
try {
|
||||
await patientDbManager.patientsToFMDB();
|
||||
} catch (error) {
|
||||
console.error('加载患者数据失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
onPageShow(): void {
|
||||
console.log('--onPageShow--');
|
||||
emitter.emit('notification_status_changed')
|
||||
this.onChangeIndex()
|
||||
// emitter.emit({eventId:BasicConstant.notification_home_tab_change},{data:{'changeIndex':this.activeIndex}})
|
||||
this.loadPatients();
|
||||
}
|
||||
|
||||
onPageHide(): void {
|
||||
@@ -62,8 +74,6 @@ struct Home {
|
||||
const ctx = getContext() as common.UIAbilityContext
|
||||
ctx.terminateSelf()
|
||||
}
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -73,4 +83,8 @@ struct Home {
|
||||
}
|
||||
.backgroundColor($r('app.color.white'))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface updateExtraData {
|
||||
expertUuid: string
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { BuildOrEditGroupPage } from 'patient'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct BuildGroupPage {
|
||||
@Provide refreshFlag:boolean = false;
|
||||
|
||||
onPageShow(): void {
|
||||
this.refreshFlag = !this.refreshFlag;
|
||||
}
|
||||
|
||||
build() {
|
||||
RelativeContainer() {
|
||||
BuildOrEditGroupPage();
|
||||
}
|
||||
.height('100%')
|
||||
.width('100%')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { PatientDetailsComp } from 'patient'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct PatientDetailsPage {
|
||||
@Provide refreshFlag:boolean = false;
|
||||
|
||||
onPageShow(): void {
|
||||
this.refreshFlag = !this.refreshFlag;
|
||||
}
|
||||
|
||||
build() {
|
||||
RelativeContainer() {
|
||||
PatientDetailsComp()
|
||||
}
|
||||
.height('100%')
|
||||
.width('100%')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { PatientSetMsgPage } from 'patient'
|
||||
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct PatientMsgSetPage {
|
||||
build() {
|
||||
RelativeContainer() {
|
||||
PatientSetMsgPage();
|
||||
}
|
||||
.height('100%')
|
||||
.width('100%')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { PatientApplyPage } from 'patient'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct PatientPages {
|
||||
build() {
|
||||
RelativeContainer() {
|
||||
PatientApplyPage();
|
||||
}
|
||||
.height('100%')
|
||||
.width('100%')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { PatientsGroup } from 'patient'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct PatientsGroupPage {
|
||||
@Provide refreshFlag:boolean = false;
|
||||
|
||||
onPageShow(): void {
|
||||
this.refreshFlag = !this.refreshFlag;
|
||||
}
|
||||
|
||||
build() {
|
||||
RelativeContainer() {
|
||||
PatientsGroup();
|
||||
}
|
||||
.height('100%')
|
||||
.width('100%')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { PatientsListComp } from 'patient'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct PatientsListPage {
|
||||
|
||||
build() {
|
||||
RelativeContainer(){
|
||||
PatientsListComp();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { VideoPage,VideoGandan } from 'home'
|
||||
import { VideoPage,VideoGandan, HomePage } from 'home'
|
||||
import { MyHomePage } from 'mypage'
|
||||
import { TabBarCompModel } from '../../models/TabBarCompModel'
|
||||
import { TabBarItems } from '../../contants/TabBarItems'
|
||||
@@ -50,10 +50,10 @@ export struct TabBarComp {
|
||||
}) {
|
||||
ForEach(TabBarItems, (item: TabBarCompModel, index: number) => {
|
||||
TabContent() {
|
||||
if (index === 0) VideoPage()
|
||||
else if (index === 1) VideoGandan()
|
||||
else if (index === 2) MyHomePage()
|
||||
// else MyHomePage()
|
||||
if (index === 0) HomePage()
|
||||
else if (index === 1) VideoPage()
|
||||
else if (index === 2) VideoGandan()
|
||||
else MyHomePage()
|
||||
}
|
||||
.tabBar(this.TabBarBuilder(item, index))
|
||||
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { VideoGandan } from 'home'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct VideoGandanPage {
|
||||
|
||||
|
||||
build() {
|
||||
RelativeContainer() {
|
||||
VideoGandan()
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import webview from '@ohos.web.webview';
|
||||
import { HdNav } from '@itcast/basic';
|
||||
import router from '@ohos.router';
|
||||
import { image } from '@kit.ImageKit';
|
||||
import { photoAccessHelper } from '@kit.MediaLibraryKit';
|
||||
import { promptAction } from '@kit.ArkUI';
|
||||
import { componentSnapshot } from '@kit.ArkUI';
|
||||
import { fileIo, fileUri } from '@kit.CoreFileKit';
|
||||
const TAG = 'WebViewSaveImage';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
@@ -8,29 +14,117 @@ struct WebPage {
|
||||
private controller: webview.WebviewController = new webview.WebviewController();
|
||||
@State params:RouteParams = router.getParams() as RouteParams;
|
||||
|
||||
@State contentWidth: number = 0;
|
||||
@State contentHeight: number = 0;
|
||||
@State url: string = this.params.url;
|
||||
@State title: string = this.params.title;
|
||||
customUserAgent: string = 'gdxz-expert';
|
||||
|
||||
onBackPress(): boolean | void {
|
||||
if (this.controller.accessStep(-1)) {
|
||||
this.controller.backward();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
HdNav({ title: this.title, showRightIcon: false, hasBorder: true })
|
||||
HdNav({ title: this.title, showRightIcon: false, hasBorder: true ,isLeftAction:true,leftItemAction:()=>{
|
||||
if (this.controller.accessBackward()) {
|
||||
this.controller.backward();
|
||||
} else {
|
||||
router.back();
|
||||
}
|
||||
}})
|
||||
Web({
|
||||
src: this.url,
|
||||
controller: this.controller
|
||||
})
|
||||
.id('webView')
|
||||
.mixedMode(MixedMode.All)
|
||||
.overScrollMode(OverScrollMode.ALWAYS)
|
||||
.domStorageAccess(true)
|
||||
.onControllerAttached(() => {
|
||||
let userAgent = this.controller.getUserAgent() + this.customUserAgent;
|
||||
this.controller.setCustomUserAgent(userAgent);
|
||||
})
|
||||
.onPageEnd(() => {
|
||||
// 注入JS获取body高度
|
||||
this.controller.runJavaScript(
|
||||
'document.documentElement.scrollWidth', (error, result) => {
|
||||
if (!error) this.contentWidth = Number(result);
|
||||
}
|
||||
);
|
||||
this.controller.runJavaScript('document.body.scrollHeight',(error,result)=>{
|
||||
if (!error) this.contentHeight = Number(result);
|
||||
})
|
||||
})
|
||||
.width('100%')
|
||||
.layoutWeight(1)// 占据剩余空间
|
||||
.height('100%')
|
||||
if (this.title == '我的二维码') {
|
||||
Row(){
|
||||
SaveButton({text:SaveDescription.SAVE_IMAGE,buttonType:ButtonType.Normal})
|
||||
.fontSize(16)
|
||||
.fontColor(Color.White)
|
||||
.backgroundColor('rgb(63,199,193)')
|
||||
.width('100%').height(50)
|
||||
.onClick(async (event, result) => {
|
||||
// if (result === SaveButtonOnClickResult.SUCCESS) {
|
||||
await this.saveWebViewImage();
|
||||
// }
|
||||
})
|
||||
}.width('100%').height(56).backgroundColor(Color.White).alignItems(VerticalAlign.Top)
|
||||
}
|
||||
}
|
||||
.height('100%')// 关键:约束父容器高度
|
||||
}
|
||||
|
||||
async saveWebViewImage() {
|
||||
try {
|
||||
// 1. 获取整个网页的长截图
|
||||
this.controller.webPageSnapshot({
|
||||
id: "webView",
|
||||
size: { width: this.contentWidth, height:this.contentHeight } // 确保捕获全尺寸
|
||||
}, async (error, result) => {
|
||||
if (error) {
|
||||
promptAction.showToast({ message: `截图失败: ${error.message}` });
|
||||
console.error('webPageSnapshot error:', error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!result?.imagePixelMap) {
|
||||
promptAction.showToast({ message: '获取截图数据失败' });
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 转为JPEG并写入沙箱
|
||||
const ctx = getContext(this);
|
||||
const imagePacker = image.createImagePacker();
|
||||
const arrayBuffer = await imagePacker.packToData(
|
||||
result.imagePixelMap,
|
||||
{ format: 'image/jpeg', quality: 100 } // 平衡质量与大小
|
||||
);
|
||||
|
||||
const sandboxPath = ctx.cacheDir + `/web_fullpage_${Date.now()}.jpg`;
|
||||
const file = fileIo.openSync(sandboxPath, fileIo.OpenMode.CREATE | fileIo.OpenMode.READ_WRITE);
|
||||
fileIo.writeSync(file.fd, arrayBuffer);
|
||||
fileIo.closeSync(file.fd);
|
||||
|
||||
// 3. 保存到相册
|
||||
const helper = photoAccessHelper.getPhotoAccessHelper(ctx);
|
||||
const sandboxUri = fileUri.getUriFromPath(sandboxPath);
|
||||
const request = photoAccessHelper.MediaAssetChangeRequest.createImageAssetRequest(ctx, sandboxUri);
|
||||
await helper.applyChanges(request);
|
||||
|
||||
promptAction.showToast({ message: '网页已保存至相册' });
|
||||
});
|
||||
} catch (e) {
|
||||
promptAction.showToast({ message: '保存失败: ' + e.message });
|
||||
console.error('saveWebViewImage error:', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface RouteParams {
|
||||
|
||||
@@ -63,6 +63,11 @@
|
||||
"name": "ohos.permission.READ_MEDIA",
|
||||
"reason": "$string:media_reason",
|
||||
"usedScene": {}
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.WRITE_MEDIA",
|
||||
"reason": "$string:media_reason",
|
||||
"usedScene": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -28,6 +28,12 @@
|
||||
"pages/VideoPage/CommentReplyPage",
|
||||
"pages/SearchPage/VideoSearchPage",
|
||||
"pages/VideoPage/VideoSelectedPage",
|
||||
"pages/PatientsPage/PatientPages",
|
||||
"pages/PatientsPage/PatientMsgSetPage",
|
||||
"pages/PatientsPage/PatientsGroupPage",
|
||||
"pages/PatientsPage/BuildOrEditGroupPage",
|
||||
"pages/PatientsPage/PatientsListPage",
|
||||
"pages/PatientsPage/PatientDetailsPage",
|
||||
"pages/Netease/imTabPage",
|
||||
"pages/Netease/PublicConsultationPage",
|
||||
"pages/Netease/ConsultationDetailPage",
|
||||
|
||||
Reference in New Issue
Block a user