refactor: 优化BoardPrePareSetPopup组件,重构照片获取逻辑和数据初始化流程
This commit is contained in:
parent
a8bf95df5f
commit
d461cca1c4
@ -64,21 +64,20 @@ export default struct DeductedPopup {
|
||||
fontColor: '#FFF',
|
||||
bgColor: '#B36E00'
|
||||
}
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
private judgeTask: JudgeTask
|
||||
private filePhoto: FilePhoto
|
||||
// 过程照片拍照
|
||||
getPhoto = async (empty?: boolean) => {
|
||||
//单机模式返回空照片
|
||||
if (this.singlePlay) {
|
||||
return ''
|
||||
} else {
|
||||
const { filePhoto } = this;
|
||||
const photoBase64 = await filePhoto.getPhoto();
|
||||
const photoBase64: string = await this.filePhoto.getPhoto();
|
||||
return photoBase64
|
||||
}
|
||||
}
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
private judgeTask: JudgeTask
|
||||
private filePhoto: FilePhoto
|
||||
private avPlayer
|
||||
private avPlayer: VoiceAnnounce
|
||||
|
||||
async aboutToAppear() {
|
||||
this.carInfo = AppStorage.get('carInfo')
|
||||
@ -89,8 +88,8 @@ export default struct DeductedPopup {
|
||||
this.filePhoto = mediaTest
|
||||
//上车准备
|
||||
// this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+''))
|
||||
const { isTrajectoryOpen } = judgeConfig;
|
||||
if (isTrajectoryOpen) {
|
||||
// const { isTrajectoryOpen } = judgeConfig;
|
||||
if (judgeConfig.isTrajectoryOpen) {
|
||||
await this.initDb()
|
||||
} else {
|
||||
await this.initSysset()
|
||||
@ -109,16 +108,19 @@ export default struct DeductedPopup {
|
||||
|
||||
//本地数据初始化
|
||||
async initDb() {
|
||||
const { isTrajectoryOpen, trajectoryPath } = judgeConfig
|
||||
// const { isTrajectoryOpen, trajectoryPath } = judgeConfig
|
||||
const examSubject = this.carInfo.examSubject;
|
||||
//轨迹回放读取 systemparam表、markrule表
|
||||
const fileUtil = new FileUtil(this.context);
|
||||
const folderPath = await fileUtil.initFolder(trajectoryPath);
|
||||
const folderPath = await fileUtil.initFolder(judgeConfig.trajectoryPath);
|
||||
const str = await fileUtil.readFile(folderPath);
|
||||
const strArr = str.split('\n');
|
||||
const [initData, beginData] = [strArr[0], strArr[1]];
|
||||
const initDataObj = JSON.parse(initData);
|
||||
this.examSubject = isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject;
|
||||
// const [initData, beginData] = [strArr[0], strArr[1]];
|
||||
const initData = strArr[0];
|
||||
const beginData = strArr[1];
|
||||
// TODO 补全类型
|
||||
const initDataObj: ESObject = JSON.parse(initData);
|
||||
this.examSubject = Number(judgeConfig.isTrajectoryOpen ? (initDataObj.kskm * 1) : examSubject);
|
||||
await this.initMarkRules(initDataObj.mark);
|
||||
await this.initSysset(initDataObj.sysset);
|
||||
await this.initStudent()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user