fix: 更新数据获取逻辑,优化类型定义和代码一致性
This commit is contained in:
parent
c2e9449a57
commit
87b313fafd
@ -6,7 +6,7 @@ import imageBtn from './compontents/imageBtn';
|
||||
import { UserLoginType } from '../model/ExaminerLogin';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import { examinerLogin } from '../api/login';
|
||||
import { CarInfoType, ExaminerLoginInfo } from '../model/index';
|
||||
import { ApiResponseType, CarInfoType, ExaminerLoginInfo } from '../model/index';
|
||||
import { CryptoJS } from '@ohos/crypto-js';
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ struct Index {
|
||||
this.limit = true
|
||||
try {
|
||||
// TODO
|
||||
examinerLogin(param).then((res: ESObject) => {
|
||||
examinerLogin(param).then((res: ApiResponseType) => {
|
||||
// AppStorage.setOrCreate('examinerInfo', res?.examinerLoginRsp?.body)
|
||||
console.log('res?.examinerLoginRsp?.head?.resultCode', res?.examinerLoginRsp?.head?.resultCode,
|
||||
JSON.stringify(res))
|
||||
@ -134,12 +134,10 @@ struct Index {
|
||||
examinerLoginInfo.username = this.inputTextArr[0]
|
||||
AppStorage.setOrCreate<ExaminerLoginInfo>('examinerInfo', examinerLoginInfo)
|
||||
}).catch((err: BusinessError) => {
|
||||
console.log('jiangsong12', JSON.stringify(err))
|
||||
this.errorDialog.close()
|
||||
this.limit = false
|
||||
})
|
||||
} catch (eroor) {
|
||||
console.log('erroreee')
|
||||
} catch (error) {
|
||||
this.errorDialog.close()
|
||||
this.limit = false
|
||||
}
|
||||
@ -191,12 +189,9 @@ struct Index {
|
||||
|
||||
aboutToAppear() {
|
||||
this.url = ''
|
||||
console.info('ExmainerLogin aboutToAppear');
|
||||
}
|
||||
|
||||
onPageShow() {
|
||||
// this.vocObj = new voiceService(async (status, val, next) => {
|
||||
// });
|
||||
}
|
||||
|
||||
outClick() {
|
||||
|
||||
@ -456,7 +456,6 @@ struct Index {
|
||||
}
|
||||
|
||||
async onPageShow() {
|
||||
console.log('ttttt', 1111)
|
||||
this.singlePlay = AppStorage.get<boolean>('singlePlay')
|
||||
this.baseInfo = AppStorage.get<BaseInfoType>('baseInfo')
|
||||
// await this.userAuth();
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
import { getSyncData } from '../../../common/service/initable';
|
||||
import { judgeConfig } from '../../judgeSDK/utils/judgeConfig';
|
||||
|
||||
import common from '@ohos.app.ability.common';
|
||||
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 JudgeTask from '../../judgeSDK/utils/judgeTask';
|
||||
import FilePhoto from '../../judgeSDK/utils/filePhoto';
|
||||
import { CarInfoType } from '../../../model';
|
||||
import { CarInfoType, MASYSSETTableType } from '../../../model';
|
||||
import { GetCurrentTime } from '../../../utils/Common';
|
||||
import FileUtils from '../../../utils/FileUtils';
|
||||
import { GetSyncData } from '../../../utils/table/Operation';
|
||||
|
||||
interface SEL {
|
||||
fontColor: string
|
||||
@ -353,8 +353,8 @@ export default struct DeductedPopup {
|
||||
}
|
||||
|
||||
//获取sysset表数据
|
||||
async initSysset(sysset?: SYSSET[]) {
|
||||
const syssetParams = sysset || await getSyncData('MA_SYSSET');
|
||||
async initSysset(sysset?: MASYSSETTableType[]) {
|
||||
const syssetParams = sysset || await GetSyncData<MASYSSETTableType>('MA_SYSSET');
|
||||
console.info('surenjun syssetParams', JSON.stringify(syssetParams));
|
||||
syssetParams.forEach(sys => {
|
||||
//监管序列号
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
import {
|
||||
InitializeTheCentralTableType, ResponseDataType, User
|
||||
} from '../../model';
|
||||
import { InitializeTheCentralTableType, ResponseDataType, User } from '../../model';
|
||||
import DB, { ColumnInfo, ColumnType } from '../DbSql';
|
||||
import { CenterMap, ParameterPlatform, RemappingTableName } from './Relationship';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
@ -13,7 +11,7 @@ import FileUtils from '../FileUtils';
|
||||
// 建表操作
|
||||
export async function InitTable() {
|
||||
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[]> {
|
||||
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 {
|
||||
name: res,
|
||||
columnName: res,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user