@@ -6,8 +6,6 @@ | |||
"author": "", | |||
"license": "", | |||
"dependencies": { | |||
"@szyx/sdk_ywx": "file:../sdk_ywx", | |||
// "@szyx/sdk_ywx": "^1.0.4", | |||
"@szyx/sdk_base": "file:../basic", | |||
// "@szyx/sdk_base": "^1.0.2", | |||
// "@yunkss/eftool": "^1.1.8" | |||
@@ -0,0 +1,33 @@ | |||
import promptAction from '@ohos.promptAction'; | |||
import { HttpHelper, ToolsHelper } from '@szyx/sdk_base'; | |||
@Component | |||
@Preview | |||
export struct Home { | |||
@Consume('pageInfos') pageInfos: NavPathStack; | |||
private oldTime = 0 | |||
// 手机号 | |||
@State phone: string = '15731028102' | |||
@State draw: string | null = null | |||
build() { | |||
NavDestination() { | |||
Column() { | |||
Text('1.0.1版本上线').fontSize(30) | |||
} | |||
}.padding({ left: 15, right: 15 }).hideTitleBar(true) | |||
.onBackPressed(() => { | |||
const currentTime = new Date().getTime() | |||
if (currentTime - this.oldTime > 1500) { | |||
promptAction.showToast({ | |||
message: '双击退出', | |||
duration: 2000 | |||
}); | |||
this.oldTime = currentTime | |||
return false | |||
} | |||
return true | |||
}) | |||
} | |||
} |
@@ -1,8 +1,5 @@ | |||
import { CertHome } from './cert/CertHome' | |||
import { SettingView } from './setting/SettingView' | |||
import { RouterBuilder } from '../router/RouterBuilder' | |||
import { BJCASDK } from '@szyx/sdk_ywx/Index' | |||
import { SignHome } from './sign/SignHome' | |||
import { Home } from './Home' | |||
@Entry | |||
@Component | |||
@@ -24,19 +21,18 @@ struct Index { | |||
} | |||
aboutToAppear(): void { | |||
BJCASDK.settingManager().init() | |||
} | |||
build() { | |||
Navigation(this.pageInfos) { | |||
Tabs({ barPosition: BarPosition.End }) { | |||
TabContent() { | |||
CertHome() | |||
Home() | |||
} | |||
.tabBar(this.tabBuilder('证书', 0, $r('app.media.icon_home_selected'), $r('app.media.icon_home_normal'))) | |||
TabContent() { | |||
SignHome() | |||
Text('1.0.1版本上线').fontSize(30) | |||
} | |||
.tabBar(this.tabBuilder('签名', 1, $r('app.media.icon_sign_selected'), $r('app.media.icon_sign_normal'))) | |||
@@ -46,7 +42,7 @@ struct Index { | |||
.tabBar(this.tabBuilder('二维码', 2, $r('app.media.icon_code_selected'), $r('app.media.icon_code_normal'))) | |||
TabContent() { | |||
SettingView() | |||
Text('1.0.1版本上线').fontSize(30) | |||
} | |||
.tabBar(this.tabBuilder('设置', 3, $r('app.media.icon_setting_selected'), $r('app.media.icon_setting_Normal'))) | |||
@@ -1,13 +0,0 @@ | |||
// PageOne.ets | |||
@Entry | |||
@Component | |||
export struct PageOneTmp { | |||
build() { | |||
Button('pushPathByName', { stateEffect: true, type: ButtonType.Capsule }) | |||
.width('80%') | |||
.height(40) | |||
.margin(20) | |||
.onClick(() => { | |||
}) | |||
} | |||
} |
@@ -1,24 +0,0 @@ | |||
// PageTwo.ets | |||
export class Pages { | |||
names: string = "" | |||
values: NavPathStack | null = null | |||
} | |||
@Builder | |||
export function pageTwoTmp(info: Pages) { | |||
NavDestination() { | |||
Column() { | |||
Button('pushPathByName', { stateEffect: true, type: ButtonType.Capsule }) | |||
.width('80%') | |||
.height(40) | |||
.margin(20) | |||
.onClick(() => { | |||
(info.values as NavPathStack).pushPathByName('pageOne', null) | |||
}) | |||
}.width('100%').height('100%') | |||
}.title('pageTwo') | |||
.onBackPressed(() => { | |||
(info.values as NavPathStack).pop() | |||
return true | |||
}) | |||
} |
@@ -1,199 +0,0 @@ | |||
import promptAction from '@ohos.promptAction'; | |||
import { HttpHelper, ToolsHelper } from '@szyx/sdk_base'; | |||
import { BJCASDK } from '@szyx/sdk_ywx/Index'; | |||
import { BJCACallMsg } from '@szyx/sdk_ywx/src/main/ets/public/callBack/BJCACallMsg'; | |||
@Component | |||
@Preview | |||
export struct CertHome { | |||
@Consume('pageInfos') pageInfos: NavPathStack; | |||
private oldTime = 0 | |||
// 手机号 | |||
@State phone: string = '15731028102' | |||
@State draw: string | null = null | |||
build() { | |||
NavDestination() { | |||
Column() { | |||
Text('证书下载完成后即可签名') | |||
.margin({ top: 100 }) | |||
Row({ space: FlexAlign.SpaceBetween }) { | |||
TextInput({ | |||
placeholder: '证书下载需要填写手机号', | |||
text: $$this.phone, | |||
}) | |||
.width('70%') | |||
.maxLength(11) | |||
.fontSize(16) | |||
.placeholderFont({ size: 16 }) | |||
.type(InputType.PhoneNumber)/** | |||
* 正则表达式,限制输入内容,而不是格式验证 | |||
* 配置该参数后,上面的type会失效 | |||
*/ | |||
.inputFilter('[-0-9]', error => { | |||
ToolsHelper.showMessage(error) | |||
}) | |||
Button('证书下载', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.width('30%') | |||
.fontColor('#333333') | |||
.height(40) | |||
.onClick(() => { | |||
BJCASDK.certManager().certDown(this.phone, undefined, (result) => { | |||
ToolsHelper.showMessage(result.msg) | |||
}) | |||
}) | |||
} | |||
.width('100%') | |||
.alignItems(VerticalAlign.Center) | |||
.margin({ top: 50 }) | |||
Row() { | |||
Button('查看证书页面', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.width('40%') | |||
.fontColor('#333333') | |||
.height(40) | |||
.onClick(() => { | |||
if (BJCASDK.certManager().existsCert(this.phone)) { | |||
BJCASDK.certManager().showCertPage(this.phone, (result) => { | |||
ToolsHelper.showMessage(result.msg) | |||
}) | |||
} else { | |||
ToolsHelper.showMessage("证书不存在,请先下证。") | |||
} | |||
}) | |||
Button('查看用户信息', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.width('40%') | |||
.height(40) | |||
.fontColor('#333333') | |||
.onClick(() => { | |||
if (BJCASDK.certManager().existsCert(this.phone)) { | |||
BJCASDK.certManager().getUserInfo(this.phone, res => { | |||
ToolsHelper.showMessage(JSON.stringify(res)) | |||
}) | |||
} else { | |||
ToolsHelper.showMessage("证书不存在,请先下证。") | |||
} | |||
}) | |||
}.margin({ top: 20 }) | |||
.width('100%') | |||
.justifyContent(FlexAlign.SpaceAround) | |||
Grid() { | |||
GridItem() { | |||
Button('密码重置', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.height(40) | |||
.fontColor('#333333') | |||
.width('100%') | |||
.onClick(() => { | |||
BJCASDK.certManager().certResetPin(undefined, res => { | |||
if (res !== BJCACallMsg.SUCCESS) { | |||
ToolsHelper.showMessage(JSON.stringify(res)) | |||
} | |||
}) | |||
}) | |||
} | |||
GridItem() { | |||
Button('证书更新', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.height(40) | |||
.fontColor('#333333') | |||
.width('100%') | |||
.onClick(() => { | |||
BJCASDK.certManager().certUpdate(this.phone, undefined, res => { | |||
if (res !== BJCACallMsg.SUCCESS) { | |||
ToolsHelper.showMessage(JSON.stringify(res)) | |||
} | |||
}) | |||
}) | |||
} | |||
GridItem() { | |||
Button('存在本地证书', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.height(40) | |||
.fontColor('#333333') | |||
.width('100%') | |||
.onClick(() => { | |||
ToolsHelper.showMessage(BJCASDK.certManager().existsCert(this.phone) ? "证书存在" : "证书不存在") | |||
}) | |||
} | |||
GridItem() { | |||
Button('清除本地证书', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.height(40) | |||
.fontColor('#333333') | |||
.width('100%') | |||
.onClick(() => { | |||
BJCASDK.certManager().certClear() | |||
}) | |||
} | |||
} | |||
.margin({ top: 20 }) | |||
.width('100%') | |||
.columnsGap(10) | |||
.height(100) | |||
.rowsTemplate('1fr 1fr') | |||
.columnsTemplate('1fr 1fr') | |||
Text('用户可以修改个人的手写签名图片') | |||
.margin({ top: 20 }) | |||
Row() { | |||
Button('查看个人签章图片', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL | |||
}) | |||
.width('40%') | |||
.fontColor('#333333') | |||
.height(40) | |||
.onClick(() => { | |||
BJCASDK.certManager().drawStamp(this.phone, res => { | |||
if (res.code === BJCACallMsg.SUCCESS.code && res.data) { | |||
this.draw = res.data | |||
} else { | |||
ToolsHelper.showMessage("未设置签名图片") | |||
} | |||
}) | |||
}) | |||
Button('修改个人签章图片', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL | |||
}) | |||
.width('40%') | |||
.height(40) | |||
.fontColor('#333333') | |||
.onClick(() => { | |||
ToolsHelper.showMessage('hello world1') | |||
}) | |||
}.margin({ top: 10 }) | |||
.width('100%') | |||
.justifyContent(FlexAlign.SpaceAround) | |||
Image(`data:image/png;base64,${this.draw}`) | |||
.width(300) | |||
.height(200) | |||
.margin({ top: 15 }) | |||
.objectFit(ImageFit.Contain) | |||
.visibility(this.draw ? Visibility.Visible : Visibility.None) | |||
} | |||
}.padding({ left: 15, right: 15 }).hideTitleBar(true) | |||
.onBackPressed(() => { | |||
const currentTime = new Date().getTime() | |||
if (currentTime - this.oldTime > 1500) { | |||
promptAction.showToast({ | |||
message: '双击退出', | |||
duration: 2000 | |||
}); | |||
this.oldTime = currentTime | |||
return false | |||
} | |||
return true | |||
}) | |||
} | |||
} |
@@ -1,142 +0,0 @@ | |||
import { ToolsHelper } from '@szyx/sdk_base/Index'; | |||
import { BJCASDK, EnvEnum } from '@szyx/sdk_ywx'; | |||
import { AlertDialog } from '@ohos.arkui.advanced.Dialog'; | |||
@Component | |||
@Preview | |||
export struct ChangeEvnView { | |||
@Consume('pageInfos') pageInfos: NavPathStack | |||
// 环境信息 | |||
@State envType: EnvEnum = BJCASDK.settingManager().getServerEnvType() | |||
// 环境地址 | |||
@State envUrl: String = BJCASDK.settingManager().getServerEnvUrl() | |||
// 是否清理证书 | |||
@State clean: boolean = true | |||
// 切换确认 | |||
dialogControllerConfirm: CustomDialogController = new CustomDialogController({ | |||
builder: AlertDialog({ | |||
content: '确定需要切换环境吗?', | |||
primaryButton: { | |||
value: '取消', | |||
action: () => { | |||
}, | |||
}, | |||
secondaryButton: { | |||
value: '确认', | |||
fontColor: $r('sys.color.ohos_id_color_warning'), | |||
action: () => { | |||
BJCASDK.settingManager().setServerEnvType(this.envType) | |||
this.pageInfos.pop() | |||
} | |||
}, | |||
}), | |||
autoCancel: true, | |||
customStyle: true, | |||
alignment: DialogAlignment.Center | |||
}) | |||
build() { | |||
NavDestination() { | |||
Column() { | |||
Row() { | |||
Text(`当前环境地址:${this.envType}\n${this.envUrl}`).margin({ left: 5 }) | |||
}.width('100%') | |||
Row() { | |||
Radio({ value: 'Radio1', group: 'evnGroup' }) | |||
.height(20) | |||
.width(20) | |||
.onChange((isChecked: boolean) => { | |||
if (isChecked) { | |||
this.envType = EnvEnum.DEV | |||
this.envUrl = BJCASDK.settingManager().getUrlByEnvType(EnvEnum.DEV) | |||
} | |||
}).checked(this.envType == EnvEnum.DEV) | |||
Text('开发环境').margin({ left: 5 }).onClick(() => { | |||
this.envType = EnvEnum.DEV | |||
this.envUrl = BJCASDK.settingManager().getUrlByEnvType(EnvEnum.DEV) | |||
}) | |||
}.width('100%').margin({ top: 15 }) | |||
Row() { | |||
Radio({ value: 'Radio2', group: 'evnGroup' }) | |||
.height(20) | |||
.width(20) | |||
.onChange((isChecked: boolean) => { | |||
if (isChecked) { | |||
this.envType = EnvEnum.TEST | |||
this.envUrl = BJCASDK.settingManager().getUrlByEnvType(EnvEnum.TEST) | |||
} | |||
}).checked(this.envType == EnvEnum.TEST) | |||
Text('测试环境').margin({ left: 5 }).onClick(() => { | |||
this.envType = EnvEnum.TEST | |||
this.envUrl = BJCASDK.settingManager().getUrlByEnvType(EnvEnum.TEST) | |||
}) | |||
}.width('100%').margin({ top: 5 }) | |||
Row() { | |||
Radio({ value: 'Radio3', group: 'evnGroup' }) | |||
.height(20) | |||
.width(20) | |||
.onChange((isChecked: boolean) => { | |||
if (isChecked) { | |||
this.envType = EnvEnum.INTEGRATE | |||
this.envUrl = BJCASDK.settingManager().getUrlByEnvType(EnvEnum.INTEGRATE) | |||
} | |||
}).checked(this.envType == EnvEnum.INTEGRATE) | |||
Text('集成环境').margin({ left: 5 }).onClick(() => { | |||
this.envType = EnvEnum.INTEGRATE | |||
this.envUrl = BJCASDK.settingManager().getUrlByEnvType(EnvEnum.INTEGRATE) | |||
}) | |||
}.width('100%').margin({ top: 5 }) | |||
Row() { | |||
Radio({ value: 'Radio3', group: 'evnGroup' }) | |||
.height(20) | |||
.width(20) | |||
.onChange((isChecked: boolean) => { | |||
if (isChecked) { | |||
this.envType = EnvEnum.PUBLIC | |||
this.envUrl = BJCASDK.settingManager().getUrlByEnvType(EnvEnum.PUBLIC) | |||
} | |||
}).checked(this.envType == EnvEnum.PUBLIC) | |||
Text('运营环境').margin({ left: 5 }).onClick(() => { | |||
this.envType = EnvEnum.PUBLIC | |||
this.envUrl = BJCASDK.settingManager().getUrlByEnvType(EnvEnum.PUBLIC) | |||
}) | |||
}.width('100%').margin({ top: 5 }) | |||
Row() { | |||
Toggle({ type: ToggleType.Checkbox, isOn: this.clean }) | |||
Text('清空本地数据').margin({ left: 5 }) | |||
}.width('100%').margin({ top: 10 }) | |||
Row() { | |||
Button('取消', { type: ButtonType.Normal, stateEffect: true }) | |||
.borderRadius(8) | |||
.backgroundColor(0x317aff) | |||
.width(90) | |||
.height(40) | |||
.onClick(() => { | |||
this.pageInfos.pop() | |||
}) | |||
Button('确定', { type: ButtonType.Normal, stateEffect: true }) | |||
.borderRadius(8) | |||
.backgroundColor(0x317aff) | |||
.width(90) | |||
.height(40) | |||
.onClick(() => { | |||
if (BJCASDK.settingManager().getServerEnvType() == this.envType) { | |||
ToolsHelper.showMessage('环境没有变更!') | |||
return | |||
} | |||
this.dialogControllerConfirm.open() | |||
}) | |||
}.width('100%').margin({ top: 20 }).justifyContent(FlexAlign.SpaceAround) | |||
}.width('100%').height('100%').padding(20) | |||
}.title('切换sdk环境') | |||
} | |||
} |
@@ -1,89 +0,0 @@ | |||
import { ToolsHelper } from '@szyx/sdk_base'; | |||
import { BJCASDK } from '@szyx/sdk_ywx'; | |||
@Component | |||
@Preview | |||
export struct SettingView { | |||
@Consume('pageInfos') pageInfos: NavPathStack | |||
// 环境地址 | |||
@State clientId: string | undefined = BJCASDK.settingManager().getClientId() | |||
@State clientIdEdit: string | undefined = '2015112716143758' | |||
build() { | |||
NavDestination() { | |||
Column() { | |||
Row() { | |||
Text(`当前厂商ID:${this.clientId}`).margin({ left: 5 }) | |||
}.width('100%') | |||
Row({ space: FlexAlign.SpaceBetween }) { | |||
TextInput({ | |||
placeholder: '输入厂商ID', | |||
text: $$this.clientIdEdit, | |||
}) | |||
.width('70%') | |||
.fontSize(16) | |||
.placeholderFont({ size: 16 }) | |||
.type(InputType.PhoneNumber) | |||
Button('确认', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.width('30%') | |||
.fontColor('#333333') | |||
.height(40) | |||
.onClick(() => { | |||
if (!this.clientIdEdit) { | |||
ToolsHelper.showMessage('请输入厂商ID') | |||
return | |||
} | |||
BJCASDK.settingManager().setClientId(this.clientIdEdit) | |||
this.clientId = BJCASDK.settingManager().getClientId() | |||
}) | |||
} | |||
.width('80%') | |||
.alignItems(VerticalAlign.Center) | |||
.margin({ top: 10 }) | |||
Button('获取当前版本号', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.width('80%') | |||
.fontColor('#333333') | |||
.height(40) | |||
.onClick(() => { | |||
ToolsHelper.showMessage(BJCASDK.settingManager().getVersion()) | |||
}) | |||
.margin({ top: 60 }) | |||
Button('切换环境', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.width('80%') | |||
.fontColor('#333333') | |||
.height(40) | |||
.onClick(() => { | |||
this.pageInfos.pushPathByName('ChangeEvnView', undefined) | |||
}) | |||
.margin({ top: 10 }) | |||
Button('设置语言-中文', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.width('80%') | |||
.fontColor('#333333') | |||
.height(40) | |||
.onClick(() => { | |||
ToolsHelper.showMessage('hello world1') | |||
}) | |||
.margin({ top: 30 }) | |||
Button('设置语言-英文', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.width('80%') | |||
.fontColor('#333333') | |||
.height(40) | |||
.onClick(() => { | |||
ToolsHelper.showMessage('hello world1') | |||
}) | |||
.margin({ top: 10 }) | |||
Button('显示pin码输入框', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.width('80%') | |||
.fontColor('#333333') | |||
.height(40) | |||
.onClick(() => { | |||
ToolsHelper.showMessage('hello world1') | |||
}) | |||
.margin({ top: 10 }) | |||
} | |||
}.padding({ left: 15, right: 15, top: 100 }).hideTitleBar(true) | |||
} | |||
} |
@@ -1,219 +0,0 @@ | |||
import { HttpHelper, ToolsHelper } from '@szyx/sdk_base/Index' | |||
import { BJCASDK, PinDialog } from '@szyx/sdk_ywx/Index' | |||
import { SynedModel } from './SynedModel' | |||
@Component | |||
@Preview | |||
export struct Sign { | |||
@Consume('pageInfos') pageInfos: NavPathStack | |||
@State mDoctorId: string | null = '130427199604025922' | |||
@State mNum: string = '1' | |||
@State mListUniqueId: string[] = [] | |||
@State mSynedNum: number = 0 | |||
@State uniqueId: string | null = null | |||
@State needSignNow: boolean = false | |||
private signRequest() { | |||
this.needSignNow = false | |||
BJCASDK.signManager().signWithFirmId(this.mListUniqueId, (res) => { | |||
ToolsHelper.showMessage(JSON.stringify(res)) | |||
}) | |||
} | |||
private shouldSynAgain() { | |||
this.mSynedNum += 1 | |||
if (this.mSynedNum < Number.parseInt(this.mNum)) { | |||
this.synUnSignData() | |||
} else { | |||
ToolsHelper.showMessage('处方同步完成') | |||
if (this.needSignNow) { | |||
this.signRequest() | |||
} | |||
} | |||
} | |||
private synUnSignData() { | |||
HttpHelper.get() | |||
.get<SynedModel>({ | |||
url: BJCASDK.settingManager() | |||
.getServerEnvUrl() + 'AppOAuthDemo/synSdkRecipeInfoForBatch', | |||
query: { | |||
'clientId': BJCASDK.settingManager() | |||
.getClientId()!, | |||
'doctorId': this.mDoctorId | |||
} | |||
}, undefined) | |||
.then(res => { | |||
console.log('---->', JSON.stringify(res)) | |||
if (res.status === '0') { | |||
this.mListUniqueId.push(res.data.uniqueId) | |||
} | |||
this.shouldSynAgain() | |||
}).catch(() => { | |||
ToolsHelper.showMessage(`同步第 ${this.mSynedNum + 1} 条处方失败!`) | |||
this.shouldSynAgain() | |||
}) | |||
} | |||
build() { | |||
NavDestination() { | |||
Column() { | |||
Text('第一步,模拟应用厂商将多条待签数据同步到医网信获取待签名数据的唯一标识uniqueId。') | |||
.margin({ top: 20 }) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
Row() { | |||
Text('医师证号:') | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
TextInput({ | |||
placeholder: '请输入医师证号', | |||
text: $$this.mDoctorId, | |||
}) | |||
.margin({ left: 5 }) | |||
.layoutWeight(1) | |||
}.alignItems(VerticalAlign.Center) | |||
.margin({ top: 10 }) | |||
.width('100%') | |||
Row() { | |||
Button('1.批量获取待签数据:', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL | |||
}) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
.enabled(this.mSynedNum === 0 || this.mSynedNum === this.mListUniqueId.length) | |||
.onClick(() => { | |||
if (!this.mDoctorId) { | |||
ToolsHelper.showMessage('医师证号不能为空') | |||
return | |||
} | |||
if (!this.mNum || Number.parseInt(this.mNum) < 1 || Number.parseInt(this.mNum) > 100) { | |||
ToolsHelper.showMessage('需要批量签名数量不能小于1,不能大于100') | |||
return | |||
} | |||
this.mListUniqueId = [] | |||
this.mSynedNum = 0 | |||
this.needSignNow = false | |||
this.synUnSignData() | |||
}) | |||
TextInput({ | |||
text: $$this.mNum, | |||
}) | |||
.enabled(this.mSynedNum === 0 || this.mSynedNum === this.mListUniqueId.length) | |||
.margin({ left: 5 }) | |||
.width(60) | |||
.maxLength(3) | |||
.type(InputType.Number) | |||
Text('条') | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
.textAlign(TextAlign.Center) | |||
.margin({ left: 3 }) | |||
}.alignItems(VerticalAlign.Center) | |||
.width('100%') | |||
.margin({ top: 10 }) | |||
Text(`已同步 ${this.mListUniqueId.length}/${this.mNum} 条待签数据`) | |||
.fontSize(14) | |||
.fontColor('#666666') | |||
.textAlign(TextAlign.Center) | |||
.width('100%') | |||
.margin({ top: 10 }) | |||
Text(`当前待签名数据总量为: ${this.mListUniqueId.length}`) | |||
.fontSize(14) | |||
.fontColor('#666666') | |||
.textAlign(TextAlign.Center) | |||
.width('100%') | |||
.margin({ top: 5 }) | |||
Text('第二步,调用医网信接口进行签名,参数为厂商标识(clientId)和医网信待签数据唯一标识(uniqueId)的List列表(不大于100条)') | |||
.margin({ top: 30 }) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
Button(this.mSynedNum >= Number.parseInt(this.mNum) ? '2.签名' : '请耐心等待批量同步待签数据', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL, | |||
}) | |||
.enabled(this.mSynedNum >= Number.parseInt(this.mNum)) | |||
.fontSize(16) | |||
.width('100%') | |||
.fontColor('#666666') | |||
.margin({ top: 10 }) | |||
.onClick(() => { | |||
this.signRequest() | |||
}) | |||
Button(this.mSynedNum === 0 ? '立即签名(同步后立即签名)' : '正在同步处方数据', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL | |||
}) | |||
.fontSize(16) | |||
.width('100%') | |||
.fontColor('#666666') | |||
.margin({ top: 10 }) | |||
.enabled(this.mSynedNum === 0) | |||
.onClick(() => { | |||
if (!this.mDoctorId) { | |||
ToolsHelper.showMessage('医师证号不能为空') | |||
return | |||
} | |||
if (!this.mNum || Number.parseInt(this.mNum) < 1) { | |||
ToolsHelper.showMessage('需要批量签名数量不能小于1,不能大于100') | |||
return | |||
} | |||
this.mListUniqueId = [] | |||
this.mSynedNum = 0 | |||
this.needSignNow = true | |||
this.synUnSignData() | |||
}) | |||
Row() { | |||
TextInput({ | |||
text: $$this.uniqueId, | |||
placeholder: '请输入待签uniqueId' | |||
}) | |||
.margin({ left: 5 }) | |||
.width(180) | |||
.type(InputType.NUMBER_DECIMAL) | |||
Button('添加uniqueId', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL | |||
}) | |||
.fontSize(16) | |||
.layoutWeight(1) | |||
.margin({ left: 3 }) | |||
.fontColor('#666666') | |||
.onClick(() => { | |||
if (this.uniqueId) { | |||
this.mListUniqueId.push(this.uniqueId) | |||
this.uniqueId = null | |||
} | |||
}) | |||
}.alignItems(VerticalAlign.Center) | |||
.width('100%') | |||
.margin({ top: 40 }) | |||
Button('手动签名', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL | |||
}) | |||
.fontSize(16) | |||
.width('100%') | |||
.fontColor('#666666') | |||
.margin({ top: 10 }) | |||
.onClick(() => { | |||
this.signRequest() | |||
}) | |||
PinDialog({ | |||
controller: BJCASDK.signManager().dialogController | |||
}) | |||
}.width('100%').height('100%').padding(20) | |||
}.title('医师sdk签名演示') | |||
} | |||
} |
@@ -1,81 +0,0 @@ | |||
import { ToolsHelper } from '@szyx/sdk_base/Index' | |||
import { BJCASDK, PinDialog } from '@szyx/sdk_ywx/Index' | |||
@Component | |||
@Preview | |||
export struct SignForAuto { | |||
@State sysTag: string | null = null | |||
build() { | |||
NavDestination() { | |||
Column() { | |||
Row() { | |||
Text('系统标识名称') | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
TextInput({ | |||
text: $$this.sysTag, | |||
placeholder: '开启自动签标识' | |||
}) | |||
.margin({ left: 5 }) | |||
.width(160) | |||
}.alignItems(VerticalAlign.Center) | |||
.width('100%') | |||
.margin({ top: 10 }) | |||
Row() { | |||
Button('获取自动签信息', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL, | |||
}) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
.onClick(() => { | |||
BJCASDK.signManager().getSignAutoInfo((res) => { | |||
ToolsHelper.showMessage(JSON.stringify(res)) | |||
}) | |||
}) | |||
Button('开启自动签名', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL, | |||
}) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
.margin({ left: 10 }) | |||
.onClick(() => { | |||
if (!this.sysTag) { | |||
ToolsHelper.showMessage('请输入系统标识') | |||
return | |||
} | |||
BJCASDK.signManager().signForSignAuto(this.sysTag, (res) => { | |||
ToolsHelper.showMessage(JSON.stringify(res)) | |||
}) | |||
}) | |||
}.alignItems(VerticalAlign.Center) | |||
.width('100%') | |||
.margin({ top: 15 }) | |||
Button('关闭自动签名', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL, | |||
}) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
.margin({ top: 10 }) | |||
.onClick(() => { | |||
BJCASDK.signManager().stopSignAuto(this.sysTag ?? undefined, (res) => { | |||
ToolsHelper.showMessage(JSON.stringify(res)) | |||
}) | |||
}) | |||
PinDialog({ | |||
controller: BJCASDK.signManager().dialogController | |||
}) | |||
}.width('100%').height('100%').padding(20) | |||
}.title('医师sdk自动签名演示') | |||
} | |||
} |
@@ -1,129 +0,0 @@ | |||
import { ToolsHelper } from '@szyx/sdk_base/Index' | |||
import { BJCASDK, PinDialog } from '@szyx/sdk_ywx/Index' | |||
@Component | |||
@Preview | |||
export struct SignForPin { | |||
@State mNum: string = '1' | |||
build() { | |||
NavDestination() { | |||
Column() { | |||
Text('此页面的接口是为了让用户在签名过程中无需输入证书签名密码,如果不使用可以忽略。') | |||
.margin({ top: 20 }) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
Text('1.开启免密签名后,在开启时间内用户签名无需输入密码') | |||
.margin({ top: 80 }) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
Row() { | |||
Text('免密时间1-60天:') | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
TextInput({ | |||
text: $$this.mNum, | |||
placeholder: '天数' | |||
}) | |||
.margin({ left: 5 }) | |||
.width(60) | |||
.maxLength(3) | |||
.type(InputType.Number) | |||
Button('开启免密', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL, | |||
}) | |||
.fontSize(16) | |||
.margin({ left: 5 }) | |||
.fontColor('#666666') | |||
.onClick(() => { | |||
BJCASDK.signManager().keepPin(Number.parseInt(this.mNum), (res) => { | |||
ToolsHelper.showMessage(JSON.stringify(res)) | |||
}) | |||
}) | |||
}.alignItems(VerticalAlign.Center) | |||
.width('100%') | |||
.margin({ top: 10 }) | |||
Row() { | |||
Button('判断免密状态', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL, | |||
}) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
.onClick(() => { | |||
ToolsHelper.showMessage(BJCASDK.signManager().isPinExempt() ? '已开启' : '未开启') | |||
}) | |||
Button('取消免密', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL, | |||
}) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
.margin({ left: 10 }) | |||
.onClick(() => { | |||
BJCASDK.signManager().clearPin(() => { | |||
ToolsHelper.showMessage('免密签名已关闭') | |||
}) | |||
}) | |||
}.alignItems(VerticalAlign.Center) | |||
.width('100%') | |||
.margin({ top: 10 }) | |||
Text('---以下功能,1.0.1版本开始支持---') | |||
.margin({ top: 80 }) | |||
.fontSize(13) | |||
.fontColor('#999999') | |||
Text('2.开启指纹签名后,在开启状态内用户可以通过指纹验证来进行签名,当免密开启时无效') | |||
.margin({ top: 10 }) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
Row() { | |||
Button('指纹签名状态', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL, | |||
}) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
.onClick(() => { | |||
}) | |||
Button('开启指纹签名', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL, | |||
}) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
.margin({ left: 10 }) | |||
.onClick(() => { | |||
}) | |||
}.alignItems(VerticalAlign.Center) | |||
.width('100%') | |||
.margin({ top: 10 }) | |||
Button('关闭指纹签名', { | |||
stateEffect: true, | |||
type: ButtonType.Normal, | |||
buttonStyle: ButtonStyleMode.NORMAL, | |||
}) | |||
.fontSize(16) | |||
.fontColor('#666666') | |||
.margin({ top: 5 }) | |||
.onClick(() => { | |||
}) | |||
PinDialog({ | |||
controller: BJCASDK.signManager().dialogController | |||
}) | |||
}.width('100%').height('100%').padding(20) | |||
}.title('医师sdk免密签名演示') | |||
} | |||
} |
@@ -1,69 +0,0 @@ | |||
import promptAction from '@ohos.promptAction'; | |||
import { ToolsHelper } from '@szyx/sdk_base/Index'; | |||
import { BJCASDK } from '@szyx/sdk_ywx/Index'; | |||
@Component | |||
@Preview | |||
export struct SignHome { | |||
@Consume('pageInfos') pageInfos: NavPathStack; | |||
private oldTime = 0 | |||
build() { | |||
NavDestination() { | |||
Column() { | |||
Button('签名', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.width('40%') | |||
.fontColor('#333333') | |||
.height(40) | |||
.onClick(() => { | |||
if (BJCASDK.certManager().existsCert()) { | |||
this.pageInfos.pushPathByName('Sign', undefined) | |||
} else { | |||
ToolsHelper.showMessage("证书不存在,请先下证。") | |||
} | |||
}) | |||
Button('自动签', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.width('40%') | |||
.fontColor('#333333') | |||
.height(40) | |||
.margin({ top: 40 }) | |||
.onClick(() => { | |||
if (BJCASDK.certManager().existsCert()) { | |||
this.pageInfos.pushPathByName('SignForAuto', undefined) | |||
} else { | |||
ToolsHelper.showMessage("证书不存在,请先下证。") | |||
} | |||
}) | |||
Button('免密签名', { stateEffect: true, type: ButtonType.Normal, buttonStyle: ButtonStyleMode.NORMAL }) | |||
.width('40%') | |||
.fontColor('#333333') | |||
.height(40) | |||
.margin({ top: 40 }) | |||
.onClick(() => { | |||
if (BJCASDK.certManager().existsCert()) { | |||
this.pageInfos.pushPathByName('SignForPin', undefined) | |||
} else { | |||
ToolsHelper.showMessage("证书不存在,请先下证。") | |||
} | |||
}) | |||
} | |||
.width('100%') | |||
.height("100%") | |||
.padding(20) | |||
.backgroundColor("#ffffff") | |||
}.padding({ left: 15, right: 15 }).hideTitleBar(true) | |||
.onBackPressed(() => { | |||
const currentTime = new Date().getTime() | |||
if (currentTime - this.oldTime > 1500) { | |||
promptAction.showToast({ | |||
message: '双击退出', | |||
duration: 2000 | |||
}); | |||
this.oldTime = currentTime | |||
return false | |||
} | |||
return true | |||
}) | |||
} | |||
} |
@@ -1,11 +0,0 @@ | |||
export class SynedData { | |||
doctorId: string | |||
clientId: string | |||
constructor(doctorId: string, clientId: string) { | |||
this.doctorId = doctorId | |||
this.clientId = clientId | |||
} | |||
} |
@@ -1,12 +0,0 @@ | |||
export interface Data { | |||
selfSign: boolean; | |||
checkSelfToken: boolean; | |||
uniqueId: string; | |||
timeStampSignData: string; | |||
} | |||
export interface SynedModel { | |||
data: Data; | |||
message: string; | |||
status: string; | |||
} |
@@ -1,23 +1,6 @@ | |||
import { ChangeEvnView } from '../pages/evn/ChangeEvnView' | |||
import { PageOneTmp } from '../pages/PageOne' | |||
import { Sign } from '../pages/sign/Sign' | |||
import { SignForAuto } from '../pages/sign/SignForAuto' | |||
import { SignForPin } from '../pages/sign/SignForPin' | |||
@Builder | |||
export function RouterBuilder(name: string) { | |||
if (name === 'pageOne') { | |||
PageOneTmp() | |||
} else if (name === 'pageTwo') { | |||
// pageTwoTmp() | |||
} else if (name === 'ChangeEvnView') { | |||
ChangeEvnView() | |||
} else if (name === 'Sign') { | |||
Sign() | |||
} else if (name === 'SignForAuto') { | |||
SignForAuto() | |||
} else if (name === 'SignForPin') { | |||
SignForPin() | |||
} | |||
// if (name === 'pageOne') { | |||
// PageOneTmp() | |||
// } | |||
} |
@@ -1 +1 @@ | |||
Subproject commit d5efce7b3280b3ef369fc6cdffd7476ee14cad19 | |||
Subproject commit 28a7d7feba459d5710407f1656eb14d491e22ff8 |
@@ -35,10 +35,6 @@ | |||
{ | |||
"name": "basic", | |||
"srcPath": "./basic" | |||
}, | |||
{ | |||
"name": "sdk_ywx", | |||
"srcPath": "./sdk_ywx" | |||
} | |||
] | |||
} |
@@ -1 +0,0 @@ | |||
Subproject commit 1b9180473b38974764f2092db99ef3e930acfa76 |