注册资料
@ -37,14 +37,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "uicomponents",
|
|
||||||
"srcPath": "./commons/uicomponents",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "utils",
|
|
||||||
"srcPath": "./commons/utils",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "mypage",
|
"name": "mypage",
|
||||||
"srcPath": "./features/mypage"
|
"srcPath": "./features/mypage"
|
||||||
|
|||||||
@ -2,6 +2,8 @@ export { hdHttp, HdResponse } from './src/main/ets/utils/request'
|
|||||||
|
|
||||||
export { authStore, HdUser, AUTH_STORE_KEY } from './src/main/ets/utils/auth'
|
export { authStore, HdUser, AUTH_STORE_KEY } from './src/main/ets/utils/auth'
|
||||||
|
|
||||||
|
export { perfactAuth } from './src/main/ets/utils/PerfactAuth'
|
||||||
|
|
||||||
export { logger } from './src/main/ets/utils/logger'
|
export { logger } from './src/main/ets/utils/logger'
|
||||||
|
|
||||||
export { getTimeText, getPercentText } from './src/main/ets/utils/base'
|
export { getTimeText, getPercentText } from './src/main/ets/utils/base'
|
||||||
@ -32,4 +34,14 @@ export { AESEncryptionDecryption } from './src/main/ets/utils/AESEncryptionDecry
|
|||||||
|
|
||||||
export { HdGrid } from './src/main/ets/components/HdGrid'
|
export { HdGrid } from './src/main/ets/components/HdGrid'
|
||||||
|
|
||||||
|
export { PhotoActionSheet } from './src/main/ets/Views/PhotoActionSheet'
|
||||||
|
|
||||||
|
export { DatePickerDialog } from './src/main/ets/Views/DatePickerDialog'
|
||||||
|
|
||||||
|
export { OfficeSelectedSheet } from './src/main/ets/Views/OfficeSelectedSheet'
|
||||||
|
|
||||||
|
export { PositionSelectedSheet } from './src/main/ets/Views/PositionSelectedSheet'
|
||||||
|
|
||||||
|
export { SpecialitySelectedSheet } from './src/main/ets/Views/SpecialitySelectedSheet'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,6 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"mypage": "file:../../features/mypage"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { formatDate } from '../util/DateUtils'
|
import { formatDate } from '../utils/DateUtils'
|
||||||
import { authStore } from '@itcast/basic'
|
import { authStore } from '../utils/auth'
|
||||||
|
|
||||||
@CustomDialog
|
@CustomDialog
|
||||||
export struct DatePickerDialog {
|
export struct DatePickerDialog {
|
||||||
@ -1,8 +1,9 @@
|
|||||||
import { hdHttp, HdResponse,BasicConstant, logger,RequestDefaultModel, Data } from '@itcast/basic'
|
|
||||||
import { promptAction } from '@kit.ArkUI'
|
|
||||||
import HashMap from '@ohos.util.HashMap';
|
import HashMap from '@ohos.util.HashMap';
|
||||||
|
import { promptAction } from '@kit.ArkUI'
|
||||||
import { BusinessError } from '@kit.BasicServicesKit';
|
import { BusinessError } from '@kit.BasicServicesKit';
|
||||||
import { authStore } from '@itcast/basic'
|
import { RequestDefaultModel } from '../models/RequestDefaultModel'
|
||||||
|
import { hdHttp, HdResponse } from '../utils/request'
|
||||||
|
import { BasicConstant } from '../constants/BasicConstant'
|
||||||
|
|
||||||
interface DefaultData {
|
interface DefaultData {
|
||||||
|
|
||||||
@ -1,8 +1,10 @@
|
|||||||
import { hdHttp, HdResponse,BasicConstant, logger,RequestDefaultModel, Data } from '@itcast/basic'
|
import { BasicConstant } from '../constants/BasicConstant'
|
||||||
|
import { RequestDefaultModel } from '../models/RequestDefaultModel'
|
||||||
import { promptAction } from '@kit.ArkUI'
|
import { promptAction } from '@kit.ArkUI'
|
||||||
import HashMap from '@ohos.util.HashMap';
|
import HashMap from '@ohos.util.HashMap';
|
||||||
import { BusinessError } from '@kit.BasicServicesKit';
|
import { BusinessError } from '@kit.BasicServicesKit';
|
||||||
import { authStore } from '@itcast/basic'
|
import { authStore } from '../utils/auth'
|
||||||
|
import { hdHttp, HdResponse } from '../utils/request'
|
||||||
|
|
||||||
interface DefaultData {
|
interface DefaultData {
|
||||||
'officeName':string;
|
'officeName':string;
|
||||||
@ -48,6 +50,10 @@ export struct OfficeSelectedSheet {
|
|||||||
if (name == authStore.getUser().officeName) {
|
if (name == authStore.getUser().officeName) {
|
||||||
this.selectedIndex = index;
|
this.selectedIndex = index;
|
||||||
this.selectedModel = {officeName:name,officeUuid:officeObject.officeUuid}
|
this.selectedModel = {officeName:name,officeUuid:officeObject.officeUuid}
|
||||||
|
} else {
|
||||||
|
const defaultModel = this.officeArr[0] as DefaultData;
|
||||||
|
this.selectedIndex = 0;
|
||||||
|
this.selectedModel = {officeName:defaultModel.officeName,officeUuid:defaultModel.officeUuid};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -93,6 +99,7 @@ export struct OfficeSelectedSheet {
|
|||||||
range:this.officeNameArr,
|
range:this.officeNameArr,
|
||||||
selected:this.selectedIndex
|
selected:this.selectedIndex
|
||||||
})
|
})
|
||||||
|
.canLoop(false)
|
||||||
.selectedTextStyle({
|
.selectedTextStyle({
|
||||||
color: '#007AFF',
|
color: '#007AFF',
|
||||||
font: { size: 20, weight: FontWeight.Medium }
|
font: { size: 20, weight: FontWeight.Medium }
|
||||||
77
commons/basic/src/main/ets/Views/PerfactInputSheet.ets
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
import { promptAction } from '@kit.ArkUI'
|
||||||
|
|
||||||
|
@CustomDialog
|
||||||
|
export struct PerfactInputSheet {
|
||||||
|
controller:CustomDialogController;
|
||||||
|
|
||||||
|
@Prop inputTitle:string = '';
|
||||||
|
@Prop inputPlaceholder:string = ''
|
||||||
|
@State inputText:string = ''
|
||||||
|
|
||||||
|
// 添加回调函数属性
|
||||||
|
private inputCallBack: (input: string,title:string) => void = () => {};
|
||||||
|
|
||||||
|
// 修改构造函数
|
||||||
|
constructor(controller: CustomDialogController, inputCallBack: (input: string,title:string) => void) {
|
||||||
|
super();
|
||||||
|
this.controller = controller;
|
||||||
|
this.inputCallBack = inputCallBack;
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
Column() {
|
||||||
|
// 操作按钮区域
|
||||||
|
Row() {
|
||||||
|
Button('取消')
|
||||||
|
.layoutWeight(1)
|
||||||
|
.backgroundColor(Color.Transparent)
|
||||||
|
.fontColor($r('app.color.main_color'))
|
||||||
|
.backgroundColor('#EEEEEE')
|
||||||
|
.width('15%')
|
||||||
|
.fontSize(15)
|
||||||
|
.onClick(() => {
|
||||||
|
this.controller.close()
|
||||||
|
})
|
||||||
|
|
||||||
|
Text(this.inputTitle)
|
||||||
|
.width('65%')
|
||||||
|
.fontSize(15)
|
||||||
|
.fontColor('#333333')
|
||||||
|
.textAlign(TextAlign.Center)
|
||||||
|
|
||||||
|
Button('确定')
|
||||||
|
.layoutWeight(1)
|
||||||
|
.fontSize(15)
|
||||||
|
.backgroundColor(Color.Transparent)
|
||||||
|
.fontColor($r('app.color.main_color'))
|
||||||
|
.backgroundColor('#EEEEEE')
|
||||||
|
.width('15%')
|
||||||
|
.onClick(() => {
|
||||||
|
if (this.inputText.length <= 0) {
|
||||||
|
promptAction.showToast({ message: '输入不能为空', duration: 1000 })
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.controller.close()
|
||||||
|
this.inputCallBack(this.inputText, this.inputTitle);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
.height(30)
|
||||||
|
|
||||||
|
Row(){
|
||||||
|
TextInput({
|
||||||
|
placeholder: this.inputPlaceholder
|
||||||
|
})
|
||||||
|
.height(50)
|
||||||
|
.fontColor(Color.Black)
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.onChange((value: string) => {
|
||||||
|
this.inputText = value;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
}
|
||||||
|
.width('100%')
|
||||||
|
.height(100)
|
||||||
|
.backgroundColor('#EEEEEE')
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,10 @@
|
|||||||
import { hdHttp, HdResponse,BasicConstant,RequestDefaultModel } from '@itcast/basic'
|
import { BasicConstant } from '../constants/BasicConstant'
|
||||||
|
import { RequestDefaultModel } from '../models/RequestDefaultModel'
|
||||||
import { promptAction } from '@kit.ArkUI'
|
import { promptAction } from '@kit.ArkUI'
|
||||||
import HashMap from '@ohos.util.HashMap';
|
import HashMap from '@ohos.util.HashMap';
|
||||||
import { BusinessError } from '@kit.BasicServicesKit';
|
import { BusinessError } from '@kit.BasicServicesKit';
|
||||||
import { authStore } from '@itcast/basic'
|
import { authStore } from '../utils/auth'
|
||||||
|
import { hdHttp, HdResponse } from '../utils/request'
|
||||||
|
|
||||||
interface DefaultData {
|
interface DefaultData {
|
||||||
'name':string;
|
'name':string;
|
||||||
@ -47,7 +49,12 @@ export struct PositionSelectedSheet {
|
|||||||
const nameIndex = this.officeNameArr[index];
|
const nameIndex = this.officeNameArr[index];
|
||||||
if (nameIndex == authStore.getUser().positionName) {
|
if (nameIndex == authStore.getUser().positionName) {
|
||||||
this.selectedIndex = index;
|
this.selectedIndex = index;
|
||||||
this.selectedModel = {name:nameIndex,uuid:object.uuid}
|
this.selectedModel = {name:nameIndex,uuid:object.uuid};
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
const defaultModel = this.officeArr[0] as DefaultData;
|
||||||
|
this.selectedIndex = 0;
|
||||||
|
this.selectedModel = {name:defaultModel.name,uuid:defaultModel.uuid};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('职称名称数组:', this.officeNameArr);
|
console.log('职称名称数组:', this.officeNameArr);
|
||||||
@ -95,6 +102,7 @@ export struct PositionSelectedSheet {
|
|||||||
range:this.officeNameArr,
|
range:this.officeNameArr,
|
||||||
selected:this.selectedIndex
|
selected:this.selectedIndex
|
||||||
})
|
})
|
||||||
|
.canLoop(false)
|
||||||
.selectedTextStyle({
|
.selectedTextStyle({
|
||||||
color: '#007AFF',
|
color: '#007AFF',
|
||||||
font: { size: 20, weight: FontWeight.Medium }
|
font: { size: 20, weight: FontWeight.Medium }
|
||||||
68
commons/basic/src/main/ets/Views/SexSelectedSheet.ets
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
@CustomDialog
|
||||||
|
export struct SexSelectedSheet {
|
||||||
|
controller:CustomDialogController;
|
||||||
|
|
||||||
|
@State sexNameArr:Array<string> = ['男','女'];
|
||||||
|
@Prop selectedSex:number = 0;
|
||||||
|
|
||||||
|
// 添加回调函数属性
|
||||||
|
private sexSelected: (index: number) => void = () => {};
|
||||||
|
|
||||||
|
// 修改构造函数
|
||||||
|
constructor(controller: CustomDialogController, sexSelected: (index: number) => void) {
|
||||||
|
super();
|
||||||
|
this.controller = controller;
|
||||||
|
this.sexSelected = sexSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
Column() {
|
||||||
|
// 操作按钮区域
|
||||||
|
Row({space:70}) {
|
||||||
|
Button('取消')
|
||||||
|
.layoutWeight(1)
|
||||||
|
.backgroundColor(Color.Transparent)
|
||||||
|
.fontColor($r('app.color.main_color'))
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.width(80)
|
||||||
|
.onClick(() => {
|
||||||
|
this.controller.close()
|
||||||
|
})
|
||||||
|
|
||||||
|
Text('请选择性别')
|
||||||
|
.fontSize(15)
|
||||||
|
.fontColor('#666666')
|
||||||
|
|
||||||
|
Button('确定')
|
||||||
|
.layoutWeight(1)
|
||||||
|
.backgroundColor(Color.Transparent)
|
||||||
|
.fontColor($r('app.color.main_color'))
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.width(80)
|
||||||
|
.onClick(() => {
|
||||||
|
this.controller.close()
|
||||||
|
this.sexSelected(this.selectedSex);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
.height(40)
|
||||||
|
|
||||||
|
TextPicker({
|
||||||
|
range:this.sexNameArr,
|
||||||
|
})
|
||||||
|
.canLoop(false)
|
||||||
|
.selectedTextStyle({
|
||||||
|
color: '#007AFF',
|
||||||
|
font: { size: 20, weight: FontWeight.Medium }
|
||||||
|
})
|
||||||
|
.onChange((name: string | string[], index: number | number[]) => {
|
||||||
|
// 处理单列选择场景
|
||||||
|
if (typeof index === "number") {
|
||||||
|
this.selectedSex = index;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
.width('100%')
|
||||||
|
.height(240)
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,9 @@
|
|||||||
import { hdHttp, HdResponse,BasicConstant,RequestDefaultModel } from '@itcast/basic'
|
|
||||||
import HashMap from '@ohos.util.HashMap';
|
import HashMap from '@ohos.util.HashMap';
|
||||||
import { promptAction } from '@kit.ArkUI'
|
import { promptAction } from '@kit.ArkUI'
|
||||||
import { BusinessError } from '@kit.BasicServicesKit';
|
import { BusinessError } from '@kit.BasicServicesKit';
|
||||||
|
import { RequestDefaultModel } from '../models/RequestDefaultModel'
|
||||||
|
import { hdHttp, HdResponse } from '../utils/request'
|
||||||
|
import { BasicConstant } from '../constants/BasicConstant'
|
||||||
|
|
||||||
interface DefaultData {
|
interface DefaultData {
|
||||||
'name':string;
|
'name':string;
|
||||||
@ -13,13 +15,13 @@ export struct SpecialitySelectedSheet {
|
|||||||
controller: CustomDialogController;
|
controller: CustomDialogController;
|
||||||
|
|
||||||
@State specialityArr:Array<DefaultData> = [];
|
@State specialityArr:Array<DefaultData> = [];
|
||||||
@State specialityNameArr:Array<string> = [];
|
@State selectedNames: Array<string> = [];
|
||||||
@State selectedTags: Array<string> = [];
|
@State selectedTags: Array<string> = [];
|
||||||
|
|
||||||
// 添加回调函数属性
|
// 添加回调函数属性
|
||||||
private specialitySelected: (seletedTags:string) => void = () => {};
|
private specialitySelected: (seletedTags:string,selectedNames:string) => void = () => {};
|
||||||
// 修改构造函数
|
// 修改构造函数
|
||||||
constructor(controller: CustomDialogController, specialitySelected: (seletedTags:string) => void) {
|
constructor(controller: CustomDialogController, specialitySelected: (seletedTags:string,selectedNames:string) => void) {
|
||||||
super();
|
super();
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
this.specialitySelected = specialitySelected;
|
this.specialitySelected = specialitySelected;
|
||||||
@ -36,7 +38,6 @@ export struct SpecialitySelectedSheet {
|
|||||||
let json:RequestDefaultModel = JSON.parse(res+'') as RequestDefaultModel;
|
let json:RequestDefaultModel = JSON.parse(res+'') as RequestDefaultModel;
|
||||||
if(json.code=='1') {
|
if(json.code=='1') {
|
||||||
this.specialityArr = json.data as DefaultData[];
|
this.specialityArr = json.data as DefaultData[];
|
||||||
this.specialityNameArr = json.data.map(item => item.name);
|
|
||||||
console.log('请求专长接口成功,信息:', this.specialityArr);
|
console.log('请求专长接口成功,信息:', this.specialityArr);
|
||||||
} else {
|
} else {
|
||||||
console.error('请求专长接口失败:'+json.message)
|
console.error('请求专长接口失败:'+json.message)
|
||||||
@ -74,9 +75,11 @@ export struct SpecialitySelectedSheet {
|
|||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
this.controller.close()
|
this.controller.close()
|
||||||
// 拼接为逗号分隔字符串
|
// 拼接为逗号分隔字符串
|
||||||
const diseaseName = this.selectedTags.join(',');
|
const diseaseUuid = this.selectedTags.join(',');
|
||||||
console.log('当前选中标签的uuid字符串:', diseaseName);
|
const diseaseName = this.selectedNames.join(',');
|
||||||
this.specialitySelected(diseaseName);
|
console.log('当前选中标签的uuid字符串:', diseaseUuid);
|
||||||
|
console.log('当前选中标签的name字符串:', diseaseName);
|
||||||
|
this.specialitySelected(diseaseUuid,diseaseName);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
.height(40)
|
.height(40)
|
||||||
@ -92,7 +95,7 @@ export struct SpecialitySelectedSheet {
|
|||||||
.textAlign(TextAlign.Center)
|
.textAlign(TextAlign.Center)
|
||||||
.backgroundColor(this.isSelected(data.uuid) ? '#b58078' : '#FFFFFF')
|
.backgroundColor(this.isSelected(data.uuid) ? '#b58078' : '#FFFFFF')
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
this.handleTagClick(data.uuid)
|
this.handleTagClick(data.uuid,data.name)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
.height(30)
|
.height(30)
|
||||||
@ -112,7 +115,7 @@ export struct SpecialitySelectedSheet {
|
|||||||
return this.selectedTags.includes(uuid)
|
return this.selectedTags.includes(uuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleTagClick(uuid: string) {
|
private handleTagClick(uuid: string,name:string) {
|
||||||
const index = this.selectedTags.indexOf(uuid);
|
const index = this.selectedTags.indexOf(uuid);
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
// 添加选中(限制最多10个)
|
// 添加选中(限制最多10个)
|
||||||
@ -121,11 +124,16 @@ export struct SpecialitySelectedSheet {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.selectedTags = [...this.selectedTags, uuid];
|
this.selectedTags = [...this.selectedTags, uuid];
|
||||||
|
this.selectedNames = [...this.selectedNames,name];
|
||||||
} else {
|
} else {
|
||||||
// 取消选中
|
// 取消选中
|
||||||
const newSelected = [...this.selectedTags];
|
const newSelected = [...this.selectedTags];
|
||||||
newSelected.splice(index, 1);
|
newSelected.splice(index, 1);
|
||||||
this.selectedTags = newSelected;
|
this.selectedTags = newSelected;
|
||||||
|
|
||||||
|
const nameSelected = [...this.selectedNames];
|
||||||
|
nameSelected.splice(index, 1);
|
||||||
|
this.selectedNames = nameSelected;
|
||||||
}
|
}
|
||||||
console.log('当前选中标签:', this.selectedTags)
|
console.log('当前选中标签:', this.selectedTags)
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import { router } from '@kit.ArkUI'
|
import { router } from '@kit.ArkUI'
|
||||||
|
import { emitter } from '@kit.BasicServicesKit'
|
||||||
|
|
||||||
@Builder
|
@Builder
|
||||||
function defaultBuilder(): void {
|
function defaultBuilder(): void {
|
||||||
@ -34,23 +35,30 @@ export struct HdNav {
|
|||||||
@BuilderParam
|
@BuilderParam
|
||||||
menuBuilder: () => void = defaultBuilder
|
menuBuilder: () => void = defaultBuilder
|
||||||
|
|
||||||
|
// 添加右侧点击处理
|
||||||
|
private onRightItemClick() {
|
||||||
|
emitter.emit({
|
||||||
|
eventId: 250516,
|
||||||
|
priority: emitter.EventPriority.HIGH
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
Row({ space: 16 }) {
|
Row() {
|
||||||
if (this.showLeftIcon) {
|
if (this.showLeftIcon) {
|
||||||
Image(this.leftIcon)
|
Image(this.leftIcon)
|
||||||
.size({ width: 24, height: 24 })
|
.size({ width: 24, height: 24 })
|
||||||
.margin({left:-5})
|
.margin({left:-5})
|
||||||
.onClick(() => router.back())
|
.onClick(() => router.back())
|
||||||
.fillColor($r('app.color.black'))
|
.fillColor($r('app.color.black'))
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Blank()
|
Blank()
|
||||||
.width(24)
|
.width(24)
|
||||||
}
|
}
|
||||||
Row() {
|
Row() {
|
||||||
if (this.title) {
|
if (this.title) {
|
||||||
Text(this.title)
|
Text(this.title)
|
||||||
.fontWeight(600)
|
// .fontWeight(600)
|
||||||
.layoutWeight(1)
|
.layoutWeight(1)
|
||||||
.textAlign(TextAlign.Center)
|
.textAlign(TextAlign.Center)
|
||||||
.fontSize(20)
|
.fontSize(20)
|
||||||
@ -62,6 +70,7 @@ export struct HdNav {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.height(56)
|
.height(56)
|
||||||
|
.width(150)
|
||||||
.layoutWeight(1)
|
.layoutWeight(1)
|
||||||
|
|
||||||
if (this.showRightIcon) {
|
if (this.showRightIcon) {
|
||||||
@ -69,14 +78,14 @@ export struct HdNav {
|
|||||||
.size({ width: 24, height: 24 })
|
.size({ width: 24, height: 24 })
|
||||||
.objectFit(ImageFit.Contain)
|
.objectFit(ImageFit.Contain)
|
||||||
.bindMenu(this.menuBuilder)
|
.bindMenu(this.menuBuilder)
|
||||||
} else if (this.showRightText)
|
.onClick(()=>this.onRightItemClick())
|
||||||
{
|
} else if (this.showRightText) {
|
||||||
Text(this.rightText)
|
Text(this.rightText)
|
||||||
.fontSize(16)
|
.fontSize(16)
|
||||||
.fontColor(this.textColor)
|
.fontColor(this.textColor)
|
||||||
.margin({right:10})
|
.onClick(()=>this.onRightItemClick())
|
||||||
}
|
// .margin({right:10})
|
||||||
else {
|
} else {
|
||||||
Blank()
|
Blank()
|
||||||
.width(24)
|
.width(24)
|
||||||
}
|
}
|
||||||
@ -85,6 +94,5 @@ export struct HdNav {
|
|||||||
.height(56 + this.topHeight)
|
.height(56 + this.topHeight)
|
||||||
.width('100%')
|
.width('100%')
|
||||||
.backgroundColor(this.bgColor)
|
.backgroundColor(this.bgColor)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,4 +50,6 @@ export interface ExpertData{
|
|||||||
state:number;
|
state:number;
|
||||||
realName:string;
|
realName:string;
|
||||||
specialy:Array<object>;
|
specialy:Array<object>;
|
||||||
|
diseaseName:string;
|
||||||
|
diseaseUuid:string;
|
||||||
}
|
}
|
||||||
44
commons/basic/src/main/ets/utils/PerfactAuth.ets
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import { preferences } from '@kit.ArkData'
|
||||||
|
import { ExpertData } from '../models/RequestDefaultModel'
|
||||||
|
|
||||||
|
export const AUTH_STORE_KEY = 'perfactAuth'
|
||||||
|
|
||||||
|
class PerfactAuth {
|
||||||
|
store: preferences.Preferences | null = null
|
||||||
|
|
||||||
|
getStore() {
|
||||||
|
if (!this.store) {
|
||||||
|
this.store = preferences.getPreferencesSync(getContext(), { name: AUTH_STORE_KEY })
|
||||||
|
}
|
||||||
|
return this.store
|
||||||
|
}
|
||||||
|
|
||||||
|
async setUser(phone:string,user: ExpertData) {
|
||||||
|
AppStorage.setOrCreate(phone, user)
|
||||||
|
await this.getStore().put(phone, JSON.stringify(user))
|
||||||
|
await this.getStore().flush()
|
||||||
|
}
|
||||||
|
|
||||||
|
async updateUser(phone:string,user: ExpertData) {
|
||||||
|
AppStorage.setOrCreate(phone, user)
|
||||||
|
await this.getStore().put(phone, JSON.stringify(user))
|
||||||
|
await this.getStore().flush()
|
||||||
|
}
|
||||||
|
|
||||||
|
async delUser(phone:string) {
|
||||||
|
AppStorage.setOrCreate(phone, {})
|
||||||
|
await this.getStore().put(phone, '{}')
|
||||||
|
await this.getStore().flush()
|
||||||
|
}
|
||||||
|
|
||||||
|
initUser() {
|
||||||
|
const json = this.getStore().getSync(AUTH_STORE_KEY, '{}') as string
|
||||||
|
AppStorage.setOrCreate(AUTH_STORE_KEY, JSON.parse(json))
|
||||||
|
}
|
||||||
|
|
||||||
|
getUser(phone:string) {
|
||||||
|
return AppStorage.get<ExpertData>(phone) || {} as ExpertData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const perfactAuth = new PerfactAuth()
|
||||||
@ -2,6 +2,7 @@ import { preferences } from '@kit.ArkData'
|
|||||||
import { router } from '@kit.ArkUI'
|
import { router } from '@kit.ArkUI'
|
||||||
import { Data } from '../models/LoginInfoModel'
|
import { Data } from '../models/LoginInfoModel'
|
||||||
import { ExpertData } from '../models/RequestDefaultModel'
|
import { ExpertData } from '../models/RequestDefaultModel'
|
||||||
|
import { BusinessError } from '@kit.BasicServicesKit'
|
||||||
|
|
||||||
export interface HdUser {
|
export interface HdUser {
|
||||||
id: string
|
id: string
|
||||||
@ -38,6 +39,18 @@ class AuthStore {
|
|||||||
await this.getStore().flush()
|
await this.getStore().flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async setPerfactUser(mobile:string,user:ExpertData) {
|
||||||
|
AppStorage.setOrCreate('mobile', mobile)
|
||||||
|
await this.getStore().put(mobile, JSON.stringify(user))
|
||||||
|
await this.getStore().flush((err:BusinessError)=>{
|
||||||
|
if (err) {
|
||||||
|
console.error('保存失败',err.code,err.message)
|
||||||
|
} else {
|
||||||
|
console.info('保存成功',JSON.stringify(user))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
async delUser() {
|
async delUser() {
|
||||||
AppStorage.setOrCreate('user', {})
|
AppStorage.setOrCreate('user', {})
|
||||||
await this.getStore().put(AUTH_STORE_KEY, '{}')
|
await this.getStore().put(AUTH_STORE_KEY, '{}')
|
||||||
@ -53,6 +66,10 @@ class AuthStore {
|
|||||||
return AppStorage.get<Data>('user') || {} as Data
|
return AppStorage.get<Data>('user') || {} as Data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPerfactUser(phone:string) {
|
||||||
|
return AppStorage.get<ExpertData>(phone) || {} as ExpertData
|
||||||
|
}
|
||||||
|
|
||||||
checkAuth(options: router.RouterOptions | Function) {
|
checkAuth(options: router.RouterOptions | Function) {
|
||||||
// if (this.getUser().token) {
|
// if (this.getUser().token) {
|
||||||
// if (typeof options === 'function') {
|
// if (typeof options === 'function') {
|
||||||
|
|||||||
@ -150,7 +150,7 @@ class HdHttp {
|
|||||||
logger.info('Response httpReq:' + data.result);
|
logger.info('Response httpReq:' + data.result);
|
||||||
let json:TimestampBean = JSON.parse(data.result.toString()) as TimestampBean;
|
let json:TimestampBean = JSON.parse(data.result.toString()) as TimestampBean;
|
||||||
let tp = json.timestamp;
|
let tp = json.timestamp;
|
||||||
datas.set("user_uuid", authStore.getUser().uuid?authStore.getUser().uuid:'');
|
datas.set("user_uuid", authStore.getUser().uuid?authStore.getUser().uuid:'5kO57cuAL8seXQpxgtc');
|
||||||
datas.set("client_type", 'A');
|
datas.set("client_type", 'A');
|
||||||
datas.set("version",'4.0.0' );
|
datas.set("version",'4.0.0' );
|
||||||
datas.set('timestamp',tp+'');
|
datas.set('timestamp',tp+'');
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
6
commons/uicomponents/.gitignore
vendored
@ -1,6 +0,0 @@
|
|||||||
/node_modules
|
|
||||||
/oh_modules
|
|
||||||
/.preview
|
|
||||||
/build
|
|
||||||
/.cxx
|
|
||||||
/.test
|
|
||||||
@ -1 +0,0 @@
|
|||||||
export { MainPage } from './src/main/ets/components/MainPage';
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
{
|
|
||||||
"apiType": "stageMode",
|
|
||||||
"buildOption": {
|
|
||||||
},
|
|
||||||
"buildOptionSet": [
|
|
||||||
{
|
|
||||||
"name": "release",
|
|
||||||
"arkOptions": {
|
|
||||||
"obfuscation": {
|
|
||||||
"ruleOptions": {
|
|
||||||
"enable": false,
|
|
||||||
"files": [
|
|
||||||
"./obfuscation-rules.txt"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"consumerFiles": [
|
|
||||||
"./consumer-rules.txt"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"name": "default"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ohosTest"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
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. */
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
# 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
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "uicomponents",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "Please describe the basic information.",
|
|
||||||
"main": "Index.ets",
|
|
||||||
"author": "",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {}
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
@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%')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"module": {
|
|
||||||
"name": "uicomponents",
|
|
||||||
"type": "har",
|
|
||||||
"deviceTypes": [
|
|
||||||
"default",
|
|
||||||
"tablet",
|
|
||||||
"2in1"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"float": [
|
|
||||||
{
|
|
||||||
"name": "page_text_font_size",
|
|
||||||
"value": "50fp"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"string": [
|
|
||||||
{
|
|
||||||
"name": "page_show",
|
|
||||||
"value": "page from package"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
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);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
import abilityTest from './Ability.test';
|
|
||||||
|
|
||||||
export default function testsuite() {
|
|
||||||
abilityTest();
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"module": {
|
|
||||||
"name": "uicomponents_test",
|
|
||||||
"type": "feature",
|
|
||||||
"deviceTypes": [
|
|
||||||
"default",
|
|
||||||
"tablet",
|
|
||||||
"2in1"
|
|
||||||
],
|
|
||||||
"deliveryWithInstall": true,
|
|
||||||
"installationFree": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
import localUnitTest from './LocalUnit.test';
|
|
||||||
|
|
||||||
export default function testsuite() {
|
|
||||||
localUnitTest();
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
6
commons/utils/.gitignore
vendored
@ -1,6 +0,0 @@
|
|||||||
/node_modules
|
|
||||||
/oh_modules
|
|
||||||
/.preview
|
|
||||||
/build
|
|
||||||
/.cxx
|
|
||||||
/.test
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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 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;
|
|
||||||
}
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
export { logger } from './src/main/ets/request/logger'
|
|
||||||
export { Base64Util } from './src/main/ets/request/Base64Util'
|
|
||||||
export { HdResponse } from './src/main/ets/request/request'
|
|
||||||
export { ChangeUtil } from './src/main/ets/request/ChangeUtil'
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
{
|
|
||||||
"apiType": "stageMode",
|
|
||||||
"buildOption": {
|
|
||||||
},
|
|
||||||
"buildOptionSet": [
|
|
||||||
{
|
|
||||||
"name": "release",
|
|
||||||
"arkOptions": {
|
|
||||||
"obfuscation": {
|
|
||||||
"ruleOptions": {
|
|
||||||
"enable": false,
|
|
||||||
"files": [
|
|
||||||
"./obfuscation-rules.txt"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"consumerFiles": [
|
|
||||||
"./consumer-rules.txt"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"name": "default"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ohosTest"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
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. */
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
# 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
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"meta": {
|
|
||||||
"stableOrder": true
|
|
||||||
},
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
|
||||||
"specifiers": {
|
|
||||||
"@ohos/crypto-js@^2.0.4": "@ohos/crypto-js@2.0.4"
|
|
||||||
},
|
|
||||||
"packages": {
|
|
||||||
"@ohos/crypto-js@2.0.4": {
|
|
||||||
"name": "@ohos/crypto-js",
|
|
||||||
"version": "2.0.4",
|
|
||||||
"integrity": "sha512-589ur6oqU1UNibqefMly2cwEeEhkSoCAA3uc+oNUwRnYYtevn/kQnO+Coi36N+VJSeeg/uFzZk1K/wUMdovpOA==",
|
|
||||||
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/crypto-js/-/crypto-js-2.0.4.har",
|
|
||||||
"registryType": "ohpm"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "utils",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "Please describe the basic information.",
|
|
||||||
"main": "Index.ets",
|
|
||||||
"author": "",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
|
||||||
"@ohos/crypto-js": "^2.0.4"
|
|
||||||
},
|
|
||||||
"devDependencies": {},
|
|
||||||
"dynamicDependencies": {}
|
|
||||||
}
|
|
||||||
@ -1,84 +0,0 @@
|
|||||||
import util from '@ohos.util';
|
|
||||||
|
|
||||||
import { buffer } from '@kit.ArkTS';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base64 工具类
|
|
||||||
* author: 鸿蒙布道师
|
|
||||||
* since: 2025/03/31
|
|
||||||
*/
|
|
||||||
export class Base64Util {
|
|
||||||
/**
|
|
||||||
* 创建 Base64Helper 实例
|
|
||||||
* @returns Base64Helper 实例
|
|
||||||
*/
|
|
||||||
private static createBase64Helper(): util.Base64Helper {
|
|
||||||
return new util.Base64Helper();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编码为 Uint8Array(异步)
|
|
||||||
* @param array 输入的 Uint8Array 数据
|
|
||||||
* @returns 编码后的 Uint8Array 对象
|
|
||||||
*/
|
|
||||||
static encode(array: Uint8Array): Promise<Uint8Array> {
|
|
||||||
const base64 = Base64Util.createBase64Helper();
|
|
||||||
return base64.encode(array);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编码为 Uint8Array(同步)
|
|
||||||
* @param array 输入的 Uint8Array 数据
|
|
||||||
* @returns 编码后的 Uint8Array 对象
|
|
||||||
*/
|
|
||||||
static encodeSync(array: Uint8Array): Uint8Array {
|
|
||||||
const base64 = Base64Util.createBase64Helper();
|
|
||||||
return base64.encodeSync(array);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编码为字符串(异步)
|
|
||||||
* @param array 输入的 Uint8Array 数据
|
|
||||||
* @param options 可选参数
|
|
||||||
* @returns 编码后的字符串
|
|
||||||
*/
|
|
||||||
static encodeToStr(array: Uint8Array, options?: util.Type): Promise<string> {
|
|
||||||
const base64 = Base64Util.createBase64Helper();
|
|
||||||
return base64.encodeToString(array, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编码为字符串(同步)
|
|
||||||
* @param array 输入的 Uint8Array 数据
|
|
||||||
* @param options 可选参数
|
|
||||||
* @returns 编码后的字符串
|
|
||||||
*/
|
|
||||||
static encodeToStrSync(keyValueStr:string): string {
|
|
||||||
let array: Uint8Array=new Uint8Array(buffer.from(keyValueStr, 'utf-8').buffer)
|
|
||||||
const base64 = Base64Util.createBase64Helper();
|
|
||||||
|
|
||||||
return base64.encodeToStringSync(array, util.Type.BASIC).replaceAll("=", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解码为 Uint8Array(异步)
|
|
||||||
* @param input 输入的 Uint8Array 或字符串
|
|
||||||
* @param options 可选参数
|
|
||||||
* @returns 解码后的 Uint8Array 对象
|
|
||||||
*/
|
|
||||||
static decode(input: Uint8Array | string, options?: util.Type): Promise<Uint8Array> {
|
|
||||||
const base64 = Base64Util.createBase64Helper();
|
|
||||||
return base64.decode(input, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解码为 Uint8Array(同步)
|
|
||||||
* @param input 输入的 Uint8Array 或字符串
|
|
||||||
* @param options 可选参数
|
|
||||||
* @returns 解码后的 Uint8Array 对象
|
|
||||||
*/
|
|
||||||
static decodeSync(input: Uint8Array | string, options?: util.Type): Uint8Array {
|
|
||||||
const base64 = Base64Util.createBase64Helper();
|
|
||||||
return base64.decodeSync(input, options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,61 +0,0 @@
|
|||||||
|
|
||||||
import HashMap from '@ohos.util.HashMap';
|
|
||||||
import { Base64Util } from './Base64Util';
|
|
||||||
|
|
||||||
|
|
||||||
export class ChangeUtil {
|
|
||||||
/**
|
|
||||||
* 将HashMap转成JsonString
|
|
||||||
* @param map
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
static map2Json(map:HashMap<string, string>): string {
|
|
||||||
let jsonObject: Record<string, Object> = {};
|
|
||||||
map.forEach((value, key) => {
|
|
||||||
if(key != undefined && value != undefined){
|
|
||||||
jsonObject[key] = value;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return JSON.stringify(jsonObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
static getSign(extraDatas1:HashMap<string, string>): string {
|
|
||||||
let secret= extraDatas1.get("timestamp")
|
|
||||||
if(secret!=null) {
|
|
||||||
let keyValueStr: string = "";
|
|
||||||
let entriesArray: Array<string> = Array.from(extraDatas1.keys());
|
|
||||||
entriesArray.sort();
|
|
||||||
|
|
||||||
let sortedMap:HashMap<string, string> = new HashMap();
|
|
||||||
entriesArray.forEach((value: string, index: number) => {
|
|
||||||
sortedMap.set(value,extraDatas1.get(value));
|
|
||||||
keyValueStr +=value+extraDatas1.get(value)
|
|
||||||
});
|
|
||||||
keyValueStr = keyValueStr.replace(" ", "");
|
|
||||||
keyValueStr = keyValueStr + CryptoJS.MD5(secret).toString();
|
|
||||||
let Md5keyValueStr: string = CryptoJS.MD5(keyValueStr).toString();
|
|
||||||
let base64Str:string=Base64Util.encodeToStrSync(Md5keyValueStr);
|
|
||||||
return base64Str;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static isMobileNum(mobiles:string): boolean {
|
|
||||||
const reg2: RegExp = new RegExp('^(1[3-9])[0-9]{9}$')
|
|
||||||
|
|
||||||
return reg2.test(mobiles);
|
|
||||||
}
|
|
||||||
static isPassword(password:string): boolean {
|
|
||||||
const reg2: RegExp = new RegExp('^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$')
|
|
||||||
|
|
||||||
return reg2.test(password);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
import hilog from '@ohos.hilog'
|
|
||||||
|
|
||||||
const DOMAIN = 0xFF09
|
|
||||||
const PREFIX = 'PASS_INTERVIEW_LOGGER'
|
|
||||||
const FORMAT = '%{public}s, %{public}s'
|
|
||||||
|
|
||||||
class Logger {
|
|
||||||
debug(...args: string[]) {
|
|
||||||
hilog.debug(DOMAIN, PREFIX, FORMAT, args)
|
|
||||||
}
|
|
||||||
|
|
||||||
info(...args: string[]) {
|
|
||||||
hilog.info(DOMAIN, PREFIX, FORMAT, args)
|
|
||||||
}
|
|
||||||
|
|
||||||
warn(...args: string[]) {
|
|
||||||
hilog.warn(DOMAIN, PREFIX, FORMAT, args)
|
|
||||||
}
|
|
||||||
|
|
||||||
error(...args: string[]) {
|
|
||||||
hilog.error(DOMAIN, PREFIX, FORMAT, args)
|
|
||||||
}
|
|
||||||
|
|
||||||
fatal(...args: string[]) {
|
|
||||||
hilog.fatal(DOMAIN, PREFIX, FORMAT, args)
|
|
||||||
}
|
|
||||||
|
|
||||||
isLoggable(level: hilog.LogLevel) {
|
|
||||||
hilog.isLoggable(DOMAIN, PREFIX, level)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const logger = new Logger()
|
|
||||||
@ -1,288 +0,0 @@
|
|||||||
import { http } from '@kit.NetworkKit';
|
|
||||||
import { promptAction, router } from '@kit.ArkUI';
|
|
||||||
import { BusinessError } from '@ohos.base';
|
|
||||||
import { HashMap } from '@kit.ArkTS';
|
|
||||||
import { CryptoJS } from '@ohos/crypto-js'
|
|
||||||
import { Base64Util } from './Base64Util';
|
|
||||||
import { ChangeUtil } from './ChangeUtil'
|
|
||||||
import { logger } from './logger'
|
|
||||||
|
|
||||||
interface HdRequestOptions {
|
|
||||||
baseURL?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
type HdParams = Record<string, string | number | boolean>
|
|
||||||
|
|
||||||
export interface HdResponse<T> {
|
|
||||||
code: number
|
|
||||||
message: string
|
|
||||||
data: T
|
|
||||||
}
|
|
||||||
export interface TimestampBean {
|
|
||||||
timestamp:string
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
class HdHttp {
|
|
||||||
baseURL: string
|
|
||||||
|
|
||||||
constructor(options: HdRequestOptions) {
|
|
||||||
this.baseURL = options.baseURL || ''
|
|
||||||
}
|
|
||||||
|
|
||||||
private request1<T>(path: string, method: http.RequestMethod = http.RequestMethod.GET, extraDatas:HashMap<string, string>) {
|
|
||||||
const httpInstance = http.createHttp()
|
|
||||||
let fullUrl = this.baseURL + path
|
|
||||||
let promise = httpInstance.request(
|
|
||||||
// 请求url地址
|
|
||||||
fullUrl,
|
|
||||||
{
|
|
||||||
// 请求方式
|
|
||||||
method: http.RequestMethod.POST,
|
|
||||||
// 可选,默认为60s
|
|
||||||
connectTimeout: 60000,
|
|
||||||
// 可选,默认为60s
|
|
||||||
readTimeout: 60000,
|
|
||||||
// 开发者根据自身业务需要添加header字段
|
|
||||||
header: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'sign':this.getSign(extraDatas)
|
|
||||||
},
|
|
||||||
extraData:ChangeUtil.map2Json(extraDatas)
|
|
||||||
});
|
|
||||||
logger.info('Response JSON.stringify(extraDatas)' + ChangeUtil.map2Json(extraDatas))
|
|
||||||
return promise.then((data) => {
|
|
||||||
logger.info('Response request:' + data.result);
|
|
||||||
if (data.result) {
|
|
||||||
const result = data.result as HdResponse<T>
|
|
||||||
logger.info('Response result:' + result);
|
|
||||||
return result
|
|
||||||
|
|
||||||
}
|
|
||||||
return Promise.reject(data.result)
|
|
||||||
// if (data.responseCode === http.ResponseCode.OK) {
|
|
||||||
// console.info('Response request:' + data.result);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// return Promise.reject(data.result)
|
|
||||||
}
|
|
||||||
|
|
||||||
).catch((err:BusinessError) => {
|
|
||||||
logger.info('Response httpReq request:' + JSON.stringify(err));
|
|
||||||
return Promise.reject(err)
|
|
||||||
|
|
||||||
}).finally(() => {
|
|
||||||
httpInstance.destroy()
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
private request<T>(path: string, method: http.RequestMethod = http.RequestMethod.POST, extraDatas :HashMap<string, string>) {
|
|
||||||
const httpInstance = http.createHttp()
|
|
||||||
|
|
||||||
const options: http.HttpRequestOptions = {
|
|
||||||
method: http.RequestMethod.POST,
|
|
||||||
// 可选,默认为60s
|
|
||||||
connectTimeout: 60000,
|
|
||||||
// 可选,默认为60s
|
|
||||||
readTimeout: 60000,
|
|
||||||
// 开发者根据自身业务需要添加header字段
|
|
||||||
header: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'sign':this.getSign(extraDatas)
|
|
||||||
},
|
|
||||||
extraData:ChangeUtil.map2Json(extraDatas)
|
|
||||||
}
|
|
||||||
|
|
||||||
let fullUrl = this.baseURL + path
|
|
||||||
|
|
||||||
|
|
||||||
return httpInstance.request(fullUrl, options).then((res) => {
|
|
||||||
logger.info('Response fullUrl:' +fullUrl+ res.result);
|
|
||||||
const result = res.result as HdResponse<T>
|
|
||||||
return result
|
|
||||||
}).catch((err: BusinessError) => {
|
|
||||||
logger.info(fullUrl+`Response succeeded: ${err}`);
|
|
||||||
promptAction.showToast({ message: err.message || '网络错误' })
|
|
||||||
return Promise.reject(err)
|
|
||||||
}).finally(() => {
|
|
||||||
httpInstance.destroy()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private requestafter<T>(path: string, method: http.RequestMethod = http.RequestMethod.GET, extraData?: Object) {
|
|
||||||
const httpInstance = http.createHttp()
|
|
||||||
|
|
||||||
const options: http.HttpRequestOptions = {
|
|
||||||
method: http.RequestMethod.GET,
|
|
||||||
// 可选,默认为60s
|
|
||||||
connectTimeout: 60000,
|
|
||||||
// 可选,默认为60s
|
|
||||||
readTimeout: 60000,
|
|
||||||
// 开发者根据自身业务需要添加header字段
|
|
||||||
header: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let fullUrl = this.baseURL + path
|
|
||||||
if (method === http.RequestMethod.GET && extraData) {
|
|
||||||
const strArr = Object.keys(extraData)
|
|
||||||
.filter(key => (extraData as HdParams)[key] !== undefined)
|
|
||||||
.map(key => `${key}=${(extraData as HdParams)[key]}`)
|
|
||||||
fullUrl += `?${strArr.join('&')}`
|
|
||||||
} else {
|
|
||||||
options.extraData = extraData
|
|
||||||
}
|
|
||||||
|
|
||||||
return httpInstance.request(fullUrl, options).then((res) => {
|
|
||||||
return Promise.reject(res.result)
|
|
||||||
}).catch((err: BusinessError) => {
|
|
||||||
logger.error(fullUrl+`Response succeeded: ${err}+${err.name}+${err.message}+${err.data}+${err.stack}`);
|
|
||||||
// logger.error(fullUrl, err.code?.toString(), err.message)
|
|
||||||
promptAction.showToast({ message: err.message || '网络错误' })
|
|
||||||
return Promise.reject(err)
|
|
||||||
}).finally(() => {
|
|
||||||
httpInstance.destroy()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
get<T>(url: string, data?: Object): Promise<HdResponse<T>> {
|
|
||||||
return this.requestafter<T>(url, http.RequestMethod.GET, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
post<T>(url: string, data?: Object): Promise<HdResponse<T>> {
|
|
||||||
return this.requestafter<T>(url, http.RequestMethod.POST, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
put<T>(url: string, data?: Object): Promise<HdResponse<T>> {
|
|
||||||
return this.requestafter<T>(url, http.RequestMethod.PUT, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
delete<T>(url: string, data?: Object): Promise<HdResponse<T>> {
|
|
||||||
return this.requestafter<T>(url, http.RequestMethod.DELETE, data)
|
|
||||||
}
|
|
||||||
posts<T>(url: string, data: HashMap<string, string>): Promise<HdResponse<T>> {
|
|
||||||
return this.request<T>(url, http.RequestMethod.POST, data)
|
|
||||||
}
|
|
||||||
httpReq<T>(url: string, datas: HashMap<string, string>): Promise<HdResponse<T>> {
|
|
||||||
|
|
||||||
// 创建httpRequest对象。
|
|
||||||
let httpRequest = http.createHttp();
|
|
||||||
let url1 = "https://dev-app.igandan.com/app/manager/getSystemTimeStamp";
|
|
||||||
let promise = httpRequest.request(
|
|
||||||
// 请求url地址
|
|
||||||
url1,
|
|
||||||
{
|
|
||||||
// 请求方式
|
|
||||||
method: http.RequestMethod.GET,
|
|
||||||
// 可选,默认为60s
|
|
||||||
connectTimeout: 60000,
|
|
||||||
// 可选,默认为60s
|
|
||||||
readTimeout: 60000,
|
|
||||||
// 开发者根据自身业务需要添加header字段
|
|
||||||
header: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// 处理响应结果。
|
|
||||||
return promise.then((data) => {
|
|
||||||
if (data.responseCode === http.ResponseCode.OK) {
|
|
||||||
logger.info('Response httpReq:' + data.result);
|
|
||||||
let json:TimestampBean = JSON.parse(data.result.toString()) as TimestampBean;
|
|
||||||
let tp = json.timestamp;
|
|
||||||
datas.set("user_uuid", '');
|
|
||||||
datas.set("client_type", 'A');
|
|
||||||
datas.set("version",'4.0.0' );
|
|
||||||
datas.set('timestamp',tp+'');
|
|
||||||
|
|
||||||
return this.posts<T>(url, datas);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return this.posts<T>(url, datas);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
).catch((err:BusinessError) => {
|
|
||||||
logger.info('Response httpReq error:' + JSON.stringify(err));
|
|
||||||
return Promise.reject(err);
|
|
||||||
|
|
||||||
}).finally(() => {
|
|
||||||
httpRequest.destroy()
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
httpReqSimply<T>(url: string) {
|
|
||||||
|
|
||||||
// 创建httpRequest对象。
|
|
||||||
let httpRequest = http.createHttp();
|
|
||||||
|
|
||||||
let promise = httpRequest.request(
|
|
||||||
// 请求url地址
|
|
||||||
url,
|
|
||||||
{
|
|
||||||
// 请求方式
|
|
||||||
method: http.RequestMethod.POST,
|
|
||||||
// 可选,默认为60s
|
|
||||||
connectTimeout: 60000,
|
|
||||||
// 可选,默认为60s
|
|
||||||
readTimeout: 60000,
|
|
||||||
// 开发者根据自身业务需要添加header字段
|
|
||||||
header: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// 处理响应结果。
|
|
||||||
return promise.then((data) => {
|
|
||||||
logger.info('Response httpReqSimply:' + JSON.stringify(data));
|
|
||||||
const result = data.result as HdResponse<T>
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
).catch((err:BusinessError) => {
|
|
||||||
logger.info('Response httpReq error:' + JSON.stringify(err));
|
|
||||||
return Promise.reject(err);
|
|
||||||
|
|
||||||
}).finally(() => {
|
|
||||||
httpRequest.destroy()
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
getSign(extraDatas1:HashMap<string, string>): string {
|
|
||||||
let secret= extraDatas1.get("timestamp")
|
|
||||||
if(secret!=null) {
|
|
||||||
let keyValueStr: string = "";
|
|
||||||
let entriesArray: Array<string> = Array.from(extraDatas1.keys());
|
|
||||||
entriesArray.sort();
|
|
||||||
|
|
||||||
let sortedMap:HashMap<string, string> = new HashMap();
|
|
||||||
entriesArray.forEach((value: string, index: number) => {
|
|
||||||
sortedMap.set(value,extraDatas1.get(value));
|
|
||||||
keyValueStr +=value+extraDatas1.get(value)
|
|
||||||
});
|
|
||||||
keyValueStr = keyValueStr.replace(" ", "");
|
|
||||||
keyValueStr = keyValueStr + CryptoJS.MD5(secret).toString();
|
|
||||||
let Md5keyValueStr: string = CryptoJS.MD5(keyValueStr).toString();
|
|
||||||
let base64Str:string=Base64Util.encodeToStrSync(Md5keyValueStr);
|
|
||||||
return base64Str;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const hdHttp = new HdHttp({ baseURL: '' })
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"module": {
|
|
||||||
"name": "utils",
|
|
||||||
"type": "har",
|
|
||||||
"deviceTypes": [
|
|
||||||
"default",
|
|
||||||
"tablet",
|
|
||||||
"2in1"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"float": [
|
|
||||||
{
|
|
||||||
"name": "page_text_font_size",
|
|
||||||
"value": "50fp"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"string": [
|
|
||||||
{
|
|
||||||
"name": "page_show",
|
|
||||||
"value": "page from package"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
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);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
import abilityTest from './Ability.test';
|
|
||||||
|
|
||||||
export default function testsuite() {
|
|
||||||
abilityTest();
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"module": {
|
|
||||||
"name": "utils_test",
|
|
||||||
"type": "feature",
|
|
||||||
"deviceTypes": [
|
|
||||||
"default",
|
|
||||||
"tablet",
|
|
||||||
"2in1"
|
|
||||||
],
|
|
||||||
"deliveryWithInstall": true,
|
|
||||||
"installationFree": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
import localUnitTest from './LocalUnit.test';
|
|
||||||
|
|
||||||
export default function testsuite() {
|
|
||||||
localUnitTest();
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,15 +1,8 @@
|
|||||||
export { MyHomePage } from './src/main/ets/pages/MyHomePage'
|
export { MyHomePage } from './src/main/ets/pages/MyHomePage'
|
||||||
|
|
||||||
export { ChangePasswordComp } from './src/main/ets/view/ChangePasswordComp'
|
export { ChangePasswordComp } from './src/main/ets/view/ChangePasswordComp'
|
||||||
|
|
||||||
export { ForgetPasswordComp } from './src/main/ets/view/ForgetPasswordComp'
|
export { ForgetPasswordComp } from './src/main/ets/view/ForgetPasswordComp'
|
||||||
|
|
||||||
export { ChangePhoneComp } from './src/main/ets/view/ChangePhoneComp'
|
export { ChangePhoneComp } from './src/main/ets/view/ChangePhoneComp'
|
||||||
|
|
||||||
export { ChooseEmailComp } from './src/main/ets/view/ChooseEmailComp'
|
export { ChooseEmailComp } from './src/main/ets/view/ChooseEmailComp'
|
||||||
|
|
||||||
export { ChooseOfficePhoneComp } from './src/main/ets/view/ChooseOfficePhoneComp'
|
export { ChooseOfficePhoneComp } from './src/main/ets/view/ChooseOfficePhoneComp'
|
||||||
|
|
||||||
export { EditUserDataComp } from './src/main/ets/view/EditUserDataComp'
|
export { EditUserDataComp } from './src/main/ets/view/EditUserDataComp'
|
||||||
|
export { SpecialitySelectedSheet } from '@itcast/basic/src/main/ets/Views/SpecialitySelectedSheet'
|
||||||
export { SpecialitySelectedSheet } from './src/main/ets/view/SpecialitySelectedSheet'
|
|
||||||
@ -3,11 +3,11 @@ import HashMap from '@ohos.util.HashMap'
|
|||||||
import { BusinessError } from '@kit.BasicServicesKit';
|
import { BusinessError } from '@kit.BasicServicesKit';
|
||||||
import { promptAction, router } from '@kit.ArkUI'
|
import { promptAction, router } from '@kit.ArkUI'
|
||||||
import { EditUserDataItem } from './EditUserDataItem'
|
import { EditUserDataItem } from './EditUserDataItem'
|
||||||
import { PhotoActionSheet } from './PhotoActionSheet'
|
import { PhotoActionSheet } from '@itcast/basic/src/main/ets/Views/PhotoActionSheet'
|
||||||
import { DatePickerDialog } from './DatePickerDialog'
|
import { DatePickerDialog } from '@itcast/basic/src/main/ets/Views//DatePickerDialog'
|
||||||
import { OfficeSelectedSheet } from './OfficeSelectedSheet'
|
import { OfficeSelectedSheet } from '@itcast/basic/src/main/ets/Views//OfficeSelectedSheet'
|
||||||
import { PositionSelectedSheet } from './PositionSelectedSheet'
|
import { PositionSelectedSheet } from '@itcast/basic/src/main/ets/Views//PositionSelectedSheet'
|
||||||
import { SpecialitySelectedSheet } from './SpecialitySelectedSheet'
|
import { SpecialitySelectedSheet } from '@itcast/basic/src/main/ets/Views//SpecialitySelectedSheet'
|
||||||
import { http } from '@kit.NetworkKit';
|
import { http } from '@kit.NetworkKit';
|
||||||
import { rcp } from '@kit.RemoteCommunicationKit';
|
import { rcp } from '@kit.RemoteCommunicationKit';
|
||||||
interface extraData {
|
interface extraData {
|
||||||
|
|||||||
@ -4,6 +4,7 @@ export struct EditUserDataItem {
|
|||||||
private required: boolean = false
|
private required: boolean = false
|
||||||
@Prop content: string = ''
|
@Prop content: string = ''
|
||||||
private hasArrow: boolean = false
|
private hasArrow: boolean = false
|
||||||
|
@Prop isLine:boolean = true;
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
Column() {
|
Column() {
|
||||||
@ -12,7 +13,7 @@ export struct EditUserDataItem {
|
|||||||
Text(this.label)
|
Text(this.label)
|
||||||
.fontSize(16)
|
.fontSize(16)
|
||||||
.fontColor('#333333')
|
.fontColor('#333333')
|
||||||
.margin({ left: 15 })
|
.margin({ left: this.isLine?15:10 })
|
||||||
if (this.required) {
|
if (this.required) {
|
||||||
Text('*')
|
Text('*')
|
||||||
.margin({ left: 0 })
|
.margin({ left: 0 })
|
||||||
@ -26,7 +27,7 @@ export struct EditUserDataItem {
|
|||||||
Row({space:5}) {
|
Row({space:5}) {
|
||||||
if (this.label == '头像') {
|
if (this.label == '头像') {
|
||||||
Image(this.content)
|
Image(this.content)
|
||||||
.alt($r('app.media.userPhoto_default'))
|
.alt(this.isLine?$r('app.media.userPhoto_default'):$r('app.media.icon_touxiang_persion_ws'))
|
||||||
.onComplete(() => console.log('图片加载完成'))
|
.onComplete(() => console.log('图片加载完成'))
|
||||||
.onError(() => console.error('图片加载失败'+this.content))
|
.onError(() => console.error('图片加载失败'+this.content))
|
||||||
.width(40)
|
.width(40)
|
||||||
@ -35,6 +36,7 @@ export struct EditUserDataItem {
|
|||||||
.borderRadius(8)
|
.borderRadius(8)
|
||||||
} else if (this.label == '执业医师证图片或胸牌') {
|
} else if (this.label == '执业医师证图片或胸牌') {
|
||||||
Image(this.content)
|
Image(this.content)
|
||||||
|
.alt(this.isLine?null:$r('app.media.icon_xiongpai_ws'))
|
||||||
.onComplete(() => console.log('图片加载完成'))
|
.onComplete(() => console.log('图片加载完成'))
|
||||||
.onError(() => console.error('图片加载失败'+this.content))
|
.onError(() => console.error('图片加载失败'+this.content))
|
||||||
.width(60)
|
.width(60)
|
||||||
@ -44,7 +46,10 @@ export struct EditUserDataItem {
|
|||||||
Text(this.content)
|
Text(this.content)
|
||||||
.fontSize(14)
|
.fontSize(14)
|
||||||
.fontColor('#333333')
|
.fontColor('#333333')
|
||||||
.width('60%')
|
.width('auto')
|
||||||
|
.constraintSize({
|
||||||
|
maxWidth:this.label='专长(可选一到十项)'?'50%':'70%'
|
||||||
|
})
|
||||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||||
.maxLines(1)
|
.maxLines(1)
|
||||||
.margin({right: this.hasArrow?0:10 })
|
.margin({right: this.hasArrow?0:10 })
|
||||||
@ -62,11 +67,13 @@ export struct EditUserDataItem {
|
|||||||
.height(50)
|
.height(50)
|
||||||
.alignItems(VerticalAlign.Center)
|
.alignItems(VerticalAlign.Center)
|
||||||
|
|
||||||
Divider()
|
if (this.isLine) {
|
||||||
.color('#F4F4F4')
|
Divider()
|
||||||
.strokeWidth(1)
|
.color('#F4F4F4')
|
||||||
.height(1)
|
.strokeWidth(1)
|
||||||
.margin({ left: 10, top: 0 })
|
.height(1)
|
||||||
|
.margin({ left: 10, top: 0 })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { hdHttp, HdResponse,BasicConstant,ExpertData, authStore,RequestDefaultModel } from '@itcast/basic'
|
import { hdHttp, HdResponse,BasicConstant,ExpertData, authStore,RequestDefaultModel } from '@itcast/basic'
|
||||||
import { BusinessError } from '@kit.BasicServicesKit';
|
import { BusinessError } from '@kit.BasicServicesKit';
|
||||||
import { HeroPopWindow } from '../view/HeroPopWindow'
|
import { HeroPopWindow } from '@itcast/basic/src/main/ets/Views/HeroPopWindow'
|
||||||
import HashMap from '@ohos.util.HashMap'
|
import HashMap from '@ohos.util.HashMap'
|
||||||
import { router } from '@kit.ArkUI'
|
import { router } from '@kit.ArkUI'
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
@ -1,7 +1,7 @@
|
|||||||
export { MainPage } from './src/main/ets/components/MainPage';
|
export { MainPage } from './src/main/ets/components/MainPage';
|
||||||
export { GuidePage } from './src/main/ets/view/GuidePage'
|
export { GuidePage } from './src/main/ets/view/GuidePage'
|
||||||
export { LoginComp } from './src/main/ets/view/LoginComp'
|
export { LoginComp } from './src/main/ets/view/LoginComp'
|
||||||
|
|
||||||
export { WebHeightPage } from './src/main/ets/view/WebHeightPage'
|
export { WebHeightPage } from './src/main/ets/view/WebHeightPage'
|
||||||
|
|
||||||
export { LoginSetInfo } from './src/main/ets/view/LoginSetInfo'
|
export { LoginSetInfo } from './src/main/ets/view/LoginSetInfo'
|
||||||
|
export { PerfectUserDataComp } from './src/main/ets/view/PerfectUserDataComp'
|
||||||
|
export { SelectedHospitalComp } from './src/main/ets/view/SelectedHospitalComp'
|
||||||
@ -5,7 +5,8 @@
|
|||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
||||||
"specifiers": {
|
"specifiers": {
|
||||||
"@itcast/basic@../../commons/basic": "@itcast/basic@../../commons/basic"
|
"@itcast/basic@../../commons/basic": "@itcast/basic@../../commons/basic",
|
||||||
|
"mypage@../mypage": "mypage@../mypage"
|
||||||
},
|
},
|
||||||
"packages": {
|
"packages": {
|
||||||
"@itcast/basic@../../commons/basic": {
|
"@itcast/basic@../../commons/basic": {
|
||||||
@ -13,6 +14,15 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "../../commons/basic",
|
"resolved": "../../commons/basic",
|
||||||
"registryType": "local"
|
"registryType": "local"
|
||||||
|
},
|
||||||
|
"mypage@../mypage": {
|
||||||
|
"name": "mypage",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "../mypage",
|
||||||
|
"registryType": "local",
|
||||||
|
"dependencies": {
|
||||||
|
"@itcast/basic": "file:../../commons/basic"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,6 +6,8 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@itcast/basic": "file:../../commons/basic"
|
"@itcast/basic": "file:../../commons/basic",
|
||||||
|
|
||||||
|
"mypage": "file:../../features/mypage"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,18 +41,14 @@ export struct LoginComp {
|
|||||||
if (!ChangeUtil.isMobileNum(this.mobile)) {
|
if (!ChangeUtil.isMobileNum(this.mobile)) {
|
||||||
return promptAction.showToast({ message: "手机号码不正确" })
|
return promptAction.showToast({ message: "手机号码不正确" })
|
||||||
}
|
}
|
||||||
if(this.isPassLogin)
|
if(this.isPassLogin) {
|
||||||
{
|
|
||||||
|
|
||||||
if (!this.code) {
|
if (!this.code) {
|
||||||
return promptAction.showToast({ message: '密码不为空' })
|
return promptAction.showToast({ message: '密码不为空' })
|
||||||
}
|
}
|
||||||
if (!ChangeUtil.isPassword(this.code)) {
|
if (!ChangeUtil.isPassword(this.code)) {
|
||||||
return promptAction.showToast({ message: "请输入6-16位字母、数字组合密码" })
|
return promptAction.showToast({ message: "请输入6-16位字母、数字组合密码" })
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!this.current_code) {
|
if (!this.current_code) {
|
||||||
return promptAction.showToast({ message: '请输入验证码' })
|
return promptAction.showToast({ message: '请输入验证码' })
|
||||||
}
|
}
|
||||||
@ -64,13 +60,10 @@ export struct LoginComp {
|
|||||||
this.loading = true
|
this.loading = true
|
||||||
this.hashMap.clear();
|
this.hashMap.clear();
|
||||||
this.hashMap.set('mobile',this.mobile)
|
this.hashMap.set('mobile',this.mobile)
|
||||||
if(this.isPassLogin)
|
if(this.isPassLogin) {
|
||||||
{
|
|
||||||
this.hashMap.set('password',this.code)
|
this.hashMap.set('password',this.code)
|
||||||
this.loginUrl=BasicConstant.urlExpertAPI+'login'
|
this.loginUrl=BasicConstant.urlExpertAPI+'login'
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
this.hashMap.set('sms',this.current_code)
|
this.hashMap.set('sms',this.current_code)
|
||||||
this.loginUrl=BasicConstant.urlExpertAPI+'umSmsLogin'
|
this.loginUrl=BasicConstant.urlExpertAPI+'umSmsLogin'
|
||||||
}
|
}
|
||||||
@ -80,46 +73,39 @@ export struct LoginComp {
|
|||||||
logger.info('Response login'+res);
|
logger.info('Response login'+res);
|
||||||
console.info(`Response login succeeded: ${res}`);
|
console.info(`Response login succeeded: ${res}`);
|
||||||
let json:LoginInfo = JSON.parse(res+'') as LoginInfo;
|
let json:LoginInfo = JSON.parse(res+'') as LoginInfo;
|
||||||
|
if(json.code=='1') {
|
||||||
if(json.code=='1')
|
|
||||||
{
|
|
||||||
this.getSaveUserInfor(1,json)
|
this.getSaveUserInfor(1,json)
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
promptAction.showToast({ message: json.message, duration: 1000 })
|
promptAction.showToast({ message: json.message, duration: 1000 })
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch((err: BusinessError) => {
|
}).catch((err: BusinessError) => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
console.info(`Response login fail: ${err}`);
|
console.info(`Response login fail: ${err}`);
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
getSaveUserInfor(type:number,objs:LoginInfo)
|
|
||||||
{
|
getSaveUserInfor(type:number,objs:LoginInfo) {
|
||||||
authStore.setUser(objs.data)
|
|
||||||
promptAction.showToast({ message: '登录成功', duration: 1000 })
|
|
||||||
// emitter.emit({ eventId: 100401 })
|
|
||||||
let state:number=objs.data.state
|
let state:number=objs.data.state
|
||||||
logger.info('Response state'+state);
|
if(state!=6) {
|
||||||
if(state!=6)
|
|
||||||
{
|
|
||||||
router.pushUrl({
|
router.pushUrl({
|
||||||
url: 'pages/LoginPage/LoginSetInfoPage', // 目标url
|
url: 'pages/LoginPage/LoginSetInfoPage', // 目标url
|
||||||
|
params: {
|
||||||
|
loginInputPhone:this.mobile
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
} else {
|
||||||
else
|
authStore.setUser(objs.data)
|
||||||
{
|
// emitter.emit({ eventId: 100401 })
|
||||||
|
logger.info('Response state'+state);
|
||||||
|
promptAction.showToast({ message: '登录成功', duration: 1000 })
|
||||||
preferenceStore.setItemBoolean('isLogin',true)
|
preferenceStore.setItemBoolean('isLogin',true)
|
||||||
router.replaceUrl({
|
router.replaceUrl({
|
||||||
url: 'pages/Home', // 目标url
|
url: 'pages/Home', // 目标url
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
getMessage()
|
|
||||||
{
|
getMessage() {
|
||||||
if (!this.mobile) {
|
if (!this.mobile) {
|
||||||
return promptAction.showToast({ message: '手机号码不为空' })
|
return promptAction.showToast({ message: '手机号码不为空' })
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,11 +5,11 @@ import { ComponentContent } from '@kit.ArkUI';
|
|||||||
@Component
|
@Component
|
||||||
export struct LoginSetInfo{
|
export struct LoginSetInfo{
|
||||||
scroller: Scroller = new Scroller();
|
scroller: Scroller = new Scroller();
|
||||||
@State
|
@Prop
|
||||||
realName:string=''
|
realName:string=''
|
||||||
@State
|
@Prop
|
||||||
officePhone:string=''
|
officePhone:string=''
|
||||||
@State
|
@Prop
|
||||||
certificate:string='111111111'
|
certificate:string='111111111'
|
||||||
@State titleName: string = ""
|
@State titleName: string = ""
|
||||||
private ctx: UIContext = this.getUIContext();
|
private ctx: UIContext = this.getUIContext();
|
||||||
@ -139,7 +139,6 @@ function customStyleR() {
|
|||||||
|
|
||||||
@Builder
|
@Builder
|
||||||
function buildText( title: string ) {
|
function buildText( title: string ) {
|
||||||
|
|
||||||
Column() {
|
Column() {
|
||||||
Row(){
|
Row(){
|
||||||
Text('取消')
|
Text('取消')
|
||||||
@ -166,7 +165,6 @@ function buildText( title: string ) {
|
|||||||
case '':
|
case '':
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
} .width('100%')
|
} .width('100%')
|
||||||
.padding(10)
|
.padding(10)
|
||||||
@ -175,5 +173,7 @@ function buildText( title: string ) {
|
|||||||
.padding(10)
|
.padding(10)
|
||||||
.backgroundColor($r('app.color.white'))
|
.backgroundColor($r('app.color.white'))
|
||||||
.borderRadius(0)
|
.borderRadius(0)
|
||||||
|
.onChange((value:string)=>{
|
||||||
|
})
|
||||||
}.backgroundColor('#FFF0F0F0')
|
}.backgroundColor('#FFF0F0F0')
|
||||||
}
|
}
|
||||||
|
|||||||
362
features/register/src/main/ets/view/PerfectUserDataComp.ets
Normal file
@ -0,0 +1,362 @@
|
|||||||
|
import { BasicConstant,ExpertData, authStore,perfactAuth } from '@itcast/basic'
|
||||||
|
import { promptAction, router } from '@kit.ArkUI'
|
||||||
|
import { EditUserDataItem } from 'mypage/src/main/ets/view/EditUserDataItem'
|
||||||
|
import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet'
|
||||||
|
import { PhotoActionSheet } from '@itcast/basic/src/main/ets/Views/PhotoActionSheet'
|
||||||
|
import { SexSelectedSheet } from '@itcast/basic/src/main/ets/Views/SexSelectedSheet'
|
||||||
|
import { OfficeSelectedSheet } from '@itcast/basic/src/main/ets/Views/OfficeSelectedSheet'
|
||||||
|
import { PositionSelectedSheet } from '@itcast/basic/src/main/ets/Views/PositionSelectedSheet'
|
||||||
|
import { SpecialitySelectedSheet } from '@itcast/basic/src/main/ets/Views/SpecialitySelectedSheet'
|
||||||
|
import { emitter } from '@kit.BasicServicesKit'
|
||||||
|
|
||||||
|
interface extraData {
|
||||||
|
uuid: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface updateExtraData {
|
||||||
|
uuid: string,
|
||||||
|
userName: string,
|
||||||
|
birthDate: string,
|
||||||
|
type: string,
|
||||||
|
photo: string,
|
||||||
|
certificateImg: string,
|
||||||
|
positionUuid: string,
|
||||||
|
officeUuid: string,
|
||||||
|
officeName: string,
|
||||||
|
diseaseUuids: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface callBackData {
|
||||||
|
expert:ExpertData,
|
||||||
|
code:number,
|
||||||
|
message:string,
|
||||||
|
specialy:[],
|
||||||
|
data:ExpertData,
|
||||||
|
special:[]
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component
|
||||||
|
export struct PerfectUserDataComp {
|
||||||
|
scroller: Scroller = new Scroller();
|
||||||
|
|
||||||
|
@Prop loginPhone:string = '13419527489';
|
||||||
|
|
||||||
|
@State photoPath:string = BasicConstant.urlImage+authStore.getUser().photo;
|
||||||
|
@State name:string = perfactAuth.getUser('13419527489').realName?perfactAuth.getUser('13419527489').realName:'请输入姓名';
|
||||||
|
@State sex:string = perfactAuth.getUser('13419527489').sex?perfactAuth.getUser('13419527489').sex == 0 ? '男' : '女':'请选择性别';
|
||||||
|
@State sexnum:number = perfactAuth.getUser('13419527489').sex;
|
||||||
|
@State hospatilName:string = perfactAuth.getUser('13419527489').hospitalName?'':'请选择所在医院';
|
||||||
|
@State officeName:string = perfactAuth.getUser('13419527489').officeName?perfactAuth.getUser('13419527489').officeName.length>0?perfactAuth.getUser('13419527489').officeName:'请选择科室':'请选择科室';
|
||||||
|
@State officeUuid:string = perfactAuth.getUser('13419527489').officeUuid;
|
||||||
|
@State officePhone:string = authStore.getUser().officePhone?perfactAuth.getUser('13419527489').officePhone.length?perfactAuth.getUser('13419527489').officePhone:'请输入所在科室的电话':'请输入所在科室的电话';
|
||||||
|
@State positionName:string = authStore.getUser().positionName?perfactAuth.getUser('13419527489').positionName.length>0?perfactAuth.getUser('13419527489').positionName:'请选择职称':'请选择职称';
|
||||||
|
@State positionUuid:string = authStore.getUser().positionUuid;
|
||||||
|
@State certificate:string = authStore.getUser().certificate?perfactAuth.getUser('13419527489').certificate.length>0?perfactAuth.getUser('13419527489').certificate:'请输入执业医师证号码':'请输入执业医师证号码';
|
||||||
|
@State certificatePhoto:string = BasicConstant.urlImage+perfactAuth.getUser('13419527489').certificateImg;
|
||||||
|
// @State diseaseName:string = authStore.getUser().diseaseName?authStore.getUser().diseaseName.length>0?authStore.getUser().diseaseName:'请选择专长':'请选择专长';
|
||||||
|
// @State diswaseUuid:string = authStore.getUser().diseaseName;
|
||||||
|
@State diseaseName:string = '请选择专长';
|
||||||
|
@State diswaseUuid:string = '';
|
||||||
|
|
||||||
|
@State inputTitle:string = '';
|
||||||
|
@State inputPlaceholder:string = '';
|
||||||
|
|
||||||
|
private photoSheetDialog!: CustomDialogController;
|
||||||
|
private officePickerDialog!: CustomDialogController;
|
||||||
|
private positionPickerDialog!: CustomDialogController;
|
||||||
|
private certificatePhotoSheetDialog!: CustomDialogController;
|
||||||
|
private diseaseSheetDialog!:CustomDialogController;
|
||||||
|
private sexSheetDilog!:CustomDialogController;
|
||||||
|
private perfactInputSheet!:CustomDialogController;
|
||||||
|
|
||||||
|
aboutToAppear() {
|
||||||
|
this.initSexDialog();
|
||||||
|
this.initPhotoDialog();
|
||||||
|
this.initPerfactInputDialog();
|
||||||
|
this.initOfficePickerDialog();
|
||||||
|
this.initPositionPickerDialog();
|
||||||
|
this.initCerficatePhotoDialog();
|
||||||
|
this.initDiseaseSheetDIalog();
|
||||||
|
|
||||||
|
authStore.initUser()
|
||||||
|
emitter.on({ eventId: 250516 }, () => {
|
||||||
|
this.handleSave()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
aboutToDisappear() {
|
||||||
|
emitter.off(250516)
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleSave() {
|
||||||
|
promptAction.showToast({ message: '您输入的个人资料已经保存,请完善所有信息后提交审核', duration: 1000 })
|
||||||
|
const userData:ExpertData = {
|
||||||
|
positionName: this.positionName='请选择职称'?'':this.positionName,
|
||||||
|
userName: this.loginPhone,
|
||||||
|
createDate: '',
|
||||||
|
password: '',
|
||||||
|
officeName: this.officeName='请选择科室'?'':this.officeName,
|
||||||
|
certificateImg: this.certificatePhoto,
|
||||||
|
birthDate: '',
|
||||||
|
isStar: 0,
|
||||||
|
countyId: 0,
|
||||||
|
cityId: 0,
|
||||||
|
email: '',
|
||||||
|
photo: this.photoPath,
|
||||||
|
qrcode: '',
|
||||||
|
mobile: this.loginPhone,
|
||||||
|
hospitalName: '',
|
||||||
|
officeUuid: this.officeUuid,
|
||||||
|
checkInfo: '',
|
||||||
|
hospitalUuid: '',
|
||||||
|
officePhone: this.officePhone='请输入所在科室的电话'?'':this.officePhone,
|
||||||
|
positionUuid: this.positionUuid,
|
||||||
|
sex: this.sexnum,
|
||||||
|
provId: 0,
|
||||||
|
certificate: this.certificate='请输入执业医师证号码'?'':this.certificate,
|
||||||
|
realName: this.name,
|
||||||
|
isEnable: 0,
|
||||||
|
isVisit: 0,
|
||||||
|
modifyDate: '',
|
||||||
|
currentSpec: '',
|
||||||
|
deviceType: 0,
|
||||||
|
currentType: 0,
|
||||||
|
deviceSpec: '',
|
||||||
|
nation: 0,
|
||||||
|
wechat_qrcode: '',
|
||||||
|
uuid: '',
|
||||||
|
intro: '',
|
||||||
|
state: 0,
|
||||||
|
specialy: [],
|
||||||
|
diseaseName:this.diseaseName='请选择专长'?'':this.diseaseName,
|
||||||
|
diseaseUuid:this.diswaseUuid
|
||||||
|
};
|
||||||
|
perfactAuth.setUser('13419527489',userData);
|
||||||
|
console.info('个人资料=name:',perfactAuth.getUser('13419527489').realName,'\n科室:',perfactAuth.getUser('13419527489').positionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
initSexDialog(){
|
||||||
|
this.sexSheetDilog = new CustomDialogController({
|
||||||
|
builder:SexSelectedSheet({
|
||||||
|
controller:this.sexSheetDilog,
|
||||||
|
sexSelected:(index: number)=>{
|
||||||
|
this.sex = index == 0 ? '男' : '女';
|
||||||
|
this.sexnum = index;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
alignment: DialogAlignment.Bottom,
|
||||||
|
customStyle: true,
|
||||||
|
autoCancel: false,
|
||||||
|
backgroundColor: ('rgba(0,0,0,0.5)'),
|
||||||
|
height: '100%'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
initPerfactInputDialog() {
|
||||||
|
this.perfactInputSheet = new CustomDialogController({
|
||||||
|
builder:PerfactInputSheet({
|
||||||
|
controller:this.perfactInputSheet,
|
||||||
|
inputTitle:this.inputTitle,
|
||||||
|
inputPlaceholder:this.inputPlaceholder,
|
||||||
|
inputCallBack:(input: string,title:string)=>{
|
||||||
|
if (title == '请输入姓名') {
|
||||||
|
this.name = input;
|
||||||
|
} else if (title == '请输入所在科室电话') {
|
||||||
|
this.officePhone = input;
|
||||||
|
} else if (title == '请输入执业医师资格证号码') {
|
||||||
|
this.certificate = input;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
keyboardAvoidDistance: {value:-2000} as LengthMetrics, // 设置弹窗底部与键盘顶部间距(单位:vp)
|
||||||
|
alignment: DialogAlignment.Bottom,
|
||||||
|
customStyle: true,
|
||||||
|
autoCancel: false,
|
||||||
|
backgroundColor: ('rgba(0,0,0,0.5)'),
|
||||||
|
height: '100%'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private initPhotoDialog() {
|
||||||
|
this.photoSheetDialog = new CustomDialogController({
|
||||||
|
builder: PhotoActionSheet({
|
||||||
|
controller: this.photoSheetDialog,
|
||||||
|
onPhotoSelected: async (uri: string) => {
|
||||||
|
this.photoPath = uri;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
alignment: DialogAlignment.Bottom,
|
||||||
|
customStyle: true,
|
||||||
|
autoCancel: false,
|
||||||
|
backgroundColor: ('rgba(0,0,0,0.5)'),
|
||||||
|
height: '100%'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private initOfficePickerDialog() {
|
||||||
|
this.officePickerDialog = new CustomDialogController({
|
||||||
|
builder:OfficeSelectedSheet({
|
||||||
|
controller:this.officePickerDialog,
|
||||||
|
officeSelected: (name:string , uuid:string) => {
|
||||||
|
this.officeName = name;
|
||||||
|
this.officeUuid = uuid;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
alignment: DialogAlignment.Bottom,
|
||||||
|
customStyle: true,
|
||||||
|
autoCancel: false,
|
||||||
|
backgroundColor: ('rgba(0,0,0,0.5)'),
|
||||||
|
height: '100%'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private initPositionPickerDialog() {
|
||||||
|
this.positionPickerDialog = new CustomDialogController({
|
||||||
|
builder:PositionSelectedSheet({
|
||||||
|
controller:this.officePickerDialog,
|
||||||
|
officeSelected: (name:string , uuid:string) => {
|
||||||
|
this.positionName = name;
|
||||||
|
this.positionUuid = uuid;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
alignment: DialogAlignment.Bottom,
|
||||||
|
customStyle: true,
|
||||||
|
autoCancel: false,
|
||||||
|
backgroundColor: ('rgba(0,0,0,0.5)'),
|
||||||
|
height: '100%'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private initCerficatePhotoDialog() {
|
||||||
|
this.certificatePhotoSheetDialog = new CustomDialogController({
|
||||||
|
builder: PhotoActionSheet({
|
||||||
|
controller: this.certificatePhotoSheetDialog,
|
||||||
|
onPhotoSelected: (url: string) => {
|
||||||
|
this.certificatePhoto = url;
|
||||||
|
console.log('Selected image URI:', url);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
alignment: DialogAlignment.Bottom,
|
||||||
|
customStyle: true,
|
||||||
|
autoCancel: false,
|
||||||
|
backgroundColor: ('rgba(0,0,0,0.5)'),
|
||||||
|
height: '100%'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private initDiseaseSheetDIalog() {
|
||||||
|
this.diseaseSheetDialog = new CustomDialogController({
|
||||||
|
builder: SpecialitySelectedSheet({
|
||||||
|
controller:this.diseaseSheetDialog,
|
||||||
|
specialitySelected: (diseaseUuids:string,diseaseName:string)=>{
|
||||||
|
this.diseaseName = diseaseName;
|
||||||
|
this.diswaseUuid = diseaseUuids;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
alignment: DialogAlignment.Bottom,
|
||||||
|
customStyle: true,
|
||||||
|
autoCancel: false,
|
||||||
|
backgroundColor: ('rgba(0,0,0,0.5)'),
|
||||||
|
height: '100%'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
Scroll(this.scroller) {
|
||||||
|
Column() {
|
||||||
|
// 基本信息字段
|
||||||
|
EditUserDataItem({ label: '头像', required: false, content: this.photoPath, hasArrow: true, isLine:false })
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.onClick(()=>this.photoSheetDialog.open())
|
||||||
|
EditUserDataItem({ label: '姓名', required: false, content: this.name, hasArrow:true, isLine:false })
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.margin({top:8})
|
||||||
|
.onClick(()=>{
|
||||||
|
this.inputTitle = '请输入姓名';
|
||||||
|
this.inputPlaceholder = this.name;
|
||||||
|
this.perfactInputSheet.open()
|
||||||
|
})
|
||||||
|
EditUserDataItem({ label: '性别', required: false, content: this.sex, hasArrow:true, isLine:false })
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.margin({top:8})
|
||||||
|
.onClick(()=>this.sexSheetDilog.open())
|
||||||
|
EditUserDataItem({ label: '医院', required: false, content: this.hospatilName, hasArrow: true, isLine:false })
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.margin({top:8})
|
||||||
|
.onClick(()=> {
|
||||||
|
router.pushUrl({
|
||||||
|
url: 'pages/LoginPage/SelectedHospitalPage'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
EditUserDataItem({ label: '科室', required: false, content: this.officeName, hasArrow: true, isLine:false })
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.margin({top:8})
|
||||||
|
.onClick(()=>this.officePickerDialog.open())
|
||||||
|
EditUserDataItem({ label: '科室电话', required: false, content: this.officePhone, hasArrow: true, isLine:false })
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.margin({top:8})
|
||||||
|
.onClick(()=>{
|
||||||
|
this.inputTitle = '请输入所在科室电话';
|
||||||
|
this.inputPlaceholder = this.officePhone;
|
||||||
|
this.perfactInputSheet.open()
|
||||||
|
})
|
||||||
|
EditUserDataItem({ label: '职称', required: false, content: this.positionName, hasArrow: true, isLine:false })
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.margin({top:8})
|
||||||
|
.onClick(()=>this.positionPickerDialog.open())
|
||||||
|
EditUserDataItem({ label: '执业医师证编号', required: false, content: this.certificate ,hasArrow: true, isLine:false })
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.margin({top:8})
|
||||||
|
.onClick(()=>{
|
||||||
|
this.inputTitle = '请输入执业医师资格证号码';
|
||||||
|
this.inputPlaceholder = this.certificate;
|
||||||
|
this.perfactInputSheet.open()}
|
||||||
|
)
|
||||||
|
EditUserDataItem({ label: '执业医师证图片或胸牌', required: false, content: this.certificatePhoto, hasArrow: true, isLine:false })
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.margin({top:8})
|
||||||
|
.onClick(()=>this.certificatePhotoSheetDialog.open())
|
||||||
|
EditUserDataItem({ label: '专长(可选一到十项)', required: false, content: this.diseaseName , hasArrow: true, isLine:false })
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
.margin({top:8})
|
||||||
|
.onClick(()=>this.diseaseSheetDialog.open())
|
||||||
|
|
||||||
|
Column() {
|
||||||
|
// 登录按钮
|
||||||
|
Button({type:ButtonType.Normal}){
|
||||||
|
Text('提交')
|
||||||
|
}
|
||||||
|
.width('95%')
|
||||||
|
.height(48)
|
||||||
|
.borderRadius(8)
|
||||||
|
.backgroundColor($r('app.color.main_color'))
|
||||||
|
.fontColor('#FFFFFF')
|
||||||
|
.fontSize(18)
|
||||||
|
.position({x:'2.5%'})
|
||||||
|
.onClick(() => {
|
||||||
|
// 提交逻辑
|
||||||
|
router.pushUrl({
|
||||||
|
url: 'pages/LoginPage/SelectedHospitalPage'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
.width('100%')
|
||||||
|
.height(48)
|
||||||
|
.margin({top:50})
|
||||||
|
}
|
||||||
|
.width('100%')
|
||||||
|
.height('100%')
|
||||||
|
.padding(8)
|
||||||
|
.backgroundImage($r('app.media.bg_reg'))
|
||||||
|
.backgroundImageSize(ImageSize.FILL)
|
||||||
|
}
|
||||||
|
.height('auto')
|
||||||
|
.scrollable(ScrollDirection.Vertical)
|
||||||
|
.scrollBar(BarState.Off)
|
||||||
|
.backgroundColor('#ffffff')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSave() {
|
||||||
|
|
||||||
|
}
|
||||||
369
features/register/src/main/ets/view/SelectedHospitalComp.ets
Normal file
@ -0,0 +1,369 @@
|
|||||||
|
import { hdHttp, HdResponse,BasicConstant } from '@itcast/basic'
|
||||||
|
import { promptAction, CommonModifier } from '@kit.ArkUI'
|
||||||
|
import { BusinessError } from '@kit.BasicServicesKit';
|
||||||
|
import HashMap from '@ohos.util.HashMap';
|
||||||
|
import { it } from '@ohos/hypium';
|
||||||
|
|
||||||
|
@Component
|
||||||
|
export struct SelectedHospitalComp {
|
||||||
|
scrollerForList: Scroller = new Scroller();
|
||||||
|
|
||||||
|
@State provincerSelectedName:string = '请选择';
|
||||||
|
@State provincerId:string = '';
|
||||||
|
@State citySelectedName:string = '';
|
||||||
|
@State cityId:string = '';
|
||||||
|
@State districtsSelectedName:string = '';
|
||||||
|
@State districtsId:string = '';
|
||||||
|
@State hospitalSelectedName:string = '';
|
||||||
|
@State inputSearch:string = '';
|
||||||
|
@State tabBarModifier: CommonModifier = new CommonModifier();
|
||||||
|
@State isHidenCity:boolean = false;
|
||||||
|
@State isHiddenSearchView:boolean = false;
|
||||||
|
// 当前选中的层级索引(0-省 1-市 2-区 3-医院)
|
||||||
|
@State currentTabIndex: number = 0
|
||||||
|
// 存储各层级选择状态
|
||||||
|
@State selections: number[] = [0, 1,2 ,3]
|
||||||
|
// 数据集合
|
||||||
|
@State provinces: ProvinceOrCiry[] = []
|
||||||
|
@State cities: ProvinceOrCiry[] = []
|
||||||
|
@State districts: ProvinceOrCiry[] = []
|
||||||
|
@State hospitals: Hospital[] = []
|
||||||
|
@State searchHospitals: Hospital[] = []
|
||||||
|
// 搜索关键词
|
||||||
|
@Prop searchKey: string = ''
|
||||||
|
|
||||||
|
aboutToAppear() {
|
||||||
|
this.loadProvinces(0,0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载省份数据
|
||||||
|
private loadProvinces(type:number,provinceIdOrCity:number) {
|
||||||
|
const areaListUrl:string = BasicConstant.urlExpertAPI+'areaList';
|
||||||
|
const hashMap: HashMap<string, string> = new HashMap();
|
||||||
|
|
||||||
|
hashMap.clear();
|
||||||
|
if (type != 0) {
|
||||||
|
hashMap.set('parent_id',provinceIdOrCity.toString())
|
||||||
|
}
|
||||||
|
hdHttp.httpReq<string>(areaListUrl,hashMap).then(async (res: HdResponse<string>) => {
|
||||||
|
console.info(`Response areaList succeeded: ${res}`);
|
||||||
|
let json:RequestProvinceCallData = JSON.parse(res+'') as RequestProvinceCallData;
|
||||||
|
if(json.code=='200') {
|
||||||
|
if (type == 0) {
|
||||||
|
this.provinces = json.data;
|
||||||
|
this.onTabChange(0)
|
||||||
|
} else if (type == 1) {
|
||||||
|
this.cities = json.data;
|
||||||
|
this.onTabChange(1);
|
||||||
|
} else if (type == 2) {
|
||||||
|
this.onTabChange(2);
|
||||||
|
if (json.data.length>0) {
|
||||||
|
this.isHidenCity = false;
|
||||||
|
this.districts = json.data;
|
||||||
|
} else {
|
||||||
|
this.isHidenCity = true;
|
||||||
|
this.searchHospitalList('',false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.searchHospitalList('',false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
promptAction.showToast({ message: json.msg, duration: 1000 })
|
||||||
|
}
|
||||||
|
}).catch((err: BusinessError) => {
|
||||||
|
console.info(`Response areaList fail: ${err}`);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
searchHospitalList(input:string,isSearchStatus:boolean) {
|
||||||
|
const areaListUrl:string = BasicConstant.urlExpertAPI+'hospitalList';
|
||||||
|
const hashMap: HashMap<string, string> = new HashMap();
|
||||||
|
hashMap.clear();
|
||||||
|
hashMap.set('name',input);
|
||||||
|
hashMap.set('prov_id',this.provincerId);
|
||||||
|
hashMap.set('city_id',this.cityId);
|
||||||
|
hashMap.set('county_id',this.districtsId);
|
||||||
|
hdHttp.httpReq<string>(areaListUrl,hashMap).then(async (res: HdResponse<string>) => {
|
||||||
|
console.info(`Response hospitalList succeeded: ${res}`);
|
||||||
|
let json:HospitalCallData = JSON.parse(res+'') as HospitalCallData;
|
||||||
|
if(json.code=='200') {
|
||||||
|
if (isSearchStatus) {
|
||||||
|
if (json.data.length > 0) {
|
||||||
|
this.isHiddenSearchView = true;
|
||||||
|
} else {
|
||||||
|
this.isHiddenSearchView = false;
|
||||||
|
}
|
||||||
|
this.searchHospitals = json.data;
|
||||||
|
} else {
|
||||||
|
this.isHiddenSearchView = false;
|
||||||
|
this.hospitalSelectedName = '请选择';
|
||||||
|
this.hospitals = json.data;
|
||||||
|
if (this.isHidenCity) {
|
||||||
|
this.onTabChange(2);
|
||||||
|
} else {
|
||||||
|
this.onTabChange(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
promptAction.showToast({ message: json.msg, duration: 1000 })
|
||||||
|
}
|
||||||
|
}).catch((err: BusinessError) => {
|
||||||
|
console.info(`Response hospitalList fail: ${err}`);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tab切换事件
|
||||||
|
private onTabChange(index: number) {
|
||||||
|
if (index < this.currentTabIndex) { // 允许回退
|
||||||
|
this.currentTabIndex = index
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 验证数据完整性
|
||||||
|
if (index === 1 && !this.selections[0]) return
|
||||||
|
if (index === 2 && !this.selections[1]) return
|
||||||
|
if (index === 3 && !this.selections[2]) return
|
||||||
|
if (index === 4 && !this.selections[3]) return
|
||||||
|
this.currentTabIndex = index
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleSearchInput(value:string) {
|
||||||
|
if (value.length<0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.searchHospitalList(value,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
Column() {
|
||||||
|
SearchInput((input:string)=>{
|
||||||
|
this.handleSearchInput(input);
|
||||||
|
})
|
||||||
|
|
||||||
|
// 内容区域
|
||||||
|
Tabs({ index: this.currentTabIndex,barModifier:this.tabBarModifier.align(Alignment.Start) }) {
|
||||||
|
// 省份列表
|
||||||
|
TabContent() {
|
||||||
|
List() {
|
||||||
|
ForEach(this.provinces, (item : ProvinceOrCiry) => {
|
||||||
|
ListItem() {
|
||||||
|
Text(item.name)
|
||||||
|
.fontColor(item.name == this.provincerSelectedName?$r('app.color.main_color'):'#666666')
|
||||||
|
.fontSize(17)
|
||||||
|
.height(40)
|
||||||
|
.margin({left:20})
|
||||||
|
.onClick(() => {
|
||||||
|
this.selections[0] = 1;
|
||||||
|
this.provincerSelectedName = item.name;
|
||||||
|
this.citySelectedName = '请选择'
|
||||||
|
this.districtsSelectedName = '';
|
||||||
|
this.hospitalSelectedName = '';
|
||||||
|
this.provincerId = item.id.toString();
|
||||||
|
this.loadProvinces(1,item.id);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
.width('100%')
|
||||||
|
.height('100%')
|
||||||
|
}.tabBar(this.provincerSelectedName)
|
||||||
|
|
||||||
|
// 城市列表
|
||||||
|
TabContent() {
|
||||||
|
List() {
|
||||||
|
ForEach(this.cities, (item : ProvinceOrCiry) => {
|
||||||
|
ListItem() {
|
||||||
|
Text(item.name)
|
||||||
|
.fontColor(item.name == this.citySelectedName?$r('app.color.main_color'):'#666666')
|
||||||
|
.fontSize(17)
|
||||||
|
.height(40)
|
||||||
|
.margin({left:20})
|
||||||
|
.onClick(() => {
|
||||||
|
this.selections[1] = 2;
|
||||||
|
this.citySelectedName = item.name;
|
||||||
|
this.districtsSelectedName = '请选择'
|
||||||
|
this.hospitalSelectedName = '';
|
||||||
|
this.cityId = item.id.toString();
|
||||||
|
this.loadProvinces(2,item.id)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
.width('100%')
|
||||||
|
.height('100%')
|
||||||
|
}.tabBar(this.citySelectedName)
|
||||||
|
|
||||||
|
// 区县列表
|
||||||
|
TabContent() {
|
||||||
|
List() {
|
||||||
|
if (this.isHidenCity) {
|
||||||
|
ForEach(this.hospitals, (item: Hospital) => {
|
||||||
|
ListItem() {
|
||||||
|
Text(item.name)
|
||||||
|
// .fontColor(item.name == this.districtsSelectedName?$r('app.color.main_color'):'#666666')
|
||||||
|
.fontSize(17)
|
||||||
|
.height(40)
|
||||||
|
.margin({left:20})
|
||||||
|
.onClick(() => {
|
||||||
|
// this.districtsSelectedName = item.name;
|
||||||
|
this.selections[2] = 3;
|
||||||
|
//医院点击
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
ForEach(this.districts, (item: ProvinceOrCiry) => {
|
||||||
|
ListItem() {
|
||||||
|
Text(item.name)
|
||||||
|
.fontColor(item.name == this.districtsSelectedName?$r('app.color.main_color'):'#666666')
|
||||||
|
.fontSize(17)
|
||||||
|
.height(40)
|
||||||
|
.margin({left:20})
|
||||||
|
.onClick(() => {
|
||||||
|
this.districtsSelectedName = item.name;
|
||||||
|
this.selections[3] = 4;
|
||||||
|
this.districtsId = item.id.toString();
|
||||||
|
this.searchHospitalList('',false);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.width('100%')
|
||||||
|
.height('100%')
|
||||||
|
}.tabBar(this.districtsSelectedName)
|
||||||
|
|
||||||
|
if (!this.isHidenCity) {
|
||||||
|
// 医院列表
|
||||||
|
TabContent() {
|
||||||
|
List() {
|
||||||
|
ForEach(this.hospitals, (item:Hospital) => {
|
||||||
|
ListItem() {
|
||||||
|
Text(item.name)
|
||||||
|
.fontSize(17)
|
||||||
|
.height(40)
|
||||||
|
.margin({left:20})
|
||||||
|
.onClick(()=>{
|
||||||
|
//医院点击
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
.width('100%')
|
||||||
|
.height('100%')
|
||||||
|
}.tabBar(this.hospitalSelectedName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onChange(index => this.onTabChange(index))
|
||||||
|
.barWidth('100%')
|
||||||
|
.barMode(BarMode.Scrollable)
|
||||||
|
.height('100%')
|
||||||
|
|
||||||
|
if (this.isHiddenSearchView) {
|
||||||
|
Column() {
|
||||||
|
List() {
|
||||||
|
ForEach(this.searchHospitals, (item: Hospital) => {
|
||||||
|
ListItem() {
|
||||||
|
Text(item.name)
|
||||||
|
.fontSize(17)
|
||||||
|
.height(40)
|
||||||
|
.margin({ left: 20 })
|
||||||
|
.onClick(() => {
|
||||||
|
//医院点击
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
.width('100%')
|
||||||
|
.height('100%')
|
||||||
|
}
|
||||||
|
.position({ y: 60 })
|
||||||
|
.width('100%')
|
||||||
|
.height('82%')
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.height('100%')
|
||||||
|
}
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
CustomTabBuilder(title: string, index: number) {
|
||||||
|
Column() {
|
||||||
|
Text(title)
|
||||||
|
.fontSize(17)
|
||||||
|
.fontColor(this.currentTabIndex === index ? $r('app.color.main_color') : '#333333')
|
||||||
|
Divider()
|
||||||
|
.width('auto')
|
||||||
|
.height(3)
|
||||||
|
.color($r('app.color.main_color'))
|
||||||
|
.visibility(this.currentTabIndex === index ? Visibility.Visible : Visibility.Hidden)
|
||||||
|
}
|
||||||
|
.width('auto')
|
||||||
|
.width('auto')
|
||||||
|
.height(50)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
function SearchInput(onSearchInput:(input:string)=>void) {
|
||||||
|
// inputText:String = ;
|
||||||
|
Row() {
|
||||||
|
// 返回按钮
|
||||||
|
Image($r('app.media.selected_hospital_ws'))
|
||||||
|
.width(20)
|
||||||
|
.height(20)
|
||||||
|
.margin({left:10})
|
||||||
|
|
||||||
|
TextInput({ placeholder: '搜索医院标准名别名' })
|
||||||
|
.width('80%')
|
||||||
|
.backgroundColor('#EEEEEE')
|
||||||
|
.onChange((value:string)=>{
|
||||||
|
onSearchInput(value);
|
||||||
|
})
|
||||||
|
// .onEditChange((isEditing: boolean) => {
|
||||||
|
// if (!isEditing) {
|
||||||
|
// onSearchInput(value);
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .onSubmit(() => {
|
||||||
|
// onSearchInput(value);
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
.borderRadius(20)
|
||||||
|
.width('90%')
|
||||||
|
.height(40)
|
||||||
|
.margin({top:10})
|
||||||
|
.backgroundColor('#EEEEEE')
|
||||||
|
.justifyContent(FlexAlign.Start)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RequestProvinceCallData {
|
||||||
|
msg:string,
|
||||||
|
code:string,
|
||||||
|
data:ProvinceOrCiry[]
|
||||||
|
}
|
||||||
|
|
||||||
|
interface HospitalCallData {
|
||||||
|
msg:string,
|
||||||
|
code:string,
|
||||||
|
data:Hospital[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// DataModel.ts
|
||||||
|
interface ProvinceOrCiry {
|
||||||
|
treePath: string
|
||||||
|
name: string,
|
||||||
|
parent:number,
|
||||||
|
id:number,
|
||||||
|
fullName:string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Hospital {
|
||||||
|
city_name: string
|
||||||
|
county_id: string
|
||||||
|
prov_id: string
|
||||||
|
prov_name: string
|
||||||
|
name:string
|
||||||
|
county_name:string
|
||||||
|
uuid:string
|
||||||
|
city_id:string
|
||||||
|
}
|
||||||
@ -5,4 +5,4 @@
|
|||||||
"value": "50fp"
|
"value": "50fp"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
After Width: | Height: | Size: 2.8 KiB |
@ -11,7 +11,6 @@
|
|||||||
"@itcast/basic@../../commons/basic": "@itcast/basic@../../commons/basic",
|
"@itcast/basic@../../commons/basic": "@itcast/basic@../../commons/basic",
|
||||||
"@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.4",
|
"@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.4",
|
||||||
"@ohos/crypto-js@^2.0.2": "@ohos/crypto-js@2.0.4",
|
"@ohos/crypto-js@^2.0.2": "@ohos/crypto-js@2.0.4",
|
||||||
"@ohos/crypto-js@^2.0.4": "@ohos/crypto-js@2.0.4",
|
|
||||||
"@ohos/httpclient@2.0.2": "@ohos/httpclient@2.0.2",
|
"@ohos/httpclient@2.0.2": "@ohos/httpclient@2.0.2",
|
||||||
"@polyvharmony/httpdns-api@1.0.2": "@polyvharmony/httpdns-api@1.0.2",
|
"@polyvharmony/httpdns-api@1.0.2": "@polyvharmony/httpdns-api@1.0.2",
|
||||||
"@polyvharmony/httpdns-impl-ali@1.0.2": "@polyvharmony/httpdns-impl-ali@1.0.2",
|
"@polyvharmony/httpdns-impl-ali@1.0.2": "@polyvharmony/httpdns-impl-ali@1.0.2",
|
||||||
@ -28,8 +27,7 @@
|
|||||||
"mypage@../../features/mypage": "mypage@../../features/mypage",
|
"mypage@../../features/mypage": "mypage@../../features/mypage",
|
||||||
"pako@^2.1.0": "pako@2.1.0",
|
"pako@^2.1.0": "pako@2.1.0",
|
||||||
"register@../../features/register": "register@../../features/register",
|
"register@../../features/register": "register@../../features/register",
|
||||||
"scene_single_video@../../scene_single_video": "scene_single_video@../../scene_single_video",
|
"scene_single_video@../../scene_single_video": "scene_single_video@../../scene_single_video"
|
||||||
"utils@../../commons/utils": "utils@../../commons/utils"
|
|
||||||
},
|
},
|
||||||
"packages": {
|
"packages": {
|
||||||
"@aliyun/error@1.0.2": {
|
"@aliyun/error@1.0.2": {
|
||||||
@ -234,7 +232,8 @@
|
|||||||
"resolved": "../../features/register",
|
"resolved": "../../features/register",
|
||||||
"registryType": "local",
|
"registryType": "local",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@itcast/basic": "file:../../commons/basic"
|
"@itcast/basic": "file:../../commons/basic",
|
||||||
|
"mypage": "file:../../features/mypage"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scene_single_video@../../scene_single_video": {
|
"scene_single_video@../../scene_single_video": {
|
||||||
@ -246,15 +245,6 @@
|
|||||||
"media-player-common": "file:../polyv",
|
"media-player-common": "file:../polyv",
|
||||||
"@polyvharmony/media-player-sdk": "2.5.0"
|
"@polyvharmony/media-player-sdk": "2.5.0"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"utils@../../commons/utils": {
|
|
||||||
"name": "utils",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "../../commons/utils",
|
|
||||||
"registryType": "local",
|
|
||||||
"dependencies": {
|
|
||||||
"@ohos/crypto-js": "^2.0.4"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,7 +7,6 @@
|
|||||||
"license": "",
|
"license": "",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@itcast/basic": "file:../../commons/basic",
|
"@itcast/basic": "file:../../commons/basic",
|
||||||
"utils": "file:../../commons/utils",
|
|
||||||
"mypage":"file:../../features/mypage",
|
"mypage":"file:../../features/mypage",
|
||||||
"home": 'file:../../features/Home',
|
"home": 'file:../../features/Home',
|
||||||
"register": 'file:../../features/register',
|
"register": 'file:../../features/register',
|
||||||
|
|||||||
@ -1,11 +1,16 @@
|
|||||||
import { LoginSetInfo } from 'register'
|
import { LoginSetInfo,PerfectUserDataComp } from 'register'
|
||||||
|
import { HdNav } from '@itcast/basic'
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@Component
|
@Component
|
||||||
struct LoginSetInfoPage {
|
struct LoginSetInfoPage {
|
||||||
|
@Prop loginInputPhone:string;
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
Column() {
|
Column() {
|
||||||
LoginSetInfo()
|
// LoginSetInfo()
|
||||||
|
HdNav({ title: '完善个人资料', showRightIcon: false, showLeftIcon: true,showRightText:true,rightText:'保存' })
|
||||||
|
PerfectUserDataComp({loginPhone:this.loginInputPhone});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
import { SelectedHospitalComp } from 'register'
|
||||||
|
import { HdNav } from '@itcast/basic'
|
||||||
|
|
||||||
|
@Entry
|
||||||
|
@Component
|
||||||
|
struct SelectedHospitalPage {
|
||||||
|
build() {
|
||||||
|
Column(){
|
||||||
|
HdNav({ title: '选择医院', showRightIcon: false, showLeftIcon: true,showRightText:false})
|
||||||
|
SelectedHospitalComp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,6 +5,7 @@
|
|||||||
"pages/Home",
|
"pages/Home",
|
||||||
"pages/LoginPage/LoginPage",
|
"pages/LoginPage/LoginPage",
|
||||||
"pages/LoginPage/LoginSetInfoPage",
|
"pages/LoginPage/LoginSetInfoPage",
|
||||||
|
"pages/LoginPage/SelectedHospitalPage",
|
||||||
"pages/MinePage/MyPage",
|
"pages/MinePage/MyPage",
|
||||||
"pages/VideoPage/ScienceVideoPage",
|
"pages/VideoPage/ScienceVideoPage",
|
||||||
"pages/MinePage/SettingPage",
|
"pages/MinePage/SettingPage",
|
||||||
|
|||||||