fix: 更新数据获取逻辑,优化类型定义和代码一致性

This commit is contained in:
wangzhongjie 2025-04-03 15:25:44 +08:00
parent c2e9449a57
commit 87b313fafd
4 changed files with 11 additions and 19 deletions

View File

@ -6,7 +6,7 @@ import imageBtn from './compontents/imageBtn';
import { UserLoginType } from '../model/ExaminerLogin'; import { UserLoginType } from '../model/ExaminerLogin';
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
import { examinerLogin } from '../api/login'; import { examinerLogin } from '../api/login';
import { CarInfoType, ExaminerLoginInfo } from '../model/index'; import { ApiResponseType, CarInfoType, ExaminerLoginInfo } from '../model/index';
import { CryptoJS } from '@ohos/crypto-js'; import { CryptoJS } from '@ohos/crypto-js';
@ -108,7 +108,7 @@ struct Index {
this.limit = true this.limit = true
try { try {
// TODO // TODO
examinerLogin(param).then((res: ESObject) => { examinerLogin(param).then((res: ApiResponseType) => {
// AppStorage.setOrCreate('examinerInfo', res?.examinerLoginRsp?.body) // AppStorage.setOrCreate('examinerInfo', res?.examinerLoginRsp?.body)
console.log('res?.examinerLoginRsp?.head?.resultCode', res?.examinerLoginRsp?.head?.resultCode, console.log('res?.examinerLoginRsp?.head?.resultCode', res?.examinerLoginRsp?.head?.resultCode,
JSON.stringify(res)) JSON.stringify(res))
@ -134,12 +134,10 @@ struct Index {
examinerLoginInfo.username = this.inputTextArr[0] examinerLoginInfo.username = this.inputTextArr[0]
AppStorage.setOrCreate<ExaminerLoginInfo>('examinerInfo', examinerLoginInfo) AppStorage.setOrCreate<ExaminerLoginInfo>('examinerInfo', examinerLoginInfo)
}).catch((err: BusinessError) => { }).catch((err: BusinessError) => {
console.log('jiangsong12', JSON.stringify(err))
this.errorDialog.close() this.errorDialog.close()
this.limit = false this.limit = false
}) })
} catch (eroor) { } catch (error) {
console.log('erroreee')
this.errorDialog.close() this.errorDialog.close()
this.limit = false this.limit = false
} }
@ -191,12 +189,9 @@ struct Index {
aboutToAppear() { aboutToAppear() {
this.url = '' this.url = ''
console.info('ExmainerLogin aboutToAppear');
} }
onPageShow() { onPageShow() {
// this.vocObj = new voiceService(async (status, val, next) => {
// });
} }
outClick() { outClick() {

View File

@ -456,7 +456,6 @@ struct Index {
} }
async onPageShow() { async onPageShow() {
console.log('ttttt', 1111)
this.singlePlay = AppStorage.get<boolean>('singlePlay') this.singlePlay = AppStorage.get<boolean>('singlePlay')
this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo') this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')
// await this.userAuth(); // await this.userAuth();

View File

@ -1,15 +1,15 @@
import { getSyncData } from '../../../common/service/initable';
import { judgeConfig } from '../../judgeSDK/utils/judgeConfig'; import { judgeConfig } from '../../judgeSDK/utils/judgeConfig';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements'; import VoiceAnnounce from '../../judgeSDK/utils/voiceAnnouncements';
import { MarkRule, SYSSET } from '../../judgeSDK/api/judgeSDK.d'; import { MarkRule } from '../../judgeSDK/api/judgeSDK.d';
import { writeObjectOut } from '../../../api/judge'; import { writeObjectOut } from '../../../api/judge';
import JudgeTask from '../../judgeSDK/utils/judgeTask'; import JudgeTask from '../../judgeSDK/utils/judgeTask';
import FilePhoto from '../../judgeSDK/utils/filePhoto'; import FilePhoto from '../../judgeSDK/utils/filePhoto';
import { CarInfoType } from '../../../model'; import { CarInfoType, MASYSSETTableType } from '../../../model';
import { GetCurrentTime } from '../../../utils/Common'; import { GetCurrentTime } from '../../../utils/Common';
import FileUtils from '../../../utils/FileUtils'; import FileUtils from '../../../utils/FileUtils';
import { GetSyncData } from '../../../utils/table/Operation';
interface SEL { interface SEL {
fontColor: string fontColor: string
@ -353,8 +353,8 @@ export default struct DeductedPopup {
} }
//获取sysset表数据 //获取sysset表数据
async initSysset(sysset?: SYSSET[]) { async initSysset(sysset?: MASYSSETTableType[]) {
const syssetParams = sysset || await getSyncData('MA_SYSSET'); const syssetParams = sysset || await GetSyncData<MASYSSETTableType>('MA_SYSSET');
console.info('surenjun syssetParams', JSON.stringify(syssetParams)); console.info('surenjun syssetParams', JSON.stringify(syssetParams));
syssetParams.forEach(sys => { syssetParams.forEach(sys => {
//监管序列号 //监管序列号

View File

@ -1,6 +1,4 @@
import { import { InitializeTheCentralTableType, ResponseDataType, User } from '../../model';
InitializeTheCentralTableType, ResponseDataType, User
} from '../../model';
import DB, { ColumnInfo, ColumnType } from '../DbSql'; import DB, { ColumnInfo, ColumnType } from '../DbSql';
import { CenterMap, ParameterPlatform, RemappingTableName } from './Relationship'; import { CenterMap, ParameterPlatform, RemappingTableName } from './Relationship';
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
@ -13,7 +11,7 @@ import FileUtils from '../FileUtils';
// 建表操作 // 建表操作
export async function InitTable() { export async function InitTable() {
Object.keys(ParameterPlatform).forEach(async (item) => { Object.keys(ParameterPlatform).forEach(async (item) => {
await DB.executeSql(ParameterPlatform[item].sqlCreate); await DB.executeSql(ParameterPlatform.get(item).sqlCreate);
}); });
} }
@ -58,7 +56,7 @@ export function UpdateTableByArray(tableName: string, arr: Array<User>): Promise
//依据表名同步获取数据 //依据表名同步获取数据
export async function GetSyncData<T>(tableName: string): Promise<T[]> { export async function GetSyncData<T>(tableName: string): Promise<T[]> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const columns: ColumnInfo[] = ParameterPlatform[tableName].columns.map((res: string) => { const columns: ColumnInfo[] = ParameterPlatform.get(tableName).columns.map((res: string) => {
return { return {
name: res, name: res,
columnName: res, columnName: res,