更新云信相关代码

This commit is contained in:
XiuYun CHEN
2025-07-10 08:57:32 +08:00
parent a297e0452f
commit 5954f51701
523 changed files with 61546 additions and 1488 deletions
+2 -2
View File
@@ -2,8 +2,8 @@
* Use these variables when you tailor your ArkTS code. They must be of the const type.
*/
export const HAR_VERSION = '1.0.0';
export const BUILD_MODE_NAME = 'debug';
export const DEBUG = true;
export const BUILD_MODE_NAME = 'release';
export const DEBUG = false;
export const TARGET_NAME = 'default';
/**
@@ -85,6 +85,7 @@ export struct VideoPage {
.justifyContent(FlexAlign.Center)
.onClick(() => {
router.pushUrl({url:'pages/VideoPage/PlayBackPage'})
})
}.width('100%').height(45)
@@ -197,8 +198,9 @@ export struct VideoPage {
})
.margin({bottom:60})
.onClick(() => {
router.pushUrl({url:'pages/VideoPage/PastVideoPage'})
// router.pushUrl({url:'pages/VideoPage/VideoGandanPage'})
// router.pushUrl({url:'pages/VideoPage/PastVideoPage'})
// router.pushUrl({url:'pages/Netease/imTabPage'})
router.pushUrl({url:'pages/Netease/PublicConsultationPage'})
})
}
+2 -2
View File
@@ -2,8 +2,8 @@
* Use these variables when you tailor your ArkTS code. They must be of the const type.
*/
export const HAR_VERSION = '1.0.0';
export const BUILD_MODE_NAME = 'debug';
export const DEBUG = true;
export const BUILD_MODE_NAME = 'release';
export const DEBUG = false;
export const TARGET_NAME = 'default';
/**
@@ -136,10 +136,10 @@ export struct EditUserDataComp {
this.photoSheetDialog = new CustomDialogController({
builder: PhotoActionSheet({
controller: this.photoSheetDialog,
onPhotoSelected: async (uri: string) => {
this.photoPath = uri;
onPhotoSelected: async (uri: string| string[]) => {
this.photoPath = String(uri);
console.info('Selected image URI:', uri);
const base64String = await ChangeUtil.convertUriToBase64(uri);
const base64String = await ChangeUtil.convertUriToBase64(String(uri));
const updateDataUrl:string = BasicConstant.urlExpert + 'modify';
// 定义content,请根据实际情况选择
@@ -306,10 +306,10 @@ export struct EditUserDataComp {
this.certificatePhotoSheetDialog = new CustomDialogController({
builder: PhotoActionSheet({
controller: this.certificatePhotoSheetDialog,
onPhotoSelected: async (url: string) => {
this.certificatePhoto = url;
console.log('Selected image URI:', url);
const base64String = await ChangeUtil.convertUriToBase64(url);
onPhotoSelected: async (uri: string| string[]) => {
this.certificatePhoto = String(uri);
const base64String = await ChangeUtil.convertUriToBase64(String(uri));
const updateDataUrl:string = BasicConstant.urlExpert + 'modify';
// 定义content,请根据实际情况选择
const postContent = new rcp.MultipartForm({
+6
View File
@@ -0,0 +1,6 @@
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
+17
View File
@@ -0,0 +1,17 @@
/**
* Use these variables when you tailor your ArkTS code. They must be of the const type.
*/
export const HAR_VERSION = '1.0.0';
export const BUILD_MODE_NAME = 'release';
export const DEBUG = false;
export const TARGET_NAME = 'default';
/**
* BuildProfile Class is used only for compatibility purposes.
*/
export default class BuildProfile {
static readonly HAR_VERSION = HAR_VERSION;
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
static readonly DEBUG = DEBUG;
static readonly TARGET_NAME = TARGET_NAME;
}
+17
View File
@@ -0,0 +1,17 @@
export { MainPage } from './src/main/ets/components/MainPage';
export { TabBarComp } from './src/main/ets/view/TabBarComp'
export { MessageComp } from './src/main/ets/view/MessageComp'
export { TabBarConsultationComp } from './src/main/ets/view/TabBarConsultationComp'
export { ConsultationDetailComp } from './src/main/ets/view/ConsultationDetailComp'
export { PreviewPhoto } from './src/main/ets/components/PreviewPhoto'
export { InterrogationDetailComp } from './src/main/ets/view/InterrogationDetailComp'
export { PatientSimplyComp } from './src/main/ets/view/PatientSimplyComp'
export { MyOpinionComp } from './src/main/ets/view/MyOpinionComp'
+70
View File
@@ -0,0 +1,70 @@
# 图片保存权限功能说明
## 功能概述
`PreviewPhoto.ets` 组件中的 `downloadImage` 方法添加了完整的权限检查和申请功能,确保在保存图片到相册时能够正确处理存储权限。
## 实现的功能
### 1. 权限检查
- 在下载图片前检查 `ohos.permission.WRITE_MEDIA` 权限
- 使用 `abilityAccessCtrl.AtManager` 检查权限状态
### 2. 权限申请
- 如果权限未授予,自动申请权限
- 使用项目中已有的 `PermissionsUtils` 工具类
- 提供友好的用户提示
### 3. 错误处理
- 网络连接失败提示
- 文件写入失败提示
- 权限拒绝提示
- 下载进度提示
### 4. 国际化支持
- 所有提示信息都使用字符串资源
- 支持多语言显示
## 修改的文件
### 1. PreviewPhoto.ets
- 添加权限检查和申请方法
- 优化 `downloadImage` 方法的错误处理
- 使用字符串资源替代硬编码文本
### 2. module.json5
- 添加 `ohos.permission.WRITE_MEDIA` 权限声明
- 添加 `ohos.permission.READ_MEDIA` 权限声明
- 使用字符串资源作为权限说明
### 3. string.json
- 添加权限相关的字符串资源
- 添加用户提示信息的字符串资源
## 权限说明
### WRITE_MEDIA 权限
- 用途:保存图片到相册
- 申请时机:用户点击保存图片时
- 说明:用于将下载的图片写入到设备相册
### READ_MEDIA 权限
- 用途:读取相册中的图片
- 申请时机:应用启动时
- 说明:用于访问用户相册中的图片
## 使用流程
1. 用户点击保存图片按钮
2. 系统检查是否有存储权限
3. 如果没有权限,弹出权限申请对话框
4. 用户授权后,开始下载图片
5. 下载完成后保存到相册
6. 显示相应的成功或失败提示
## 注意事项
1. 权限申请是异步操作,需要等待用户响应
2. 如果用户拒绝权限,会显示提示信息
3. 网络下载和文件写入都有超时设置
4. 所有操作都有相应的错误处理
+31
View File
@@ -0,0 +1,31 @@
{
"apiType": "stageMode",
"buildOption": {
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": false,
"files": [
"./obfuscation-rules.txt"
]
},
"consumerFiles": [
"./consumer-rules.txt"
]
}
},
},
],
"targets": [
{
"name": "default"
},
{
"name": "ohosTest"
}
]
}
View File
+6
View File
@@ -0,0 +1,6 @@
import { harTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
+23
View File
@@ -0,0 +1,23 @@
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file
# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
-enable-property-obfuscation
-enable-toplevel-obfuscation
-enable-filename-obfuscation
-enable-export-obfuscation
+225
View File
@@ -0,0 +1,225 @@
{
"meta": {
"stableOrder": true
},
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@itcast/basic@../../commons/basic": "@itcast/basic@../../commons/basic",
"@nimkit/chatkit@../../chatkit": "@nimkit/chatkit@../../chatkit",
"@nimkit/chatkit_ui@../../chatkit_ui": "@nimkit/chatkit_ui@../../chatkit_ui",
"@nimkit/common@../../common": "@nimkit/common@../../common",
"@nimkit/conversationkit_ui@../../conversationkit_ui": "@nimkit/conversationkit_ui@../../conversationkit_ui",
"@nimkit/corekit@../../corekit": "@nimkit/corekit@../../corekit",
"@nimkit/localconversationkit_ui@../../localconversationkit_ui": "@nimkit/localconversationkit_ui@../../localconversationkit_ui",
"@nimkit/markdown@1.1.0": "@nimkit/markdown@1.1.0",
"@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+conversation@10.9.10/oh_modules/@nimsdk/conversation/libs/base.har": "@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+nim@10.9.10/oh_modules/@nimsdk/nim/libs/base.har",
"@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+friend@10.9.10/oh_modules/@nimsdk/friend/libs/base.har": "@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+nim@10.9.10/oh_modules/@nimsdk/nim/libs/base.har",
"@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+message@10.9.10/oh_modules/@nimsdk/message/libs/base.har": "@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+nim@10.9.10/oh_modules/@nimsdk/nim/libs/base.har",
"@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+nim@10.9.10/oh_modules/@nimsdk/nim/libs/base.har": "@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+nim@10.9.10/oh_modules/@nimsdk/nim/libs/base.har",
"@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+team@10.9.10/oh_modules/@nimsdk/team/libs/base.har": "@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+nim@10.9.10/oh_modules/@nimsdk/nim/libs/base.har",
"@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+user@10.9.10/oh_modules/@nimsdk/user/libs/base.har": "@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+nim@10.9.10/oh_modules/@nimsdk/nim/libs/base.har",
"@nimsdk/base@10.9.10": "@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+nim@10.9.10/oh_modules/@nimsdk/nim/libs/base.har",
"@nimsdk/conversation@10.9.10": "@nimsdk/conversation@10.9.10",
"@nimsdk/friend@10.9.10": "@nimsdk/friend@10.9.10",
"@nimsdk/message@10.9.10": "@nimsdk/message@10.9.10",
"@nimsdk/nim@10.9.10": "@nimsdk/nim@10.9.10",
"@nimsdk/team@10.9.10": "@nimsdk/team@10.9.10",
"@nimsdk/user@10.9.10": "@nimsdk/user@10.9.10",
"@nimsdk/vendor@1.0.0": "@nimsdk/vendor@1.0.0",
"@ohos/pinyin4js@^2.0.0": "@ohos/pinyin4js@2.0.1",
"class-transformer@^0.5.1": "class-transformer@0.5.1",
"reflect-metadata@^0.1.13": "reflect-metadata@0.2.1"
},
"packages": {
"@itcast/basic@../../commons/basic": {
"name": "@itcast/basic",
"version": "1.0.0",
"resolved": "../../commons/basic",
"registryType": "local"
},
"@nimkit/chatkit@../../chatkit": {
"name": "@nimkit/chatkit",
"version": "10.1.0",
"resolved": "../../chatkit",
"registryType": "local",
"dependencies": {
"@nimsdk/conversation": "10.9.10",
"@nimsdk/message": "10.9.10",
"@nimsdk/team": "10.9.10",
"@nimsdk/user": "10.9.10",
"@nimsdk/friend": "10.9.10",
"@nimsdk/nim": "10.9.10",
"@nimsdk/base": "10.9.10",
"@nimkit/corekit": "file:../corekit",
"class-transformer": "^0.5.1",
"reflect-metadata": "^0.1.13"
}
},
"@nimkit/chatkit_ui@../../chatkit_ui": {
"name": "@nimkit/chatkit_ui",
"version": "10.1.0",
"resolved": "../../chatkit_ui",
"registryType": "local",
"dependencies": {
"@nimkit/common": "file:../common",
"@nimkit/chatkit": "file:../chatkit",
"@nimkit/corekit": "file:../corekit",
"@nimsdk/base": "10.9.10",
"class-transformer": "^0.5.1",
"reflect-metadata": "^0.1.13",
"@nimkit/markdown": "1.1.0",
"@itcast/basic": "file:../commons/basic"
}
},
"@nimkit/common@../../common": {
"name": "@nimkit/common",
"version": "1.1.0",
"resolved": "../../common",
"registryType": "local",
"dependencies": {
"@ohos/pinyin4js": "^2.0.0"
}
},
"@nimkit/conversationkit_ui@../../conversationkit_ui": {
"name": "@nimkit/conversationkit_ui",
"version": "10.1.0",
"resolved": "../../conversationkit_ui",
"registryType": "local",
"dependencies": {
"@nimkit/common": "file:../common",
"@nimkit/chatkit": "file:../chatkit",
"@nimsdk/base": "10.9.10"
}
},
"@nimkit/corekit@../../corekit": {
"name": "@nimkit/corekit",
"version": "1.1.0",
"resolved": "../../corekit",
"registryType": "local"
},
"@nimkit/localconversationkit_ui@../../localconversationkit_ui": {
"name": "@nimkit/localconversationkit_ui",
"version": "10.1.0",
"resolved": "../../localconversationkit_ui",
"registryType": "local",
"dependencies": {
"@nimkit/common": "file:../common",
"@nimkit/chatkit": "file:../chatkit",
"@nimsdk/base": "10.9.10"
}
},
"@nimkit/markdown@1.1.0": {
"name": "@nimkit/markdown",
"version": "1.1.0",
"integrity": "sha512-ITTM5bIkvcK+KsWHxn7vta1W3XGulMQ4vWHT37NidayhTlo04lG6JMABtsxCYYR7H6OiwuUcVpLzDvOyjScYSA==",
"resolved": "https://repo.harmonyos.com/ohpm/@nimkit/markdown/-/markdown-1.1.0.har",
"registryType": "ohpm"
},
"@nimsdk/base@../../oh_modules/.ohpm/@nimsdk+nim@10.9.10/oh_modules/@nimsdk/nim/libs/base.har": {
"name": "@nimsdk/base",
"version": "10.9.10",
"resolved": "../../oh_modules/.ohpm/@nimsdk+nim@10.9.10/oh_modules/@nimsdk/nim/libs/base.har",
"registryType": "local",
"dependencies": {
"@nimsdk/vendor": "1.0.0"
}
},
"@nimsdk/conversation@10.9.10": {
"name": "@nimsdk/conversation",
"version": "10.9.10",
"integrity": "sha512-1HLvs19/GJAHeIOCN0OiKlowkg6dzZwvZK0Jqu7tAcYGcLl4+G/Z3pwsGHhv+E2Tzs8FHZCqbESMgSh+LNyt/g==",
"resolved": "https://repo.harmonyos.com/ohpm/@nimsdk/conversation/-/conversation-10.9.10.har",
"registryType": "ohpm",
"dependencies": {
"@nimsdk/base": "file:./libs/base.har",
"@nimsdk/vendor": "1.0.0"
}
},
"@nimsdk/friend@10.9.10": {
"name": "@nimsdk/friend",
"version": "10.9.10",
"integrity": "sha512-JVACpT8xqLLaN8D26YHmwfsS1dHFQvBnP3Jyk9El89P2trn/2ZFLvnQjxzyBDsqJRUtNFfIrN+TK7Idmud4ACQ==",
"resolved": "https://repo.harmonyos.com/ohpm/@nimsdk/friend/-/friend-10.9.10.har",
"registryType": "ohpm",
"dependencies": {
"@nimsdk/base": "file:./libs/base.har",
"@nimsdk/vendor": "1.0.0"
}
},
"@nimsdk/message@10.9.10": {
"name": "@nimsdk/message",
"version": "10.9.10",
"integrity": "sha512-f59rWiM4SjhhxNftRUt9vg7lIwkGycV/aL8J3omH+Te4SMbUGolwDGErDr7adtZ3tDUThtxxgU8n5tD28TBRtA==",
"resolved": "https://repo.harmonyos.com/ohpm/@nimsdk/message/-/message-10.9.10.har",
"registryType": "ohpm",
"dependencies": {
"@nimsdk/base": "file:./libs/base.har",
"@nimsdk/vendor": "1.0.0"
}
},
"@nimsdk/nim@10.9.10": {
"name": "@nimsdk/nim",
"version": "10.9.10",
"integrity": "sha512-WpT8vBTld92ExtH30Ffsm+xq6BW6/UFj8SuhJrcQaZY3AYf9sg+d+euqx/dFzjZin5cWRxd/yoodBiVcGfsM4w==",
"resolved": "https://repo.harmonyos.com/ohpm/@nimsdk/nim/-/nim-10.9.10.har",
"registryType": "ohpm",
"dependencies": {
"@nimsdk/base": "file:./libs/base.har",
"@nimsdk/vendor": "1.0.0"
}
},
"@nimsdk/team@10.9.10": {
"name": "@nimsdk/team",
"version": "10.9.10",
"integrity": "sha512-T4YSN395VXQr1TDX2B24DmGYuvUgUqE7wndbleR980wEyki9IfhC2VxxJ1yajhxVlVkfmuBjCB/eKWL0zLzu5A==",
"resolved": "https://repo.harmonyos.com/ohpm/@nimsdk/team/-/team-10.9.10.har",
"registryType": "ohpm",
"dependencies": {
"@nimsdk/base": "file:./libs/base.har",
"@nimsdk/vendor": "1.0.0"
}
},
"@nimsdk/user@10.9.10": {
"name": "@nimsdk/user",
"version": "10.9.10",
"integrity": "sha512-KyWVDDPbymj3qoC8Y0mB8umgvLg89Y2cB02tM35oSG8IW95C936v5ogip2Jk7qAfabXxI/XTyy5wQoW1z950JA==",
"resolved": "https://repo.harmonyos.com/ohpm/@nimsdk/user/-/user-10.9.10.har",
"registryType": "ohpm",
"dependencies": {
"@nimsdk/base": "file:./libs/base.har",
"@nimsdk/vendor": "1.0.0"
}
},
"@nimsdk/vendor@1.0.0": {
"name": "@nimsdk/vendor",
"version": "1.0.0",
"integrity": "sha512-q49MJM6PfucNs8jvLP56a2etyqRfZCeJaMa1BT9vO4sIgwt15bin+hpUWZ1qkflBs9YkDb2nMIX5O8zt556muw==",
"resolved": "https://repo.harmonyos.com/ohpm/@nimsdk/vendor/-/vendor-1.0.0.har",
"registryType": "ohpm"
},
"@ohos/pinyin4js@2.0.1": {
"name": "@ohos/pinyin4js",
"version": "2.0.1",
"integrity": "sha512-qmYDelku5gcgKVmJyMqa7kWf0a+e8nnGS9ts5FRLA0LdRf+Iz36X/4Vub6hhh/RusuDmmWG9h153KZe+kraIVg==",
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/pinyin4js/-/pinyin4js-2.0.1.har",
"registryType": "ohpm"
},
"class-transformer@0.5.1": {
"name": "class-transformer",
"version": "0.5.1",
"integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==",
"resolved": "https://repo.harmonyos.com/ohpm/class-transformer/-/class-transformer-0.5.1.tgz",
"shasum": "24147d5dffd2a6cea930a3250a677addf96ab336",
"registryType": "ohpm"
},
"reflect-metadata@0.2.1": {
"name": "reflect-metadata",
"version": "0.2.1",
"integrity": "sha512-i5lLI6iw9AU3Uu4szRNPPEkomnkjRTaVt9hy/bn5g/oSzekBSMeLZblcjP74AW0vBabqERLLIrz+gR8QYR54Tw==",
"resolved": "https://repo.harmonyos.com/ohpm/reflect-metadata/-/reflect-metadata-0.2.1.tgz",
"shasum": "8d5513c0f5ef2b4b9c3865287f3c0940c1f67f74",
"registryType": "ohpm"
}
}
}
+18
View File
@@ -0,0 +1,18 @@
{
"name": "netease",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "Index.ets",
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@itcast/basic": "file:../../commons/basic",
"@nimkit/conversationkit_ui": "file:../../conversationkit_ui",
"@nimkit/chatkit_ui": "file:../../chatkit_ui",
"@nimkit/chatkit": "file:../../chatkit",
"@nimsdk/base": "10.9.10",
"@nimkit/common": "file:../../common",
"@nimkit/localconversationkit_ui": "file:../../localconversationkit_ui",
}
}
@@ -0,0 +1,84 @@
import { InterrogationBean } from '../model/ConsulModel'
import { router } from '@kit.ArkUI'
import { calculateExactAge } from '@itcast/basic'
@Preview
@Component
export struct ItemCompMany {
@Prop item:InterrogationBean;
@State isHistory:boolean = false;//是否是我已回答
@State status:string=''
aboutToAppear(): void {
}
build() {
Column() {
Row()
{
Text()
{
Span(this.item.user_status==0?$r('app.string.cancellation'):this.item.name.substring(0,1)+'**').fontColor($r('app.color.top_title'))
Span(this.item.sex==0?"(男 "+this.getYears(this.item.birthday)+"岁)":"(女 "+this.getYears(this.item.birthday)+"岁)").fontColor($r('app.color.common_gray_03'))
}.fontSize(19).layoutWeight(1)
Text(this.item.create_date?this.item.create_date.length>10?this.item.create_date.substring(0,10):this.item.create_date:'')
.fontSize(15).fontColor($r('app.color.common_gray_03')).padding({left:5})
// Text('').width(11).height(11).backgroundColor('#ffff3e3e').borderRadius(20).margin({top:-20})
// .visibility(this.isHistory?Visibility.Visible:Visibility.None)
}
Text(this.item.disease_describe)
.fontSize(14).fontColor($r('app.color.common_gray_03')).padding(9).margin({top:10})
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.backgroundColor($r('app.color.f6f6f6')).borderRadius(8)
.width('100%')
Row()
{
if(this.item.answer_num==0)
{
Text('').width(11).height(11).backgroundColor('#ffff3e3e').borderRadius(20) .textAlign(TextAlign.Start)
Text('暂未有医生回答').fontSize(12).fontColor($r('app.color.common_gray_03'))
.textAlign(TextAlign.Start).layoutWeight(1).margin({left:3})
}
else
{
Text(this.item.answer_num+'位医生已回答').fontSize(12).fontColor($r('app.color.top_title'))
.textAlign(TextAlign.Start).layoutWeight(1)
}
Text(this.item.disease_name.includes("甲、乙、丙、丁")?'肝炎':this.item.disease_name).fontSize(11).borderColor($r('app.color.top_title')).fontColor($r('app.color.top_title'))
.width(63).height(25).borderRadius(17).borderWidth(1).textAlign(TextAlign.Center).margin({left:10})
}.alignSelf(ItemAlign.Start)
.margin({top:10})
}
.width('100%')
.padding(10)
.onClick(() => {
router.pushUrl({
url: 'pages/Netease/InterrogationDetailCompPage',
params: { uuid: this.item.step1_uuid,isHistory:this.isHistory+''}
});
})
}
getYears(birthDateStr:string): number
{
const birthDate: Date = new Date(birthDateStr);
return calculateExactAge(birthDate)
}
}
@@ -0,0 +1,66 @@
import { ConsulList } from '../model/ConsulModel'
import { router } from '@kit.ArkUI'
@Preview
@Component
export struct ItemCompPublic {
@Prop item:ConsulList;
@State isHistory:boolean = false;//是否是我已回答
@State status:string=''
aboutToAppear(): void {
}
build() {
Column() {
Row()
{
Text(this.item.state==0?$r('app.string.cancellation'):this.item.realName).fontSize(19).fontColor($r('app.color.top_title')).layoutWeight(1)
Text(this.item.createDate?this.item.createDate.length>16?this.item.createDate.substring(1,16):this.item.createDate:'')
.fontSize(15).fontColor($r('app.color.top_title')).padding({left:5})
Text('').width(11).height(11).backgroundColor('#ffff3e3e').borderRadius(20).margin({top:-20})
.visibility(this.isHistory?Visibility.Visible:Visibility.None)
}
Text(this.item.content)
.fontSize(14).fontColor($r('app.color.common_gray_03')).padding(9).margin({top:10})
.backgroundColor($r('app.color.f6f6f6')).borderRadius(8)
.width('100%')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Row()
{
Text('问题详情').fontSize(11).backgroundColor($r('app.color.top_title')).fontColor(Color.White)
.width(63).height(25).borderRadius(17).textAlign(TextAlign.Center)
.onClick(() => {
router.pushUrl({
url: 'pages/Netease/ConsultationDetailPage',
params: { uuid: this.item.uuid,isHistory:this.isHistory+''}
});
})
Text(this.item.diseaseName.includes("甲、乙、丙、丁")?'肝炎':this.item.diseaseName).fontSize(11).borderColor($r('app.color.top_title')).fontColor($r('app.color.top_title'))
.width(63).height(25).borderRadius(17).borderWidth(1).textAlign(TextAlign.Center).margin({left:10})
}.alignSelf(ItemAlign.Start)
.margin({top:10})
}
.width('100%')
.padding(10)
.onClick(() => {
router.pushUrl({
url: 'pages/Netease/ConsultationDetailPage',
params: { uuid: this.item.uuid,isHistory:this.isHistory+''}
});
})
}
}
@@ -0,0 +1,151 @@
import { ItemCompMany } from './ItemCompMany'
import { ListInterrogationBean,InterrogationBean } from '../model/ConsulModel'
import { HdList, HdListController,BasicConstant,hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
import { promptAction, router } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit';
import { EmptyViewComp,HdLoadingDialog } from '@itcast/basic'
import HashMap from '@ohos.util.HashMap';
@Component
export struct ListCompInterrogation {
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
@Prop
@Watch('onUpdate')
isHistory:boolean = false;//是否是我已回答
@State
list: InterrogationBean[] = []
controller = new HdListController()
@State
page: number = 1
@State url:string=BasicConstant.newConsultList
hashMap: HashMap<string, string> = new HashMap();
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
onUpdate() {
this.onRefresh()
}
onRefresh() {
this.page = 1
this.initData(0)
}
initData(type:number)
{
this.dialog.open()
this.hashMap.clear();
this.hashMap.set('page', this.page+"")
if(this.isHistory)
{
this.url=BasicConstant.listMyAnsweredInterrogation
}
else
{
this.url=BasicConstant.listNewInterrogation
}
hdHttp.httpReq<string>(this.url,this.hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close()
if(type==0)
{
this.controller.refreshed()
}
else
{
this.controller.loaded()
}
let json:ListInterrogationBean = JSON.parse(res+'') as ListInterrogationBean;
if(this.page==1)
{
this.list=[]
if(json.data!=null&&json.data.list!=null&&json.data.list.length>0)
{
this.list = json.data.list
}
}
else if(this.page>1&&json.data!=null&&json.data.list!=null&&json.data.list.length>0)
{
this.list.push(...json.data.list)
}
if (json.data.isLastPage) {
this.controller.finished()
} else {
this.page++
}
if (this.list.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
}).catch((err: BusinessError) => {
this.dialog.close()
if (this.list.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
})
}
build() {
Column()
{
if (this.isEmptyViewVisible){
EmptyViewComp({promptText:'暂无公益咨询',isVisibility:this.isEmptyViewVisible})
.width('100%')
.height('100%')
} else
{
HdList({
lw: 1,
controller: this.controller,
strokeWidth:5,
onRefresh: () => {
this.onRefresh()
},
onLoad: () => {
this.initData(1)
}
})
{
ForEach(this.list, (item: InterrogationBean) => {
ListItem() {
ItemCompMany({ item,isHistory:this.isHistory })
}
})
}
}
}
}
}
@@ -0,0 +1,151 @@
import { ItemCompMany } from './ItemCompMany'
import { ListInterrogationBean,InterrogationBean } from '../model/ConsulModel'
import { HdList, HdListController,BasicConstant,hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
import { promptAction, router } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit';
import { EmptyViewComp,HdLoadingDialog } from '@itcast/basic'
import HashMap from '@ohos.util.HashMap';
@Component
export struct ListCompMany {
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
@Prop
@Watch('onUpdate')
isHistory:boolean = false;//是否是我已回答
@State
list: InterrogationBean[] = []
controller = new HdListController()
@State
page: number = 1
@State url:string=BasicConstant.newConsultList
hashMap: HashMap<string, string> = new HashMap();
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
onUpdate() {
this.onRefresh()
}
onRefresh() {
this.page = 1
this.initData(0)
}
initData(type:number)
{
this.dialog.open()
this.hashMap.clear();
this.hashMap.set('page', this.page+"")
if(this.isHistory)
{
this.url=BasicConstant.listMyAnsweredInterrogation
}
else
{
this.url=BasicConstant.listNewInterrogation
}
hdHttp.httpReq<string>(this.url,this.hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close()
if(type==0)
{
this.controller.refreshed()
}
else
{
this.controller.loaded()
}
let json:ListInterrogationBean = JSON.parse(res+'') as ListInterrogationBean;
if(this.page==1)
{
this.list=[]
if(json.data!=null&&json.data.list!=null&&json.data.list.length>0)
{
this.list = json.data.list
}
}
else if(this.page>1&&json.data!=null&&json.data.list!=null&&json.data.list.length>0)
{
this.list.push(...json.data.list)
}
if (json.data.isLastPage) {
this.controller.finished()
} else {
this.page++
}
if (this.list.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
}).catch((err: BusinessError) => {
this.dialog.close()
if (this.list.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
})
}
build() {
Column()
{
if (this.isEmptyViewVisible){
EmptyViewComp({promptText:'暂无公益咨询',isVisibility:this.isEmptyViewVisible})
.width('100%')
.height('100%')
} else
{
HdList({
lw: 1,
controller: this.controller,
strokeWidth:5,
onRefresh: () => {
this.onRefresh()
},
onLoad: () => {
this.initData(1)
}
})
{
ForEach(this.list, (item: InterrogationBean) => {
ListItem() {
ItemCompMany({ item,isHistory:this.isHistory })
}
})
}
}
}
}
}
@@ -0,0 +1,222 @@
import { ItemCompPublic } from './ItemCompPublic'
import { ConsulList,ConsulModel,ConsulModelHis } from '../model/ConsulModel'
import { HdList, HdListController,BasicConstant,hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
import { promptAction, router } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit';
import { EmptyViewComp,HdLoadingDialog } from '@itcast/basic'
import HashMap from '@ohos.util.HashMap';
@Component
export struct ListCompPublic {
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
@Prop
@Watch('onUpdate')
isHistory:boolean = false;//是否是我已回答
@State
list: ConsulList[] = []
controller = new HdListController()
@State
page: number = 1
@State
yetDayTotalNum: number = 0
@State
yetDayTotalnumEPNum: number = 0
@State url:string=BasicConstant.newConsultList
hashMap: HashMap<string, string> = new HashMap();
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
onUpdate() {
this.onRefresh()
}
onRefresh() {
this.page = 1
this.initData(0)
}
initData(type:number)
{
this.dialog.open()
this.hashMap.clear();
this.hashMap.set('page', this.page+"")
if(this.isHistory)
{
this.url=BasicConstant.consultListHis
}
else
{
this.url=BasicConstant.newConsultList
}
hdHttp.httpReq<string>(this.url,this.hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close()
if(type==0)
{
this.controller.refreshed()
}
else
{
this.controller.loaded()
}
if(this.isHistory)
{
let json:ConsulModelHis = JSON.parse(res+'') as ConsulModelHis;
if(this.page==1)
{
this.list=[]
if(json.data!=null&&json.data.list!=null&&json.data.list!=null&&json.data.list.length>0)
{
this.list = json.data.list
}
}
else if(this.page>1&&json.data!=null&&json.data.list!=null&&json.data.list.length>0)
{
this.list.push(...json.data.list)
}
if (this.page >= json.data.totalPage) {
this.controller.finished()
} else {
this.page++
}
}
else
{
let json:ConsulModel = JSON.parse(res+'') as ConsulModel;
this.yetDayTotalNum=json.data.yetDayTotalNum
this.yetDayTotalnumEPNum=json.data.yetDayTotalnumEPNum
if(this.page==1)
{
this.list=[]
if(json.data!=null&&json.data.consult_list!=null&&json.data.consult_list.list!=null&&json.data.consult_list.list.length>0)
{
this.list = json.data.consult_list.list
}
}
else if(this.page>1&&json.data!=null&&json.data.consult_list!=null&&json.data.consult_list.list!=null&&json.data.consult_list.list.length>0)
{
this.list.push(...json.data.consult_list.list)
}
if (this.page >= json.data.consult_list.totalPage) {
this.controller.finished()
} else {
this.page++
}
}
if (this.list.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
}).catch((err: BusinessError) => {
this.dialog.close()
if (this.list.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
})
}
build() {
Column()
{
if(!this.isHistory)
{
Column()
{
Text() {
Span('昨天共有').fontSize(14).fontColor(Color.White)
Span(this.yetDayTotalNum+'').fontColor('#FFEB63') .fontSize(20)
Span('条公益咨询').fontSize(14).fontColor(Color.White)
}
.margin({top:20})
.width('100%')
.textAlign(TextAlign.Start)
.padding({left:120})
Text() {
if(this.yetDayTotalnumEPNum>0)
{
Span('您回答了').fontSize(14).fontColor(Color.White)
Span(this.yetDayTotalnumEPNum+'').fontColor('#FFEB63') .fontSize(20)
Span('条,谢谢您的支持!').fontSize(14).fontColor(Color.White)
}
else
{
Span('邀请您一起参与').fontSize(14).fontColor(Color.White)
ImageSpan($r('app.media.consult_zero')).width(35).height(20).padding({top:4,bottom:2}).objectFit(ImageFit.Contain)
}
}
.width('100%')
.textAlign(TextAlign.Start)
.padding({left:120})
.margin({top:10})
}
.backgroundImage($r('app.media.consult_background'))
.height(90)
.backgroundImageSize(ImageSize.Cover)
.backgroundImagePosition(Alignment.Center)
.width('100%')
.visibility(this.yetDayTotalNum>0?Visibility.Visible:Visibility.None)
Text('').width('100%').height(5).backgroundColor($r('app.color.efefef'))
.visibility(this.yetDayTotalNum>0?Visibility.Visible:Visibility.None)
}
if (this.isEmptyViewVisible){
EmptyViewComp({promptText:'暂无公益咨询',isVisibility:this.isEmptyViewVisible})
.width('100%')
.height('100%')
} else
{
HdList({
lw: 1,
controller: this.controller,
strokeWidth:5,
onRefresh: () => {
this.onRefresh()
},
onLoad: () => {
this.initData(1)
}
})
{
ForEach(this.list, (item: ConsulList) => {
ListItem() {
ItemCompPublic({ item,isHistory:this.isHistory })
}
})
}
}
}
}
}
@@ -0,0 +1,19 @@
@Component
export struct MainPage {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize($r('app.float.page_text_font_size'))
.fontWeight(FontWeight.Bold)
.onClick(() => {
this.message = 'Welcome';
})
}
.width('100%')
}
.height('100%')
}
}
@@ -0,0 +1,263 @@
import { BasicConstant } from "@itcast/basic"
import { ConsultPhoto } from "../model/ConsulModel"
import { router } from "@kit.ArkUI";
import http from '@ohos.net.http'
import fileio from '@ohos.fileio'
import prompt from '@ohos.promptAction'
import { abilityAccessCtrl, common, Permissions } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { PermissionsUtils } from '@itcast/basic';
@Component
export struct PreviewPhoto {
@State
imgListurl: string[]=[]
@State
imgList: ConsultPhoto[]=[] // 传入图片数组
@State params:paramPhoto= router.getParams() as paramPhoto
@State previewIndex: number = 0
// 检查存储权限
async checkStoragePermission(): Promise<boolean> {
try {
const atManager = abilityAccessCtrl.createAtManager();
const grantStatus = await atManager.checkAccessToken(
globalThis.abilityContext.applicationInfo.accessTokenId,
'ohos.permission.WRITE_MEDIA'
);
return grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED;
} catch (error) {
console.error('检查权限失败:', error);
return false;
}
}
// 申请存储权限
async requestStoragePermission(): Promise<boolean> {
try {
const context = getContext(this) as common.UIAbilityContext;
const result = await PermissionsUtils.reqPermissionsFromUser(['ohos.permission.WRITE_MEDIA'], context);
return result.grantStatus || false;
} catch (error) {
console.error('申请权限失败:', error);
return false;
}
}
// 下载图片方法(伪代码,需根据实际API实现)
async downloadImage(url: string) {
try {
// 1. 检查权限
const hasPermission = await this.checkStoragePermission();
if (!hasPermission) {
// 申请权限
const granted = await this.requestStoragePermission();
if (!granted) {
prompt.showToast({ message: $r('app.string.netease_permission_denied_tips') });
return;
}
}
// 显示下载中提示
prompt.showToast({ message: $r('app.string.netease_saving_image_tips') });
// 2. 下载图片
const httpRequest = http.createHttp()
const response = await httpRequest.request(url, {
method: http.RequestMethod.GET,
expectDataType: http.HttpDataType.ARRAY_BUFFER,
connectTimeout: 30000, // 30秒连接超时
readTimeout: 30000, // 30秒读取超时
})
httpRequest.destroy()
if (response.responseCode !== 200) {
prompt.showToast({ message: $r('app.string.netease_download_failed_tips') })
return
}
// 3. 写入到公共图片目录
const fileName = 'img_' + Date.now() + '.jpg'
const filePath = '/storage/media/100/local/photos/' + fileName
try {
const fd = await fileio.open(filePath, 0o2 | 0o100) // 写入+创建
await fileio.write(fd, new Uint8Array(response.result as ArrayBuffer))
await fileio.close(fd)
prompt.showToast({ message: $r('app.string.netease_save_success_tips') })
} catch (fileError) {
console.error('文件写入失败:', fileError);
prompt.showToast({ message: $r('app.string.netease_save_failed_tips') })
}
} catch (e) {
console.error('下载图片失败:', e);
prompt.showToast({ message: $r('app.string.netease_save_error_tips') })
}
}
aboutToAppear(): void {
this.imgList= this.params.imgList
this.imgListurl= this.params.imgListurl
this.previewIndex=this.params.previewIndex
}
dialog = new CustomDialogController({
builder: SaveDialog(
{
CallBack:()=>{
}
}
),
cornerRadius: 4,
width: '70%',
})
build() {
RelativeContainer() {
// 遮罩层
Stack() {
// 半透明背景
Text().backgroundColor(Color.Black).width('100%').height('100%')
// 大图浏览
Column({ space: 16 }) {
// 角标
// 可滑动大图
Swiper() {
if(this.imgListurl.length>0)
{
ForEach(this.imgListurl, (item: string, idx: number) => {
Image(BasicConstant.urlHtml + item)
.width('100%')
// .objectFit(ImageFit.ScaleDown)
.gesture(
LongPressGesture({
duration: 1000, // 设置长按触发时间为1秒
repeat: true // 允许连续触发回调
})
.onAction((event: GestureEvent) => {
this.dialog.open()
})
)
})
}
else if(this.imgList.length>0)
{
ForEach(this.imgList, (item: ConsultPhoto, idx: number) => {
Image(BasicConstant.urlHtml + item.path)
.width('100%')
// .objectFit(ImageFit.Contain)
.gesture(
LongPressGesture({
duration: 1000, // 设置长按触发时间为1秒
repeat: true // 允许连续触发回调
})
.onAction((event: GestureEvent) => {
this.dialog.open()
})
)
})
}
}
.indicator(false)
.loop(false) // 禁用循环滑动
.onChange((index: number) => {
this.previewIndex = index
})
}
.align(Alignment.Center)
}
.width('100%')
.height('100%')
.onClick(() => {
router.back()
})
Row()
{
if(this.imgListurl.length>0)
{
Image($r('app.media.ic_topbar_save')).width(30).height(30)
.onClick(()=>{
this.downloadImage(BasicConstant.urlHtml + this.imgListurl[this.previewIndex])
})
Blank()
Text(`${this.previewIndex + 1}/${this.imgListurl.length}`)
.fontSize(18)
.fontColor($r('app.color.top_title'))
}
else
{
Image($r('app.media.ic_topbar_save')).width(30).height(30)
.onClick(()=>{
this.downloadImage(BasicConstant.urlHtml + this.imgList[this.previewIndex].path)
})
Blank()
Text(`${this.previewIndex + 1}/${this.imgList.length}`)
.fontSize(18)
.fontColor($r('app.color.top_title'))
}
}
.height(30)
.width('100%')
.padding({ left:20,right:20 })
.margin({bottom:40})
.alignRules({bottom: { anchor: "__container__", align: VerticalAlign.Bottom }} )
}
.width('100%')
.height('100%')
}
}
interface paramPhoto
{
previewIndex:number ,
imgList:ConsultPhoto[]
imgListurl:string[]
}
@CustomDialog
struct SaveDialog {
controller: CustomDialogController
CallBack: () => void = () => {};
build() {
Column() {
Text('提示')
.fontSize(17)
.fontColor('#444444')
.padding(15)
Text('').height(1).width('100%')
.backgroundColor($r('app.color.home_gray'))
Text('保存到手机')
.fontSize(16).fontColor($r('app.color.common_gray_03'))
.padding(10).width('100%').textAlign(TextAlign.Start)
.onClick(() => {
if (this.controller != undefined) {
this.controller.close()
this.CallBack();
}
})
Text('').height(1).width('100%')
.backgroundColor($r('app.color.home_gray'))
.margin({bottom:10})
}
.backgroundColor($r('app.color.white'))
}
}
@@ -0,0 +1,13 @@
import { TabBarCompModel } from '../model/TabBarCompModel'
export const TabBarItems: TabBarCompModel[] = [
{
label: '快速问医生'
},
{
label: '多对一解惑'
}
]
@@ -0,0 +1,17 @@
import { TabBarCompModel } from '../model/TabBarCompModel'
export const TabBarItems: TabBarCompModel[] = [
{
label: '患者消息'
},
{
label: '患者列表'
},
{
label: '随访计划'
}
]
@@ -0,0 +1,149 @@
export interface ConsulModel {
code:string;
data:ConsulData;
message:string;
}
export interface ConsulModelHis {
code:string;
data:ConsulBean;
message:string;
}
export interface ConsulData{
yetDayTotalNum:number;
yetDayTotalnumEPNum:number;
consult_list:ConsulBean;
}
export interface ConsulBean{
totalPage:number;
list:ConsulList[];
}
export interface ConsulList{
uuid:string;
patientUuid:string;
expertUuid:string;
title:string;
createDate:string;
content:string;
diseaseUuid:string;
state:number;
realName:string;
sex:number;
birthDate:string;
photo:string;
mobile:string;
diseaseName:string;
user_status:string;
patientName:string;
patientPhoto:string;
}
export interface ConsultDetail {
code:string;
data:ConsulDetailBean;
message:string;
}
export interface ConsulDetailBean{
detail:ConsultBeans;
imgList:ConsultPhoto[];
}
export interface ConsultBeans extends ConsulList{
patientName:string;
patientPhoto:string;
}
export interface ConsultPhoto{
uuid:string;
path:string;
createDate:string;
}
export interface ListInterrogationBean
{
code:string;
data:InterrogationListBean;
message:string;
}
export interface InterrogationListBean
{
pages:number;
isLastPage:boolean
list:InterrogationBean[]
}
export interface InterrogationBean
{
birthday:string;
answer_num:number;
your_question:string;
sex:number;
name:string;
disease_describe:string;
step1_uuid:string;
disease_name:string;
create_date:string;
user_status:number;
}
export interface GetInterrogationBean
{
code:string;
data:InterrogationDataBean;
message:string;
}
export interface InterrogationDataBean
{
birthday:string;
imgs:string;
answer_num:number;
your_question:string;
sex:number;
name:string;
disease_describe:string;
step1_uuid:string;
disease_name:string;
create_date:string;
status:number;
user_status:string
AnswerList:AnswerListBean[]
SupplementList:SupplementListBean[]
}
export interface AnswerListBean
{
note:string;
imgs:string;
answer_uuid:string;
satisfied:string;
name:string;
expert_uuid:string;
photo:string;
create_date:string;
realname:string;
hospital_name:string;
expert_status:string;
examine_status:string;
}
export interface SupplementListBean
{
imgs:string;
your_question:string;
disease_describe:string;
create_date:string;
}
@@ -0,0 +1,28 @@
export interface InterrogationPatientInfoBean
{
code:string;
data:InterrogationPatientInfo;
message:string;
}
export interface InterrogationPatientInfo
{
birthday:string;
disease_date:string;
address:string;
regist_patient:string;
prov_id:number;
sex:number;
boolean_medication:string;
medication_info:string;
county_id:number;
whether_hbv:number;
whether_pregnant:number;
liver_status:string;
other_disease:string;
name:string;
go_hospital:number;
disease_name:string;
expected_date_of_childbirth:string;
city_id:number;
}
@@ -0,0 +1,5 @@
export class TabBarCompModel {
label: string = ''
}
@@ -0,0 +1,180 @@
import { BasicConstant, calculateExactAge, hdHttp, HdLoadingDialog,HdNav, HdResponse } from '@itcast/basic'
import { TabBarTopComp } from './TabBarTopComp';
import { HashMap } from '@kit.ArkTS';
import { router } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
import { InterrogationPatientInfoBean } from '../model/InterrogationPatientInfoBean';
@Component
export struct BaseInfoComp {
@State sex: number=0;
hashMap: HashMap<string, string> = new HashMap();
@State params:Record<string, string> = router.getParams() as Record<string, string>;
@State name:string='';
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
@State birthday: string='' ;
@State address: string='' ;
@State whether_hbv: string='' ;
@State whether_pregnant: string='';
@State expected_date_of_childbirth: string='';
aboutToAppear() {
this.initData()
}
initData()
{
this.dialog.open()
this.hashMap.clear();
this.hashMap.set('step1_uuid', this.params.uuid)
hdHttp.httpReq<string>(BasicConstant.InterrogationPatientInfo,this.hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close()
let json:InterrogationPatientInfoBean = JSON.parse(res+'') as InterrogationPatientInfoBean;
this.name=json.data.name+' '
this.sex=json.data.sex
this.birthday=json.data.birthday
this.address=json.data.address
if(json.data.whether_hbv==0)
{
this.whether_hbv='无'
}
else if(json.data.whether_hbv==1)
{
this.whether_hbv='有'
}
else
{
this.whether_hbv='未知'
}
if(json.data.whether_pregnant==0)
{
this.whether_pregnant=''
}
else if(json.data.whether_pregnant==1)
{
this.whether_pregnant='无计划'
}
else if(json.data.whether_pregnant==2)
{
this.whether_pregnant='计划中'
}
else if(json.data.whether_pregnant==3)
{
this.whether_pregnant='已怀孕'
}
else if(json.data.whether_pregnant==4)
{
this.whether_pregnant='家有宝宝'
}
if(json.data.expected_date_of_childbirth!=null)
{
this.expected_date_of_childbirth=json.data.expected_date_of_childbirth
}
}).catch((err: BusinessError) => {
this.dialog.close()
})
}
build() {
Column() {
Row()
{
Text('姓名').customStyle().layoutWeight(1)
Text(this.name.substring(0,1)+'**').customStyle1()
}
.width('100%')
Text('').height(1).width('100%')
.backgroundColor($r('app.color.common_gray_border'))
Row()
{
Text('性别').customStyle().layoutWeight(1)
Text(this.sex==0?"男":"女").customStyle1()
}
.width('100%')
Text('').height(1).width('100%')
.backgroundColor($r('app.color.common_gray_border'))
Row()
{
Text('年龄').customStyle().layoutWeight(1)
Text(this.getYears(this.birthday)+'').customStyle1()
}
.width('100%')
Text('').height(1).width('100%')
.backgroundColor($r('app.color.common_gray_border'))
Row()
{
Text('地址').customStyle().layoutWeight(1)
Text(this.address).customStyle1()
}
.width('100%')
Text('').height(1).width('100%')
.backgroundColor($r('app.color.common_gray_border'))
Row()
{
Text('是否怀孕').customStyle().layoutWeight(1)
Text(this.whether_pregnant).customStyle1()
}
.width('100%')
.visibility(this.whether_pregnant==''?Visibility.None:Visibility.Visible)
Text('').height(1).width('100%')
.backgroundColor($r('app.color.common_gray_border')).visibility(this.whether_pregnant==''?Visibility.None:Visibility.Visible)
Row()
{
Text('是否怀孕').customStyle().layoutWeight(1)
Text(this.expected_date_of_childbirth).customStyle1()
}
.width('100%')
.visibility(this.expected_date_of_childbirth==''?Visibility.None:Visibility.Visible)
Text('').height(1).width('100%')
.backgroundColor($r('app.color.common_gray_border')).visibility(this.expected_date_of_childbirth==''?Visibility.None:Visibility.Visible)
Row()
{
Text('肝硬化或肝癌家族史').customStyle().layoutWeight(1)
Text(this.whether_hbv).customStyle1()
}
.width('100%')
}.width('100%')
.height('100%')
.backgroundColor(Color.White)
.padding({left:10,right:10})
}
getYears(birthDateStr:string): number
{
const birthDate: Date = new Date(birthDateStr);
return calculateExactAge(birthDate)
}
}
@Extend(Text)
function customStyle() {
.fontColor($r('app.color.common_gray_01'))
.fontSize(16)
.padding({top:15,bottom:15})
}
@Extend(Text)
function customStyle1() {
.fontColor($r('app.color.999999'))
.fontSize(16)
}
@@ -0,0 +1,200 @@
import { authStore, BaseBean, BasicConstant, hdHttp, HdLoadingDialog, HdNav, HdResponse,
PhotoGrids,
ViewImageInfo} from '@itcast/basic'
import { HashMap } from '@kit.ArkTS';
import { ConsultDetail, ConsultPhoto } from '../model/ConsulModel';
import { BusinessError } from '@kit.BasicServicesKit';
import { promptAction, router } from '@kit.ArkUI';
import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet';
@Component
export struct ConsultationDetailComp {
@State patientName: string='' ;
hashMap: HashMap<string, string> = new HashMap();
@State params:Record<string, string> = router.getParams() as Record<string, string>;
@State state: number=1 ;
@State createDate: string='' ;
@State content: string='' ;
@State diseaseName: string='' ;
@State imgList:ConsultPhoto[]=[]
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
private custom!:CustomDialogController;
@State inputPlaceholder:string='是否确认回答?'
initDialog() {
this.custom = new CustomDialogController({
builder:PerfactInputSheet({
controller:this.custom,
inputTitle:'',
inputPlaceholder:this.inputPlaceholder,
style:'2',
okColor:$r('app.color.top_title'),
inputCallBack:(input: string,title:string)=>{
this. resConsult()
}
}),
alignment: DialogAlignment.Center,
customStyle: true,
autoCancel: false,
backgroundColor: ('rgba(0,0,0,0.5)'),
height: '100%'
})
}
aboutToAppear() {
this.initDialog()
this.initData()
}
initData()
{
this.dialog.open()
this.hashMap.clear();
this.hashMap.set('uuid', this.params.uuid)
hdHttp.httpReq<string>(BasicConstant.consultDetail,this.hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close()
let json:ConsultDetail = JSON.parse(res+'') as ConsultDetail;
this.patientName=json.data.detail.patientName
this.state=json.data.detail.state
this.createDate=json.data.detail.createDate
this.content=json.data.detail.content
this.diseaseName=json.data.detail.diseaseName
this.imgList = [...json.data.imgList]
}).catch((err: BusinessError) => {
this.dialog.close()
})
}
countConsult()
{
this.dialog.open()
hdHttp.post<string>(BasicConstant.countConsult, {
consultUuid:this.params.uuid,
expertUuid: authStore.getUser().uuid,
} as extraData).then(async (res: HdResponse<string>) => {
this.dialog.close()
let json = JSON.parse(res+'') as Record<string, string>;
let data=json.data as string
if(data!='0')
{
this.inputPlaceholder="您已回答过该患者" + data + "次公益咨询,是否确定回答?";
}
this.custom.open()
}).catch((err: BusinessError) => {
})
}
resConsult()
{
this.dialog.open()
hdHttp.post<string>(BasicConstant.resConsult, {
consultUuid:this.params.uuid,
expertUuid: authStore.getUser().uuid,
} as extraData).then(async (res: HdResponse<string>) => {
this.dialog.close()
let json = JSON.parse(res+'') as BaseBean;
if(json.code=='1')
{
promptAction.showToast({ message: '抢答成功' })
}
else
{
promptAction.showToast({ message: json.message })
}
}).catch((err: BusinessError) => {
})
}
build() {
Column() {
HdNav({ title: '咨询详情', showRightIcon: false, showLeftIcon: true})
Text(this.state==0?$r('app.string.cancellation'):this.patientName).fontSize(19).fontColor($r('app.color.top_title')).width('100%') .padding(10)
Row()
{
Text(this.diseaseName.includes("甲、乙、丙、丁")?'肝炎':this.diseaseName).fontSize(11).borderColor($r('app.color.top_title')).fontColor($r('app.color.top_title'))
.width(63).height(25).borderRadius(17).borderWidth(1).textAlign(TextAlign.Center)
Blank()
Text(this.createDate?this.createDate.length>16?this.createDate.substring(1,16):this.createDate:'')
.fontSize(15).fontColor($r('app.color.common_gray_03')).padding({left:5})
}
.width('100%')
.alignSelf(ItemAlign.Start)
.padding({left:10,right:10,bottom:10})
Row()
{
Text(this.content)
.fontSize(14).fontColor($r('app.color.common_gray_03')).padding(9)
.backgroundColor($r('app.color.f6f6f6')).borderRadius(8)
.width('100%')
}
.margin({left:10,right:10,bottom:10})
// PhotoGrids({imgList:this.imgList})
PhotoGrids({imgList:this.changeToImg(this.imgList)})
Button({ type: ButtonType.Normal }){
Text('我要回答')
}
.width('90%')
.height(53)
.position({x:'5%',y:'91%'})
.backgroundColor('#ffffff')
.borderColor($r('app.color.main_color'))
.borderRadius(8)
.borderWidth(1)
.fontColor($r('app.color.main_color'))
.onClick(() => {
this.countConsult()
})
.visibility(this.params.isHistory=='false'?Visibility.Visible:Visibility.None)
}
.width('100%')
.width('100%')
.onClick(() => {
// router.pushUrl({
// url: 'pages/Netease/ConsultationDetailPage',
// params: { uuid: this.item.uuid}
// });
})
}
changeToImg( imgListurl:ConsultPhoto[])
{
let imgListtmps:ViewImageInfo[]=[]
imgListurl.forEach((items: ConsultPhoto) => {
let item = {url:items.path} as ViewImageInfo
imgListtmps.push(item)
})
return imgListtmps
}
}
interface extraData {
consultUuid:string,
expertUuid: string,
}
@@ -0,0 +1,311 @@
import { authStore, BasicConstant,
calculateExactAge,
hdHttp, HdLoadingDialog, HdNav, HdResponse,
PhotoGrids,
ViewImageInfo} from '@itcast/basic'
import { HashMap } from '@kit.ArkTS';
import { GetInterrogationBean, ConsultPhoto, SupplementListBean, AnswerListBean } from '../model/ConsulModel';
import { BusinessError } from '@kit.BasicServicesKit';
import { promptAction, router } from '@kit.ArkUI';
@Component
export struct InterrogationDetailComp {
@State patientName: string='' ;
hashMap: HashMap<string, string> = new HashMap();
@State params:Record<string, string> = router.getParams() as Record<string, string>;
@State state: string='1' ;
@State createDate: string='' ;
@State content: string='' ;
@State diseaseName: string='' ;
@State imgListurl:string[]=[]
@State sex:number=0
@State birthday: string='' ;
@State supplementList:SupplementListBean[]=[]
@State AnswerList:AnswerListBean[]=[]
@State flag_more:boolean=true
scroller = new Scroller()
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
aboutToAppear() {
this.initData()
}
initData()
{
this.dialog.open()
this.hashMap.clear();
this.hashMap.set('uuid', this.params.uuid)
hdHttp.httpReq<string>(BasicConstant.getInterrogation,this.hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close()
let json:GetInterrogationBean = JSON.parse(res+'') as GetInterrogationBean;
this.patientName=json.data.name
this.state=json.data.user_status
this.sex=json.data.sex
this.birthday=json.data.birthday
this.createDate=json.data.create_date
this.content=json.data.disease_describe
this.diseaseName=json.data.disease_name
if(json.data.imgs!=null)
{
this.imgListurl = [...json.data.imgs.split(",")]
}
this.supplementList=json.data.SupplementList
this.AnswerList=json.data.AnswerList
}).catch((err: BusinessError) => {
this.dialog.close()
})
}
build() {
Column() {
HdNav({ title: '问题详情', showRightIcon: false, showLeftIcon: true})
Scroll(this.scroller) {
Column() {
Row() {
Text() {
Span(this.state == '0' ? $r('app.string.cancellation') : this.patientName.substring(0, 1) + '**')
.fontColor($r('app.color.top_title'))
Span(this.sex == 0 ? "(男 " + this.getYears(this.birthday) + "岁)" :
"(女 " + this.getYears(this.birthday) + "岁)").fontColor($r('app.color.common_gray_03'))
}.fontSize(19).padding({ left: 10, right: 3 }).textAlign(TextAlign.Start)
Image($r('app.media.iv_zixun')).width(91).height(17)
.onClick(() => {
router.pushUrl({
url: 'pages/Netease/PatientSimplyPage',
params: { uuid: this.params.uuid }
});
})
}
.padding({ top: 10, bottom: 10 })
.alignSelf(ItemAlign.Start)
Row() {
Text(this.diseaseName.includes("甲、乙、丙、丁") ? '肝炎' : this.diseaseName)
.fontSize(11)
.borderColor($r('app.color.top_title'))
.fontColor($r('app.color.top_title'))
.width(63)
.height(25)
.borderRadius(17)
.borderWidth(1)
.textAlign(TextAlign.Center)
Blank()
Text(this.createDate ? this.createDate.length > 10 ? this.createDate.substring(0, 10) : this.createDate :
'')
.fontSize(15).fontColor($r('app.color.common_gray_03')).padding({ left: 5 })
}
.width('100%')
.alignSelf(ItemAlign.Start)
.padding({ left: 10, right: 10, bottom: 10 })
Row() {
Text(this.content)
.fontSize(14)
.fontColor($r('app.color.common_gray_03'))
.padding(9)
.backgroundColor($r('app.color.f6f6f6'))
.borderRadius(8)
.width('100%')
}
.margin({ left: 10, right: 10, bottom: 10 })
PhotoGrids({ imgList: this.changeToImg(this.imgListurl) })
Row()
{
Text(this.flag_more?'查看更多':'收起').fontSize(14).fontColor($r('app.color.top_title'))
Image(this.flag_more?$r('app.media.icon_down'):$r('app.media.icon_up')).width(8).height(4)
}
.margin(10)
.onClick(()=>{
this.flag_more=!this.flag_more
})
.visibility(this.supplementList.length&&this.AnswerList.length>0?Visibility.Visible:Visibility.None)
List() {
ForEach(this.supplementList, (item: SupplementListBean,index:number) => {
ListItem() {
Column() {
Row()
{
Text('信息补充').width(54).height(30).fontColor(Color.White).fontSize(11)
.textAlign(TextAlign.Center)
.padding({bottom:5})
.backgroundImage($r('app.media.complete_question'))
.backgroundImageSize(ImageSize.FILL)
Blank()
Text(item.create_date.split(" ")[0]).fontColor($r('app.color.common_gray_03'))
}
.width('100%')
.padding(10)
Text(item.disease_describe)
.fontSize(14).fontColor($r('app.color.common_gray_03')).padding(9)
.backgroundColor($r('app.color.f6f6f6')).borderRadius(8)
.width('calc(100% - 20vp)')
.margin({bottom:10})
PhotoGrids({ imgList: this.changeToImg(item.imgs?[...item.imgs.split(",") ]:[]) })
// PhotoGridUrl({ imgListurl: item.imgs?[...item.imgs.split(",") ]:[] })
}
}
})
} .visibility(this.flag_more?Visibility.None:Visibility.Visible)
Text('').width('100%').height(10).backgroundColor($r('app.color.efefef'))
.visibility(this.AnswerList.length>0?Visibility.Visible:Visibility.None)
Text('医生回答')
.fontSize(18).fontColor($r('app.color.top_title'))
.width('calc(100% - 20vp)')
.margin({bottom:10,top:10})
.visibility(this.AnswerList.length>0?Visibility.Visible:Visibility.None)
Text('').width('100%').height(0.5).backgroundColor($r('app.color.f6f6f6'))
.visibility(this.AnswerList.length>0?Visibility.Visible:Visibility.None)
List() {
ForEach(this.AnswerList, (item: AnswerListBean,index:number) => {
ListItem() {
Column() {
Row()
{
Image(BasicConstant.urlHtml+item.photo).width(45).height(45).borderRadius(6)
Column()
{
Row() {
Text()
{
if(item.expert_status=='0')
{
Span($r('app.string.cancellation')).fontColor($r('app.color.top_title')).fontSize(18)
}
else
{
Span(item.realname.length>5?item.realname.substring(0,5)+"...":item.realname).fontColor($r('app.color.top_title')).fontSize(18)
}
Span('|').fontColor($r('app.color.common_gray_03')).fontSize(17).padding({left:5,right:5}).visibility(item.name=='其他'?Visibility.Hidden:Visibility.Visible)
Span(item.name).fontColor($r('app.color.common_gray_03')).fontSize(17).visibility(item.name=='其他'?Visibility.Hidden:Visibility.Visible)
}.layoutWeight(1)
Text('满意答复').fontSize(13).padding({left:9,right:9,bottom:3,top:3})
.backgroundColor('#ffa800').borderRadius(17).fontColor(Color.White).visibility(item.satisfied=='1'?Visibility.Visible:Visibility.None)
}.width('100%')
Row() {
Text(item.hospital_name).fontColor($r('app.color.common_gray_03')).fontSize(14).
visibility(item.hospital_name=='其他医院'?Visibility.Hidden:Visibility.Visible)
.layoutWeight(1)
Text(item.create_date).fontColor($r('app.color.common_gray_03')).fontSize(16)
}
.margin({top:5})
.width('100%')
}.layoutWeight(1)
.margin({left:10})
}
.width('100%')
.padding(10)
Text(item.note)
.fontSize(14).fontColor($r('app.color.common_gray_03')).padding(9)
.backgroundColor($r('app.color.f6f6f6')).borderRadius(8)
.width('calc(100% - 20vp)')
.margin({bottom:10})
PhotoGrids({ imgList: this.changeToImg(item.imgs?[...item.imgs.split(",") ]:[]) })
}
}
})
}
.divider({
strokeWidth: 5, // 线宽
color:$r('app.color.f6f6f6'), // 颜色
})
}
}
.width('100%')
.layoutWeight(1)
.align(Alignment.TopStart)
Column()
{
Text()
{
Span('特别声明:').fontColor($r('app.color.top_title'))
Span('答案仅为医生个人经验或建议分享,不能视为诊断依据,如有诊疗需求,请务必前往正规医院就诊。').fontColor($r('app.color.common_gray_03'))
}
.fontSize(14).padding(9).margin({left:10,right:10,top:10,bottom:10})
.backgroundColor($r('app.color.f6f6f6')).borderRadius(8)
Button({ type: ButtonType.Normal }){
Text(this.params.isHistory =='false'?'我要回答':'我要编辑')
}
.width('100%')
.height(53)
.backgroundColor($r('app.color.patient_theme'))
.fontColor(Color.White)
.onClick(() => {
router.pushUrl({
url: 'pages/Netease/MyOpinionPage',
// params: { uuid: this.item.uuid}
});
})
}
.backgroundColor(Color.White)
.width('100%')
}
.width('100%')
.width('100%')
.onClick(() => {
// router.pushUrl({
// url: 'pages/Netease/ConsultationDetailPage',
// params: { uuid: this.item.uuid}
// });
})
}
getYears(birthDateStr:string): number
{
const birthDate: Date = new Date(birthDateStr);
return calculateExactAge(birthDate)
}
changeToImg( imgListurl:string[])
{
let imgListtmps:ViewImageInfo[]=[]
imgListurl.forEach((url: string) => {
let item = {url:url} as ViewImageInfo
imgListtmps.push(item)
})
return imgListtmps
}
}
@@ -0,0 +1,27 @@
import { BasicConstant,HdNav } from '@itcast/basic'
import { TabBarTopComp } from './TabBarTopComp';
@Component
export struct ManyForOneComp {
@State
@Watch('onChangeIndex')
activeIndex: number = 0
@State type: number=1
onChangeIndex() {
}
build() {
Column() {
TabBarTopComp({activeIndex:this.activeIndex,type:this.type});
}.width('100%')
.height('100%')
.backgroundColor(Color.White)
}
}
@@ -0,0 +1,85 @@
import { BasicConstant,HdNav } from '@itcast/basic'
import { ChatKitClient, ContactRepo, IMKitConfigCenter,
LocalConversationRepo } from '@nimkit/chatkit';
import { ChatKitConfig } from '@nimkit/chatkit_ui/src/main/ets/ChatKitConfig';
import { CommonConstants } from '@nimkit/common';
import { LocalConversationPage } from '@nimkit/localconversationkit_ui';
import { V2NIMFriendAddApplication } from '@nimsdk/base';
@ComponentV2
export struct MessageComp {
@Param pathStack: NavPathStack = new NavPathStack()
@Param onUreadMessageChange?: (unreadCount?: number) => void = undefined
loadUnreadApplication = async () => {
try {
const unreadCount = await ContactRepo.getAddApplicationUnreadCount()
} catch (err) {
console.log(err)
}
}
//获取会话列表未读数
loadUnreadMessageCount = () => {
let unreadCount = 0
unreadCount = LocalConversationRepo.getTotalUnreadCount() ?? 0
}
// 加载配置信息
loadConfig = () => {
// let readOrOpen: boolean = AppStorage.get<boolean>(CommonConstants.KEY_SETTING_MESSAGE_READ_OR) ?? true
ChatKitConfig.messageReadState = true
}
async aboutToAppear(): Promise<void> {
ChatKitClient.nim.localConversationService?.on('onSyncFinished',
async () => {
//同步完成拉一次
ChatKitClient.logger?.debug(`onSyncFinished`)
}
)
ChatKitClient.nim.friendService?.on('onFriendAddApplication', async (application: V2NIMFriendAddApplication) => {
await this.loadUnreadApplication()
})
try {
await this.loadUnreadApplication()
} catch (err) {
console.log(err)
}
this.loadConfig()
this.loadUnreadMessageCount()
}
build() {
// Navigation(this.pathStack) {
Column() {
HdNav({ title: '患者消息', showRightIcon: true, showLeftIcon: true,showRightText:false,rightIcon:$r('app.media.selected_hospital_ws'),rightItemAction:()=>{
// router.pushUrl({
// url:'pages/SearchPage/VideoSearchPage',
// params:{'pageName':'视频'}
// })
}})
LocalConversationPage({
pathStack: this.pathStack,
onUreadMessageChange: this.onUreadMessageChange,
})
}.width('100%')
.height('100%')
.backgroundColor($r('app.color.top_bg'))
// }
// .mode(NavigationMode.Auto)
// .hideTitleBar(true)
}
}
@@ -0,0 +1,91 @@
import { ChangePhotoGrids, HdNav, ViewImageInfo } from "@itcast/basic"
import { PhotoActionSheet } from '@itcast/basic'
@Component
export struct MyOpinionComp {
@State photos: string[] = []
@State previewIndex: number = -1
@State maxSelectNumber: number = 6
private photoSheetDialog!: CustomDialogController;
@State
@Watch('onRemoveImg')
removeImg: boolean=false
@State
@Watch('onAddImg')
addImg: boolean=false
@State removeIndex: number=0
onAddImg()
{
this.photoSheetDialog.open()
}
onRemoveImg()
{
this.photos.splice(this.removeIndex, 1)
this.maxSelectNumber = this.maxSelectNumber - this.photos.length;
}
private initPhotoDialog() {
this.photoSheetDialog = new CustomDialogController({
builder: PhotoActionSheet({
controller: this.photoSheetDialog,
maxSelectNumber:this.maxSelectNumber,
// 修改为支持多选
onPhotoSelected: async (uris: string[] | string) => {
let selectedUris: string[] = [];
if (Array.isArray(uris)) {
selectedUris = uris;
} else if (typeof uris === 'string') {
selectedUris = [uris];
}
this.photos.push(...selectedUris);
this.maxSelectNumber = this.maxSelectNumber - this.photos.length;
}
// onPhotoSelected: async (uri: string) => {
// if (uri && this.photos.length < 9) {
// this.photos.push(uri)
// }
// // this.photoPath = uri;
// // this.base64Stringphoto = await ChangeUtil.convertUriToBase64(uri);
// }
}),
alignment: DialogAlignment.Bottom,
customStyle: true,
autoCancel: false,
backgroundColor: ('rgba(0,0,0,0.5)'),
height: '100%'
});
}
aboutToAppear(): void {
this.initPhotoDialog()
}
build() {
Column() {
HdNav({ title: '我的意见', showRightIcon: false, showLeftIcon: true })
ChangePhotoGrids({imgList:this.changeToImg(this.photos),maxSelectNumber:6
,addImg:this.addImg,removeImg:this.removeImg,removeIndex:this.removeIndex})
.backgroundColor(Color.Red)
}
.height('100%')
.width('100%')
}
changeToImg( imgListurl:string[])
{
let imgListtmps:ViewImageInfo[]=[]
imgListurl.forEach((url: string) => {
let item = {uri:url} as ViewImageInfo
imgListtmps.push(item)
})
return imgListtmps
}
}
@@ -0,0 +1,88 @@
import { BasicConstant,HdNav } from '@itcast/basic'
import { TabBarCompModel } from '../model/TabBarCompModel'
import { TabBarTopComp } from '../view/TabBarTopComp'
import { BaseInfoComp } from './BaseInfoComp'
import { medicalHistoryComp } from './medicalHistoryComp'
@Component
export struct PatientSimplyComp {
@StorageProp('bottomHeight')
bottomHeight: number = 0
@State activeIndex: number=0
aboutToAppear() {
}
@Builder
TabBarBuilder(item: TabBarCompModel, index: number) {
Row() {
Text(item.label)
.fontSize(16)
.fontColor(this.activeIndex === index ? $r('app.color.top_title'):$r('app.color.common_gray_03') )
.animation({ duration: 300 })
.textAlign(TextAlign.Center)
.layoutWeight(1)
if (index < TabBarItems.length - 1) {
// 竖线
Text('|').fontColor($r('app.color.common_gray_02')) // 可选:左右留点间距
}
}
}
build() {
Column()
{
HdNav({ title: '患者信息', showRightIcon: false, showLeftIcon: true })
Tabs({
index: this.activeIndex
}) {
ForEach(TabBarItems, (item: TabBarCompModel, index: number) => {
TabContent() {
if (this.activeIndex==0)
{
BaseInfoComp()
}
else
{
medicalHistoryComp()
}
}
.tabBar(this.TabBarBuilder(item, index))
})
}
.layoutWeight(1)
.divider({ strokeWidth:"5vp", color: $r('app.color.common_gray_border') })
.barPosition(BarPosition.Start)
.barHeight(50)
.scrollable(false)
.onTabBarClick((index) => {
this.activeIndex = index
})
}
}
}
export const TabBarItems: TabBarCompModel[] = [
{
label: '基本资料'
},
{
label: '病史信息'
}
]
@@ -0,0 +1,27 @@
import { BasicConstant,HdNav } from '@itcast/basic'
import { TabBarTopComp } from '../view/TabBarTopComp'
@Component
export struct QuictDoctorComp {
@State
@Watch('onChangeIndex')
activeIndex: number = 0
@State type: number=0
onChangeIndex() {
}
build() {
Column() {
TabBarTopComp({activeIndex:this.activeIndex,type:this.type});
}.width('100%')
.height('100%')
}
}
@@ -0,0 +1,56 @@
import { TabBarCompModel } from '../model/TabBarCompModel'
import { TabBarItems } from '../components/TabBarItems'
import { BasicConstant } from '@itcast/basic'
import { MessageComp } from '../view/MessageComp'
@Component
export struct TabBarComp {
pathStack: NavPathStack = new NavPathStack()
@StorageProp('bottomHeight')
bottomHeight: number = 0
@Link
activeIndex: number
aboutToAppear() {
}
@Builder
TabBarBuilder(item: TabBarCompModel, index: number) {
Column({ space: BasicConstant.SPACE_SM }) {
Text(item.label)
.fontSize(16)
.fontColor(this.activeIndex === index ? $r('app.color.top_title'):$r('app.color.common_gray_01') )
.animation({ duration: 300 })
}
}
build() {
// Navigation(this.pathStack) {
Tabs({
index: this.activeIndex
}) {
ForEach(TabBarItems, (item: TabBarCompModel, index: number) => {
TabContent() {
if (index === 0) MessageComp({ pathStack: this.pathStack })
// else if (index === 1) VideoGandan()
// else if (index === 2) MyHomePage()
}
.tabBar(this.TabBarBuilder(item, index))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
})
}
.divider({ strokeWidth: $r('app.float.common_border_width'), color: $r('app.color.common_gray_border') })
.barPosition(BarPosition.End)
.barHeight(50)
.scrollable(false)
.margin({ bottom: this.bottomHeight })
.onTabBarClick((index) => {
this.activeIndex = index
})
// }.mode(NavigationMode.Auto)
// .hideTitleBar(true)
}
}
@@ -0,0 +1,72 @@
import { TabBarCompModel } from '../model/TabBarCompModel'
import { TabBarItems } from '../components/TabBarConsultationItems'
import { BasicConstant,HdNav } from '@itcast/basic'
import { QuictDoctorComp } from '../view/QuictDoctorComp'
import { ManyForOneComp } from '../view/ManyForOneComp'
@Component
export struct TabBarConsultationComp {
@StorageProp('bottomHeight')
bottomHeight: number = 0
@Link activeIndex: number
aboutToAppear() {
}
@Builder
TabBarBuilder(item: TabBarCompModel, index: number) {
Column({ space: BasicConstant.SPACE_SM }) {
Text(item.label)
.fontSize(16)
.fontColor(this.activeIndex === index ? Color.White:$r('app.color.common_gray_03') )
.backgroundColor(this.activeIndex === index ? $r('app.color.top_title'):Color.White)
.textAlign(TextAlign.Center)
.width('100%')
.height(49)
.animation({ duration: 300 })
}
}
build() {
Column()
{
HdNav({ title: '公益咨询', showLeftIcon: true, showRightIcon: false})
Tabs({
index: this.activeIndex
}) {
ForEach(TabBarItems, (item: TabBarCompModel, index: number) => {
TabContent() {
if (index === 0)
{
QuictDoctorComp()
}
else if(index === 1)
{
ManyForOneComp()
}
}
.tabBar(this.TabBarBuilder(item, index))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
})
}
.layoutWeight(1)
.divider({ strokeWidth: $r('app.float.common_border_width'), color: $r('app.color.common_gray_border') })
.barPosition(BarPosition.End)
.barHeight(50)
.scrollable(false)
.margin({ bottom: this.bottomHeight })
.onTabBarClick((index) => {
this.activeIndex = index
})
}
.width('100%')
.height('100%')
}
}
@@ -0,0 +1,97 @@
import { TabBarCompModel } from '../model/TabBarCompModel'
import { BasicConstant,HdNav } from '@itcast/basic'
import { ListCompPublic } from '../components/ListCompPublic'
import { ListCompMany } from '../components/ListCompMany'
@Component
export struct TabBarTopComp {
@StorageProp('bottomHeight')
bottomHeight: number = 0
@Link activeIndex: number
@Link type:number //type=0是快速问医生,type=1是 多对一解惑
@State isHistory:boolean = false;//是否是我已回答
aboutToAppear() {
}
@Builder
TabBarBuilder(item: TabBarCompModel, index: number) {
Row() {
Text(item.label)
.fontSize(16)
.fontColor(this.activeIndex === index ? $r('app.color.top_title'):$r('app.color.common_gray_03') )
.animation({ duration: 300 })
.textAlign(TextAlign.Center)
.layoutWeight(1)
if (index < TabBarItems.length - 1) {
// 竖线
Text('|').fontColor($r('app.color.common_gray_02')) // 可选:左右留点间距
}
}
}
build() {
Column()
{
Tabs({
index: this.activeIndex
}) {
ForEach(TabBarItems, (item: TabBarCompModel, index: number) => {
TabContent() {
if (this.type==0)
{
ListCompPublic({isHistory:this.isHistory})
}
else if(this.type==1)
{
ListCompMany({isHistory:this.isHistory})
}
}
.tabBar(this.TabBarBuilder(item, index))
})
}
.layoutWeight(1)
.divider({ strokeWidth: $r('app.float.common_border_width'), color: $r('app.color.common_gray_border') })
.barPosition(BarPosition.Start)
.barHeight(50)
.scrollable(false)
.onTabBarClick((index) => {
this.activeIndex = index
if(this.activeIndex === 0)
{
this.isHistory=false
}
else
{
this.isHistory=true
}
})
}
}
}
export const TabBarItems: TabBarCompModel[] = [
{
label: '新的咨询'
},
{
label: '我已回答'
}
]
@@ -0,0 +1,176 @@
import { BasicConstant, calculateExactAge, hdHttp, HdLoadingDialog,HdNav, HdResponse } from '@itcast/basic'
import { TabBarTopComp } from './TabBarTopComp';
import { HashMap } from '@kit.ArkTS';
import { router } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
import { InterrogationPatientInfoBean } from '../model/InterrogationPatientInfoBean';
@Component
export struct medicalHistoryComp {
hashMap: HashMap<string, string> = new HashMap();
@State params:Record<string, string> = router.getParams() as Record<string, string>;
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
@State go_hospital: string='' ;
@State disease_date: string='' ;
@State liver_status: string='' ;
@State medication: string='' ;
@State Medication_info: string='';
@State other_disease: string='';
@State disease: string[]=[];
aboutToAppear() {
this.initData()
}
initData()
{
this.dialog.open()
this.hashMap.clear();
this.hashMap.set('step1_uuid', this.params.uuid)
hdHttp.httpReq<string>(BasicConstant.InterrogationPatientInfo,this.hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close()
let json:InterrogationPatientInfoBean = JSON.parse(res+'') as InterrogationPatientInfoBean;
if(json.data.go_hospital==0)
{
this.go_hospital='否'
}
else
{
this.go_hospital='是'
}
this.disease_date=json.data.disease_date
this.liver_status=json.data.liver_status
this.medication=json.data.boolean_medication
if(json.data.medication_info!=null)
{
this.Medication_info=json.data.medication_info
}
if(json.data.other_disease!=null)
{
this.other_disease=json.data.other_disease
this.disease=this.other_disease.split(",")
}
}).catch((err: BusinessError) => {
this.dialog.close()
})
}
build() {
Column() {
Row()
{
Text('前往医院就诊该疾病情况').customStyle().layoutWeight(1)
Text(this.go_hospital).customStyle1()
}
.width('100%')
Text('').height(1).width('100%')
.backgroundColor($r('app.color.common_gray_border'))
Row()
{
Text('患病时间').customStyle().layoutWeight(1)
Text(this.disease_date).customStyle1()
}
.width('100%')
Text('').height(1).width('100%')
.backgroundColor($r('app.color.common_gray_border'))
Row()
{
Text('目前肝脏状态').customStyle().layoutWeight(1)
Text(this.liver_status).customStyle1()
}
.width('100%')
Text('').height(1).width('100%')
.backgroundColor($r('app.color.common_gray_border'))
Row()
{
Text('当前服用肝病用药情况').customStyle().layoutWeight(1)
Text(this.medication).customStyle1()
}
.width('100%')
Text('').height(1).width('100%')
.backgroundColor($r('app.color.common_gray_border'))
Column()
{
Text('当前服用的肝病药物及服用时长').customStyle().width('100%').textAlign(TextAlign.Start)
Text(this.Medication_info)
.fontSize(14).fontColor($r('app.color.common_gray_03')).padding(9).margin({bottom:10})
.backgroundColor($r('app.color.f6f6f6')).borderRadius(8)
.width('100%')
}
.width('100%')
.visibility(this.Medication_info==''?Visibility.None:Visibility.Visible)
Text('').height(1).width('100%')
.backgroundColor($r('app.color.common_gray_border')).visibility(this.Medication_info==''?Visibility.None:Visibility.Visible)
Column()
{
Text('是否合并其他慢性疾病').fontColor($r('app.color.common_gray_01'))
.fontSize(16)
.padding({top:15,bottom:5}).width('100%').textAlign(TextAlign.Start)
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap}) {
ForEach(this.disease,
(item: string) => {
Text(item)
.fontSize(11).borderColor($r('app.color.top_title')).fontColor($r('app.color.top_title'))
.height(25).borderRadius(17).borderWidth(1).margin({left:10})
.padding({left:10,right:10})
.margin({top:10,left:10,right:10})
})
} .width('100%')
}
.width('100%')
.visibility(this.other_disease==''?Visibility.None:Visibility.Visible)
}.width('100%')
.height('100%')
.backgroundColor(Color.White)
.padding({left:10,right:10})
}
getYears(birthDateStr:string): number
{
const birthDate: Date = new Date(birthDateStr);
return calculateExactAge(birthDate)
}
}
@Extend(Text)
function customStyle() {
.fontColor($r('app.color.common_gray_01'))
.fontSize(16)
.padding({top:15,bottom:15})
}
@Extend(Text)
function customStyle1() {
.fontColor($r('app.color.999999'))
.fontSize(16)
}
+33
View File
@@ -0,0 +1,33 @@
{
"module": {
"name": "netease",
"type": "har",
"deviceTypes": [
"default",
"tablet",
"2in1"
],
"requestPermissions": [
{
"name": "ohos.permission.WRITE_MEDIA",
"reason": "$string:netease_permission_write_media_desc",
"usedScene": {
"abilities": [
"FormAbility"
],
"when": "always"
}
},
{
"name": "ohos.permission.READ_MEDIA",
"reason": "$string:netease_permission_read_media_desc",
"usedScene": {
"abilities": [
"FormAbility"
],
"when": "always"
}
}
]
}
}
@@ -0,0 +1,8 @@
{
"float": [
{
"name": "page_text_font_size",
"value": "50fp"
}
]
}
@@ -0,0 +1,40 @@
{
"string": [
{
"name": "page_show",
"value": "page from package"
},
{
"name": "netease_permission_write_media_desc",
"value": "用于保存图片到相册"
},
{
"name": "netease_permission_read_media_desc",
"value": "用于读取相册中的图片"
},
{
"name": "netease_permission_denied_tips",
"value": "需要存储权限才能保存图片,请在设置中开启权限"
},
{
"name": "netease_saving_image_tips",
"value": "正在保存图片..."
},
{
"name": "netease_download_failed_tips",
"value": "图片下载失败,请检查网络连接"
},
{
"name": "netease_save_success_tips",
"value": "图片已保存到相册"
},
{
"name": "netease_save_failed_tips",
"value": "保存失败,请检查存储空间"
},
{
"name": "netease_save_error_tips",
"value": "保存失败,请稍后重试"
}
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

@@ -0,0 +1,35 @@
import { hilog } from '@kit.PerformanceAnalysisKit';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function abilityTest() {
describe('ActsAbilityTest', () => {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(() => {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(() => {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
})
afterEach(() => {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
})
afterAll(() => {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
it('assertContain', 0, () => {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
let a = 'abc';
let b = 'b';
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
expect(a).assertContain(b);
expect(a).assertEqual(a);
})
})
}
@@ -0,0 +1,5 @@
import abilityTest from './Ability.test';
export default function testsuite() {
abilityTest();
}
@@ -0,0 +1,13 @@
{
"module": {
"name": "netease_test",
"type": "feature",
"deviceTypes": [
"default",
"tablet",
"2in1"
],
"deliveryWithInstall": true,
"installationFree": false
}
}
+5
View File
@@ -0,0 +1,5 @@
import localUnitTest from './LocalUnit.test';
export default function testsuite() {
localUnitTest();
}
@@ -0,0 +1,33 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function localUnitTest() {
describe('localUnitTest', () => {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(() => {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
});
beforeEach(() => {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
});
afterEach(() => {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
});
afterAll(() => {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
});
it('assertContain', 0, () => {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
let a = 'abc';
let b = 'b';
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
expect(a).assertContain(b);
expect(a).assertEqual(a);
});
});
}
+2 -2
View File
@@ -2,8 +2,8 @@
* Use these variables when you tailor your ArkTS code. They must be of the const type.
*/
export const HAR_VERSION = '1.0.0';
export const BUILD_MODE_NAME = 'debug';
export const DEBUG = true;
export const BUILD_MODE_NAME = 'release';
export const DEBUG = false;
export const TARGET_NAME = 'default';
/**
@@ -7,6 +7,7 @@ import { deviceInfo } from '@kit.BasicServicesKit';
@Preview
@Component
export struct LoginComp {
@Link loginstatus: boolean;
@State
mobile: string = ''
@State
@@ -49,6 +50,7 @@ export struct LoginComp {
})
osFullName: string = deviceInfo.marketName.replace(/[\s\-\p{P}\p{S}]/gu, '');
login() {
if (this.loading) return;
if (!this.mobile) {
return promptAction.showToast({ message: '手机号码不为空' })
@@ -91,6 +93,8 @@ export struct LoginComp {
console.info(`Response login succeeded: ${res}`);
let json:LoginInfo = JSON.parse(res+'') as LoginInfo;
if(json.code=='1'||json.code=='200') {
preferenceStore.setItemString(BasicConstant.YX_accid,json.YX_accid)
preferenceStore.setItemString(BasicConstant.YX_token,json.YX_token)
this.arrToStringSpecialy(json.special)
this.getSaveUserInfor(1,json)
} else {
@@ -117,6 +121,9 @@ export struct LoginComp {
}
})
} else {
this.loginstatus=true
authStore.setUser(objs.data)
// emitter.emit({ eventId: 100401 })
logger.info('Response state'+state);
@@ -417,9 +417,9 @@ export struct PerfectUserDataComp {
this.photoSheetDialog = new CustomDialogController({
builder: PhotoActionSheet({
controller: this.photoSheetDialog,
onPhotoSelected: async (uri: string) => {
this.photoPath = uri;
this.base64Stringphoto = await ChangeUtil.convertUriToBase64(uri);
onPhotoSelected: async (uri: string| string[]) => {
this.photoPath = String(uri);
this.base64Stringphoto = await ChangeUtil.convertUriToBase64( String(uri));
}
}),
alignment: DialogAlignment.Bottom,
@@ -468,11 +468,11 @@ export struct PerfectUserDataComp {
this.certificatePhotoSheetDialog = new CustomDialogController({
builder: PhotoActionSheet({
controller: this.certificatePhotoSheetDialog,
onPhotoSelected: async (url: string) => {
this.certificatePhoto = url;
this.base64Stringcertificate = await ChangeUtil.convertUriToBase64(url);
onPhotoSelected: async (uri: string| string[]) => {
this.certificatePhoto = String(uri);
this.base64Stringcertificate = await ChangeUtil.convertUriToBase64( String(uri));
console.log('Selected image URI:', url);
// console.log('Selected image URI:', url);
}
}),
alignment: DialogAlignment.Bottom,