promise修改
This commit is contained in:
parent
29332c5ae8
commit
3e641b22d5
@ -2,7 +2,7 @@ import request from "../common/utils/request"
|
|||||||
|
|
||||||
|
|
||||||
export async function carConfigurationInfo(params){
|
export async function carConfigurationInfo(params){
|
||||||
return await request({
|
return request({
|
||||||
url:'/der2/services/exam/carConfigurationInfo.ws',
|
url:'/der2/services/exam/carConfigurationInfo.ws',
|
||||||
data:params,
|
data:params,
|
||||||
method:'post',
|
method:'post',
|
||||||
@ -12,7 +12,7 @@ export async function carConfigurationInfo(params){
|
|||||||
|
|
||||||
//设备注册
|
//设备注册
|
||||||
export async function registrationDeviceNo(params){
|
export async function registrationDeviceNo(params){
|
||||||
return await request({
|
return request({
|
||||||
url:'/der2/services/exam/registrationDeviceNo.ws',
|
url:'/der2/services/exam/registrationDeviceNo.ws',
|
||||||
data:`<?xml version="1.0" encoding="UTF-8" ?>
|
data:`<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<registrationDeviceNoReq>
|
<registrationDeviceNoReq>
|
||||||
@ -26,7 +26,7 @@ export async function registrationDeviceNo(params){
|
|||||||
|
|
||||||
//自检结果上传
|
//自检结果上传
|
||||||
export async function uploadExamCarCheckResult(params){
|
export async function uploadExamCarCheckResult(params){
|
||||||
return await request({
|
return request({
|
||||||
url:'/der2/services/exam/uploadExamCarCheckResult.ws',
|
url:'/der2/services/exam/uploadExamCarCheckResult.ws',
|
||||||
data:`<?xml version="1.0" encoding="UTF-8" ?>
|
data:`<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<uploadExamCarCheckResultReq>
|
<uploadExamCarCheckResultReq>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import request from "../common/utils/request"
|
import request from "../common/utils/request"
|
||||||
|
|
||||||
export async function timeSynchronization(params){
|
export async function timeSynchronization(params){
|
||||||
return await request({
|
return request({
|
||||||
url:'/der2/services/exam/timeSynchronization.ws',
|
url:'/der2/services/exam/timeSynchronization.ws',
|
||||||
data:`<timeSynchronizationReq>
|
data:`<timeSynchronizationReq>
|
||||||
<head>
|
<head>
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import request from "../common/utils/request"
|
|||||||
|
|
||||||
//同步时间
|
//同步时间
|
||||||
export async function timeSynchronization(params){
|
export async function timeSynchronization(params){
|
||||||
return await request({
|
return request({
|
||||||
url:'/der2/services/exam/timeSynchronization.ws',
|
url:'/der2/services/exam/timeSynchronization.ws',
|
||||||
data:`<?xml version="1.0" encoding="UTF-8" ?>
|
data:`<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<timeSynchronizationReq>
|
<timeSynchronizationReq>
|
||||||
@ -19,7 +19,7 @@ export async function timeSynchronization(params){
|
|||||||
|
|
||||||
//获取考车信息
|
//获取考车信息
|
||||||
export async function obtainCarExamInfo(params){
|
export async function obtainCarExamInfo(params){
|
||||||
return await request({
|
return request({
|
||||||
url:'/der2/services/exam/obtainCarExamInfo.ws',
|
url:'/der2/services/exam/obtainCarExamInfo.ws',
|
||||||
data:`<?xml version="1.0" encoding="UTF-8" ?>
|
data:`<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<obtainCarExamInfoReq>
|
<obtainCarExamInfoReq>
|
||||||
@ -32,7 +32,7 @@ export async function obtainCarExamInfo(params){
|
|||||||
}
|
}
|
||||||
//获取参数平台考车信息
|
//获取参数平台考车信息
|
||||||
export async function initCarInfoCache(params){
|
export async function initCarInfoCache(params){
|
||||||
return await request({
|
return request({
|
||||||
url:'/para/initCarInfoCache.ws',
|
url:'/para/initCarInfoCache.ws',
|
||||||
data:params.data,
|
data:params.data,
|
||||||
method:'post',
|
method:'post',
|
||||||
@ -42,7 +42,7 @@ export async function initCarInfoCache(params){
|
|||||||
}
|
}
|
||||||
//参数下发读表接口
|
//参数下发读表接口
|
||||||
export async function initCenterCache(params,url){
|
export async function initCenterCache(params,url){
|
||||||
return await request({
|
return request({
|
||||||
url:'/para/initCenterCache.ws',
|
url:'/para/initCenterCache.ws',
|
||||||
data:params,
|
data:params,
|
||||||
method:'post',
|
method:'post',
|
||||||
@ -52,7 +52,7 @@ export async function initCenterCache(params,url){
|
|||||||
}
|
}
|
||||||
//参数下发读表接口
|
//参数下发读表接口
|
||||||
export async function initCenterCacheByKSPT(params,url){
|
export async function initCenterCacheByKSPT(params,url){
|
||||||
return await request({
|
return request({
|
||||||
url:'/der2/services/para/initCenterCache.ws',
|
url:'/der2/services/para/initCenterCache.ws',
|
||||||
data:params,
|
data:params,
|
||||||
method:'post',
|
method:'post',
|
||||||
@ -64,7 +64,7 @@ export async function initCenterCacheByKSPT(params,url){
|
|||||||
|
|
||||||
//从参数平台获取模型
|
//从参数平台获取模型
|
||||||
export async function initEsModel(params){
|
export async function initEsModel(params){
|
||||||
return await request({
|
return request({
|
||||||
url:'/para/initEsModel.ws',
|
url:'/para/initEsModel.ws',
|
||||||
data:params,
|
data:params,
|
||||||
method:'post',
|
method:'post',
|
||||||
@ -74,7 +74,7 @@ export async function initEsModel(params){
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function initialization(params){
|
export async function initialization(params){
|
||||||
return await request({
|
return request({
|
||||||
url:'/der2/services/exam/initialization.ws',
|
url:'/der2/services/exam/initialization.ws',
|
||||||
data:`<?xml version="1.0" encoding="UTF-8" ?><initializationReq><body><carId>${params.carId}</carId><examinationRoomId>${params.examinationRoomId}</examinationRoomId><shellVersion>${params.shellVersion}</shellVersion><judgeVersion>${params.judgeVersion}</judgeVersion><videoVersion>${params.videoVersion}</videoVersion><carInfo></carInfo><map_Road></map_Road><map_Road_Lane></map_Road_Lane><map_SubItem></map_SubItem><t_CarParmSet></t_CarParmSet><map_ItemClass></map_ItemClass><map_Point></map_Point><map_Point_Item></map_Point_Item><CDSBINFO></CDSBINFO><MARKRULESET></MARKRULESET></body></initializationReq>`,
|
data:`<?xml version="1.0" encoding="UTF-8" ?><initializationReq><body><carId>${params.carId}</carId><examinationRoomId>${params.examinationRoomId}</examinationRoomId><shellVersion>${params.shellVersion}</shellVersion><judgeVersion>${params.judgeVersion}</judgeVersion><videoVersion>${params.videoVersion}</videoVersion><carInfo></carInfo><map_Road></map_Road><map_Road_Lane></map_Road_Lane><map_SubItem></map_SubItem><t_CarParmSet></t_CarParmSet><map_ItemClass></map_ItemClass><map_Point></map_Point><map_Point_Item></map_Point_Item><CDSBINFO></CDSBINFO><MARKRULESET></MARKRULESET></body></initializationReq>`,
|
||||||
method:'post',
|
method:'post',
|
||||||
@ -85,7 +85,7 @@ export async function initialization(params){
|
|||||||
|
|
||||||
//参数下发读表接口
|
//参数下发读表接口
|
||||||
export async function initCarParameter(params){
|
export async function initCarParameter(params){
|
||||||
return await request({
|
return request({
|
||||||
url:'/der2/services/para/initCarParameter.ws',
|
url:'/der2/services/para/initCarParameter.ws',
|
||||||
data:params,
|
data:params,
|
||||||
method:'post',
|
method:'post',
|
||||||
|
|||||||
@ -8,7 +8,7 @@ let baseHost = globalThis.host;
|
|||||||
|
|
||||||
// 下载模型
|
// 下载模型
|
||||||
export async function download() {
|
export async function download() {
|
||||||
return await request({
|
return request({
|
||||||
host: baseHost,
|
host: baseHost,
|
||||||
url: '/para/initEsModel.ws',
|
url: '/para/initEsModel.ws',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@ -64,7 +64,7 @@ export async function writeObjectOut(params,filePath?:string): Promise<WR> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//对象转换成xml
|
//对象转换成xml
|
||||||
const temp = await request({
|
const temp = request({
|
||||||
host: globalThis.JGHOST,
|
host: globalThis.JGHOST,
|
||||||
url: '/dems_ws/services/TmriOutAccess?wsdl',
|
url: '/dems_ws/services/TmriOutAccess?wsdl',
|
||||||
data: `<?xml version="1.0"?>
|
data: `<?xml version="1.0"?>
|
||||||
@ -115,7 +115,7 @@ export async function uploadExamProgressData(params) {
|
|||||||
if (singlePlay) {
|
if (singlePlay) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return await request({
|
return request({
|
||||||
url: '/der2/services/exam/uploadExamDataFile.ws',
|
url: '/der2/services/exam/uploadExamDataFile.ws',
|
||||||
data: `<?xml version="1.0" encoding="UTF-8"?>
|
data: `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<uploadExamDataFileReq>
|
<uploadExamDataFileReq>
|
||||||
@ -142,7 +142,7 @@ export async function uploadExamMileage(params) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const time = await getCurrentTime()
|
const time = await getCurrentTime()
|
||||||
return await request({
|
return request({
|
||||||
url: '/der2/services/exam/uploadExamMileage.ws',
|
url: '/der2/services/exam/uploadExamMileage.ws',
|
||||||
data: `<?xml version="1.0" encoding="UTF-8"?>
|
data: `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<uploadExamMileageReq>
|
<uploadExamMileageReq>
|
||||||
@ -168,7 +168,7 @@ export async function uploadExamGrade(params) {
|
|||||||
}
|
}
|
||||||
const paramsArrs = Reflect.ownKeys(params).map((key: string) => (`<${key}>${params[key]}</${key}>`))
|
const paramsArrs = Reflect.ownKeys(params).map((key: string) => (`<${key}>${params[key]}</${key}>`))
|
||||||
const time = await getCurrentTime()
|
const time = await getCurrentTime()
|
||||||
return await request({
|
return request({
|
||||||
url: '/der2/services/exam/uploadExamGrade.ws',
|
url: '/der2/services/exam/uploadExamGrade.ws',
|
||||||
data: `<?xml version="1.0" encoding="UTF-8"?>
|
data: `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<uploadExamGradeReq>
|
<uploadExamGradeReq>
|
||||||
@ -190,7 +190,7 @@ function validateIP(path: string) {
|
|||||||
|
|
||||||
// 上传运行时常
|
// 上传运行时常
|
||||||
export async function uploadHarmonyLiCheng(data) {
|
export async function uploadHarmonyLiCheng(data) {
|
||||||
return await request({
|
return request({
|
||||||
url: '/der2/services/data/harmonyLiCheng.ws',
|
url: '/der2/services/data/harmonyLiCheng.ws',
|
||||||
data,
|
data,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
|||||||
@ -69,10 +69,12 @@ export default async function writeObjectOutNew(data,filePath): Promise<WR> {
|
|||||||
await fileUtil.initFolder(filePath);
|
await fileUtil.initFolder(filePath);
|
||||||
fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify(temp) +`\n`);
|
fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify(temp) +`\n`);
|
||||||
}
|
}
|
||||||
|
// @ts-ignore
|
||||||
const {code} = temp;
|
const {code} = temp;
|
||||||
if(code == '2300007' || code == '2300028'){
|
if(code == '2300007' || code == '2300028'){
|
||||||
return await writeObjectOutNew(params,filePath)
|
return await writeObjectOutNew(params,filePath)
|
||||||
}else{
|
}else{
|
||||||
|
// @ts-ignore
|
||||||
return temp
|
return temp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import request from "../common/utils/request"
|
|||||||
|
|
||||||
|
|
||||||
export async function examinerLogin(params){
|
export async function examinerLogin(params){
|
||||||
return await request({
|
return request({
|
||||||
url:'/der2/services/exam/examinerLogin.ws',
|
url:'/der2/services/exam/examinerLogin.ws',
|
||||||
data:`<?xml version="1.0" encoding="UTF-8" ?>
|
data:`<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<examinerLoginReq>
|
<examinerLoginReq>
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import request from "../common/utils/request"
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export async function faceCompare(params) {
|
export async function faceCompare(params) {
|
||||||
return await request({
|
return request({
|
||||||
url: '/der2/services/imageCompare/base64ImageStrCompare.ws',
|
url: '/der2/services/imageCompare/base64ImageStrCompare.ws',
|
||||||
data: `<?xml version="1.0" encoding="UTF-8" ?>
|
data: `<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<imageCompareReq>
|
<imageCompareReq>
|
||||||
@ -30,7 +30,7 @@ export async function faceCompare(params) {
|
|||||||
|
|
||||||
|
|
||||||
export async function getExaminationStudentInfo(params) {
|
export async function getExaminationStudentInfo(params) {
|
||||||
return await request({
|
return request({
|
||||||
url: '/der2/services/exam/getExaminationStudentInfo.ws',
|
url: '/der2/services/exam/getExaminationStudentInfo.ws',
|
||||||
data: params,
|
data: params,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@ -39,7 +39,7 @@ export async function getExaminationStudentInfo(params) {
|
|||||||
}
|
}
|
||||||
//缺考
|
//缺考
|
||||||
export async function examinationStuAbsent(params) {
|
export async function examinationStuAbsent(params) {
|
||||||
return await request({
|
return request({
|
||||||
url: '/der2/services/exam/examinationStuAbsent.ws',
|
url: '/der2/services/exam/examinationStuAbsent.ws',
|
||||||
data: params,
|
data: params,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@ -49,7 +49,7 @@ export async function examinationStuAbsent(params) {
|
|||||||
|
|
||||||
//获取断点续考
|
//获取断点续考
|
||||||
export async function getExaminationItem(params) {
|
export async function getExaminationItem(params) {
|
||||||
return await request({
|
return request({
|
||||||
url: '/der2/services/exam/getExaminationItem.ws',
|
url: '/der2/services/exam/getExaminationItem.ws',
|
||||||
data: `<getExaminationItemReq>
|
data: `<getExaminationItemReq>
|
||||||
<head>
|
<head>
|
||||||
@ -68,7 +68,7 @@ export async function getExaminationItem(params) {
|
|||||||
|
|
||||||
//参数下发读表接口
|
//参数下发读表接口
|
||||||
export async function getPhotosForOther(params) {
|
export async function getPhotosForOther(params) {
|
||||||
return await request({
|
return request({
|
||||||
url: '/der2/services/third/getPhotosForOther.ws',
|
url: '/der2/services/third/getPhotosForOther.ws',
|
||||||
data: `<?xml version="1.0" encoding="utf-8"?><getBmzpReq><head><time>${params.time}</time></head><body><sfzmhm>${params.sfzmhm}</sfzmhm><kskm>2</kskm><zptype>${params.zptype}</zptype><ksrq>${params.ksrq}</ksrq></body></getBmzpReq>`,
|
data: `<?xml version="1.0" encoding="utf-8"?><getBmzpReq><head><time>${params.time}</time></head><body><sfzmhm>${params.sfzmhm}</sfzmhm><kskm>2</kskm><zptype>${params.zptype}</zptype><ksrq>${params.ksrq}</ksrq></body></getBmzpReq>`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@ -78,7 +78,7 @@ export async function getPhotosForOther(params) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function setVideoText() {
|
export async function setVideoText() {
|
||||||
return await request({
|
return request({
|
||||||
url: 'http://admin:12345qwe@192.168.36.94/PSIA/Custom/SelfExt/OSD/channels/2/textOverlay',
|
url: 'http://admin:12345qwe@192.168.36.94/PSIA/Custom/SelfExt/OSD/channels/2/textOverlay',
|
||||||
data: `<?xml version="1.0" encoding="UTF-8" ?>
|
data: `<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<TextOverlayList><TextOverlay><id>1</id><enabled>true</enabled><positionX>0</positionX><positionY>0</positionY><displayText>1222</displayText></TextOverlay><TextOverlay><id>2</id><enabled>true</enabled><positionX>0</positionX><positionY>0</positionY><displayText>2222</displayText></TextOverlay><TextOverlay><id>3</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>4</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>5</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>6</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>7</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>8</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay></TextOverlayList>`,
|
<TextOverlayList><TextOverlay><id>1</id><enabled>true</enabled><positionX>0</positionX><positionY>0</positionY><displayText>1222</displayText></TextOverlay><TextOverlay><id>2</id><enabled>true</enabled><positionX>0</positionX><positionY>0</positionY><displayText>2222</displayText></TextOverlay><TextOverlay><id>3</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>4</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>5</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>6</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>7</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay><TextOverlay><id>8</id><enabled>false</enabled><positionX>0</positionX><positionY>0</positionY><displayText></displayText></TextOverlay></TextOverlayList>`,
|
||||||
|
|||||||
@ -13,14 +13,19 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import photoAccessHelper from '@ohos.file.photoAccessHelper'
|
import photoAccessHelper from '@ohos.file.photoAccessHelper'
|
||||||
import dataSharePredicates from '@ohos.data.dataSharePredicates'
|
import dataSharePredicates from '@ohos.data.dataSharePredicates'
|
||||||
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
|
import fs from '@ohos.file.fs';
|
||||||
|
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
|
||||||
|
|
||||||
export class FileHelper {
|
class FileHelper {
|
||||||
|
|
||||||
private userFileMgr: photoAccessHelper.PhotoAccessHelper = undefined;
|
private userFileMgr: photoAccessHelper.PhotoAccessHelper = undefined;
|
||||||
|
private mediaLib: mediaLibrary.MediaLibrary = undefined;
|
||||||
|
|
||||||
|
private baseDir: string =""
|
||||||
FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI,
|
FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI,
|
||||||
photoAccessHelper.PhotoKeys.PHOTO_TYPE,
|
photoAccessHelper.PhotoKeys.PHOTO_TYPE,
|
||||||
photoAccessHelper.PhotoKeys.DISPLAY_NAME,
|
photoAccessHelper.PhotoKeys.DISPLAY_NAME,
|
||||||
@ -36,11 +41,34 @@ export class FileHelper {
|
|||||||
photoAccessHelper.PhotoKeys.TITLE,
|
photoAccessHelper.PhotoKeys.TITLE,
|
||||||
photoAccessHelper.PhotoKeys.POSITION,
|
photoAccessHelper.PhotoKeys.POSITION,
|
||||||
photoAccessHelper.PhotoKeys.DATE_TRASHED,
|
photoAccessHelper.PhotoKeys.DATE_TRASHED,
|
||||||
photoAccessHelper.PhotoKeys.HIDDEN];
|
photoAccessHelper.PhotoKeys.HIDDEN
|
||||||
|
];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
this.mediaLib = mediaLibrary.getMediaLibrary(globalThis.context);
|
||||||
this.userFileMgr = photoAccessHelper.getPhotoAccessHelper(globalThis.context);
|
this.userFileMgr = photoAccessHelper.getPhotoAccessHelper(globalThis.context);
|
||||||
|
this.baseDir = AppStorage.Get('sanBoxFileDir') + '/TextDir';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async queryFile(displayName): Promise<mediaLibrary.FileAsset> {
|
||||||
|
var ret ;
|
||||||
|
console.info(` baoyihu queryFile displayName=${displayName}`);
|
||||||
|
let fetchOp = {
|
||||||
|
selections: `media_type=? AND display_name = ?`,
|
||||||
|
selectionArgs: [`${mediaLibrary.MediaType.AUDIO}`,displayName],
|
||||||
|
};
|
||||||
|
console.log( 'baoyihu queryFile selections: '+fetchOp.selections +" args:" + fetchOp.selectionArgs);
|
||||||
|
let fileResult = await this.mediaLib.getFileAssets(fetchOp);
|
||||||
|
let retCount = fileResult.getCount();
|
||||||
|
console.log( 'baoyihu queryFile count: '+retCount );
|
||||||
|
if (retCount > 0) {
|
||||||
|
ret= fileResult.getFirstObject();
|
||||||
|
console.log( 'baoyihu queryFile success ' );
|
||||||
|
}
|
||||||
|
return Promise.resolve(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public async queryPhotoByDisplayName(displayName)
|
public async queryPhotoByDisplayName(displayName)
|
||||||
{
|
{
|
||||||
console.log( 'baoyihu queryPhotoByDisplayName begin DISPLAY_NAME:' +displayName );
|
console.log( 'baoyihu queryPhotoByDisplayName begin DISPLAY_NAME:' +displayName );
|
||||||
@ -67,7 +95,7 @@ export class FileHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getUserAlbumItemByDisplayName(displayName: string): Promise<photoAccessHelper.Album> {
|
async getUserAlbumItemByDisplayName(displayName: string): Promise<photoAccessHelper.Album> {
|
||||||
let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = null
|
let fetchResult = null
|
||||||
let album: photoAccessHelper.Album = null
|
let album: photoAccessHelper.Album = null
|
||||||
try {
|
try {
|
||||||
console.log( 'getUserAlbumItemByDisplayName');
|
console.log( 'getUserAlbumItemByDisplayName');
|
||||||
@ -116,9 +144,58 @@ export class FileHelper {
|
|||||||
} finally {
|
} finally {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private savedPictureFile:string[] = [];
|
||||||
|
private savedVideoFile:string[] = [];
|
||||||
|
//1 是图片,2 是视频
|
||||||
|
public addFile(fileName,file_type)
|
||||||
|
{
|
||||||
|
if(file_type==1) {
|
||||||
|
this.savedPictureFile.push(fileName);
|
||||||
|
}
|
||||||
|
else if(file_type==2)
|
||||||
|
{
|
||||||
|
this.savedVideoFile.push(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async trashPictureFiles(all_fileAsset)
|
||||||
|
{
|
||||||
|
|
||||||
|
let albumFetchResult = null;
|
||||||
|
try {
|
||||||
|
albumFetchResult = await this.userFileMgr.getAlbums(photoAccessHelper.AlbumType.SYSTEM, photoAccessHelper.AlbumSubtype.TRASH);
|
||||||
|
|
||||||
|
let trashAlbum = await albumFetchResult.getFirstObject();
|
||||||
|
trashAlbum.deleteAssets(all_fileAsset).then(() => {
|
||||||
|
console.log('baoyihu deletePictureOfAlbum trash ok : ');
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log('baoyihu deletePictureOfAlbum trash faild : ');
|
||||||
|
});
|
||||||
|
}catch (err) {
|
||||||
|
console.log('baoyihu deletePictureOfAlbum error: '+err);
|
||||||
|
} finally {
|
||||||
|
if (albumFetchResult != null) {
|
||||||
|
albumFetchResult.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log( 'baoyihu deletePictureOfAlbum delete end' );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public async deleteFileOfAlbum(album_Name,file_type): Promise<void> {
|
public async deleteFileOfAlbum(album_Name,file_type): Promise<void> {
|
||||||
console.log('baoyihu deletePictureOfAlbum album_Name:'+album_Name);
|
console.log('baoyihu deletePictureOfAlbum album_Name:'+album_Name);
|
||||||
|
var fileMap =[]
|
||||||
|
if(file_type==1)
|
||||||
|
{
|
||||||
|
fileMap = this.savedPictureFile.slice()
|
||||||
|
this.savedPictureFile.length = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileMap = this.savedVideoFile.slice()
|
||||||
|
this.savedVideoFile.length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
var photoFetchResult =null;
|
var photoFetchResult =null;
|
||||||
try {
|
try {
|
||||||
let album = await this.getUserAlbumItemByName(album_Name);
|
let album = await this.getUserAlbumItemByName(album_Name);
|
||||||
@ -130,15 +207,18 @@ export class FileHelper {
|
|||||||
};
|
};
|
||||||
photoFetchResult = await album.getAssets(fetchOptions)
|
photoFetchResult = await album.getAssets(fetchOptions)
|
||||||
var all_fileAsset = await photoFetchResult.getAllObjects();
|
var all_fileAsset = await photoFetchResult.getAllObjects();
|
||||||
|
|
||||||
var uri_array=[]
|
var uri_array=[]
|
||||||
console.log( 'baoyihu deletePictureOfAlbum iterator begin',album_Name );
|
console.log( 'baoyihu deletePictureOfAlbum iterator begin' +fileMap.length);
|
||||||
for (let onfile of all_fileAsset)
|
// for (let onfile of all_fileAsset)
|
||||||
{
|
// {
|
||||||
console.log(album_Name, 'baoyihu deletePictureOfAlbum uri : ' + onfile.uri +', photoType : '+onfile.photoType+', displayName : '+onfile.displayName);
|
// console.log( 'baoyihu deletePictureOfAlbum uri : ' + onfile.uri +', photoType : '+onfile.photoType+', displayName : '+onfile.displayName);
|
||||||
uri_array.push(onfile.uri);
|
// if(fileMap.indexOf(onfile.displayName)>-1)
|
||||||
}
|
// {
|
||||||
await this.userFileMgr.deleteAssets(uri_array);
|
// console.log( 'baoyihu deletePictureOfAlbum uri find one: ' + onfile.uri +', photoType : '+onfile.photoType+', displayName : '+onfile.displayName);
|
||||||
|
// uri_array.push(onfile.uri);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// await this.userFileMgr.deleteAssets(uri_array);
|
||||||
|
|
||||||
let albumFetchResult = null;
|
let albumFetchResult = null;
|
||||||
try {
|
try {
|
||||||
@ -146,21 +226,21 @@ export class FileHelper {
|
|||||||
|
|
||||||
let trashAlbum = await albumFetchResult.getFirstObject();
|
let trashAlbum = await albumFetchResult.getFirstObject();
|
||||||
trashAlbum.deleteAssets(all_fileAsset).then(() => {
|
trashAlbum.deleteAssets(all_fileAsset).then(() => {
|
||||||
console.log('baoyihu deletePictureOfAlbum trash ok : ',album_Name);
|
console.log('baoyihu deletePictureOfAlbum trash ok : ');
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log('baoyihu deletePictureOfAlbum trash faild : ',album_Name);
|
console.log('baoyihu deletePictureOfAlbum trash faild : ');
|
||||||
});
|
});
|
||||||
}catch (err) {
|
}catch (err) {
|
||||||
console.log('baoyihu deletePictureOfAlbum error: '+err,album_Name);
|
console.log('baoyihu deletePictureOfAlbum error: '+err);
|
||||||
} finally {
|
} finally {
|
||||||
if (albumFetchResult != null) {
|
if (albumFetchResult != null) {
|
||||||
albumFetchResult.close();
|
albumFetchResult.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log( 'baoyihu deletePictureOfAlbum delete end',album_Name );
|
console.log( 'baoyihu deletePictureOfAlbum delete end' );
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log( 'baoyihu deletePictureOfAlbum failed with err: ' + err,album_Name);
|
console.log( 'baoyihu deletePictureOfAlbum failed with err: ' + err);
|
||||||
} finally {
|
} finally {
|
||||||
if (photoFetchResult != null) {
|
if (photoFetchResult != null) {
|
||||||
photoFetchResult.close();
|
photoFetchResult.close();
|
||||||
@ -168,8 +248,19 @@ export class FileHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async deleteAllPictures(): Promise<void> {
|
public async deleteAllPictures(file_type): Promise<void> {
|
||||||
console.log('baoyihu deleteAllPictures');
|
console.log('baoyihu deleteAllPictures enter');
|
||||||
|
var fileMap =[]
|
||||||
|
if(file_type==1)
|
||||||
|
{
|
||||||
|
fileMap = this.savedPictureFile.slice()
|
||||||
|
this.savedPictureFile.length = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileMap = this.savedVideoFile.slice()
|
||||||
|
this.savedVideoFile.length = 0;
|
||||||
|
}
|
||||||
let photoFetchResult = null;
|
let photoFetchResult = null;
|
||||||
try {
|
try {
|
||||||
let predicates = new dataSharePredicates.DataSharePredicates();
|
let predicates = new dataSharePredicates.DataSharePredicates();
|
||||||
@ -181,17 +272,24 @@ export class FileHelper {
|
|||||||
|
|
||||||
var all_fileAsset = await photoFetchResult.getAllObjects();
|
var all_fileAsset = await photoFetchResult.getAllObjects();
|
||||||
var uri_array=[]
|
var uri_array=[]
|
||||||
console.log( 'baoyihu batch delete begin' );
|
console.log( 'baoyihu deleteAllPictures batch delete begin fileMap.length' +fileMap.length);
|
||||||
for (let onfile of all_fileAsset)
|
for (let onfile of all_fileAsset)
|
||||||
{
|
{
|
||||||
console.log( 'baoyihu push one uri : ' + onfile.uri +', photoType : '+onfile.photoType+', displayName : '+onfile.displayName +', file_size: '+onfile.size);
|
console.log( 'baoyihu deleteAllPictures find one uri : ' + onfile.uri +', photoType : '+onfile.photoType+', displayName : '+onfile.displayName +', file_size: '+onfile.size);
|
||||||
|
|
||||||
|
if(fileMap.indexOf(onfile.displayName)>-1)
|
||||||
|
{
|
||||||
|
console.log( 'baoyihu deleteAllPictures uri find one: ' + onfile.uri +', photoType : '+onfile.photoType+', displayName : '+onfile.displayName);
|
||||||
uri_array.push(onfile.uri);
|
uri_array.push(onfile.uri);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// await album.removeAssets(all_fileAsset);
|
// await album.removeAssets(all_fileAsset);
|
||||||
await this.userFileMgr.deleteAssets(uri_array);
|
await this.userFileMgr.deleteAssets(uri_array);
|
||||||
console.log( 'baoyihu batch delete end' );
|
|
||||||
|
await this.trashPictureFiles(all_fileAsset);
|
||||||
|
console.log( 'baoyihu deleteAllPictures batch delete end' );
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log( 'baoyihu get Album getPhotoAssets failed with err: ' + err);
|
console.log( 'baoyihu deleteAllPictures failed with err: ' + err);
|
||||||
} finally {
|
} finally {
|
||||||
if (photoFetchResult != null) {
|
if (photoFetchResult != null) {
|
||||||
photoFetchResult.close();
|
photoFetchResult.close();
|
||||||
@ -226,7 +324,7 @@ export class FileHelper {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
async getUserAlbumItemByName(albumName: string): Promise<photoAccessHelper.Album> {
|
async getUserAlbumItemByName(albumName: string): Promise<photoAccessHelper.Album> {
|
||||||
let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = null
|
let fetchResult= null
|
||||||
let album: photoAccessHelper.Album = null
|
let album: photoAccessHelper.Album = null
|
||||||
try {
|
try {
|
||||||
console.log( 'getUserAlbumItemByName');
|
console.log( 'getUserAlbumItemByName');
|
||||||
@ -331,6 +429,9 @@ export class FileHelper {
|
|||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async deleteAllVideos(type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype ): Promise<void> {
|
public async deleteAllVideos(type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype ): Promise<void> {
|
||||||
let fetchResult:photoAccessHelper.FetchResult<photoAccessHelper.Album> = null;
|
let fetchResult:photoAccessHelper.FetchResult<photoAccessHelper.Album> = null;
|
||||||
try {
|
try {
|
||||||
@ -382,4 +483,56 @@ export class FileHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public isPrime(number):boolean {
|
||||||
|
if (number < 2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (let i = 2; i * i <= number; i++) {
|
||||||
|
if (number % i === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public findPrimes(start, end):void
|
||||||
|
{
|
||||||
|
console.log(`baoyihu find Prime begin in the range ${start} to ${end} are:`);
|
||||||
|
var count = 0;
|
||||||
|
for (let number = start; number <= end; number++)
|
||||||
|
{
|
||||||
|
if (this.isPrime(number))
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
//console.log("baoyihu find Number:"+number);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("baoyihu find Prime count:"+count);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async createRandomFile(fileName): Promise<void> {
|
||||||
|
try {
|
||||||
|
console.log("baoyihu createRandomFile enter baseDir:"+this.baseDir);
|
||||||
|
if (!fs.accessSync(this.baseDir))
|
||||||
|
{
|
||||||
|
fs.mkdirSync(this.baseDir);
|
||||||
|
}
|
||||||
|
let depth = this.baseDir;
|
||||||
|
let myFile = depth + `/`+fileName;
|
||||||
|
console.log("baoyihu createRandomFile begin fileName:"+fileName+", filePath:"+myFile);
|
||||||
|
let file = fs.openSync(myFile, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE);
|
||||||
|
let str: string = "hello, world"+"\n"+"hello,openharmony";
|
||||||
|
let writeLen = fs.writeSync(file.fd, str);
|
||||||
|
fs.closeSync(file);
|
||||||
|
console.log("baoyihu createRandomFile success:"+file);
|
||||||
|
} catch (e)
|
||||||
|
{
|
||||||
|
console.log("baoyihu createRandomFile failed:"+e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
const fileHelper = new FileHelper();
|
||||||
|
export default fileHelper ;
|
||||||
@ -8,7 +8,7 @@ import dataSharePredicates from '@ohos.data.dataSharePredicates'
|
|||||||
import { dateFormat, getCurrentTime, isSevenDaysAgo } from '../utils/tools'
|
import { dateFormat, getCurrentTime, isSevenDaysAgo } from '../utils/tools'
|
||||||
// import rtsp_server from '@ohos.rtsprecord';
|
// import rtsp_server from '@ohos.rtsprecord';
|
||||||
import record from '@ohos.rtsprecord';
|
import record from '@ohos.rtsprecord';
|
||||||
import { FileHelper } from './FileHelper';
|
import FileHelper from './FileHelper';
|
||||||
import FileUtil from '../utils/File';
|
import FileUtil from '../utils/File';
|
||||||
import { GlobalConfig } from '../../config';
|
import { GlobalConfig } from '../../config';
|
||||||
import promptAction from '@ohos.promptAction';
|
import promptAction from '@ohos.promptAction';
|
||||||
@ -52,9 +52,9 @@ export async function startRecordVideo(param, td, context, dir, path?, index?) {
|
|||||||
} else {
|
} else {
|
||||||
fileName = `${date}_${path}_${index || num}.mp4`
|
fileName = `${date}_${path}_${index || num}.mp4`
|
||||||
}
|
}
|
||||||
|
dir=date
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
var recordResult = rtsp_server.startRecordVideo(context, video_uri, fileName, date,dir);
|
var recordResult = rtsp_server.startRecordVideo(context, video_uri, fileName, dir);
|
||||||
const handleId = recordResult.dataInt;
|
const handleId = recordResult.dataInt;
|
||||||
reslove(handleId)
|
reslove(handleId)
|
||||||
}
|
}
|
||||||
@ -88,9 +88,9 @@ export async function endRecordVideo(record_handleObj) {
|
|||||||
export async function saveStartRecordVideo(path) {
|
export async function saveStartRecordVideo(path) {
|
||||||
return new Promise(async (reslove, reject) => {
|
return new Promise(async (reslove, reject) => {
|
||||||
const fileUtil = new FileUtil(globalThis.context)
|
const fileUtil = new FileUtil(globalThis.context)
|
||||||
const fileHelper = new FileHelper();
|
// const fileHelper = new FileHelper();
|
||||||
const date = dateFormat(new Date).split(' ')[0]
|
const date = dateFormat(new Date).split(' ')[0]
|
||||||
fileHelper.createAlbum(date);
|
FileHelper.createAlbum(date);
|
||||||
// const folderPath = await fileUtil.initFolder(`/${path}/${date}`);
|
// const folderPath = await fileUtil.initFolder(`/${path}/${date}`);
|
||||||
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt');
|
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt');
|
||||||
const param = JSON.parse(data)
|
const param = JSON.parse(data)
|
||||||
@ -179,7 +179,7 @@ interface takePhotoParam {
|
|||||||
* @param callback
|
* @param callback
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const fileHelper = new FileHelper();
|
// const fileHelper = new FileHelper();
|
||||||
|
|
||||||
export async function delPic(day,type) {
|
export async function delPic(day,type) {
|
||||||
let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(globalThis.context);
|
let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(globalThis.context);
|
||||||
@ -195,12 +195,19 @@ export async function delPic(day,type) {
|
|||||||
};
|
};
|
||||||
let albumList: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, albumFetchOptions);
|
let albumList: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, albumFetchOptions);
|
||||||
let albums = await albumList.getAllObjects();
|
let albums = await albumList.getAllObjects();
|
||||||
|
|
||||||
for(let i=0;i<=albums.length;i++){
|
for(let i=0;i<=albums.length;i++){
|
||||||
let albumName=albums[i].albumName
|
let albumName=albums[i].albumName
|
||||||
// isSevenDaysAgo(albumName, day)
|
// isSevenDaysAgo(albumName, day)
|
||||||
console.log('albumNamealbumName',albumName)
|
console.log('albumNamealbumName',albumName)
|
||||||
if (isSevenDaysAgo(albumName, day)&&albumName!='jt'&&albumName!='pz') {
|
// isSevenDaysAgo(albumName, day)&&albumName!='jt'&&albumName!='pz'
|
||||||
|
if (albumName=='pz') {
|
||||||
deleteAllFileByPiC(albumName, type)
|
deleteAllFileByPiC(albumName, type)
|
||||||
|
// albums[i].deleteAssets(albums).then(() => {
|
||||||
|
// console.log('baoyihu deletePictureOfAlbum trash ok : ');
|
||||||
|
// }).catch((err) => {
|
||||||
|
// console.log('baoyihu deletePictureOfAlbum trash faild : ');
|
||||||
|
// });
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,6 +236,8 @@ export async function takePhoto(param, context, dir, flag = 1, callback?) {
|
|||||||
const date = time.split(' ')[0]
|
const date = time.split(' ')[0]
|
||||||
let dirName=dir?dir:date
|
let dirName=dir?dir:date
|
||||||
rtsp_server.getVideoSnapshot(context, video_uri, fileName,dirName, true,async (err, snapResult) => {
|
rtsp_server.getVideoSnapshot(context, video_uri, fileName,dirName, true,async (err, snapResult) => {
|
||||||
|
console.log("baohaowen_detectLoop round end size1:" + JSON.stringify(snapResult));
|
||||||
|
|
||||||
if(snapResult.result&&snapResult.errorCode==0){
|
if(snapResult.result&&snapResult.errorCode==0){
|
||||||
resolve({
|
resolve({
|
||||||
base64: snapResult.dataString,
|
base64: snapResult.dataString,
|
||||||
@ -250,7 +259,7 @@ export async function takePhoto(param, context, dir, flag = 1, callback?) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export async function deleteAllPicturesFn(){
|
export async function deleteAllPicturesFn(){
|
||||||
fileHelper.deleteAllPictures();
|
// FileHelper.deleteAllPictures();
|
||||||
deleteAllVideos(globalThis.context,photoAccessHelper.AlbumType.USER,photoAccessHelper.AlbumSubtype.VIDEO)
|
deleteAllVideos(globalThis.context,photoAccessHelper.AlbumType.USER,photoAccessHelper.AlbumSubtype.VIDEO)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -258,7 +267,8 @@ export async function deleteAllPicturesFn(){
|
|||||||
//type:1 是图片 2是视频
|
//type:1 是图片 2是视频
|
||||||
export async function deleteAllFileByPiC(dirName, type = 1) {
|
export async function deleteAllFileByPiC(dirName, type = 1) {
|
||||||
// const fileHelper = new FileHelper();
|
// const fileHelper = new FileHelper();
|
||||||
fileHelper.deleteFileOfAlbum(dirName, type);
|
// fileHelper.deleteFileOfAlbum(dirName, type);
|
||||||
|
FileHelper.deleteFileOfAlbum(dirName, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteAllVideos(context, type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype): Promise<void> {
|
export async function deleteAllVideos(context, type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype): Promise<void> {
|
||||||
|
|||||||
@ -2,12 +2,12 @@ import http from '@ohos.net.http';
|
|||||||
import convertxml from '@ohos.convertxml';
|
import convertxml from '@ohos.convertxml';
|
||||||
import prompt from '@ohos.prompt'
|
import prompt from '@ohos.prompt'
|
||||||
import { sendGreen } from '../../pages/judgeSDK/utils/judgeCommon';
|
import { sendGreen } from '../../pages/judgeSDK/utils/judgeCommon';
|
||||||
import {GlobalConfig} from '../../config/index'
|
import { GlobalConfig } from '../../config/index'
|
||||||
import FileUtil from '../../common/utils/File';
|
import FileUtil from '../../common/utils/File';
|
||||||
import { dateFormat } from '../utils/tools'
|
import { dateFormat } from '../utils/tools'
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
host:GlobalConfig.host,
|
host: GlobalConfig.host,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,9 +22,11 @@ const config = {
|
|||||||
*/
|
*/
|
||||||
// let httpRequest = http.createHttp();
|
// let httpRequest = http.createHttp();
|
||||||
|
|
||||||
export default async function request(req: any) {
|
export default async function request<T>(req: any): Promise<T> {
|
||||||
const {url,params = {},data = {},xml,method = 'get',host,isNewCenter = false} = req;
|
return new Promise((reslove, reject) => {
|
||||||
let httpRequest = http.createHttp();
|
let httpRequest = http.createHttp();
|
||||||
|
const {url,params = {},data = {},xml,method = 'get',host,isNewCenter = false} = req;
|
||||||
|
try {
|
||||||
const options = {
|
const options = {
|
||||||
method: http.RequestMethod[method.toUpperCase()],
|
method: http.RequestMethod[method.toUpperCase()],
|
||||||
header: {
|
header: {
|
||||||
@ -32,15 +34,71 @@ export default async function request(req: any) {
|
|||||||
},
|
},
|
||||||
extraData: xml ? data : JSON.stringify(data),
|
extraData: xml ? data : JSON.stringify(data),
|
||||||
}
|
}
|
||||||
//params转url拼接参数
|
|
||||||
let paramsStr = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || '';
|
let paramsStr = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || '';
|
||||||
paramsStr = paramsStr.toString();
|
paramsStr = paramsStr.toString();
|
||||||
paramsStr = paramsStr.substring(0, paramsStr.length-1)
|
paramsStr = paramsStr.substring(0, paramsStr.length - 1)
|
||||||
try {
|
let baseUrl = host ? host : globalThis.host
|
||||||
let baseUrl=host?host:globalThis.host
|
|
||||||
// let baseUrl=host?config.csptHost:config.host'
|
// let baseUrl=host?config.csptHost:config.host'
|
||||||
console.log('响应头地址1' + baseUrl,url,options.extraData.length)
|
console.log('响应头地址1' + baseUrl, url, options.extraData.length)
|
||||||
const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, {...options});
|
// const {result,responseCode} = await
|
||||||
|
httpRequest.request(`${baseUrl}${url}${paramsStr}`, {
|
||||||
|
...options
|
||||||
|
})
|
||||||
|
.then(async(data) => {
|
||||||
|
const result = data.result
|
||||||
|
console.log('响应头地址' + JSON.stringify(result))
|
||||||
|
let res: any = xml ? xmlToJson(result, url) : result;
|
||||||
|
console.log('响应头地址' + JSON.stringify(res))
|
||||||
|
|
||||||
|
let resObj = null;
|
||||||
|
if (typeof res === "string") {
|
||||||
|
res = JSON.parse(res)
|
||||||
|
}
|
||||||
|
//处理中心服务code
|
||||||
|
if (res.Envelope) {
|
||||||
|
const msgXml = res.Envelope.Body.writeObjectOutResponse.return;
|
||||||
|
//Envelope.Body.writeObjectOutResponse.return
|
||||||
|
const dd = handleCenterCode(msgXml, isNewCenter);
|
||||||
|
httpRequest.destroy();
|
||||||
|
// @ts-ignore
|
||||||
|
reslove(dd)
|
||||||
|
// return dd
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!xml) {
|
||||||
|
if (res.head.resultCode === '0') {
|
||||||
|
// return res
|
||||||
|
httpRequest.destroy();
|
||||||
|
reslove(res)
|
||||||
|
} else {
|
||||||
|
const resultMessage = res?.body?.resultMessage || res?.head?.resultMessage
|
||||||
|
prompt.showToast({
|
||||||
|
message: decodeURIComponent(resultMessage),
|
||||||
|
duration: 3000
|
||||||
|
});
|
||||||
|
httpRequest.destroy();
|
||||||
|
reject(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i in res) {
|
||||||
|
resObj = res[i].head
|
||||||
|
}
|
||||||
|
console.info('jiangsong:res in request' + url + JSON.stringify(resObj))
|
||||||
|
if (resObj.resultCode === '0') {
|
||||||
|
httpRequest.destroy();
|
||||||
|
reslove(res)
|
||||||
|
} else {
|
||||||
|
prompt.showToast({
|
||||||
|
message: decodeURIComponent(resObj.resultMessage),
|
||||||
|
duration: 3000
|
||||||
|
});
|
||||||
|
httpRequest.destroy();
|
||||||
|
reject(res)
|
||||||
|
}
|
||||||
|
}).catch(Error=>{
|
||||||
|
console.info('test-error0' + url + ' error:resp: ' + JSON.stringify(Error))
|
||||||
|
reject(Error)
|
||||||
|
})
|
||||||
// fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(arrList))
|
// fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(arrList))
|
||||||
// writeLog({
|
// writeLog({
|
||||||
// time:dateFormat(new Date()),
|
// time:dateFormat(new Date()),
|
||||||
@ -49,89 +107,73 @@ export default async function request(req: any) {
|
|||||||
// extraData: JSON.stringify(data),
|
// extraData: JSON.stringify(data),
|
||||||
// state:'end'
|
// state:'end'
|
||||||
// })
|
// })
|
||||||
console.log('响应头地址' + JSON.stringify(result))
|
|
||||||
let res:any = xml ? xmlToJson(result,url) : result;
|
|
||||||
console.log('响应头地址' + JSON.stringify(res))
|
|
||||||
|
|
||||||
let resObj = null;
|
|
||||||
if(typeof res === "string"){
|
|
||||||
res=JSON.parse(res)
|
|
||||||
}
|
|
||||||
//处理中心服务code
|
|
||||||
if(res.Envelope){
|
|
||||||
const msgXml = res.Envelope.Body.writeObjectOutResponse.return;
|
|
||||||
//Envelope.Body.writeObjectOutResponse.return
|
|
||||||
const dd = handleCenterCode(msgXml,isNewCenter);
|
|
||||||
httpRequest.destroy();
|
|
||||||
return dd
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!xml){
|
|
||||||
if(res.head.resultCode === '0'){
|
|
||||||
return res
|
|
||||||
}else{
|
|
||||||
const resultMessage = res?.body?.resultMessage || res?.head?.resultMessage
|
|
||||||
prompt.showToast({
|
|
||||||
message: decodeURIComponent(resultMessage),
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for( let i in res ) {
|
|
||||||
resObj = res[i].head
|
|
||||||
}
|
|
||||||
console.info('jiangsong:res in request' + url + JSON.stringify(resObj))
|
|
||||||
if(resObj.resultCode === '0') {
|
|
||||||
httpRequest.destroy();
|
|
||||||
return res
|
|
||||||
}else {
|
|
||||||
prompt.showToast({
|
|
||||||
message: decodeURIComponent(resObj.resultMessage),
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
httpRequest.destroy();
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.info('test-error' + url + ' error:resp: '+ JSON.stringify(e))
|
console.info('test-error' + url + ' error:resp: ' + JSON.stringify(e))
|
||||||
if(!e||!(e?.message)){
|
if (!e || !(e?.message)) {
|
||||||
httpRequest.destroy();
|
httpRequest.destroy();
|
||||||
return {code:-1}
|
reject({
|
||||||
|
code: -1
|
||||||
|
})
|
||||||
|
// httpRequest.destroy();
|
||||||
|
// return {code:-1}
|
||||||
}
|
}
|
||||||
const code = e?.code;
|
const code = e?.code;
|
||||||
prompt.showToast({
|
prompt.showToast({
|
||||||
message: e?.message,
|
message: e?.message,
|
||||||
duration: 5000
|
duration: 5000
|
||||||
});
|
});
|
||||||
httpRequest.destroy();
|
// httpRequest.destroy();
|
||||||
switch (code){
|
switch (code) {
|
||||||
//断网
|
//断网
|
||||||
case 2300007: return {code:2300007}
|
case 2300007:
|
||||||
|
return {
|
||||||
|
code: 2300007
|
||||||
|
}
|
||||||
// 超时
|
// 超时
|
||||||
case 2300028: return {code:2300028}
|
case 2300028:
|
||||||
|
return {
|
||||||
|
code: 2300028
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
return {code:e.code}
|
// return {code:e.code}
|
||||||
|
httpRequest.destroy();
|
||||||
|
reject({
|
||||||
|
code: e.code
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
async function writeLog(param){
|
|
||||||
|
async function writeLog(param) {
|
||||||
const fileUtil = new FileUtil(globalThis.context)
|
const fileUtil = new FileUtil(globalThis.context)
|
||||||
const folderPath = await fileUtil.initFolder(`/errorMsg/`);
|
const folderPath = await fileUtil.initFolder(`/errorMsg/`);
|
||||||
fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(param)+`\n`)
|
fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(param) + `\n`)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//xml格式转JSON
|
//xml格式转JSON
|
||||||
function xmlToJson(result,url) {
|
function xmlToJson(result, url) {
|
||||||
console.log("xmlToJson begin",url);
|
console.log("xmlToJson begin", url);
|
||||||
let xmlOptions = {trim : false, declarationKey:"_declaration",
|
let xmlOptions = {
|
||||||
instructionKey : "_instruction", attributesKey : "_attributes",
|
trim: false,
|
||||||
textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
|
declarationKey: "_declaration",
|
||||||
commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
|
instructionKey: "_instruction",
|
||||||
nameKey : "_name", elementsKey : "_elements", "skipPreprocess" : true}
|
attributesKey: "_attributes",
|
||||||
|
textKey: "_text",
|
||||||
|
cdataKey: "_cdata",
|
||||||
|
doctypeKey: "_doctype",
|
||||||
|
commentKey: "_comment",
|
||||||
|
parentKey: "_parent",
|
||||||
|
typeKey: "_type",
|
||||||
|
nameKey: "_name",
|
||||||
|
elementsKey: "_elements",
|
||||||
|
"skipPreprocess": true
|
||||||
|
}
|
||||||
|
|
||||||
let strXml = result.toString();
|
let strXml = result.toString();
|
||||||
let conv = new convertxml.ConvertXML();
|
let conv = new convertxml.ConvertXML();
|
||||||
@ -142,41 +184,41 @@ function xmlToJson(result,url) {
|
|||||||
let {_elements:xmlArr} = conv.convertToJSObject(strXml, xmlOptions);
|
let {_elements:xmlArr} = conv.convertToJSObject(strXml, xmlOptions);
|
||||||
console.log("xmlToJson deeml begin");
|
console.log("xmlToJson deeml begin");
|
||||||
let res = deeml(xmlArr);
|
let res = deeml(xmlArr);
|
||||||
console.log("xmlToJson end",url);
|
console.log("xmlToJson end", url);
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
//处理中心服务code
|
//处理中心服务code
|
||||||
function handleCenterCode(msgXml,isNewCenter){
|
function handleCenterCode(msgXml, isNewCenter) {
|
||||||
//新监管
|
//新监管
|
||||||
if(isNewCenter){
|
if (isNewCenter) {
|
||||||
const msg = JSON.parse(msgXml);
|
const msg = JSON.parse(msgXml);
|
||||||
const result = msg?.data[0]?.result;
|
const result = msg?.data[0]?.result;
|
||||||
if(result){
|
if (result) {
|
||||||
const {code,message,retval} = result
|
const {code,message,retval} = result
|
||||||
if(code != '1'){
|
if (code != '1') {
|
||||||
const rMessage = decodeURIComponent(message as string)
|
const rMessage = decodeURIComponent(message as string)
|
||||||
// globalThis.title=rMessage
|
// globalThis.title=rMessage
|
||||||
// globalThis.type='1'
|
// globalThis.type='1'
|
||||||
// globalThis.errorDialog.open()
|
// globalThis.errorDialog.open()
|
||||||
prompt.showToast({
|
prompt.showToast({
|
||||||
message:rMessage,
|
message: rMessage,
|
||||||
duration: 3000
|
duration: 3000
|
||||||
});
|
});
|
||||||
return {code,message}
|
return { code, message }
|
||||||
}else{
|
} else {
|
||||||
return { code ,keystr:retval}
|
return { code, keystr: retval }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//正则匹配code message字段
|
//正则匹配code message字段
|
||||||
const [code,message,keystr] = [/<code>(.*)<\/code>/i,/<message>(.*)<\/message>/i,/<keystr>(.*)<\/keystr>/i].map(pattern=>{
|
const [code, message, keystr] = [/<code>(.*)<\/code>/i, /<message>(.*)<\/message>/i, /<keystr>(.*)<\/keystr>/i].map(pattern => {
|
||||||
const patternArr = pattern.exec(msgXml);
|
const patternArr = pattern.exec(msgXml);
|
||||||
return patternArr && patternArr[1]
|
return patternArr && patternArr[1]
|
||||||
});
|
});
|
||||||
|
|
||||||
if(code != '1'){
|
if (code != '1') {
|
||||||
prompt.showToast({
|
prompt.showToast({
|
||||||
message: decodeURIComponent(message as string),
|
message: decodeURIComponent(message as string),
|
||||||
duration: 3000
|
duration: 3000
|
||||||
@ -184,56 +226,58 @@ function handleCenterCode(msgXml,isNewCenter){
|
|||||||
// globalThis.type='1'
|
// globalThis.type='1'
|
||||||
// globalThis.title=decodeURIComponent(message as string)
|
// globalThis.title=decodeURIComponent(message as string)
|
||||||
// globalThis.errorDialog.open()
|
// globalThis.errorDialog.open()
|
||||||
return {code,message:decodeURIComponent(message)}
|
return { code, message: decodeURIComponent(message) }
|
||||||
}else{
|
} else {
|
||||||
return { code ,keystr, message }
|
return { code, keystr, message }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//JSON转xml格式
|
//JSON转xml格式
|
||||||
const deeml = (elements,_name?)=>{
|
const deeml = (elements, _name?) => {
|
||||||
const json = {}
|
const json = {}
|
||||||
|
|
||||||
elements.map(ele =>{
|
elements.map(ele => {
|
||||||
const _elements = ele._elements
|
const _elements = ele._elements
|
||||||
if(ele._type === 'element'){
|
if (ele._type === 'element') {
|
||||||
if(_elements==undefined){
|
if (_elements == undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const thisJson = json[ele._name]
|
const thisJson = json[ele._name]
|
||||||
if(_elements && _elements.length === 1 && _elements[0]._type === 'text'){
|
if (_elements && _elements.length === 1 && _elements[0]._type === 'text') {
|
||||||
// 如果值存在了
|
// 如果值存在了
|
||||||
if(thisJson){
|
if (thisJson) {
|
||||||
handleCommonArr(_elements[0]._text)
|
handleCommonArr(_elements[0]._text)
|
||||||
}else{
|
} else {
|
||||||
json[ele._name] = _elements[0]._text
|
json[ele._name] = _elements[0]._text
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
if(thisJson){
|
if (thisJson) {
|
||||||
handleCommonArr( deeml(ele._elements,ele._name) )
|
handleCommonArr(deeml(ele._elements, ele._name))
|
||||||
}else{
|
} else {
|
||||||
json[ele._name] = deeml(ele._elements,ele._name)
|
json[ele._name] = deeml(ele._elements, ele._name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//通用处理重复标签
|
//通用处理重复标签
|
||||||
function handleCommonArr(obj){
|
function handleCommonArr(obj) {
|
||||||
if(thisJson){
|
if (thisJson) {
|
||||||
if(Array.isArray(thisJson)){
|
if (Array.isArray(thisJson)) {
|
||||||
json[ele._name].push(obj)
|
json[ele._name].push(obj)
|
||||||
}else{
|
} else {
|
||||||
json[ele._name] = [json[ele._name],obj]
|
json[ele._name] = [json[ele._name], obj]
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
json[ele._name] = obj
|
json[ele._name] = obj
|
||||||
}
|
}
|
||||||
}0
|
}
|
||||||
}else{
|
|
||||||
|
0
|
||||||
|
} else {
|
||||||
//标签上有属性
|
//标签上有属性
|
||||||
if(ele._attributes){
|
if (ele._attributes) {
|
||||||
json[_name] = {
|
json[_name] = {
|
||||||
value: ele._text,
|
value: ele._text,
|
||||||
attributes:ele.__attributes
|
attributes: ele.__attributes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,5 +287,5 @@ const deeml = (elements,_name?)=>{
|
|||||||
};
|
};
|
||||||
|
|
||||||
function isEmpty(param) {
|
function isEmpty(param) {
|
||||||
return!Object.keys(param).length;
|
return !Object.keys(param).length;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -157,6 +157,7 @@ export default struct Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
carConfigurationInfo(param).then(res => {
|
carConfigurationInfo(param).then(res => {
|
||||||
|
// @ts-ignore
|
||||||
const data = res.body.ES_CHECK_CAR_ITEM[0].ITEMS.split(';');
|
const data = res.body.ES_CHECK_CAR_ITEM[0].ITEMS.split(';');
|
||||||
this.checkList = []
|
this.checkList = []
|
||||||
const list = data
|
const list = data
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import router from '@ohos.router';
|
|||||||
import { getCarInfo, getDeviceInfo } from '../common/service/terminalService';
|
import { getCarInfo, getDeviceInfo } from '../common/service/terminalService';
|
||||||
import { setCurrentTime } from '../common/service/timeService';
|
import { setCurrentTime } from '../common/service/timeService';
|
||||||
import { getCurrentTime, string2Bytes } from '../common/utils/tools';
|
import { getCurrentTime, string2Bytes } from '../common/utils/tools';
|
||||||
import { FileHelper } from '../common/service/FileHelper';
|
import FileHelper from '../common/service/FileHelper';
|
||||||
import { getEsCarModel, } from '../common/service/initable';
|
import { getEsCarModel, } from '../common/service/initable';
|
||||||
import FileUtil from '../common/utils/File';
|
import FileUtil from '../common/utils/File';
|
||||||
import { getUDP, getUDP2 } from '../common/utils/GlobalUdp';
|
import { getUDP, getUDP2 } from '../common/utils/GlobalUdp';
|
||||||
@ -523,13 +523,13 @@ struct Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createAlbum() {
|
async createAlbum() {
|
||||||
this.fileHelper = new FileHelper();
|
// this.fileHelper = new FileHelper();
|
||||||
const time = await getCurrentTime()
|
const time = await getCurrentTime()
|
||||||
const date = time.split(' ')[0]
|
const date = time.split(' ')[0]
|
||||||
this.fileHelper.createAlbum('jt')
|
FileHelper.createAlbum('jt')
|
||||||
// this.fileHelper.createAlbum('2025-01-02')
|
// this.fileHelper.createAlbum('2025-01-02')
|
||||||
this.fileHelper.createAlbum('pz');
|
FileHelper.createAlbum('pz');
|
||||||
this.fileHelper.createAlbum(date);
|
FileHelper.createAlbum(date);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -128,8 +128,10 @@ export default struct Index {
|
|||||||
console.log('globalThis.deviceNo',globalThis.deviceNo)
|
console.log('globalThis.deviceNo',globalThis.deviceNo)
|
||||||
// upDateTableByArray('DeviceInfoTable', [{ deviceId: this.ip }])
|
// upDateTableByArray('DeviceInfoTable', [{ deviceId: this.ip }])
|
||||||
registrationDeviceNo(param).then(res => {
|
registrationDeviceNo(param).then(res => {
|
||||||
|
// @ts-ignore
|
||||||
if (res.registrationDeviceNoRsp.head.resultCode == '0') {
|
if (res.registrationDeviceNoRsp.head.resultCode == '0') {
|
||||||
promptAction.showToast({
|
promptAction.showToast({
|
||||||
|
// @ts-ignore
|
||||||
message: decodeURIComponent(res.registrationDeviceNoRsp.head.resultMessage),
|
message: decodeURIComponent(res.registrationDeviceNoRsp.head.resultMessage),
|
||||||
duration: 3000
|
duration: 3000
|
||||||
});
|
});
|
||||||
|
|||||||
@ -173,7 +173,6 @@ struct UserInfo {
|
|||||||
if (res.sfzmhm == user.sfzmhm) {
|
if (res.sfzmhm == user.sfzmhm) {
|
||||||
flag = true
|
flag = true
|
||||||
res.kssycs = user.kssycs
|
res.kssycs = user.kssycs
|
||||||
|
|
||||||
this.getCurrentStudent(res.sfzmhm)
|
this.getCurrentStudent(res.sfzmhm)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -596,6 +595,7 @@ struct UserInfo {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.updateTimeLimit = false
|
this.updateTimeLimit = false
|
||||||
}, 3000)
|
}, 3000)
|
||||||
|
// @ts-ignore
|
||||||
if (!res || res?.getExaminationStudentInfoRsp?.head?.resultCode == '1') {
|
if (!res || res?.getExaminationStudentInfoRsp?.head?.resultCode == '1') {
|
||||||
this.dataList = []
|
this.dataList = []
|
||||||
this.list = []
|
this.list = []
|
||||||
@ -604,7 +604,9 @@ struct UserInfo {
|
|||||||
let dataList = []
|
let dataList = []
|
||||||
this.list = []
|
this.list = []
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
for (let key in res.getExaminationStudentInfoRsp.body) {
|
for (let key in res.getExaminationStudentInfoRsp.body) {
|
||||||
|
// @ts-ignore
|
||||||
const a = res.getExaminationStudentInfoRsp.body[key]
|
const a = res.getExaminationStudentInfoRsp.body[key]
|
||||||
if (a instanceof Array) {
|
if (a instanceof Array) {
|
||||||
dataList = a
|
dataList = a
|
||||||
@ -641,7 +643,7 @@ struct UserInfo {
|
|||||||
|
|
||||||
this.dataList = dataList
|
this.dataList = dataList
|
||||||
const user = this.dataList.filter(res => {
|
const user = this.dataList.filter(res => {
|
||||||
res.kssycs = '1'
|
return res.kssycs == '1'
|
||||||
})
|
})
|
||||||
if (this.dataList.length) {
|
if (this.dataList.length) {
|
||||||
if (user.length) {
|
if (user.length) {
|
||||||
@ -742,6 +744,7 @@ struct UserInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
globalThis.udpClient2.sendMsgExt(param, this.context)
|
globalThis.udpClient2.sendMsgExt(param, this.context)
|
||||||
|
// @ts-ignore
|
||||||
if (res.examinationStuAbsentRsp.head.resultCode == '0') {
|
if (res.examinationStuAbsentRsp.head.resultCode == '0') {
|
||||||
this.pageIndex = 0
|
this.pageIndex = 0
|
||||||
this.qkFlag = false
|
this.qkFlag = false
|
||||||
@ -768,6 +771,7 @@ struct UserInfo {
|
|||||||
examinationRoomId
|
examinationRoomId
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
if (examItems?.getExaminationItemRsp?.body?.kssycs != 0) {
|
if (examItems?.getExaminationItemRsp?.body?.kssycs != 0) {
|
||||||
this.getExaminationStudentInfoFn()
|
this.getExaminationStudentInfoFn()
|
||||||
} else {
|
} else {
|
||||||
@ -785,6 +789,7 @@ struct UserInfo {
|
|||||||
let examItems = { getExaminationItemRsp: { body: { ykxx: '' } } };
|
let examItems = { getExaminationItemRsp: { body: { ykxx: '' } } };
|
||||||
if (!globalThis.singlePlay) {
|
if (!globalThis.singlePlay) {
|
||||||
//获取已考项目
|
//获取已考项目
|
||||||
|
// @ts-ignore
|
||||||
examItems = await getExaminationItem({
|
examItems = await getExaminationItem({
|
||||||
time: getCurrentTime(),
|
time: getCurrentTime(),
|
||||||
carId,
|
carId,
|
||||||
|
|||||||
@ -197,6 +197,7 @@ export default struct FaceCompare {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('mmmmm8', JSON.stringify(res))
|
console.log('mmmmm8', JSON.stringify(res))
|
||||||
|
// @ts-ignore
|
||||||
if (res.imageCompareRsp.head.resultCode=='0') {
|
if (res.imageCompareRsp.head.resultCode=='0') {
|
||||||
this.controller.stop()
|
this.controller.stop()
|
||||||
this.showFaceCompare = !this.showFaceCompare
|
this.showFaceCompare = !this.showFaceCompare
|
||||||
|
|||||||
@ -1558,7 +1558,7 @@ export default class Judge {
|
|||||||
const msgStr = strArr[num];
|
const msgStr = strArr[num];
|
||||||
if(msgStr == ''){
|
if(msgStr == ''){
|
||||||
console.info(judgeTag, '模拟数据考试结束')
|
console.info(judgeTag, '模拟数据考试结束')
|
||||||
globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
|
// globalThis.windowClass.setWindowSystemBarEnable(['navigation'])
|
||||||
clearInterval(judgeTimer)
|
clearInterval(judgeTimer)
|
||||||
this.checkExamIsEnd(true)
|
this.checkExamIsEnd(true)
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user