fix: 规范性优化
This commit is contained in:
parent
cae695e29f
commit
30e0d9606d
@ -14,7 +14,7 @@ import { dConsole } from '../utils/LogWorker';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
struct CarCheckPage {
|
||||
@State angle: number = 0
|
||||
@State ratio: number = 1700 / 960
|
||||
@State index: number = -1
|
||||
|
||||
@ -13,7 +13,7 @@ import { dConsole } from '../utils/LogWorker';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
struct ExaminerLoginPage {
|
||||
@State ratio: number = 1700 / 960
|
||||
@State url: string = ''
|
||||
@State inputPlaceholderArr: string[] = ['用户账户', '密码'];
|
||||
|
||||
@ -11,7 +11,7 @@ import { dConsole } from '../utils/LogWorker'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
struct RegisterPage {
|
||||
@State ratio: number = 1700 / 960
|
||||
@State ip: string = ''
|
||||
@State deviceNo: string = ''
|
||||
|
||||
@ -9,7 +9,7 @@ const lBg = $rawfile('judge/km3/road/luxian_nor.png');
|
||||
//单机模式才选线路
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
struct RoadsPage {
|
||||
@State outFlag: boolean = false;
|
||||
@State roadObj: number[] = [];
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import TopLogo from './compontents/TopLogo'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
struct SettingPage {
|
||||
@State ratio: number = 1280 / 960
|
||||
@State url: string = ''
|
||||
@State baseInfo: BaseInfoType = {}
|
||||
|
||||
@ -50,7 +50,7 @@ import { dConsole } from '../utils/LogWorker';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct UserInfo {
|
||||
struct UserInfoPage {
|
||||
@State pageIndex: number = 0
|
||||
@State ratio: number = 1700 / 960
|
||||
@State index: number = 0
|
||||
|
||||
@ -50,6 +50,8 @@ export function StringToBytes(str: string): Uint8Array {
|
||||
|
||||
/**
|
||||
* 字符串转ASCII码
|
||||
* @param str 需要转换的字符串
|
||||
* @returns 返回ASCII码数组
|
||||
*/
|
||||
export function StringToASCII(str: string): number[] {
|
||||
const arr: number[] = [];
|
||||
@ -61,6 +63,8 @@ export function StringToASCII(str: string): number[] {
|
||||
|
||||
/**
|
||||
* 数组转字节
|
||||
* @param array 需要转换的数组
|
||||
* @returns 返回字节数组
|
||||
*/
|
||||
export function ArrayToByteArray(array: number[]): Uint8Array {
|
||||
const buf = new ArrayBuffer(array.length);
|
||||
@ -121,7 +125,9 @@ export function FillZero(str: string | number, len: number): string {
|
||||
* @returns 分块后的二维数组
|
||||
*/
|
||||
export function CutArray<T>(arr: readonly T[], size: number): T[][] {
|
||||
if (!Array.isArray(arr) || size < 1) return [];
|
||||
if (!Array.isArray(arr) || size < 1) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const result: T[][] = [];
|
||||
for (let i = 0; i < arr.length; i += size) {
|
||||
@ -178,7 +184,8 @@ export function IsExit(path: string): Promise<boolean> {
|
||||
}
|
||||
} catch (error) {
|
||||
let err: BusinessError = error as BusinessError;
|
||||
console.error(CommonFileTag, "accessSync failed with error message: " + err.message + ", error code: " + err.code);
|
||||
console.error(CommonFileTag,
|
||||
"accessSync failed with error message: " + err.message + ", error code: " + err.code);
|
||||
reject(false);
|
||||
}
|
||||
});
|
||||
@ -209,7 +216,9 @@ export function CreateDir(path: string): Promise<boolean> {
|
||||
* @return 返回格式化后的时间字符串
|
||||
*/
|
||||
export function FormatTimeFlexible(seconds: number): string {
|
||||
if (seconds < 0) throw new Error("秒数不能为负数");
|
||||
if (seconds < 0) {
|
||||
throw new Error("秒数不能为负数");
|
||||
}
|
||||
|
||||
const hours = Math.floor(seconds / 3600);
|
||||
const minutes = Math.floor((seconds % 3600) / 60);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user