更新云信和公益咨询相关代码
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { iconsModel } from '../model/HomeModel'
|
||||
import { patientDbManager, PatientEntity } from '@itcast/basic';
|
||||
import { promptAction } from '@kit.ArkUI';
|
||||
import { promptAction, router } from '@kit.ArkUI';
|
||||
|
||||
// interface iconsModel {
|
||||
// img:string;
|
||||
@@ -57,6 +57,13 @@ export struct HomeIconComp {
|
||||
const patients = await patientDbManager.getAllPatients();
|
||||
console.info(`添加了 ${patients.length} 个患者`);
|
||||
promptAction.showToast({message:`添加了 ${patients.length} 个患者`})
|
||||
if(item.name=='公益咨询') {
|
||||
router.pushUrl({ url: 'pages/Netease/PublicConsultationPage' })
|
||||
}
|
||||
else if(item.name=='我的患者') {
|
||||
router.pushUrl({url:'pages/Netease/imTabPage'})
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
}.width('100%').backgroundColor(Color.White)
|
||||
|
||||
@@ -198,9 +198,9 @@ export struct VideoPage {
|
||||
})
|
||||
.margin({bottom:60})
|
||||
.onClick(() => {
|
||||
// router.pushUrl({url:'pages/VideoPage/PastVideoPage'})
|
||||
router.pushUrl({url:'pages/VideoPage/PastVideoPage'})
|
||||
// router.pushUrl({url:'pages/Netease/imTabPage'})
|
||||
router.pushUrl({url:'pages/Netease/PublicConsultationPage'})
|
||||
// router.pushUrl({url:'pages/Netease/PublicConsultationPage'})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ export struct ConsultationDetailComp {
|
||||
builder:PerfactInputSheet({
|
||||
controller:this.custom,
|
||||
inputTitle:'',
|
||||
okText:'是',
|
||||
cancelText:'否',
|
||||
inputPlaceholder:this.inputPlaceholder,
|
||||
style:'2',
|
||||
okColor:$r('app.color.top_title'),
|
||||
|
||||
@@ -263,11 +263,21 @@ export struct InterrogationDetailComp {
|
||||
.backgroundColor($r('app.color.patient_theme'))
|
||||
.fontColor(Color.White)
|
||||
.onClick(() => {
|
||||
if(this.params.isHistory =='false')
|
||||
{
|
||||
router.pushUrl({
|
||||
url: 'pages/Netease/MyOpinionPage',
|
||||
params: { uuid:this.params.uuid,isHistory:this.params.isHistory}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
router.pushUrl({
|
||||
url: 'pages/Netease/MyOpinionPage',
|
||||
params: { uuid:this.params.uuid,isHistory:this.params.isHistory,myAnswer:this.getMyanswer(this.AnswerList)}
|
||||
});
|
||||
}
|
||||
|
||||
router.pushUrl({
|
||||
url: 'pages/Netease/MyOpinionPage',
|
||||
// params: { uuid: this.item.uuid}
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
@@ -307,5 +317,11 @@ export struct InterrogationDetailComp {
|
||||
|
||||
}
|
||||
|
||||
getMyanswer(AnswerList:AnswerListBean[])
|
||||
{
|
||||
let targetItem = AnswerList.find(item => authStore.getUser().uuid ==item.expert_uuid );
|
||||
return targetItem
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
import { ChangePhotoGrids, HdNav, ViewImageInfo } from "@itcast/basic"
|
||||
import { BasicConstant, ChangePhotoGrids,
|
||||
ChangeUtil,
|
||||
hdHttp,
|
||||
HdLoadingDialog, HdNav,
|
||||
HdResponse,
|
||||
preferenceStore, ViewImageInfo } from "@itcast/basic"
|
||||
import { PhotoActionSheet } from '@itcast/basic'
|
||||
|
||||
import { AnswerListBean } from "../model/ConsulModel"
|
||||
import { router } from "@kit.ArkUI"
|
||||
import { PerfactInputSheet } from "@itcast/basic/src/main/ets/Views/PerfactInputSheet"
|
||||
import { BusinessError } from "@kit.BasicServicesKit"
|
||||
import { HashMap } from "@kit.ArkTS"
|
||||
import { rcp } from '@kit.RemoteCommunicationKit';
|
||||
@Component
|
||||
export struct MyOpinionComp {
|
||||
@State photos: string[] = []
|
||||
@@ -10,12 +20,15 @@ export struct MyOpinionComp {
|
||||
@State
|
||||
@Watch('onRemoveImg')
|
||||
removeImg: boolean=false
|
||||
|
||||
@State text: string = ''
|
||||
@State
|
||||
@Watch('onAddImg')
|
||||
addImg: boolean=false
|
||||
|
||||
@State params:param = router.getParams() as param;
|
||||
@State removeIndex: number=0
|
||||
hashMap: HashMap<string, Object> = new HashMap();
|
||||
hashMapImg: HashMap<string, string> = new HashMap();
|
||||
|
||||
onAddImg()
|
||||
{
|
||||
this.photoSheetDialog.open()
|
||||
@@ -25,6 +38,42 @@ export struct MyOpinionComp {
|
||||
this.photos.splice(this.removeIndex, 1)
|
||||
this.maxSelectNumber = this.maxSelectNumber - this.photos.length;
|
||||
}
|
||||
private custom!:CustomDialogController;
|
||||
dialog: CustomDialogController = new CustomDialogController({
|
||||
builder: HdLoadingDialog({ message: '加载中...' }),
|
||||
customStyle: true,
|
||||
alignment: DialogAlignment.Center
|
||||
})
|
||||
initDialog() {
|
||||
this.custom = new CustomDialogController({
|
||||
builder:PerfactInputSheet({
|
||||
controller:this.custom,
|
||||
inputTitle:'提示',
|
||||
okText:'保存',
|
||||
needcancelCallBack:true,
|
||||
okColor:$r('app.color.top_title'),
|
||||
inputPlaceholder:'您有未发布的内容,是否保存?',
|
||||
style:'2',
|
||||
inputCallBack:(input: string,title:string)=>{
|
||||
if(title=='needcancelCallBack')
|
||||
{
|
||||
preferenceStore.setItemString('MyOpinionComp'+this.params.uuid,'')
|
||||
}
|
||||
else
|
||||
{
|
||||
preferenceStore.setItemString('MyOpinionComp'+this.params.uuid,this.text)
|
||||
}
|
||||
router.back()
|
||||
|
||||
}
|
||||
}),
|
||||
alignment: DialogAlignment.Center,
|
||||
customStyle: true,
|
||||
autoCancel: false,
|
||||
backgroundColor: ('rgba(0,0,0,0.5)'),
|
||||
height: '100%'
|
||||
})
|
||||
}
|
||||
private initPhotoDialog() {
|
||||
this.photoSheetDialog = new CustomDialogController({
|
||||
builder: PhotoActionSheet({
|
||||
@@ -44,13 +93,7 @@ export struct MyOpinionComp {
|
||||
|
||||
|
||||
}
|
||||
// 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,
|
||||
@@ -60,17 +103,90 @@ export struct MyOpinionComp {
|
||||
});
|
||||
}
|
||||
aboutToAppear(): void {
|
||||
console.log('Response aboutToAppear')
|
||||
this.initPhotoDialog()
|
||||
this.initDialog()
|
||||
if(this.params.isHistory =='true')
|
||||
{
|
||||
this.text=this.params.myAnswer.note
|
||||
if(this.params.myAnswer.imgs!=null)
|
||||
{
|
||||
this.photos.push(...this.changeToImgs(this.params.myAnswer.imgs.split(",")))
|
||||
this.maxSelectNumber = this.maxSelectNumber - this.photos.length;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.text=preferenceStore.getItemString('MyOpinionComp'+this.params.uuid)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
HdNav({ title: '我的意见', showRightIcon: false, showLeftIcon: true })
|
||||
HdNav({ title: '我的意见', showRightIcon: false, showLeftIcon: true ,isLeftAction:true,leftItemAction:()=>{
|
||||
|
||||
if(this.params.isHistory =='false')
|
||||
{
|
||||
if(this.text.length>0)
|
||||
{
|
||||
this.custom.open()
|
||||
}
|
||||
else
|
||||
{
|
||||
router.back()
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
router.back()
|
||||
}
|
||||
}})
|
||||
Text('我的意见 *').fontSize(17).fontColor($r('app.color.top_title')).padding(10).width('100%').textAlign(TextAlign.Start)
|
||||
TextArea({ placeholder: '请依据患者的个人信息、疾病资料及患者所咨询的问题详细解答患者的问题(信息仅提问患者及医生可见、最多输入300个字)', text: $$this.text })
|
||||
.fontColor($r('app.color.common_gray_03'))
|
||||
.height(100)
|
||||
.textAlign(TextAlign.Start)
|
||||
.fontSize(14).padding(9).margin({left:10,right:10,bottom:10})
|
||||
.backgroundColor($r('app.color.f6f6f6')).borderRadius(8)
|
||||
Text('相关图片').fontSize(17).fontColor($r('app.color.top_title')).padding({left:10,right:10,bottom:10}).width('100%').textAlign(TextAlign.Start)
|
||||
Text('可以用部分科普或文献来协助问答问题,最多6张').fontSize(14).fontColor($r('app.color.999999')).padding({left:10,right:10,bottom:10}).width('100%').textAlign(TextAlign.Start)
|
||||
ChangePhotoGrids({imgList:this.changeToImg(this.photos),maxSelectNumber:6
|
||||
,addImg:this.addImg,removeImg:this.removeImg,removeIndex:this.removeIndex})
|
||||
.backgroundColor(Color.Red)
|
||||
,addImg:this.addImg,removeImg:this.removeImg,removeIndex:this.removeIndex}).layoutWeight(1)
|
||||
Column()
|
||||
{
|
||||
Button({ type: ButtonType.Normal }){
|
||||
Text('提交')
|
||||
}
|
||||
.width('100%')
|
||||
.height(53)
|
||||
.backgroundColor($r('app.color.patient_theme'))
|
||||
.fontColor(Color.White)
|
||||
.onClick(() => {
|
||||
if(this.params.isHistory =='false')
|
||||
{
|
||||
// router.pushUrl({
|
||||
// url: 'pages/Netease/MyOpinionPage',
|
||||
// params: { uuid:this.params.uuid,isHistory:this.params.isHistory}
|
||||
// });
|
||||
}
|
||||
else
|
||||
{
|
||||
this.updateInterrogationAnswer()
|
||||
// router.pushUrl({
|
||||
// url: 'pages/Netease/MyOpinionPage',
|
||||
// params: { uuid:this.params.uuid,isHistory:this.params.isHistory,myAnswer:this.getMyanswer(this.AnswerList)}
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
.backgroundColor(Color.White)
|
||||
.width('100%')
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -78,6 +194,48 @@ export struct MyOpinionComp {
|
||||
.width('100%')
|
||||
}
|
||||
|
||||
async getUploadImg()
|
||||
{
|
||||
this.hashMapImg.clear();
|
||||
|
||||
if(this.photos.length>0)
|
||||
{
|
||||
for (let index = 0; index < this.photos.length; index++) {
|
||||
if(this.photos[index].includes('http'))
|
||||
{
|
||||
this.hashMapImg.set('img'+index+1,await ChangeUtil.getImageBase64(this.photos[index]))
|
||||
}
|
||||
else
|
||||
{
|
||||
this.hashMapImg.set('img'+index+1, await ChangeUtil.convertUriToBase64(this.photos[index]))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return this.hashMapImg
|
||||
}
|
||||
|
||||
async updateInterrogationAnswer()
|
||||
{
|
||||
this.dialog.open()
|
||||
this.hashMap.clear();
|
||||
this.hashMap.set("note",this.text);
|
||||
this.hashMap.set('uuid', this.params.uuid)
|
||||
this.hashMap.set('imgsBean',await this.getUploadImg())
|
||||
hdHttp.httpReqObject<string>(BasicConstant.updateInterrogationAnswer,this.hashMap).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close()
|
||||
|
||||
|
||||
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close()
|
||||
|
||||
})
|
||||
|
||||
// let req = new rcp.Request("http://example.com", "POST", headers, simpleForm, cookies, transferRange, configuration);
|
||||
}
|
||||
|
||||
changeToImg( imgListurl:string[])
|
||||
{
|
||||
let imgListtmps:ViewImageInfo[]=[]
|
||||
@@ -88,4 +246,21 @@ export struct MyOpinionComp {
|
||||
return imgListtmps
|
||||
|
||||
}
|
||||
}
|
||||
changeToImgs( imgListurl:string[])
|
||||
{
|
||||
let imgListtmps:string[]=[]
|
||||
imgListurl.forEach((url: string) => {
|
||||
let item = BasicConstant.urlHtml + url
|
||||
imgListtmps.push(item)
|
||||
})
|
||||
return imgListtmps
|
||||
|
||||
}
|
||||
}
|
||||
interface param{
|
||||
uuid:string,
|
||||
isHistory:string,
|
||||
myAnswer:AnswerListBean
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user