2024-06-04 11:19:22 +08:00
|
|
|
import TopLogo from './compontents/topLogo';
|
|
|
|
|
import MA_SYSTEMPARM from '../common/constants/MA_SYSTEMPARM';
|
|
|
|
|
import AccountTable from '../common/database/tables/AccountTable';
|
|
|
|
|
import { getSyncData } from '../common/service/initable';
|
2024-05-16 11:05:19 +08:00
|
|
|
|
|
|
|
|
const cBg = $rawfile('judge/km3/road/luxian_pre.png');
|
|
|
|
|
const lBg = $rawfile('judge/km3/road/luxian_nor.png');
|
|
|
|
|
const ctBg = $rawfile('judge/km3/road/luxian_pre.png');
|
|
|
|
|
const ltBg = $rawfile('judge/km3/road/luxian_nor.png');
|
|
|
|
|
|
|
|
|
|
//单机模式才选线路
|
|
|
|
|
@Entry
|
|
|
|
|
@Component
|
2024-06-04 11:19:22 +08:00
|
|
|
export default struct Index {
|
2024-05-16 11:05:19 +08:00
|
|
|
@State @Watch('outClick') outFlag: boolean = false;
|
2024-06-04 11:19:22 +08:00
|
|
|
@State roadObj: any = {}
|
2024-05-16 11:05:19 +08:00
|
|
|
|
2024-06-04 11:19:22 +08:00
|
|
|
async aboutToAppear() {
|
2024-05-16 11:05:19 +08:00
|
|
|
//读取systemparam表的no1等于4的
|
2024-06-04 11:19:22 +08:00
|
|
|
const db = new AccountTable(() => {
|
|
|
|
|
}, MA_SYSTEMPARM);
|
|
|
|
|
const systemParms: any = await getSyncData('MA_SYSTEMPARM')
|
|
|
|
|
systemParms.forEach((systemParm) => {
|
2024-05-16 11:05:19 +08:00
|
|
|
|
|
|
|
|
//TODO 字段名称待修改
|
|
|
|
|
const {no1,no2,no3,txt1,txt2} = systemParm;
|
2024-06-04 11:19:22 +08:00
|
|
|
if (no1 == 4) {
|
|
|
|
|
const temp = { no2, no3, txt1: decodeURI(txt1), txt2 }
|
|
|
|
|
if (this.roadObj[no2]) {
|
2024-05-16 11:05:19 +08:00
|
|
|
this.roadObj[no2].push(temp)
|
2024-06-04 11:19:22 +08:00
|
|
|
} else {
|
2024-05-16 11:05:19 +08:00
|
|
|
this.roadObj[no2] = temp
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2024-06-04 11:19:22 +08:00
|
|
|
|
|
|
|
|
build() {
|
|
|
|
|
Column() {
|
|
|
|
|
TopLogo({ outFlag: $outFlag })
|
|
|
|
|
List({}) {
|
|
|
|
|
ForEach(Reflect.ownKeys(this.roadObj), (roadIndex, index) => {
|
|
|
|
|
ListItem() {
|
|
|
|
|
Column() {
|
|
|
|
|
Row() {
|
|
|
|
|
}
|
|
|
|
|
.backgroundImage(lBg, ImageRepeat.NoRepeat)
|
|
|
|
|
.backgroundImageSize({ width: '100%', height: '100%' })
|
|
|
|
|
.width(90)
|
|
|
|
|
.height(80)
|
|
|
|
|
|
|
|
|
|
Text(`线路${index + 1 + ''}`) {
|
|
|
|
|
}.fontColor('#FFF2D9').fontSize(24).padding({ top: 10 })
|
2024-05-16 11:05:19 +08:00
|
|
|
}
|
2024-06-04 11:19:22 +08:00
|
|
|
}
|
|
|
|
|
.backgroundImage(cBg, ImageRepeat.NoRepeat)
|
|
|
|
|
.backgroundImageSize({ width: '100%', height: '100%' })
|
|
|
|
|
.width(180)
|
|
|
|
|
.height(220)
|
|
|
|
|
.margin({ left: 5, bottom: 10 })
|
|
|
|
|
.onClick(async () => {
|
|
|
|
|
console.info(this.roadObj[roadIndex])
|
|
|
|
|
})
|
2024-05-16 11:05:19 +08:00
|
|
|
})
|
2024-06-04 11:19:22 +08:00
|
|
|
}.lanes(5).margin({ top: 50, left: 15 })
|
2024-05-16 11:05:19 +08:00
|
|
|
|
2024-06-04 11:19:22 +08:00
|
|
|
}.width('100%')
|
|
|
|
|
.height('100%')
|
|
|
|
|
.backgroundColor('#1A1A1A')
|
|
|
|
|
|
|
|
|
|
}
|
2024-05-16 11:05:19 +08:00
|
|
|
|
2024-06-04 11:19:22 +08:00
|
|
|
outClick() {
|
2024-05-16 11:05:19 +08:00
|
|
|
}
|
|
|
|
|
}
|