diff --git a/entry/src/main/ets/api/qitajiekou.ts b/entry/src/main/ets/api/qitajiekou.ts deleted file mode 100644 index 8032c14f..00000000 --- a/entry/src/main/ets/api/qitajiekou.ts +++ /dev/null @@ -1,46 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -// @ts-ignore -import request from '../common/utils/http'; - -/** 2.无锡所接口请求 无锡所通用接口请求 POST /common/callWxsRest.do */ -export async function callWxsRestUsingPost(body: API.Pinyin_20, options?: { [key: string]: any }) { - return request('/common/callWxsRest.do', { - method: 'POST', - headers: { - 'Content-Type': 'application/json;charset=UTF-8', - }, - data: body, - ...(options || {}), - }); -} - -/** 3.无锡所接口请求测试 无锡所接口请求测试,返回测试数据 POST /common/callWxsRestTest.do */ -export async function callWxsRestTestUsingPost( - body: API.Pinyin_20, - options?: { [key: string]: any }, -) { - return request('/common/callWxsRestTest.do', { - method: 'POST', - headers: { - 'Content-Type': 'application/json;charset=UTF-8', - }, - data: body, - ...(options || {}), - }); -} - -/** 1.大屏显示数据查询与控制 大屏显示数据查询与控制 POST /data/examInfoStandardDisplay.ws */ -export async function examInfoStandardDisplayUsingPost( - body: API.Pinyin_13, - options?: { [key: string]: any }, -) { - return request('/data/examInfoStandardDisplay.ws', { - method: 'POST', - headers: { - 'Content-Type': 'application/json;charset=UTF-8', - }, - data: body, - ...(options || {}), - }); -} diff --git a/entry/src/main/ets/api/systemRest.ts b/entry/src/main/ets/api/systemRest.ts deleted file mode 100644 index 6708ac57..00000000 --- a/entry/src/main/ets/api/systemRest.ts +++ /dev/null @@ -1,31 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '../common/utils/http'; - -/** 2.考试中心执行参数同步 由外部(考试平台)调用,主动请求参数平台同步基础数据 GET /system/doParamBaseDataSync */ -export async function doParamBaseDataSyncUsingGet(options?: { [key: string]: any }) { - return request('/system/doParamBaseDataSync', { - method: 'GET', - ...(options || {}), - }); -} - -/** 3.考试中心执行参数数据同步 由外部(考试平台)调用,主动请求参数平台同步参数数据 GET /system/doParamConfigDataSync */ -export async function doParamConfigDataSyncUsingGet(options?: { [key: string]: any }) { - return request('/system/doParamConfigDataSync', { - method: 'GET', - ...(options || {}), - }); -} - -/** 1.用户登录 用户登录接口,获取用户相关信息和登录Token,登录后调用后台接口时,将Token放到请求头中 POST /system/userLogin.do */ -export async function userLoginUsingPost(body: API.Pinyin_21, options?: { [key: string]: any }) { - return request('/system/userLogin.do', { - method: 'POST', - headers: { - 'Content-Type': 'application/json;charset=UTF-8', - }, - data: body, - ...(options || {}), - }); -} diff --git a/entry/src/main/ets/api/typings.d.ts b/entry/src/main/ets/api/typings.d.ts deleted file mode 100644 index df222d1f..00000000 --- a/entry/src/main/ets/api/typings.d.ts +++ /dev/null @@ -1,964 +0,0 @@ -declare namespace API { - type CarBrand_ = { - /** 品牌名 {type_name} */ - brandName?: string; - /** 创建者 */ - createBy?: string; - /** 创建时间 */ - createTime?: string; - /** 百米脉冲 */ - hundredMeterPulse?: string; - /** 主键 */ - id?: number; - /** 签到序号起始点 */ - signNumber?: number; - /** SIMPLE_NAME */ - simpleName?: string; - /** 更新者 */ - updateBy?: string; - /** 更新时间 */ - updateTime?: string; - }; - - type CarInfo_ = { - /** 监管分车时间 */ - assignTime?: string; - /** 车辆品牌id [car_brand.id] {cartypeid} */ - carBrandId?: number; - /** 考车自检状态(0:不用检查,1:待检查,2:检查通过,3:检查不通过) */ - carCheckStatus?: string; - /** 考车实际IP {carip} */ - carIp?: string; - /** 考车对应mac地址 */ - carMac?: string; - /** 考车编号 {carno} */ - carNo?: string; - /** 考车身份证号 */ - cardNoArray?: string; - /** 创建者 */ - createBy?: string; - /** 创建时间 */ - createTime?: string; - /** 删除标记(0:存在,2:已经删除)(status) */ - delFlag?: string; - /** 考点id [sys_dept.dept_id] {exampointid} */ - deptId?: number; - /** 设备号 */ - deviceNo?: string; - /** 考车状态(1:正常,2:停用,3:异常) */ - deviceStatus?: string; - /** 准驾车型 {cartype} */ - drivingLicenseType?: string; - /** 终点库位号 {zdkwh} */ - endPointNo?: string; - /** 考车路线 */ - examLineArray?: string; - /** 所属考官对应的用户id [sys_user.user_id] */ - examManId?: number; - /** 考试场次 {kscc} */ - examRound?: number; - /** 当前登录随车考试员id [examiner_info.id] */ - examinerId?: number; - /** 考场区域代号 */ - fieldId?: string; - /** 百米脉冲 */ - hundredMeterPulse?: string; - /** 主键 */ - id?: number; - /** 监控审核人脸识别方式(0:无人脸识别,1:视频截图方式,2:考车上传方式) {isface} */ - isFace?: string; - /** 是否更新map_collect (0:否,1:是) {is_mapcollect} */ - isMapCollect?: string; - /** 是否需要审核(0:否,1:是) */ - isReview?: string; - /** 上一次登录随车考试员 [examiner_info.id] */ - lastExaminerId?: number; - /** 考车号牌 {carcode} */ - licensePlate?: string; - /** 模型id [model_info.id] {modelid} */ - modelId?: number; - /** 导航线路 {dhxl} */ - navigationLine?: string; - /** 考车对应软件版本 */ - softwareVersion?: string; - /** 更新者 */ - updateBy?: string; - /** 更新时间 */ - updateTime?: string; - /** 车辆型号 */ - vehicleModel?: string; - /** 考车对应车辆识别代号 */ - vin?: string; - /** 考试路线 */ - wayNo?: number; - }; - - type ExamInfoVo = { - bk1?: string; - bz1?: string; - cartype?: string; - czlx?: string; - fieldid?: string; - flag?: string; - fz?: string; - jdxx?: string; - jxmc?: string; - kchp?: string; - kfxm?: string; - kscc?: string; - kscx?: string; - ksdd?: string; - kskm?: string; - kslx?: string; - ksmjzp?: string; - kssycs?: string; - ksxl?: string; - ksy1?: string; - ksy1sfzmhm?: string; - ksy2?: string; - ksy2sfzmhm?: string; - kszp?: string; - kszt?: string; - ktbh?: string; - lsh?: string; - motorType?: string; - roadway?: string; - securityGuard?: string; - sfcode?: string; - sfzmhm?: string; - updatetime?: string; - xb?: string; - xh?: string; - xldm?: string; - xm?: string; - ykrq?: string; - yycs?: string; - zkzmbh?: string; - zwxx1?: string; - zwxx2?: string; - zwxx3?: string; - zwxx4?: string; - }; - - type ExamPointInfo_ = { - /** 考场地址 {address} */ - address?: string; - /** 考场车辆类型(1:小车,2:大车,3:摩托){is_motor} */ - carType?: string; - /** 创建者 */ - createBy?: string; - /** 创建时间 */ - createTime?: string; - /** 所属部门id [sys_dept.dept_id] {organize_id} */ - deptId?: number; - /** 考点名称 {name} */ - deptName?: string; - /** 准驾车型(列表,逗号隔开) {car_type} */ - drivingLicenseType?: string; - /** 考点代码 {code} */ - examPointCode?: string; - /** 考点全称 {fullname} */ - fullName?: string; - /** 主键 */ - id?: number; - /** 联系人 {contact} */ - master?: string; - /** 联系电话 {phone} */ - phone?: string; - /** 电子地图映射信息json */ - photoInfo?: string; - /** 电子地图图片路径 {path} */ - photoPath?: string; - /** 备注 */ - remark?: string; - /** 考试科目 {type} */ - subjectType?: string; - /** 更新者 */ - updateBy?: string; - /** 更新时间 */ - updateTime?: string; - }; - - type GpsIPUdpIP_ = { - /** 车辆品牌名称 */ - carBrandName?: string; - /** 准驾车型(C1、C2...) */ - drivingLicenseType?: string; - /** GPS差分服务器地址 */ - gpsAddress?: string; - /** 是否需要自检(0:不需要自检,1:需要自检) */ - isNeedCheck?: string; - /** 百米脉冲 */ - pulse?: string; - /** 考试科目 */ - subjectType?: string; - /** UDP服务器数据端口号 */ - udpDataPort?: string; - /** UDP服务器ip */ - udpIp?: string; - /** UDP服务器消息端口号 */ - udpMessagePort?: string; - /** 语音对讲服务ip */ - voiceIp?: string; - /** 语音对讲服务端口号 */ - voicePort?: string; - }; - - type GpsIPUdpIP2 = { - /** 车牌号 */ - licensePlate: string; - /** 评判版本号 */ - softwareVersion: string; - }; - - type MarkRuleSet = { - itemName?: string; - itemno?: string; - kfxh?: string; - markcatalog?: string; - markdepend?: string; - markreal?: string; - markserial?: string; - markshow?: string; - markstandard?: string; - }; - - type paramConfigDataSyncUsingGETParams = { - /** tableName */ - tableName: string; - }; - - type Pinyin__ = { - /** 车牌号 */ - licensePlate: string; - /** 考试里程{kslc} */ - mileage: number; - /** 流水号 */ - serialNo: string; - /** 特殊扣分内容 */ - specialSub?: string; - }; - - type Pinyin_10 = { - /** 考车id */ - gunCameraInfos?: Pinyin_9[]; - }; - - type Pinyin_11 = { - /** 小红球程序编号 */ - deviceNo: string; - /** 小红球消息 */ - message: string; - }; - - type Pinyin_12 = { - kaoShengXinXi?: ExamInfoVo[]; - }; - - type Pinyin_13 = { - b2no?: string; - c1no?: string; - c2no?: string; - c5no?: string; - deviceNo?: string; - fieldId?: string; - kscc?: string; - }; - - type Pinyin_14 = { - judgeVersion?: string; - kdid?: string; - kskm?: string; - markRuleSet?: MarkRuleSet[]; - shellVersion?: string; - speendParam?: string; - vehicleSpeend?: VehicleSpeend[]; - }; - - type Pinyin_15 = { - /** 小红球程序编号 */ - deviceNo: string; - }; - - type Pinyin_16 = { - aqyphoto?: string; - aqysfzmhm?: string; - aqyxm?: string; - bkhgkssj?: string; - jxmc?: string; - kch?: string; - kchp?: string; - kclx?: string; - kcmc?: string; - kscs?: string; - kscx?: string; - ksxl?: string; - ksyphoto?: string; - ksysfzmhm?: string; - ksyxm?: string; - lsh?: string; - sfzmhm?: string; - xm?: string; - yycs?: string; - zp1?: string; - zp2?: string; - zwh?: string; - }; - - type Pinyin_17 = { - /** 考车编号 */ - carNo: string; - /** 小红球程序编号 */ - deviceNo: string; - /** 流水号 */ - serialNo: string; - }; - - type Pinyin_18 = { - /** 随车考试员编号 */ - examinerCode?: string; - /** 车牌号 */ - licensePlate: string; - /** 流水号 */ - serialNo: string; - }; - - type Pinyin_19 = { - /** 安徽已考项目 */ - ahykxx?: string; - /** 大车初考项目 */ - firstABykxx?: string; - /** 考试剩余次数 */ - kssycs?: string; - /** 考试预约流水号 */ - lsh?: string; - /** 摩托车考试模式 */ - motorType?: string; - /** 大车补考项目 */ - secondABykxx?: string; - /** 约考信息,内容如:开始时间;里程;考试项目;扣分项目;特殊地方扣分明细 */ - ykxx?: string; - }; - - type Pinyin_2 = { - /** 文件base64 */ - examData: string; - /** 考试结束时间 */ - examEndTime: string; - /** 考试开始时间 */ - examStartTime: string; - /** 文件名称(type=2/3时需要传) */ - fileName?: string; - /** 车牌号 */ - licensePlate: string; - /** 流水号 */ - serialNo: string; - /** 文件类型,鸿蒙考车固定传1(0:本地轨迹,1:监管轨迹,2:轨迹回放,3:注意力识别) */ - type: string; - }; - - type Pinyin_20 = { - /** 考车请求时间,跟下面请求数据data中的业务发生时间相同,这里用作设备时差校验 */ - carSendTime: string; - /** 请求数据,详见无锡所接口文档。JSON对象 */ - data: Record; - /** 文件列表 */ - files?: WxsBaseFileBean[]; - /** 车牌号 */ - licensePlate: string; - /** 接口编号,例如:02-21-000009(考试开始) */ - restCode: string; - }; - - type Pinyin_21 = { - /** 设备imei号 */ - imei: string; - /** 用户登录时间戳 */ - loginTime: number; - /** md5加密串(根据imei号+时间戳+盐混淆) */ - signKey: string; - }; - - type Pinyin_22 = { - /** 中心服务器当前时间 */ - time?: string; - }; - - type Pinyin_23 = { - /** 设备名称 */ - deviceName: string; - /** 设备编号 */ - deviceNo: string; - /** 设备类型(1:考车;2:闸机;3:大屏;4:指纹仪;5:拍照) */ - type: string; - }; - - type Pinyin_24 = { - /** 考试项目 */ - bk1?: string; - /** 备注1 0,0, */ - bz1?: string; - /** 考试车型,考生表的carType */ - cartype?: string; - /** 操作类型 */ - czlx?: string; - /** 考试区域 */ - fieldid?: string; - /** 考试是否合格 */ - flag?: string; - /** 考试分组 */ - fz?: string; - /** 阶段信息 */ - jdxx?: string; - /** 驾校名称 */ - jxmc?: string; - /** 考车号牌 */ - kchp?: string; - /** 扣分项目 */ - kfxm?: string; - /** 考试场次 */ - kscc?: string; - /** 考试车型 */ - kscx?: string; - /** 考试地点,考场编号 */ - ksdd?: string; - /** 考试科目 */ - kskm?: string; - /** 考试类型 */ - kslx?: string; - /** ksmjzp */ - ksmjzp?: string; - /** 考试剩余次数 */ - kssycs?: string; - /** 考试线路-实用 */ - ksxl?: string; - /** 考试员姓名1 */ - ksy1?: string; - /** 考试员1身份证号 */ - ksy1sfzmhm?: string; - /** 考试员随车考试员2 */ - ksy2?: string; - /** 考试员2身份证号 */ - ksy2sfzmhm?: string; - /** 考生照片,base64编码 */ - kszp?: string; - /** 考试状态 */ - kszt?: string; - /** 考台编号 */ - ktbh?: string; - /** 考试预约流水号 */ - lsh?: string; - /** 摩托车考试模式 1.先考科目2,再考科目3 2.科目2 3.科目3 4.先考科目3,再考科目2 */ - motorType?: string; - /** 车道 */ - roadway?: string; - /** 安全员姓名 */ - securityGuard?: string; - /** 6位身份编码 */ - sfcode?: string; - /** 身份证号 */ - sfzmhm?: string; - /** 上车更新时间 */ - updatetime?: string; - /** 考生性别 */ - xb?: string; - /** 序号 */ - xh?: string; - /** 监管线路代码,上传用 */ - xldm?: string; - /** 考生姓名 */ - xm?: string; - /** 约考日期 */ - ykrq?: string; - /** 预约次数 */ - yycs?: string; - /** 准考证明编号,admissionNo */ - zkzmbh?: string; - /** 指纹1 */ - zwxx1?: string; - /** 指纹2 */ - zwxx2?: string; - /** 指纹3 */ - zwxx3?: string; - /** 指纹4 */ - zwxx4?: string; - }; - - type Pinyin_25 = { - /** 设备号 */ - deviceNo: string; - /** 照片1 */ - firstImage: string; - /** 照片2 */ - secondImage: string; - /** 身份证号码 */ - sfzh: string; - }; - - type Pinyin_26 = { - /** 车牌号 */ - licensePlate: string; - /** 流水号 */ - serialNo: string; - }; - - type Pinyin_27 = { - /** 类别(1:外壳,2:视屏,3:评判,4:接口) */ - category: string; - /** 车牌号 */ - licensePlate: string; - /** 日志内容 */ - logData: string; - /** 考车日志类型(1:升级日,2:错误日志) */ - logType: string; - /** 考车发生时间(格式:yyyy-MM-dd HH:mm:ss) */ - vehicleTime: string; - }; - - type Pinyin_28 = { - /** 设备编号 */ - deviceNo: string; - }; - - type Pinyin_29 = { - /** 自检结果附带信息 */ - condition: string; - /** 自检结果(1:合格,0:不合格) */ - flag: string; - /** 车牌号 */ - licensePlate: string; - }; - - type Pinyin_3 = { - /** 车牌号 */ - licensePlate: string; - }; - - type Pinyin_30 = { - /** 考车编号 */ - carNo?: string; - /** 车辆类型 */ - carType?: string; - /** 身份证号 */ - cardNo?: string; - /** 设备编号 */ - deviceNo?: string; - faceVerifyRes?: string; - /** fieldId */ - fieldId?: string; - fingerVerifyRes?: string; - /** 体温是否正常标志 */ - health?: string; - /** 6位身份编码 */ - idNoSix?: string; - /** 考官证件号码 */ - kgCardNo?: string; - /** 人工过门禁原因 */ - manualReason?: string; - /** mixModel */ - mixModel?: string; - /** 人脸识别度 */ - rlsbValue?: string; - /** 流水号 */ - serialNo?: string; - sfzzp?: string; - /** 考试科目 */ - subjectType?: string; - /** 体温值 */ - temperature?: string; - /** 体温照片1 */ - twzp1?: string; - /** 体温照片2 */ - twzp2?: string; - /** 照片 */ - zp?: string; - zw1?: string; - zw2?: string; - zw3?: string; - zw4?: string; - }; - - type Pinyin_31 = { - /** 模型内容(base64) */ - content: string; - /** 文件名 */ - filename: string; - }; - - type Pinyin_32 = { - /** 车牌号 */ - licensePlate: string; - }; - - type Pinyin_33 = { - /** 车牌号码 */ - licensePlate: string; - }; - - type Pinyin_34 = { - /** 车牌号 */ - licensePlate: string; - }; - - type Pinyin_35 = { - /** 是否需要自检(0:不需要自检,1:需要自检) */ - isNeedCheck?: string; - /** 自检项目 */ - items?: string; - /** 串口号 */ - portNo?: string; - /** 重试次数 */ - retryTime?: string; - /** (1:取反,0:不取反)例如安全带取反且离合器不取反即(1^0) */ - reverse?: string; - }; - - type Pinyin_36 = { - /** 住址 */ - addr?: string; - /** 设备编号 */ - deviceNo?: string; - /** fieldId */ - fieldId?: string; - /** 考官证件号码 */ - kgsfzmhm?: string; - /** 考试科目 */ - kskm?: string; - /** 流水号 */ - lsh?: string; - /** mixModel */ - mixModel?: string; - /** 身份证号 */ - sfzh: string; - /** 姓名 */ - xm?: string; - }; - - type Pinyin_37 = { - /** 设备号 */ - deviceNo?: string; - /** 照片1 */ - firstImage?: string; - /** 考试科目 */ - kskm?: string; - /** 认证次数 */ - rzcs?: string; - /** 照片2 */ - secondImage: string; - /** 身份证号码 */ - sfzh: string; - /** 设备类型(1、门禁2、考车3、过程) */ - type: string; - /** 审核类型(2、人工审核) */ - verifyType?: string; - }; - - type Pinyin_38 = { - /** 设备硬件号 */ - deviceNo: string; - /** 门禁程序版本号 */ - gateVersion: string; - }; - - type Pinyin_39 = { - /** 随车考试员登录用户名(可以是身份证号、员工号、制卡号等等) */ - examinerName: string; - /** 随车考试员密码 */ - examinerPwd?: string; - /** 车牌号 */ - licensePlate: string; - }; - - type Pinyin_4 = { - /** 考生信息列表 */ - studentList?: Pinyin_24[]; - }; - - type Pinyin_40 = { - /** 指纹信息1 */ - finger1?: string; - /** 指纹信息2 */ - finger2?: string; - /** 随车考试员姓名 */ - name?: string; - }; - - type Pinyin_5 = { - /** 车牌号码 */ - licensePlate: string; - /** 表名,大写 */ - tableName: string; - }; - - type Pinyin_6 = { - /** car_mac */ - car_mac: string; - /** 设备类型(1:海康,2:大华) */ - equipment_type: string; - /** 第一路通道 */ - first_channel: string; - /** 第一路ip */ - first_ip: string; - /** 第一路密码 */ - first_password: string; - /** 第一路端口 */ - first_port: string; - /** 第一路用户名 */ - first_username: string; - /** 第四路通道 */ - fourth_channel: string; - /** 第四路ip */ - fourth_ip: string; - /** 第四路密码 */ - fourth_password: string; - /** 第四路端口 */ - fourth_port: string; - /** 第四路用户名 */ - fourth_username: string; - /** 连接类型(0:主码流TCP方式,1:子码流TCP方式,2:主码流UDP方式,3:子码流UDP方式) */ - line_type: string; - /** 拍照通道 */ - photo_channel: string; - /** 叠加内容1(1.考生姓名,身份证号,3.当前项目,4.当前时间) */ - photo_overlay_text_content1: string; - /** 叠加内容2(1.考生姓名,身份证号,3.当前项目,4.当前时间,0:空) */ - photo_overlay_text_content2: string; - /** 叠加内容3(1.考生姓名,身份证号,3.当前项目,4.当前时间,0:空) */ - photo_overlay_text_content3: string; - /** 照片叠加文字(1:启用,0:关闭) */ - photo_overlay_text_enable: string; - /** 位置(1:左上角,2:右上角,3:左下角,4.右下角) */ - photo_overlay_text_position: string; - /** 文字大小 */ - photo_overlay_text_size: string; - /** 分割符(1:/,2:*\,3:换行) */ - photo_overlay_text_split: string; - /** 启用过程人脸比对 {process_face_comparion_enable} */ - process_face_comparion_enable: string; - /** 过程人脸比对模式(1:启用,0:关闭) {process_face_comparion_mode} */ - process_face_comparion_mode: string; - /** 第二路通道 */ - second_channel: string; - /** 第二路ip */ - second_ip: string; - /** 第二路密码 */ - second_password: string; - /** 第二路端口 */ - second_port: string; - /** 第二路用户名 */ - second_username: string; - /** 第三路通道 */ - third_channel: string; - /** 第三路ip */ - third_ip: string; - /** 第三路密码 */ - third_password: string; - /** 第三路端口 */ - third_port: string; - /** 第三路用户名 */ - third_username: string; - /** 视频路数 */ - video_channel: string; - /** 录像方式(0:本地录像,1:本地不录象) */ - video_mode: string; - /** 视频遮挡 */ - video_occlusion: string; - /** 视频遮挡范围(1:一路,2:二路,3:三路,4:四路) */ - video_occlusion_range: string; - /** 视频叠加位置X */ - video_overlay_position_x: string; - /** 视频叠加位置Y */ - video_overlay_position_y: string; - /** 视频叠加内容1(1:考生姓名,2:身份证号,3:当前项目,4:当前时间) */ - video_overlay_text_content1: string; - /** 视频叠加内容2(1:考生姓名,2:身份证号,3:当前项目,4:当前时间,0:空) */ - video_overlay_text_content2: string; - /** 视频叠加内容3(1:考生姓名,2:身份证号,3:当前项目,4:当前时间,0:空) */ - video_overlay_text_content3: string; - /** 视频叠加文字(1:启用,0:关闭) */ - video_overlay_text_enable: string; - /** 视频叠加分割符(1:/,2:*\,3:换行) */ - video_overlay_text_split: string; - /** 录像范围(1:一路,2:二路,3:三路,4:四路) */ - video_range: string; - /** 本考车对应视频合成服务器IP(填错将不能开始考试) */ - video_synthesis_server_ip: string; - /** 本考车对应视频合成服务器端口(填错将不能开始考试) */ - video_synthesis_server_port: string; - /** 本考车对应视频合成信息处理系统IP(填错或不填将可能导致录像丢失) */ - video_synthesis_system_ip: string; - /** 本考车对应视频合成信息处理系统本地响应端口(填错或不填将可能导致录像丢失) */ - video_synthesis_system_port: string; - }; - - type Pinyin_7 = { - /** 车牌号 */ - licensePlate: string; - }; - - type Pinyin_8 = { - /** 车辆品牌列表 */ - carBrandList?: CarBrand_[]; - /** 考车列表 */ - carInfoList?: CarInfo_[]; - /** 考点列表 */ - examPointInfoList?: ExamPointInfo_[]; - }; - - type Pinyin_9 = { - /** 摄像头通道号 */ - channel?: string; - /** 硬盘录像机ip */ - deviceIP?: string; - /** 监管场地编号 */ - equipmentId?: string; - /** 非全景绑定的全景 */ - fullId?: string; - /** 全景区域坐标 */ - gpsArea?: string; - /** 摄像头id */ - id?: string; - /** 是否全景摄像头 */ - isFull?: string; - /** 硬盘录像机密码 */ - password?: string; - /** 硬盘录像机端口 */ - port?: string; - /** 硬盘录像机用户名 */ - user?: string; - }; - - type ROf_ = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_4; - /** 返回消息 */ - msg: string; - }; - - type ROf10 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_31; - /** 返回消息 */ - msg: string; - }; - - type ROf11 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_35; - /** 返回消息 */ - msg: string; - }; - - type ROf12 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_40; - /** 返回消息 */ - msg: string; - }; - - type ROf2 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_6; - /** 返回消息 */ - msg: string; - }; - - type ROf3 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_8; - /** 返回消息 */ - msg: string; - }; - - type ROf4 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_10; - /** 返回消息 */ - msg: string; - }; - - type ROf5 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_12; - /** 返回消息 */ - msg: string; - }; - - type ROf6 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_14; - /** 返回消息 */ - msg: string; - }; - - type ROf7 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_16; - /** 返回消息 */ - msg: string; - }; - - type ROf8 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_19; - /** 返回消息 */ - msg: string; - }; - - type ROf9 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_22; - /** 返回消息 */ - msg: string; - }; - - type ROfGpsIPUdpIP_ = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: GpsIPUdpIP_; - /** 返回消息 */ - msg: string; - }; - - type ROfListOfobject = { - /** 状态码 1成功 0通用失败 */ - code: number; - /** 承载数据 */ - data?: Record[]; - /** 返回消息 */ - msg: string; - }; - - type ROfobject = { - /** 状态码 1成功 0通用失败 */ - code: number; - /** 承载数据 */ - data?: Record; - /** 返回消息 */ - msg: string; - }; - - type VehicleSpeend = { - carType?: string; - speend?: string; - }; - - type WxsBaseFileBean = { - /** 文件内容base64编码 */ - data: string; - /** 文件类别或id */ - fileid: string; - }; -} diff --git a/entry/src/main/ets/common/autoUpdate/index.ts b/entry/src/main/ets/common/autoUpdate/index.ts index 7280ec8a..d0d03758 100644 --- a/entry/src/main/ets/common/autoUpdate/index.ts +++ b/entry/src/main/ets/common/autoUpdate/index.ts @@ -12,7 +12,7 @@ const TAG = '[updateModelAndCar]' export async function updateModelAndCar(flag){ const data:any = await getModalValueCdAndCar({ carid: globalThis.carInfo.carId }) - const outFile = flag ? '/data/storage/el2/base/haps/entry/files/' : '/mnt/hmdfs/100/account/device_view/local/files/duolun/models' + const outFile = flag ? '/data/storage/el2/base/haps/entry/files/' : '/mnt/hmdfs/100/account/device_view/local/files/duolun/models' const httpPath = flag ? data.getModalValueCdAndCarRsp.body.appPath : data.getModalValueCdAndCarRsp.body.filePath const arr = httpPath.split('/') let path diff --git a/entry/src/main/ets/common/utils/GlobalUdp.ts b/entry/src/main/ets/common/utils/GlobalUdp.ts index 78e36675..37b97921 100644 --- a/entry/src/main/ets/common/utils/GlobalUdp.ts +++ b/entry/src/main/ets/common/utils/GlobalUdp.ts @@ -1,7 +1,5 @@ -//import UdpClient from './UdpClient'; import UdpClientByCenter from './UdpClientByCenter'; -import { getSyncData } from '../service/initable'; -import { getChuankouFn,uploadLogFile} from '../../common/service/indexService'; +import { getChuankouFn, uploadLogFile } from '../../common/service/indexService'; import FileUtil from '../../common/utils/File'; import { GlobalConfig } from '../../config/index'; import { Array2Byte, string2Bytes } from './tools'; @@ -11,20 +9,17 @@ export async function sendMsg(val) { } export async function getUDP(context, errorFlag?) { - return new Promise(async (reslove, reject) => { + return new Promise(async (resolve, reject) => { const fileUtil = new FileUtil(context) const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt'); - console.log('ttttt', data) if (data === '' || data === undefined) { console.log(` getUDP has no IPConfigTable `); globalThis.udpClient = {} globalThis.host = '' - reslove('') + resolve('') } else { const result = JSON.parse(data) - console.log(` getUDP has IPConfigTable `); if (globalThis.udpClient && globalThis.udpClient.closeUdp) { - console.log(` getUDP has udclent close and rebind `); globalThis.udpClient.closeUdp(() => { setTimeout(() => { globalThis.udpClient.rebindUdp(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, @@ -32,22 +27,17 @@ export async function getUDP(context, errorFlag?) { globalThis.udpClient.sendMsg('111', null) globalThis.host = `http://${result.centerIp}:${result.centerPort}` globalThis.udpClient.onError_Callback(() => { - console.log('getUDPgetUDPgetUDP') getUDP(context, true) if (errorFlag && globalThis.udpClient && globalThis.udpClient.onMessage_1) { globalThis.udpClient.onMessage_1 = globalThis.udpClient.onMessage_1 } }) - reslove(`http://${result.centerIp}:${result.centerPort}`) - - // globalThis.udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{}) + resolve(`http://${result.centerIp}:${result.centerPort}`) }, 1000) }) } else { // 未绑定 - console.log(` getUDP has no udclent and bind `); - console.log('ttttttdata', JSON.stringify(result)) const udpClient: UdpClientByCenter = new UdpClientByCenter(result.udplocalIp, result.udplocalIpPort, result.udpOppositeIp, result.udpOppositeIpPort) @@ -64,78 +54,12 @@ export async function getUDP(context, errorFlag?) { } }) getChuankouFn() - reslove(`http://${result.centerIp}:${result.centerPort}`) + resolve(`http://${result.centerIp}:${result.centerPort}`) } } return - getSyncData('IpConfigTable').then((result: Array) => { - if (result.length) { - console.log(` getUDP has IPConfigTable `); - if (globalThis.udpClient && globalThis.udpClient.closeUdp) { - console.log(` getUDP has udclent close and rebind `); - globalThis.udpClient.closeUdp(() => { - setTimeout(() => { - globalThis.udpClient.rebindUdp(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, - result[0].udpOppositeIpPort) - globalThis.udpClient.sendMsg('111', null) - globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}` - globalThis.udpClient.onError_Callback(() => { - console.log('getUDPgetUDPgetUDP') - getUDP(true, context) - if (errorFlag && globalThis.udpClient && globalThis.udpClient.onMessage_1) { - globalThis.udpClient.onMessage_1 = globalThis.udpClient.onMessage_1 - } - }) - reslove(`http://${result[0].centerIp}:${result[0].centerPort}`) - - // globalThis.udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{}) - }, 1000) - }) - - } else { - // 未绑定 - console.log(` getUDP has no udclent and bind `); - const udpClient: UdpClientByCenter = - new UdpClientByCenter(result[0].udplocalIp, result[0].udplocalIpPort, result[0].udpOppositeIp, - result[0].udpOppositeIpPort) - udpClient.bindUdp() - udpClient.sendMsg('111') - globalThis.host = `http://${result[0].centerIp}:${result[0].centerPort}` - globalThis.udpClient = udpClient - - globalThis.udpClient.onMessage_1(() => { - console.log('getUDPonMessage_1msgmsgByGloalUdp') - - }) - globalThis.udpClient.onError_Callback(() => { - getUDP(true, context) - if (errorFlag && globalThis.udpClient && globalThis.udpClient.onMessage_1) { - globalThis.udpClient.onMessage_1 = globalThis.udpClient.onMessage_1 - } - }) - // udpClient.onError_resend(globalThis.udpClient.onMessage_1?globalThis.udpClient.onMessage_1:()=>{}) - getChuankouFn() - reslove(`http://${result[0].centerIp}:${result[0].centerPort}`) - - - } - - } else { - console.log(` getUDP has no IPConfigTable `); - // if(globalThis.udpClient) - // { - // console.log(` getUDP2 has IPConfigTable ,has udpClient ,close it`); - // globalThis.udpClient.closeUdp(async ()=>{ }) - // } - globalThis.udpClient = {} - // globalThis.udpClient.onMessage_1 = () => {} - globalThis.host = '' - reslove('') - - } - }) }) } @@ -187,7 +111,7 @@ export async function getUDP2(context, errorFlag?) { console.info('surenjun', `接收到平台扣分请求,请求指令为:${val.body[1]}`) globalThis.udpEvent.sendOnKf(val.body[1]) } - if(val.body[0] == 6){ + if (val.body[0] == 6) { console.info('surenjun', `接收到平台停考指令,请求指令为:${val.body[1]}`) globalThis.judgeUdp.askStopExam(val.body[1]) } @@ -199,7 +123,7 @@ export async function getUDP2(context, errorFlag?) { console.info('surenjun', 'GlobalUdp收到endExam事件') globalThis.udpEvent.sendEndExam(val.body[1]) } - if(val.body[0] == 18){ + if (val.body[0] == 18) { //上传日志和轨迹 uploadLogFile() } @@ -221,10 +145,10 @@ export async function getUDP2(context, errorFlag?) { placeId: globalThis.carInfo.examinationRoomId } globalThis.udpClient2.send(param) - }else if(val.id == '39'){ + } else if (val.id == '39') { //确定远程终止 const lsh = val.body.map(byte => String.fromCharCode(byte)).join('') - if( lsh == globalThis.lsh ){ + if (lsh == globalThis.lsh) { globalThis.udpEvent.sendStopExam() globalThis.judgeUdp.confirmStopExam(globalThis.signNum) } @@ -236,67 +160,7 @@ export async function getUDP2(context, errorFlag?) { } } return - console.log(` getUDP2 enter`); - getSyncData('IpConfigTable').then(async (result: Array) => { - if (result.length) { - console.log(` getUDP2 has IPConfigTable `); - if (globalThis.udpClient2 && globalThis.udpClient2.closeUdp) { - console.log(` getUDP2 has udclent ,close and rebind `); - globalThis.udpClient2.closeUdp(async () => { - setTimeout(() => { - globalThis.udpClient2.rebindUdp(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, - globalThis.carInfo?.messagePort) - globalThis.udpClient2.onError_Callback(() => { - getUDP2(true); - if (errorFlag && globalThis.udpClient2 && globalThis.udpClient2.onMessage_2) { - globalThis.udpClient2.onMessage_2 = globalThis.udpClient2.onMessage_2 - } - }) - }, 1000) - }) - } else { - // 未绑定 - console.log(` getUDP2 has no udclent and bind `); - const udpClient2: UdpClientByCenter = - new UdpClientByCenter(result[0].udplocalIp, '8800', globalThis.carInfo?.udpAddress, - globalThis.carInfo?.messagePort) - await udpClient2.bindUdp() - await udpClient2.onError_Callback(() => { - getUDP2(true); - if (errorFlag && globalThis.udpClient2 && globalThis.udpClient2.onMessage_2) { - globalThis.udpClient2.onMessage_2 = globalThis.udpClient2.onMessage_2 - } - }) - if (!errorFlag) { - await udpClient2.onMessage_2((val) => { - if (val.id == '32') { - globalThis.signNum = val.body[1] - } else if (val.id == '46') { - let tmpList = [] - const str = globalThis.lsh - for (let i = 0; i < str.length; i++) { - tmpList.push(this.string2Bytes(str.charCodeAt(i), 1 * 8)[0]) - } - const param = { - id: 47, - list: tmpList, - carNo: globalThis.carInfo.carNo, - placeId: globalThis.carInfo.examinationRoomId - } - globalThis.udpClient2.send(param) - } - }) - } - globalThis.udpClient2 = udpClient2 - - } - } else { - globalThis.udpClient2 = {} - globalThis.udpClient2.setMsgCallBack = () => { - } - } - }) } export async function setTopLineUdp() { @@ -325,7 +189,6 @@ export async function setJudgeUdp() { const config = JSON.parse(data) // - // const config = await getSyncData('IpConfigTable'); let udpIndex = 0; let currentUdpIndex = 0; let judgeUdpTimer @@ -343,15 +206,12 @@ export async function setJudgeUdp() { ) console.info('surenjun hintPort=> ', globalThis.carInfo?.hintPort) - await udpClientbyCenter.onError_Callback(() => { + udpClientbyCenter.onError_Callback(() => { }) - await udpClientbyCenter.bindUdp() - await udpClientbyCenter.onMessage_2((val) => { + udpClientbyCenter.bindUdp() + udpClientbyCenter.onMessage_2((val) => { }) - //远程监听开始考试、结束考试、扣分指令 - - // globalThis.judgeUdpClient = udpClientbyCenter; return { send(bytes) { if (udpIndex > currentUdpIndex) { @@ -388,11 +248,11 @@ export async function setJudgeUdp() { }, //申请语音对讲 - askVoice(){ - console.log('surenjun','发送语音对讲') + askVoice() { + console.log('surenjun', '发送语音对讲') //udp bug 连发消息 - let num =0; - let timer = setInterval(()=>{ + let num = 0; + let timer = setInterval(() => { globalThis.udpClient2.sendMsgExt({ id: 49, list: ['1'], @@ -400,15 +260,15 @@ export async function setJudgeUdp() { placeId: globalThis.carInfo.examinationRoomId, }) num++; - if(num >=5){ + if (num >= 5) { clearInterval(timer) } - },200) + }, 200) }, //查询远程终止考试 - askStopExam(directives){ + askStopExam(directives) { globalThis.udpClient2.sendMsgExt({ id: 38, list: [directives], @@ -417,11 +277,11 @@ export async function setJudgeUdp() { }) }, // 确定远程终止考试 - confirmStopExam(directives){ - console.log('surenjun','确定远程终止考试 directives=》'+directives) + confirmStopExam(directives) { + console.log('surenjun', '确定远程终止考试 directives=》' + directives) globalThis.udpClient2.sendMsgExt({ id: 40, - list: [directives,1], + list: [directives, 1], carNo: globalThis.carInfo.carNo, placeId: globalThis.carInfo.examinationRoomId }) diff --git a/entry/src/main/ets/common/utils/RemotetoolWebsocket.ets b/entry/src/main/ets/common/utils/RemotetoolWebsocket.ets index b47932da..b569946a 100644 --- a/entry/src/main/ets/common/utils/RemotetoolWebsocket.ets +++ b/entry/src/main/ets/common/utils/RemotetoolWebsocket.ets @@ -1,6 +1,13 @@ import webSocket from '@ohos.net.webSocket' import promptAction from '@ohos.promptAction' import router from '@ohos.router' +import fs from '@ohos.file.fs'; +import request from '@ohos.request'; +import common from '@ohos.app.ability.common'; +import zlib from '@ohos.zlib'; +import appRecovery from '@ohos.app.ability.appRecovery'; +import power from '@ohos.power'; +import preferences from '@ohos.data.preferences'; enum PlatFormEventType { RestartDevice = "1", @@ -39,34 +46,155 @@ const routerMap = { SignDisplay: 12, } +export const gpsConfig = [ + { label: "差分状态", prop: "cfzt" }, + { label: "经纬度收星数", prop: "sxs" }, + { label: "龄期", prop: "lq" }, + { label: "海拔高", prop: "hb" }, + { label: "高度差", prop: "gdc" }, + { label: "纬度", prop: "wd" }, + { label: "经度", prop: "jd" }, + { label: "纬度因子", prop: "wdyz" }, + { label: "经度因子", prop: "jdyz" }, + { label: "速度", prop: "sd" }, + { label: "航向角", prop: "hxj" }, + { label: "航向角状态", prop: "hxjzt" }, + { label: "航向角收星数", prop: "hxjsxs" }, + { label: "俯仰角", prop: "fyj" }, + { label: "年月日", prop: "nyr" }, + { label: "时分秒", prop: "sfm" } +] + interface PlatformEvent { serialNumber: string - eventType: PlatFormEventType // (1:豸 2: 3:־б 4:ϴ־ 5:Ծʼ(1:1)6:Ծ(1:1)7:Ծ· 8:Ծϱ 9:豸ע 10:ƽ̨ע11:ڶɻע 12:ն״̬ϱ) - uploadType: string //1:ƽ̨· 2:նϴ + eventType: PlatFormEventType // 操作类型(1:重启设备 2:重启程序 3:日志列表 4:上传日志 5:考试镜像开始(1:1)6:考试镜像结束(1:1)7:考试镜像命令下发 8:考试镜像数据上报 9:设备注册 10:平台注册11:摆渡机注册 12:终端在线状态上报) + uploadType: string //1:平台下发 2:终端上传 deviceNo: string data: T } export interface DataParams { - page: string; + page: number; data: string; } export interface StudentData { select: number students: Array<{ - id: string // ˮ - name: string // - idCard: string // ֤ - avatar?: string // ͷbase64 ҪҪ - subject: string // Ŀ - examCount: string // ʣ࿼Դ - examLine: string // · - examiner: string // + id: string // 流水号 + name: string // 姓名 + idCard: string // 身份证 + avatar?: string // 头像base64 考虑要不要传 + subject: string // 科目 + examCount: string // 剩余考试次数 + examLine: string // 考试线路 + examiner: string // 考官姓名 }> } +interface FileInfo { + fileName: string + lastUpdateTime: string + fileSize: number +} + const Tag = "[websocket]" +const SystemLogDir = "/data/log/hilog" +const AppLogDir = '/mnt/hmdfs/100/account/device_view/local/files/duolun/logs' + +async function sleep(duration: number) { + return new Promise((resolve, _reject) => { + setTimeout(() => { + resolve() + }, duration) + }) +} + +function formatDate(date: Date | string | number, fmt = 'yyyy-MM-dd') { + date = date instanceof Date ? date : new Date(date); + + const pad = (n) => (n < 10 ? `0${n}` : `${n}`); + const pad3 = (n) => (n < 10 ? `00${n}` : n < 100 ? `0${n}` : `${n}`); + + return fmt + .replace(/yyyy/g, date.getFullYear().toString()) + .replace(/yy/g, `${date.getFullYear()}`.slice(-2)) + .replace(/MM/g, pad(date.getMonth() + 1)) + .replace(/M/g, (date.getMonth() + 1).toString()) + .replace(/dd/g, pad(date.getDate())) + .replace(/d/g, (date.getDate()).toString()) + .replace(/HH/g, pad(date.getHours())) + .replace(/H/g, (date.getHours()).toString()) + .replace(/hh/g, pad(date.getHours() % 12 || 12)) + .replace(/h/g, (date.getHours() % 12 || 12).toString()) + .replace(/mm/g, pad(date.getMinutes())) + .replace(/m/g, date.getMinutes().toString()) + .replace(/ss/g, pad(date.getSeconds())) + .replace(/s/g, date.getSeconds().toString()) + .replace(/SSS/g, pad3(date.getMilliseconds())) + .replace(/S/g, date.getMilliseconds().toString()) + .replace(/a/g, date.getHours() < 12 ? '上午' : '下午') + .replace(/A/g, date.getHours() < 12 ? 'AM' : 'PM') + .replace(/q/g, Math.floor((date.getMonth() + 3) / 3).toString()); +} + +function getSystemLogList(year: string, month: string, date: string) { + let list: FileInfo[] = [] + try { + list = fs.listFileSync(SystemLogDir).filter(name => { + return new RegExp(year + month + date).test(name) + }).map(name => { + let info = fs.statSync(SystemLogDir + '/' + name) + return { + fileName: name, + lastUpdateTime: formatDate(info.mtime, 'yyyy-MM-dd HH:mm:ss'), + fileSize: info.size + } + }) + + } catch (e) { + console.log(Tag, JSON.stringify(e)) + } + return list +} + +function getAppLogList(year: string, month: string, date: string) { + let list: FileInfo[] = [] + const path = AppLogDir + `/${year}_${month}_${date}` + if (!fs.accessSync(path)) { + return [] + } + list = fs.listFileSync(path).map(name => { + let info = fs.statSync(path + '/' + name) + return { + fileName: name, + lastUpdateTime: formatDate(info.mtime, 'yyyy-MM-dd HH:mm:ss'), + fileSize: info.size + } + }) + return list +} + +function uploadFile(context: common.UIAbilityContext, serialNumber: string, filename: string, ext: string) { + return new Promise((resolve, reject) => { + return request.uploadFile(context, { + url: `http://88.22.20.30:8080/ws-signaling-0.0.1/api/file/upload?serialNumber=${serialNumber}`, + header: { 'Accept': '*/*', 'Content-Type': 'multipart/form-data' }, + method: 'post', + files: [{ filename, name: 'file', uri: `internal://cache/${filename}`, type: ext }], + data: [{ name: "serialNumber", value: serialNumber }] + }).then(task => { + task.on("fail", (err) => { + reject(err) + }) + task.on("complete", () => { + resolve() + }) + }).catch(reject).finally(() => { + fs.unlinkSync(`internal://cache/${filename}`) + }) + }) +} export class RemoteToolWebsocket { private instance: webSocket.WebSocket @@ -74,9 +202,14 @@ export class RemoteToolWebsocket { private serialNumber: string = "" private reconnectCount: number = 0 private url: string = '' - private onStartCallback: Array<() => void> = [] + private onStartCallback: Array<{ + page: number, + cb: () => void + }> = [] public isStart: boolean = false private isRegister: boolean = false + private context: common.UIAbilityContext + private store: preferences.Preferences | null = null constructor() { if (!RemoteToolWebsocket.instance) { @@ -85,36 +218,153 @@ export class RemoteToolWebsocket { return RemoteToolWebsocket.instance } - private sendReply(serialNumber: string, eventType: string) { + private handleSignal(msg: string) { + let data = msg.split(",") + let plc = [ + data[2], //左方向灯 + data[3], //右方向灯 + data[7], //近光灯 + data[8], //远光灯 + data[9], //示廓灯 + data[20], //双跳灯 + data[10], //雾灯 + data[4], //喇叭 + data[5], //点火1 + data[6], //点火2 + data[11], //雨刮器 + data[4], //脚刹 + data[13], //手刹 + data[17], //离合 + data[18], //副刹车 + data[19], //安全带 + data[14], //主驾驶门 + data[21], //其他门 + data[23], //车速 + data[25], //发动机转速 + data[22], //转速过高 + data[28], //档位 + data[27]?.split("_")[0], //方向盘角度 + data[24], //累计脉冲 + data[26], //熄火次数 + data[29], //超声波1 + data[30], //超声波2 + data[31], //超声波3 + data[32], //超声波4 + data[33], //触摸1 + data[34], //触摸2 + data[35], //触摸3 + '0,1,2', //车辆状态 + data[15], //NC + data[16], //SA15 + data[36], //SCIO + data[37], //SC1A_C + data[38], //SC1B_C + data[39], //SC2A_C + data[40], //SC2B_C + data[41], //SC3A_C + data[42], //SC3B_C + data[43], //SC4A_C + data[44], //SC4B_C + data[45], //SC5A_C + data[46], //SC5B_C + data[47], //SC6A_C + data[48],//SC6B_C + ] + const hours = Number(data[94]?.substring(0, 2)) + 8 + let time = (hours > 9 ? hours : '0' + hours) + data[94]?.substring(2, data[94]?.length - 2) + let gps = [ + data[83], // 差分状态 + data[84], // 经纬度收星数 + data[87], // 龄期 + data[85], // 海拔高 + data[86], // 高度差 + data[96], // 纬度 + data[95], // 经度 + data[88], // 纬度因子 + data[89], // 经度因子 + data[97], // 速度 + data[90], // 航向角 + data[92]?.split('-')[0], // 航向角状态 + data[92]?.split('-')[1], // 航向角收星数 + data[91], // 俯仰角 + data[93], // 年月日 + time,// 时分秒 + ] + return [...plc, ...gps].join(",") + } + + private sendReply(serialNumber: string, eventType: string, data?: string) { this.send(JSON.stringify({ serialNumber, eventType, uploadType: "2", - deviceNo: globalThis.deviceNo + deviceNo: globalThis.deviceNo, + data })) } private onMessage() { - this.instance.on("message", (err, event: string) => { + this.instance.on("message", async (err, event: string) => { const data = JSON.parse(event) as PlatformEvent; - console.log("websocket", event) + console.log(Tag, 'receive', event) switch (data.eventType) { case PlatFormEventType.RestartDevice: + try { + power.reboot("remote tools command") + this.sendReply(data.serialNumber, data.eventType, JSON.stringify({ + code: "200", + msg: "重启成功" + })) + } catch (e) { + this.sendReply(data.serialNumber, data.eventType, JSON.stringify({ + code: "500", + msg: e + })) + } break case PlatFormEventType.RestartApp: + let lastTime: number = await this.store.get('lastRestartTime', 0) as number + let now = new Date().getTime() + if (now - lastTime < 60 * 1000) { + this.sendReply(data.serialNumber, data.eventType, JSON.stringify({ + code: "500", + msg: "1分钟内只能重启一次!" + })) + } else { + await this.store.put('lastRestartTime', new Date().getTime()) + await this.store.put('serialNumber', data.serialNumber) + await this.store.flush() + appRecovery.restartApp() + setTimeout(async () => { + this.sendReply(data.serialNumber, PlatFormEventType.RestartApp, JSON.stringify({ + code: "500", + msg: "重启失败" + })) + await this.store.put('serialNumber', "") + await this.store.flush() + }, 2000) + } break case PlatFormEventType.UploadLogList: - this.onUploadLogList(data.serialNumber) + let date = JSON.parse(data.data).logDate + this.onUploadLogList(data.serialNumber, date) break case PlatFormEventType.UploadLog: - this.onUploadLogFile(data.serialNumber) + let fileName = JSON.parse(data.data).fileName + this.onUploadLogFile(data.serialNumber, fileName) break case PlatFormEventType.StartSync: this.isStart = true this.serialNumber = data.serialNumber this.sendReply(this.serialNumber, data.eventType) + await sleep(1000) this.sendRouter("", routerMap[router.getState().name]) - this.onStartCallback.forEach(cb => cb()) + await sleep(1000) + this.onStartCallback.forEach(item => { + if (item.page === routerMap[router.getState().name]) { + item.cb() + } + }) break case PlatFormEventType.StopSync: this.isStart = false @@ -127,32 +377,139 @@ export class RemoteToolWebsocket { console.warn("Unknown event type:", data.eventType); } }) + this.instance.on("close", async () => { + this.isStart = false + console.log(Tag, "close") + await this.init(this.url, this.context) + await this.register() + this.isStart = true + }) } private send(data: string) { return this.instance.send(data) .then(() => { - console.log(Tag, 'send success') + console.log(Tag, 'send success, data:', data) }) .catch((err) => { console.log(Tag, 'send error: ', JSON.stringify(err)) }) } - private onUploadLogList(serialNumber: string) { - + private onUploadLogList(serialNumber: string, time: string) { + console.log(Tag, serialNumber, time) + let year = time.split("-")[0] + let month = time.split("-")[1] + let date = time.split("-")[2] + let systemList = getSystemLogList(year, month, date) + let appList = getAppLogList(year, month, date) + let list = [...systemList, ...appList] + list.forEach(item => { + console.log(Tag, JSON.stringify(item)) + }) + this.send(JSON.stringify({ + serialNumber: serialNumber, + eventType: PlatFormEventType.UploadLogList, + uploadType: "2", + deviceNo: globalThis.deviceNo, + data: JSON.stringify({ + code: "200", + logList: list, + }) + })) } - private onUploadLogFile(serialNumber: string) { - + private onUploadLogFile(serialNumber: string, file: string) { + const reply = (error?: object | string) => { + this.send(JSON.stringify({ + serialNumber: serialNumber, + eventType: PlatFormEventType.UploadLog, + uploadType: "2", + deviceNo: globalThis.deviceNo, + data: JSON.stringify({ + code: error ? "500" : '200', + msg: error || undefined + }) + })) + } + try { + if (/hilog/.test(file)) { + fs.copyFileSync('/data/log/hilog/' + file, this.context.cacheDir + '/' + file) + zlib.compressFile(this.context.cacheDir + '/' + file, this.context.cacheDir + '/' + file + '.zip', { + level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION, + memLevel: zlib.MemLevel.MEM_LEVEL_DEFAULT, + strategy: zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY + }) + .then(() => { + return uploadFile(this.context, serialNumber, file + '.zip', 'zip') + }) + .then(() => { + reply() + }) + .catch((err) => { + reply(err) + }) + .finally(() => { + fs.unlinkSync(this.context.cacheDir + '/' + file) + fs.unlinkSync(this.context.cacheDir + '/' + file + '.zip') + }) + } else { + let tempDir = this.context.cacheDir + '/' + file + fs.mkdirSync(tempDir) + let date: string = file.substring(0, 10) + let path = AppLogDir + "/" + date + '/' + file + let list = fs.listFileSync(path) + list.forEach(name => { + fs.copyFileSync(path + '/' + name, tempDir + '/' + name) + }) + zlib.compressFile(tempDir, tempDir + '.zip', { + level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION, + memLevel: zlib.MemLevel.MEM_LEVEL_DEFAULT, + strategy: zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY + }) + .then(() => { + return uploadFile(this.context, serialNumber, file + '.zip', 'zip') + }) + .then(() => { + reply() + }) + .catch((err) => { + reply(err) + }) + .finally(() => { + fs.rmdirSync(this.context.cacheDir + '/' + file) + fs.unlinkSync(this.context.cacheDir + '/' + file + '.zip') + }) + } + } catch (err) { + this.send(JSON.stringify({ + serialNumber: serialNumber, + eventType: PlatFormEventType.UploadLogList, + uploadType: "2", + deviceNo: globalThis.deviceNo, + data: JSON.stringify({ + code: "500", + msg: err + }) + })) + console.log(Tag, JSON.stringify(err)) + } } - init(url: string) { + async init(url: string, context: common.UIAbilityContext) { + if (!this.store) { + try { + this.store = await preferences.getPreferences(context, "websocket") + } catch (e) { + console.log(Tag, JSON.stringify(e)) + } + } + this.context = context this.url = url this.instance = webSocket.createWebSocket() this.onMessage() return this.instance.connect(url).then(() => { - console.log(Tag, 'connect success') + console.log(Tag, 'connect success', 'address', this.url) this.reconnectCount = 0 }).catch((err) => { console.log(Tag, 'connect error: ', JSON.stringify(err)) @@ -162,15 +519,56 @@ export class RemoteToolWebsocket { message: "websocket connect failed" }) } else { - this.init(url) + this.init(url, context) } }) } - register() { + async register() { if (this.isRegister) { return } + + this.sendData({ + page: 20, + data: JSON.stringify({ + time: new Date().getTime().toString(), + signal: this.handleSignal(""), + error: '', + vehicle: globalThis.carInfo.kscx, + carId: globalThis.carInfo.plateNo + }) + }) + + setInterval(() => { + if (this.isStart && [11, 12].includes(routerMap[router.getState().name])) { + this.sendData({ + page: 20, + data: JSON.stringify({ + time: new Date().getTime().toString(), + signal: this.handleSignal(""), + error: '', + vehicle: globalThis.carInfo.kscx, + carId: globalThis.carInfo.plateNo + }) + }) + } + }, 2000) + + globalThis.udpClient.onMessage_1(async (msg: string) => { + if (this.isStart) { + this.sendData({ + page: 20, + data: JSON.stringify({ + time: new Date().getTime().toString(), + signal: this.handleSignal(msg), + error: '', + vehicle: globalThis.carInfo.kscx, + carId: globalThis.carInfo.plateNo + }) + }) + } + }); return this.send(JSON.stringify({ serialNumber: this.serialNumber, eventType: PlatFormEventType.DeviceRegister, @@ -182,10 +580,25 @@ export class RemoteToolWebsocket { plateNo: globalThis.carInfo.plateNo, vehicleKind: globalThis.carInfo.kscx }) - })) + })).then(async () => { + + let lastSerialNumber = await this.store.get('serialNumber', "") as string + if (lastSerialNumber) { + this.sendReply(lastSerialNumber, PlatFormEventType.RestartApp, JSON.stringify({ + code: "200", + msg: "重启成功" + })) + await this.store.put('serialNumber', "") + await this.store.flush() + } + this.isRegister = true + }) } sendData(data: T) { + if (!this.isStart) { + return Promise.resolve() + } return this.send(JSON.stringify({ serialNumber: this.serialNumber, eventType: PlatFormEventType.SyncData, @@ -199,6 +612,9 @@ export class RemoteToolWebsocket { } sendRouter(from: string, to: string) { + if (!this.isStart) { + return Promise.resolve() + } return this.send(JSON.stringify({ serialNumber: this.serialNumber, eventType: PlatFormEventType.SyncData, @@ -214,11 +630,14 @@ export class RemoteToolWebsocket { })) } - onStart(cb: () => void) { - this.onStartCallback.push(cb) + onStart(cb: () => void, page: number) { + this.onStartCallback.push({ + page, + cb + }) } - offStart(cb: () => void) { - this.onStartCallback = this.onStartCallback.filter(item => item != cb) + offStart(page: number) { + this.onStartCallback = this.onStartCallback.filter(item => item.page != page) } } \ No newline at end of file diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 4bc1badd..0ab6c2d7 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -1,19 +1,21 @@ import UIAbility from '@ohos.app.ability.UIAbility'; import hilog from '@ohos.hilog'; import window from '@ohos.window'; -import relationalStore from '@ohos.data.relationalStore' -import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; -// import featureAbility from '@ohos.ability.featureAbility' import { makedir } from '../common/service/fileService' import { Array2Byte } from '../common/utils/tools' import { GlobalConfig } from '../config/global' -import { tcpUtil } from '../common/utils/TcpRequest'; import DB from '../common/database/DbSql'; import { initTable } from '../common/service/initable'; import { RemoteToolWebsocket } from '../common/utils/RemotetoolWebsocket'; +import appRecovery from '@ohos.app.ability.appRecovery'; export default class EntryAbility extends UIAbility { async onCreate(want, launchParam) { + appRecovery.enableAppRecovery( + appRecovery.RestartFlag.ALWAYS_RESTART, + appRecovery.SaveOccasionFlag.SAVE_WHEN_ERROR, + appRecovery.SaveModeFlag.SAVE_WITH_FILE + ); try { console.log("sql first") await DB.init(this.context) @@ -35,17 +37,13 @@ export default class EntryAbility extends UIAbility { } async onWindowStageCreate(windowStage: window.WindowStage) { - // this.context - // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - new RemoteToolWebsocket().init("ws://88.22.20.30:1989/sig/v1") + globalThis.carInfo = {} globalThis.examinerInfo = {} globalThis.deviceNo = ''; globalThis.hasAuth = false - // globalThis.judgeVersion ='2024.08.24.1' - // globalThis.version ='2023.12.13.01'; globalThis.version = GlobalConfig.version.wx.km2[0]; globalThis.judgeVersion = GlobalConfig.version.wx.km2[1]; globalThis.tcpSendNum = 0 @@ -76,28 +74,26 @@ export default class EntryAbility extends UIAbility { hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } + new RemoteToolWebsocket().init("ws://88.22.20.30:1989/sig/v1", this.context) hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); }); - this.creatFiles(); + this.createFiles(); } onWindowStageDestroy() { - // Main window is destroyed, release UI related resources hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); } onForeground() { - // Ability has brought to foreground hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); } onBackground() { - // Ability has back to background hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); } - creatFiles() { + createFiles() { makedir('/testFile'); } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 860ec62a..c3161c39 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -5,7 +5,6 @@ import { setCurrentTime } from '../common/service/timeService'; import { getCurrentTime, string2Bytes } from '../common/utils/tools'; import { FileHelper } from '../common/service/FileHelper'; import { getEsCarModel, getSyncData, } from '../common/service/initable'; -import FileUtil from '../common/utils/File'; import { getUDP, getUDP2 } from '../common/utils/GlobalUdp'; import { initJudgeUdp } from '../common/utils/UdpJudge'; import { judgeConfig } from './judgeSDK/utils/judgeConfig'; @@ -20,11 +19,8 @@ import { delPic } from '../common/service/videoService'; import imageBtn from './compontents/imageBtn'; import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; import { updateModelAndCar } from '../common/autoUpdate/index' -// import {uploadLogFile} from '../common/service/indexService' -import { getModalValueCdAndCar } from '../api'; import { RemoteToolWebsocket } from '../common/utils/RemotetoolWebsocket'; -// import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; @Entry @Component @@ -61,12 +57,10 @@ struct Index { alignment: DialogAlignment.Center, }, ) - private fileUtil: FileUtil private interval = null; - // private vocObj = null; private avPlayer - private workerInstance = null; private context = getContext(this) as common.UIAbilityContext; + private remoteToolWebsocket: RemoteToolWebsocket = new RemoteToolWebsocket() @Styles commStyle(){ @@ -74,7 +68,6 @@ struct Index { .height(69 * this.ratio * this.dialogRatio) .backgroundImage($r('app.media.button_nor')) .backgroundImageSize({ width: '100%', height: '100%' }) - // .margin({ bottom: 12 * this.ratio }) } build() { @@ -110,14 +103,9 @@ struct Index { imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_lw') }) .margin({ left: 80 * globalThis.ratio }) .onClick(async () => { - // this.vocObj.playAudio({ - // type: 1, - // name: 'button_media.wav' - // }) - // ||!this.initParamFlag + if (this.loading) { - // globalThis.title = '正在初始化,请等待5s后重试' - // this.errorDialog.open() + return } setTimeout(() => { @@ -157,10 +145,7 @@ struct Index { if (this.loading) { return } - // this.vocObj.playAudio({ - // type: 1, - // name: 'button_media.wav' - // }) + if (judgeConfig.isTrajectoryOpen) { router.pushUrl({ url: 'pages/UserInfo', @@ -171,6 +156,7 @@ struct Index { getSyncData('MA_SYSSET').then(data => { console.log('datadata', JSON.stringify(data)) if (data?.[0]) { + this.remoteToolWebsocket.sendRouter("1", "9") router.pushUrl({ url: 'pages/UserInfo', }, router.RouterMode.Single) @@ -186,10 +172,7 @@ struct Index { if (this.loading) { return } - // this.vocObj.playAudio({ - // type: 1, - // name: 'button_media.wav' - // }) + router.pushUrl({ url: 'pages/CarCheck' }, router.RouterMode.Single); @@ -212,11 +195,7 @@ struct Index { .fontSize(18 * globalThis.ratio) .width('30%') .margin({ bottom: 10 }) - // Text('V 1.0') - // .fontColor('#CCAE7A') - // .fontSize(22 * globalThis.ratio) - // .width('30%') - // .margin({ bottom: 10 }) + Text('授权信息:' + (this.hasAuth ? '已授权' : '未授权')) .fontColor('#CCAE7A') .fontSize(18 * globalThis.ratio) @@ -261,10 +240,7 @@ struct Index { .commStyle() .onClick(() => { this.dialogVisiable = false - // this.vocObj.playAudio({ - // type: 1, - // name: 'button_media.wav' - // }) + }).margin({ right: 10 * this.ratio }) Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { @@ -275,11 +251,7 @@ struct Index { } .commStyle() .onClick(() => { - // this.vocObj.playAudio({ - // type: 1, - // name: 'button_media.wav' - // }) - router.back() + this.context.terminateSelf() }) }.position({ y: 265 * this.ratio * this.dialogRatio, x: 115 * this.ratio * this.dialogRatio }) @@ -380,11 +352,9 @@ struct Index { //判断是否能点开始考试 if (sys.v_no === '305') { console.log('syssyssyssys') - // this.delLoading=true - // globalThis.param854Str=sys.v_value + delPic(Number(sys.v_value), 1) delPic(Number(sys.v_value), 2) - // this.delLoading=false } }) @@ -400,9 +370,7 @@ struct Index { if (this.loading) { return } - // let mode=globalThis.timeInfo?.mode?globalThis.timeInfo?.mode:1 - // console.log('mode',mode) const param = { carId: globalThis.carInfo?.carId, @@ -438,23 +406,10 @@ struct Index { this.loadingText = '正在安装考车最新版本,请稍候……' return false } - // DB.queryListBySql('select * from MA_SYSSET', [{ - // name: "v_no", - // type: ColumnType.STRING, - // columnName: "v_no" - // }]).then((res) => { - // console.log('sql success', JSON.stringify(res)) - // }).catch((err) => { - // console.log('sql error1', err) - // }) + if (ret) { if (globalThis.singlePlay) { - router.pushUrl({ - url: 'pages/userInfo' - }, router.RouterMode.Single) - return - } - if (globalThis.singlePlay) { + this.remoteToolWebsocket.sendRouter("1", "9") router.pushUrl({ url: 'pages/UserInfo', }, router.RouterMode.Single) @@ -486,47 +441,6 @@ struct Index { } }) - // workerInstance.postMessage(param); - // workerInstance.onmessage = (e: MessageEvents): void => { - // console.log("baoyihu after postMessage :", JSON.stringify(e.data)); - // // @ts-ignore - // let workData: WorkData = e.data; - // this.loading = false - // if (workData.isComplete) { - // if(globalThis.singlePlay){ - // router.pushUrl({ - // url: 'pages/UserInfo', - // }, router.RouterMode.Single) - // return - // } - // getSyncData('MA_SYSSET').then(data => { - // console.log('datadata', JSON.stringify(data)) - // // @ts-ignore - // data.forEach(sys => { - // //判断是否能点开始考试 - // if(sys.v_no === '854'){ - // globalThis.param854Str=sys.v_value - // } - // if (sys.v_no === '824'&&decodeURIComponent(sys.v_value)=='0') { - // // this.Param612Str= decodeURIComponent(sys.v_value) - // router.pushUrl({ - // url:'pages/CarCheck', - // params: { - // 'fromIndex':true - // } - // }, router.RouterMode.Single) - // }else{ - // router.pushUrl({ - // url: 'pages/ExaminerLogin', - // }, router.RouterMode.Single) - // } - // }) - // }); - // - // } - // workerInstance.terminate(); - // - // } } async heartMsg() { @@ -556,17 +470,10 @@ struct Index { await this.userAuth(); console.log('globalThis.singlePlay', globalThis.singlePlay) if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { - // setVideoParam() console.log('diyidiy') this.context.resourceManager.getRawFileContent("welcome.wav") .then(value => { this.avPlayer.playAudio(['welcome.wav']) - - // this.vocObj.playAudio({ - // type: 1, - // name: 'welcome.wav' - // }) - // let rawFile = value; }) .catch(error => { console.log("getRawFileContent promise error is " + error); @@ -575,9 +482,7 @@ struct Index { globalThis.singlePlay = false } this.isSingle = globalThis.singlePlay - // this.loading = false this.num = 0 - // const TcpClient: TcpClient =new TcpClient(result[0].tcplocalIp, result[0].tcplocalIpPort,result[0].tcpOppositeIp,result[0].tcpOppositePort) globalThis.lsh = '1111111111111' } @@ -587,7 +492,6 @@ struct Index { const time = await getCurrentTime() const date = time.split(' ')[0] this.fileHelper.createAlbum('jt') - // this.fileHelper.createAlbum('2025-01-02') this.fileHelper.createAlbum('pz'); this.fileHelper.createAlbum(date); @@ -628,7 +532,7 @@ struct Index { await getDeviceInfo(this.context) await getCarInfo() - new RemoteToolWebsocket().register() + this.remoteToolWebsocket.register() await getUDP2(this.context, false) getTCP() this.deviceId = globalThis.carInfo.carNo diff --git a/entry/src/main/ets/pages/Judge.ets b/entry/src/main/ets/pages/Judge.ets index 19cb4f76..9a7fed55 100644 --- a/entry/src/main/ets/pages/Judge.ets +++ b/entry/src/main/ets/pages/Judge.ets @@ -9,7 +9,6 @@ import Judge from './judgeSDK/judge'; import { defaultJudgeConfigObj } from './judgeSDK/utils//judgeCommon'; import { uploadExamMileage } from '../api/judge' import DwztErrorPopup from './compontents/judge/DwztErrorPopup' -import { debounce } from '../common/utils/tools' import MsgPopup from './compontents/judge/MsgPopup' import { @@ -26,25 +25,64 @@ import { } from './judgeSDK/api/judgeSDK.d'; import { chunkArr, formatTime, getCurrentHourTime, getCurrentTime } from '../common/utils/tools'; -import { examJudgeEndExam } from './judgeSDK/api/index'; import { getSyncData } from '../common/service/initable'; import { judgeConfig } from './judgeSDK/utils/judgeConfig'; import FileUtil from '../common/utils/File'; import SignDisplayCom from './compontents/signDisplayCom'; -import promptAction from '@ohos.promptAction'; -import { voiceService } from '../common/service/voiceService'; +import { DataParams, RemoteToolWebsocket } from '../common/utils/RemotetoolWebsocket'; @Entry @Component struct Index { + @State @Watch('syncData') currentList: string[] = [] + @State @Watch('syncData') timestamp: number = 0 + private remoteToolWebsocket: RemoteToolWebsocket = new RemoteToolWebsocket() + private syncToolData = () => { + this.syncData() + } + + syncData() { + if (this.remoteToolWebsocket.isStart) { + this.remoteToolWebsocket.sendData({ + page: 11, + data: JSON.stringify({ + user: { + name: this.name, // 姓名 + idCard: this.idCard, // 身份证 + subject: this.examSubject, // 科目 + examCount: this.kssycs, // 剩余考试次数 + }, + projects: this.projects.map(item => ({ + code: item.projectCode, + status: item.type + })), + deduction: this.kfArr.map(item => ({ + code: item.markcatalog + })), + exam: { + startTime: this.timestamp.toString(), // 开始时间 + examLine: this.wayno, // 考试线路 + examMile: `${this.jl},${this.examMileage}`, // 考试里程 已行驶,应行驶 + score: this.totalScore, // 当前分数 + }, + deducted: this.isDeductedPopShow ? 1 : 0, + deductionList: this.currentList.map(item => ({ code: item })), // 扣分列表 + error: '', + }) + }) + } + } + async aboutToDisappear() { + this.remoteToolWebsocket.offStart(11) clearInterval(this.mileageTimer) } async aboutToAppear() { + this.remoteToolWebsocket.onStart(this.syncToolData, 11) globalThis.windowClass.setWindowSystemBarEnable([]) const time = await getCurrentTime() - + this.timestamp = new Date(time).getTime() this.startTime = time.split(' ')[1] this.startFullTime = await getCurrentTime(1); this.startHourTime = await getCurrentHourTime() @@ -961,6 +999,9 @@ struct Index { this.isDeductedPopShow = false this.popTimer = null; }, 500) + }, + onListChange: (list: string[]) => { + this.currentList = list } }) } @@ -982,10 +1023,6 @@ struct Index { .backgroundImage($rawfile('judge/close.png'), ImageRepeat.NoRepeat) .backgroundImageSize({ width: '33.33%', height: '33.33%' }) .onClick(() => { - // this.vocObj.playAudio({ - // type: 1, - // name: 'button_media.wav' - // }) this.signDisplayComVisible = false }) }.width('100%').height('100%').position({ y: 0 }).backgroundColor('rgba(0,0,0,0.6)') @@ -1331,7 +1368,7 @@ struct Index { } scroller: Scroller = new Scroller() //页面通用字体大小 - @State wayno: number = 0 + @State @Watch('syncData') wayno: number = 0 @State FONTSIZE: number = 30 @State BIGFONTSIZE: number = 32 //结束考试弹窗 @@ -1345,29 +1382,29 @@ struct Index { //考试用时 @State examTime: number = 0 //开始时间 - @State startTime: string = '00:00:00' + @State @Watch('syncData') startTime: string = '00:00:00' @State startFullTime: string = '' @State startHourTime: string = '' @State startExamTime: string = '' //科目类型 - @State examSubject: 2 | 3 = 3; + @State @Watch('syncData') examSubject: 2 | 3 = 3; @State ddxkTime: number = 0; @State ddxkKsxmArr: string[] = [] @State ddxkKfArr: string[] = [] @State xmmcStr: string = '' @State carztStr: string = '' - @State kfArr: { + @State @Watch('syncData') kfArr: { xmmcStr?: string, score: string, desc: string markcatalog: string }[] = [] - @State name: string = '' - @State idCard: string = '' + @State @Watch('syncData') name: string = '' + @State @Watch('syncData') idCard: string = '' @State singlePlay: boolean = false; - @State totalScore: number = 100 + @State @Watch('syncData') totalScore: number = 100 //模拟考试项目 - @State projects: Project[] = [] + @State @Watch('syncData') projects: Project[] = [] @State projectsObj: ProjectObj = {} @State projectsCenterObj: ProjectObj = {} @State markRuleListObj: MarkRule = {} @@ -1380,8 +1417,8 @@ struct Index { @State lsh: string = '' @State kszp: string = '' @State ksdd: string = '' - @State kssycs: string = '' - @State ksxl: string = '' + @State @Watch('syncData') kssycs: string = '' + @State @Watch('syncData') ksxl: string = '' @State kslx: string = '' //监管线路代码 @State xldm: string = '' @@ -1394,14 +1431,14 @@ struct Index { @State syssetParam386ET3: boolean = false; @State carType: string = '' @State carName: string = '' - @State isDeductedPopShow: boolean = false + @State @Watch('syncData') isDeductedPopShow: boolean = false @State isAmplifyPopShow: boolean = false @State amplifiedImgIndex: number = 0 @State judge: any = {} //行驶距离 - @State jl: number = 0 + @State @Watch('syncData') jl: number = 0 //应考里程 - @State examMileage: string = '0' + @State @Watch('syncData') examMileage: string = '0' @State artSubject3Projects: string[] = ['直线', '会车', '变道', '超车', '掉头', '停车'] @State artSubject3ProjectsCodesArr: string[] = ['3', '9', '4', '10', '12', '11'] @State manualMarkRules: MarkRule[] = [] diff --git a/entry/src/main/ets/pages/Roads.ets b/entry/src/main/ets/pages/Roads.ets index 2db60a05..e476b2bd 100644 --- a/entry/src/main/ets/pages/Roads.ets +++ b/entry/src/main/ets/pages/Roads.ets @@ -3,6 +3,7 @@ import MA_SYSTEMPARM from '../common/constants/MA_SYSTEMPARM'; import AccountTable from '../common/database/tables/AccountTable'; import { getSyncData } from '../common/service/initable'; import router from '@ohos.router'; +import { RemoteToolWebsocket } from '../common/utils/RemotetoolWebsocket'; const cBg = $rawfile('judge/km3/road/luxian_pre.png'); const lBg = $rawfile('judge/km3/road/luxian_nor.png'); @@ -15,6 +16,7 @@ const ltBg = $rawfile('judge/km3/road/luxian_nor.png'); export default struct Index { @State @Watch('outClick') outFlag: boolean = false; @State roadObj: any = {} + private remoteToolWebsocket: RemoteToolWebsocket = new RemoteToolWebsocket() async aboutToAppear() { //读取systemparam表的no1等于4的 @@ -32,7 +34,7 @@ export default struct Index { build() { Column() { TopLogo({ outFlag: $outFlag }) - Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row,justifyContent:FlexAlign.Start}){ + Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row, justifyContent: FlexAlign.Start }) { List({}) { ListItem() { Column() { @@ -56,9 +58,10 @@ export default struct Index { const roadArr = Reflect.ownKeys(this.roadObj).map((roadKey) => { return this.roadObj[roadKey] }); - const wayno = roadArr[Math.floor(Math.random()*roadArr.length)]; + const wayno = roadArr[Math.floor(Math.random() * roadArr.length)]; this.goJudge(wayno) }) + ForEach(Reflect.ownKeys(this.roadObj), (roadIndex) => { ListItem() { Column() { @@ -68,6 +71,7 @@ export default struct Index { .backgroundImageSize({ width: '100%', height: '100%' }) .width(90) .height(80) + Text(`线路${this.roadObj[roadIndex] + ''}`) { }.fontColor('#FFF2D9').fontSize(24).padding({ top: 10 }) } @@ -92,15 +96,17 @@ export default struct Index { goJudge(wayno) { let currentParams: any = router.getParams() || {}; const {sczb,kfdm} = currentParams; + this.remoteToolWebsocket.sendRouter("10", "11") router.replaceUrl({ url: 'pages/Judge', - params:{ + params: { sczb, kfdm, wayno, } - }, router.RouterMode.Single); - + }, router.RouterMode.Single) + } + + outClick() { } - outClick(){} } \ No newline at end of file diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 2b720b0a..ab61aa23 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -126,15 +126,15 @@ struct UserInfo { const {examSubject} = globalThis.carInfo; this.currentUser.id = '0' await upDateTableByArray('USER', [this.currentUser]) + this.remoteToolWebsocket.sendRouter("9", examSubject == 3 ? '10' : '11') router.pushUrl({ url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge', params: { sczb: Number(this.isBoardPrePareSetPopupOpen), kfdm: this.sczbkf, } - }, router.RouterMode.Single); + }, router.RouterMode.Single) this.ksksLimit = false - this.stopDeviceById() return } @@ -187,14 +187,17 @@ struct UserInfo { ] private fileUtil: FileUtil private remoteToolWebsocket: RemoteToolWebsocket = new RemoteToolWebsocket() + private syncToolData = () => { + this.syncData() + } syncData() { if (this.remoteToolWebsocket.isStart) { this.remoteToolWebsocket.sendData({ - page: "9", + page: 9, data: JSON.stringify({ select: this.select, - students: this.dataList.map(item => ({ + student: this.dataList.map(item => ({ id: item.lsh, name: item.xm, idCard: item.sfzmhm, @@ -211,12 +214,12 @@ struct UserInfo { aboutToAppear() { this.fileUtil = new FileUtil(this.context) this.avPlayer = new VoiceAnnounce(); - this.remoteToolWebsocket.onStart(this.syncData) + this.remoteToolWebsocket.onStart(this.syncToolData, 9) } aboutToDisappear() { this.outClick() - this.remoteToolWebsocket.offStart(this.syncData) + this.remoteToolWebsocket.offStart(9) } async onPageShow() { @@ -939,8 +942,6 @@ struct UserInfo { console.info('surenjun', '播放结束开始考试接口调用') const {code,keystr,message} = await this.beginExam() || {}; console.info('surenjun', '开始考试接口调用结束') - // console.info('surenjun',code +'') - //@ts-ignore TODO code转换 if (code != 1) { avPlayer.playAudio([code == -200 ? 'voice/photo_error.mp3' : 'voice/监管审核未通过.mp3']); @@ -956,6 +957,7 @@ struct UserInfo { await upDateTableByArray('USER', [this.currentUser]) this.stepFlag = false this.isLoadingPopupVisible = false + this.remoteToolWebsocket.sendRouter("9", "11") router.pushUrl({ url: 'pages/Judge', params: { @@ -965,7 +967,7 @@ struct UserInfo { //真实监管项目 kString: decodeURIComponent(keystr || '') } - }, router.RouterMode.Single); + }, router.RouterMode.Single) this.updateTimeLimit = false this.stopDeviceById() this.stepFlag = false @@ -1080,11 +1082,11 @@ struct UserInfo { // 开始考试 async beginExam() { const carInfo = globalThis.carInfo; - const {carId,examinationRoomId} = carInfo; const { examSubject,plateNo } = carInfo; const date = new Date() globalThis.startHourTime = await getCurrentHourTime() - const photoBase64 = await this.getPhoto(); + // const photoBase64 = await this.getPhoto(); + const photoBase64: string = 'data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABB2lDQ1BJQ0MgUHJvZmlsZQAAKM9jYGA8wQAELAYMDLl5JUVB7k4KEZFRCuwPGBiBEAwSk4sLGHADoKpv1yBqL+sykA44U1KLk4H0ByBWKQJaDjRSBMgWSYewNUDsJAjbBsQuLykoAbIDQOyikCBnIDsFyNZIR2InIbGTC4pA6nuAbJvcnNJkhLsZeFLzQoOBNAcQyzAUMwQxuDM4gfwPUZK/iIHB4isDA/MEhFjSTAaG7a0MDBK3EGIqCxgY+FsYGLadR4ghwqQgsSgRLMQCxExpaQwMn5YzMPBGMjAIX2Bg4IqGBQQOtymA3ebOkA+E6Qw5DKlAEU+GPIZkBj0gy4jBgMGQwQwAptY/P1N/5B4AAAAJcEhZcwAADsIAAA7CARUoSoAAAABHdEVYdENvbW1lbnQAeyJzaGExIjoiOWU0ODg3NzY3MzRlODljY2RmNmU3ZGM1ZTQyZjQ1NmFhZTg4OTVlOCIsImV4dCI6InBuZyJ9fFoHZQAAAuVpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0n77u/JyBpZD0nVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkJz8+DQo8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIj48cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPjxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSJ1dWlkOmZhZjViZGQ1LWJhM2QtMTFkYS1hZDMxLWQzM2Q3NTE4MmYxYiIgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPjxleGlmOlVzZXJDb21tZW50PjxyZGY6QWx0IHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+PHJkZjpsaSB4bWw6bGFuZz0ieC1kZWZhdWx0Ij57InNoYTEiOiI5ZTQ4ODc3NjczNGU4OWNjZGY2ZTdkYzVlNDJmNDU2YWFlODg5NWU4IiwiZXh0IjoicG5nIn08L3JkZjpsaT48L3JkZjpBbHQ+DQoJCQk8L2V4aWY6VXNlckNvbW1lbnQ+PC9yZGY6RGVzY3JpcHRpb24+PHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9InV1aWQ6ZmFmNWJkZDUtYmEzZC0xMWRhLWFkMzEtZDMzZDc1MTgyZjFiIiB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyI+PGV4aWY6TGlnaHRTb3VyY2U+MDwvZXhpZjpMaWdodFNvdXJjZT48L3JkZjpEZXNjcmlwdGlvbj48L3JkZjpSREY+PC94OnhtcG1ldGE+DQo8P3hwYWNrZXQgZW5kPSd3Jz8+W4OfQgAAAE9JREFUOE9j1JE1+M9ARcCELkApGDWQcjAkDGSCmksuxjCQumDUQMrBYDPwH7oAA1I6JAT+YcFQwPifgZGJgYERahplgBG1fKbcQDRAdQMBlzoJvmxg6wkAAAAASUVORK5CYII='; if (photoBase64 == '') { this.ksksLimit = false this.isLoadingPopupVisible = false diff --git a/entry/src/main/ets/pages/compontents/judge/DeductionPopup.ets b/entry/src/main/ets/pages/compontents/judge/DeductionPopup.ets index 972746ea..a1295a90 100644 --- a/entry/src/main/ets/pages/compontents/judge/DeductionPopup.ets +++ b/entry/src/main/ets/pages/compontents/judge/DeductionPopup.ets @@ -1,175 +1,233 @@ -import {MarkRule} from '../../judgeSDK/api/judgeSDK' +import { MarkRule } from '../../judgeSDK/api/judgeSDK' import EndPoPup from './EndPopup'; -interface SEL{ - fontColor:string - bgColor:string +interface SEL { + fontColor: string + bgColor: string } @Component -export default struct DeductedPopup { +export default struct DeductedPopup { constructor() { super() } - @State fontSize:number = 30 - @State unselected:SEL = {fontColor:'#000000', bgColor:'#CCC4B8'} - @State selected:SEL = {fontColor:'#FFAD33', bgColor:'#26231E'} - - @State currentIndex:number = 0 - @State currentPageIndex:number = 0 + @State fontSize: number = 30 + @State unselected: SEL = { fontColor: '#000000', bgColor: '#CCC4B8' } + @State selected: SEL = { fontColor: '#FFAD33', bgColor: '#26231E' } + @State currentIndex: number = 0 + @State currentPageIndex: number = 0 //通用评判扣分 - @State currentUniversalPageIndex:number = 0; - private markRules:MarkRule[] = [] - @State universalMarkRules:MarkRule[] = [] - @State manualMarkRules:MarkRule[] = [] - @State lineBg:Array = ['#4D4136','#26231E'] - @State selectedLine:number = undefined - @State endPopupVisible:boolean = false - private closePopup:Function = ()=> {} - private confirmMark:Function = (itemno:number,serial:string) => {} - @State selectedLineStyle:SEL = { - fontColor:'#FFF', - bgColor:'#B36E00' + @State currentUniversalPageIndex: number = 0; + private markRules: MarkRule[] = [] + @State universalMarkRules: MarkRule[] = [] + @State manualMarkRules: MarkRule[] = [] + @State lineBg: Array = ['#4D4136', '#26231E'] + @State selectedLine: number = undefined + @State endPopupVisible: boolean = false + private closePopup: Function = () => { } + private confirmMark: Function = (itemno: number, serial: string) => { + } + @State selectedLineStyle: SEL = { + fontColor: '#FFF', + bgColor: '#B36E00' + } + @Prop defaultTabIndex: number = 0 + @Prop @Watch('changeCurrentItems') currentItems: string[] = []; + @State preCurrentItemsLength: number = 0 + onListChange?: (list: string[]) => void - @Prop defaultTabIndex:number = 0 - @Prop @Watch('changeCurrentItems') currentItems:string[] = []; - @State preCurrentItemsLength:number = 0 - - aboutToAppear(){ + aboutToAppear() { //@ts-ignore this.universalMarkRules = this.markRules.filter(item => (this.currentItems.includes(item.itemno) || this.currentItems.includes(item.itemno + ''))); this.currentIndex = this.defaultTabIndex - if(this.currentIndex == 1){ - this.universalMarkRules = this.markRules.filter(item => item.itemno == 20 ) + if (this.currentIndex == 1) { + this.universalMarkRules = this.markRules.filter(item => item.itemno == 20) } this.preCurrentItemsLength = this.currentItems.length } - changeCurrentItems(){ - if(this.currentItems?.length && (this.currentItems?.length >= this.preCurrentItemsLength)){ + changeCurrentItems() { + if (this.currentItems?.length && (this.currentItems?.length >= this.preCurrentItemsLength)) { //@ts-ignore this.universalMarkRules = this.markRules.filter(item => (this.currentItems.includes(item.itemno) || this.currentItems.includes(item.itemno + ''))); this.currentIndex = this.defaultTabIndex - if(this.currentIndex == 1){ - this.universalMarkRules = this.markRules.filter(item => item.itemno == 20 ) + if (this.currentIndex == 1) { + this.universalMarkRules = this.markRules.filter(item => item.itemno == 20) } this.preCurrentItemsLength = this.currentItems.length - }else{ + } else { this.preCurrentItemsLength = 0 } } //上一页 下一页 - goPage(typeIndex){ + goPage(typeIndex) { const currentIndex = this.currentIndex - if(currentIndex){ + if (currentIndex) { //通用评判 typeIndex ? (this.currentUniversalPageIndex += 1) : (this.currentUniversalPageIndex -= 1) - }else{ + } else { typeIndex ? (this.currentPageIndex += 1) : (this.currentPageIndex -= 1) } this.selectedLine = -1 } //选中扣分项 - getSelectedLine(index){ + getSelectedLine(index) { const {selectedLine,selectedLineStyle,lineBg} = this; - if(selectedLine === index){ + if (selectedLine === index) { return selectedLineStyle.bgColor } - if(index % 2 === 0){ + if (index % 2 === 0) { return lineBg[0] - }else{ + } else { return lineBg[1] } } //获取当前页的数据 - getCurrentMarkRuleList(){ + getCurrentMarkRuleList() { const {currentIndex,currentUniversalPageIndex,currentPageIndex,markRules,universalMarkRules} = this; - if(currentIndex){ + if (currentIndex) { + this.onListChange(universalMarkRules.slice(currentUniversalPageIndex * 7, (currentUniversalPageIndex + 1) * 7) + .map(item => item.markcatalog)) //通用评判 - return universalMarkRules.slice(currentUniversalPageIndex*7,(currentUniversalPageIndex + 1)*7) - }else{ - return universalMarkRules.slice(currentPageIndex*7,(currentPageIndex + 1)*7) + return universalMarkRules.slice(currentUniversalPageIndex * 7, (currentUniversalPageIndex + 1) * 7) + } else { + this.onListChange(universalMarkRules.slice(currentPageIndex * 7, (currentPageIndex + 1) * 7) + .map(item => item.markcatalog)) + return universalMarkRules.slice(currentPageIndex * 7, (currentPageIndex + 1) * 7) } } - build(){ - Column(){ - Column(){ - Column(){ - Row(){ - Row(){ - ForEach(['人工评判','通用评判'],(text,index)=>{ - Row(){ - Text(text).fontColor(index === this.currentIndex ? this.selected.fontColor : this.unselected.fontColor).fontSize(this.fontSize).fontWeight(500) + build() { + Column() { + Column() { + Column() { + Row() { + Row() { + ForEach(['人工评判', '通用评判'], (text, index) => { + Row() { + Text(text) + .fontColor(index === this.currentIndex ? this.selected.fontColor : this.unselected.fontColor) + .fontSize(this.fontSize) + .fontWeight(500) } - .width(140).height(60) - .backgroundColor(index === this.currentIndex ? this.selected.bgColor: this.unselected.bgColor ).justifyContent(FlexAlign.Center).justifyContent(FlexAlign.Center) - .borderRadius({topLeft:20,topRight:20}).margin({right:10}) - .onClick(()=>{ + .width(140) + .height(60) + .backgroundColor(index === this.currentIndex ? this.selected.bgColor : this.unselected.bgColor) + .justifyContent(FlexAlign.Center) + .justifyContent(FlexAlign.Center) + .borderRadius({ topLeft: 20, topRight: 20 }) + .margin({ right: 10 }) + .onClick(() => { this.currentIndex = index; this.selectedLine = -1; - if(index === 1) { - this.universalMarkRules = this.markRules.filter(item => item.itemno == 20 ) - }else{ + if (index === 1) { + this.universalMarkRules = this.markRules.filter(item => item.itemno == 20) + } else { //@ts-ignore - this.universalMarkRules = this.markRules.filter(item => (this.currentItems.includes(item.itemno) || this.currentItems.includes(item.itemno+''))) + this.universalMarkRules = this.markRules.filter(item => (this.currentItems.includes(item.itemno) || this.currentItems.includes(item.itemno + ''))) } }) }) } - Row(){ - if( - (Math.ceil(this.universalMarkRules.length / 7 - 1)) >= (this.currentIndex ? this.currentUniversalPageIndex: this.currentPageIndex) && - (this.currentIndex ? this.currentUniversalPageIndex: this.currentPageIndex) > 0 - ){ - Row(){ - Image($rawfile(`judge/km3/zuo_nor.png`)).height(15).margin({left:20,top:0}) - Text('上一页'){}.fontColor('#FFF').fontSize(this.fontSize) - }.width(150).height(60).justifyContent(FlexAlign.Start).alignItems(VerticalAlign.Center).backgroundImage($rawfile(`judge/km3/button_nor.png`)).backgroundImageSize({width:'100%',height:'100%'}).margin({right:30}) - .onClick(()=>{this.goPage(0)}) + + Row() { + if ( + (Math.ceil(this.universalMarkRules.length / 7 - 1)) >= (this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex) && + (this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex) > 0 + ) { + Row() { + Image($rawfile(`judge/km3/zuo_nor.png`)).height(15).margin({ left: 20, top: 0 }) + Text('上一页') { + }.fontColor('#FFF').fontSize(this.fontSize) + } + .width(150) + .height(60) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .backgroundImage($rawfile(`judge/km3/button_nor.png`)) + .backgroundImageSize({ width: '100%', height: '100%' }) + .margin({ right: 30 }) + .onClick(() => { + this.goPage(0) + }) } - if( - (Math.ceil(this.universalMarkRules.length / 7 - 1)) > (this.currentIndex ? this.currentUniversalPageIndex: this.currentPageIndex) - ){ - Row(){ - Text('下一页'){}.fontColor('#FFF').fontSize(this.fontSize).padding({left:30}) - Image($rawfile(`judge/km3/you_nor.png`)).height(15).margin({right:6,top:0}) - }.width(150).height(60).justifyContent(FlexAlign.Start).alignItems(VerticalAlign.Center).backgroundImage($rawfile(`judge/km3/button_nor.png`)).backgroundImageSize({width:'100%',height:'100%'}).margin({right:30}) - .onClick(()=>{this.goPage(1)}) + if ( + (Math.ceil(this.universalMarkRules.length / 7 - 1)) > (this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex) + ) { + Row() { + Text('下一页') { + }.fontColor('#FFF').fontSize(this.fontSize).padding({ left: 30 }) + + Image($rawfile(`judge/km3/you_nor.png`)).height(15).margin({ right: 6, top: 0 }) + } + .width(150) + .height(60) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .backgroundImage($rawfile(`judge/km3/button_nor.png`)) + .backgroundImageSize({ width: '100%', height: '100%' }) + .margin({ right: 30 }) + .onClick(() => { + this.goPage(1) + }) } - Row(){ - Text('扣 分'){}.fontColor('#FFF').fontSize(this.fontSize).padding({left:35}) - }.width(140).height(60).justifyContent(FlexAlign.Start).alignItems(VerticalAlign.Center).backgroundImage($rawfile(`judge/km3/button_nor.png`)).backgroundImageSize({width:'100%',height:'100%'}) - .onClick(()=>{ + Row() { + Text('扣 分') { + }.fontColor('#FFF').fontSize(this.fontSize).padding({ left: 35 }) + } + .width(140) + .height(60) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .backgroundImage($rawfile(`judge/km3/button_nor.png`)) + .backgroundImageSize({ width: '100%', height: '100%' }) + .onClick(() => { this.endPopupVisible = true }) } }.width('100%').justifyContent(FlexAlign.SpaceBetween) - Column(){ - ForEach(this.getCurrentMarkRuleList(),(item,index) => { - Row(){ - Row(){ - Text(`${item.markshow} (${item.markcatalog})`).fontColor('#FFF').fontSize(this.fontSize).fontWeight(600) + + Column() { + ForEach(this.getCurrentMarkRuleList(), (item, index) => { + Row() { + Row() { + Text(`${item.markshow} (${item.markcatalog})`) + .fontColor('#FFF') + .fontSize(this.fontSize) + .fontWeight(600) }.width(1000) - Row(){ + + Row() { Text(item.markreal + '').fontColor('#FFF').fontSize(this.fontSize).fontWeight(600) } } - .width('100%').justifyContent(FlexAlign.SpaceBetween).alignItems(VerticalAlign.Center).constraintSize({minHeight:70}) - .padding({left:20,right:20}) + .width('100%') + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Center) + .constraintSize({ minHeight: 70 }) + .padding({ left: 20, right: 20 }) .backgroundColor(this.getSelectedLine(index)) - .onClick(()=>{this.selectedLine = index}) + .onClick(() => { + this.selectedLine = index + }) }) } } - }.width(1200).height(620).position({x:30,y:315}).backgroundColor('#E6E3DF').padding({top:15,bottom:15,left:25,right:25}).borderRadius(20) + } + .width(1200) + .height(620) + .position({ x: 30, y: 315 }) + .backgroundColor('#E6E3DF') + .padding({ top: 15, bottom: 15, left: 25, right: 25 }) + .borderRadius(20) + // Row(){}.width(100).height(100).position({y:'85%',x:'50%'}).backgroundImage($rawfile('judge/km3/close_nor.png')).backgroundImageSize({width:'100%',height:'100%'}) //结束考试弹窗 if (this.endPopupVisible) { @@ -179,12 +237,14 @@ export default struct DeductedPopup { this.endPopupVisible = false; }, confirmFn: async () => { - const index = this.currentIndex ? this.currentUniversalPageIndex: this.currentPageIndex; + const index = this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex; const mark = this.universalMarkRules[index * 7 + this.selectedLine] - mark && this.confirmMark(mark.itemno,mark.markserial) + mark && this.confirmMark(mark.itemno, mark.markserial) } }) } - }.width('100%').height('100%').position({y:0}).onClick(()=>{this.closePopup()}) + }.width('100%').height('100%').position({ y: 0 }).onClick(() => { + this.closePopup() + }) } } \ No newline at end of file diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index 067273af..cfed9289 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -1,9 +1,8 @@ - - { "module": { "name": "entry", "type": "entry", + "srcEntry": "./ets/entryability/EntryAbility.ets", "description": "$string:module_desc", "mainElement": "EntryAbility", "deviceTypes": [ @@ -13,17 +12,16 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", - "abilities": [ { "name": "EntryAbility", - "srcEntrance": "./ets/entryability/EntryAbility.ets", + "srcEntry": "./ets/entryability/EntryAbility.ets", "description": "$string:EntryAbility_desc", "icon": "$media:logo_app", "label": "$string:EntryAbility_label", "startWindowIcon": "$media:icon", "startWindowBackground": "$color:start_window_background", - "visible": true, + "exported": true, "skills": [ { "entities": [ @@ -36,9 +34,13 @@ ] } ], - "requestPermissions":[ - {"name": "ohos.permission.CONNECTIVITY_INTERNAL"}, - {"name": "ohos.permission.SET_TIME"}, + "requestPermissions": [ + { + "name": "ohos.permission.CONNECTIVITY_INTERNAL" + }, + { + "name": "ohos.permission.SET_TIME" + }, { "name": "ohos.permission.INTERNET" }, @@ -102,26 +104,6 @@ "when": "always" } }, - // { - // "name": "ohos.permission.READ_MEDIA", - // "reason": "$string:module_desc", - // "usedScene": { - // "abilities": [ - // "MainAbility" - // ], - // "when": "always" - // } - // }, - // { - // "name": "ohos.permission.WRITE_MEDIA", - // "reason": "$string:module_desc", - // "usedScene": { - // "abilities": [ - // "MainAbility" - // ], - // "when": "always" - // } - // }, { "name": "ohos.permission.FILE_ACCESS_MANAGER", "reason": "$string:module_desc", @@ -135,7 +117,6 @@ { "name": "ohos.permission.STORAGE_MANAGER" }, - { "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", "reason": "$string:module_desc", @@ -145,7 +126,7 @@ ], "when": "always" } - } + }, ] } } \ No newline at end of file