fix: 拉起app
This commit is contained in:
		
							parent
							
								
									c3c8783969
								
							
						
					
					
						commit
						076fa74604
					
				| @ -22,6 +22,7 @@ import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | |||||||
| import { updateModelAndCar } from '../common/autoUpdate/index' | import { updateModelAndCar } from '../common/autoUpdate/index' | ||||||
| // import  {uploadLogFile} from '../common/service/indexService' | // import  {uploadLogFile} from '../common/service/indexService' | ||||||
| import { getModalValueCdAndCar } from '../api'; | import { getModalValueCdAndCar } from '../api'; | ||||||
|  | import Want from '@ohos.app.ability.Want'; | ||||||
| 
 | 
 | ||||||
| // import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | // import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -59,6 +59,7 @@ import { GlobalConfig } from '../../config'; | |||||||
| import Want from '@ohos.app.ability.Want'; | import Want from '@ohos.app.ability.Want'; | ||||||
| 
 | 
 | ||||||
| const judgeTag = 'SURENJUN_JUDGE' | const judgeTag = 'SURENJUN_JUDGE' | ||||||
|  | const newAppTag = 'NewAppTag' | ||||||
| 
 | 
 | ||||||
| function ifNeedRetry(code: number | string): boolean { | function ifNeedRetry(code: number | string): boolean { | ||||||
|   let arr = ["B210010", "B210023", "B210024", "B210031", "B210033", "B210034", "B210041"] |   let arr = ["B210010", "B210023", "B210024", "B210031", "B210033", "B210034", "B210041"] | ||||||
| @ -67,6 +68,7 @@ function ifNeedRetry(code: number | string): boolean { | |||||||
|   } |   } | ||||||
|   return false |   return false | ||||||
| } | } | ||||||
|  | 
 | ||||||
| export default class Judge { | export default class Judge { | ||||||
|   // 过程照片拍照
 |   // 过程照片拍照
 | ||||||
|   getPhoto = async (empty?: boolean) => { |   getPhoto = async (empty?: boolean) => { | ||||||
| @ -624,8 +626,6 @@ export default class Judge { | |||||||
|   private disConnectNum: number = 0; |   private disConnectNum: number = 0; | ||||||
|   //调用监管接口
 |   //调用监管接口
 | ||||||
|   private externalTransmission: boolean = false |   private externalTransmission: boolean = false | ||||||
|   // 计算是否启动
 |  | ||||||
|   private whetherToStart: boolean |  | ||||||
|   //调用监管接口
 |   //调用监管接口
 | ||||||
|   sendWriteObjectOut = async (data, filePath) => { |   sendWriteObjectOut = async (data, filePath) => { | ||||||
|     const temp = await writeObjectOut(data, this.externalTransmission, filePath); |     const temp = await writeObjectOut(data, this.externalTransmission, filePath); | ||||||
| @ -646,9 +646,10 @@ export default class Judge { | |||||||
|         return await this.sendWriteObjectOut(data, filePath) |         return await this.sendWriteObjectOut(data, filePath) | ||||||
|       } |       } | ||||||
|       if (this.disConnectNum >= 5) { |       if (this.disConnectNum >= 5) { | ||||||
|  |         console.log(newAppTag, "大于5次,需要拉起app") | ||||||
|         this.externalTransmission = true |         this.externalTransmission = true | ||||||
|         let want: Want = { |         let want: Want = { | ||||||
|           bundleName: 'com.oh.upload', // 替换为你的应用包名
 |           bundleName: 'com.example.upload', // 替换为你的应用包名
 | ||||||
|           abilityName: 'EntryAbility', // 你的 Service Ability 名称
 |           abilityName: 'EntryAbility', // 你的 Service Ability 名称
 | ||||||
|           moduleName: 'entry', // 你的模块名称,通常是 'entry',
 |           moduleName: 'entry', // 你的模块名称,通常是 'entry',
 | ||||||
|           parameters: {} |           parameters: {} | ||||||
| @ -659,10 +660,10 @@ export default class Judge { | |||||||
|             .then(() => { |             .then(() => { | ||||||
|             }) |             }) | ||||||
|             .catch((error) => { |             .catch((error) => { | ||||||
|               console.error(`拉起应用失败: ${error.code} - ${error.message}`); |               console.error(newAppTag, `拉起应用失败: ${error.code} - ${error.message}`); | ||||||
|             }); |             }); | ||||||
|         } catch (error) { |         } catch (error) { | ||||||
|           console.error(`启动Ability异常: ${error.message}`); |           console.error(newAppTag, `启动Ability异常: ${error.message}`); | ||||||
|         } |         } | ||||||
|         return await this.sendWriteObjectOut(data, filePath) |         return await this.sendWriteObjectOut(data, filePath) | ||||||
|       } |       } | ||||||
| @ -670,9 +671,8 @@ export default class Judge { | |||||||
| 
 | 
 | ||||||
|     if (this.disConnectNum >= 5) { |     if (this.disConnectNum >= 5) { | ||||||
|       console.info('surenjun', '123') |       console.info('surenjun', '123') | ||||||
|       this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!'; |       // this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
 | ||||||
|       this.judgeUI.disConnectErrorOpen = true |       // this.judgeUI.disConnectErrorOpen = true
 | ||||||
| 
 |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     this.disConnectNum = 0 |     this.disConnectNum = 0 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user