首页重构
@ -1,6 +1,6 @@
|
|||||||
interface ButtonStyle {
|
interface ButtonStyle extends SizeOptions {
|
||||||
width: string | number
|
fontColor?: ResourceColor
|
||||||
height: string | number
|
fontSize?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
class CusButtonModifier implements AttributeModifier<RowAttribute> {
|
class CusButtonModifier implements AttributeModifier<RowAttribute> {
|
||||||
@ -25,7 +25,7 @@ export struct CusButton {
|
|||||||
public text?: string
|
public text?: string
|
||||||
public normalImage?: Resource
|
public normalImage?: Resource
|
||||||
public activeImage?: Resource
|
public activeImage?: Resource
|
||||||
public style?: SizeOptions
|
public style?: ButtonStyle
|
||||||
private modifier: CusButtonModifier = new CusButtonModifier()
|
private modifier: CusButtonModifier = new CusButtonModifier()
|
||||||
|
|
||||||
aboutToAppear(): void {
|
aboutToAppear(): void {
|
||||||
@ -40,7 +40,10 @@ export struct CusButton {
|
|||||||
build() {
|
build() {
|
||||||
Row() {
|
Row() {
|
||||||
if (this.text) {
|
if (this.text) {
|
||||||
Text(this.text).fontFamily("Alimama").fontSize(24)
|
Text(this.text)
|
||||||
|
.fontFamily("Alimama")
|
||||||
|
.fontSize(this.style?.fontSize || 18)
|
||||||
|
.fontColor(this.style?.fontColor || 0xffffff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.width(this.style?.width || "100%")
|
.width(this.style?.width || "100%")
|
||||||
|
|||||||
@ -20,7 +20,7 @@ export struct Dropdown {
|
|||||||
.borderRadius(0)
|
.borderRadius(0)
|
||||||
.backgroundColor(this.select === index ? 0xcccccc : 0xffffff)
|
.backgroundColor(this.select === index ? 0xcccccc : 0xffffff)
|
||||||
})
|
})
|
||||||
}
|
}.padding(0).borderRadius(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
aboutToAppear(): void {
|
aboutToAppear(): void {
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { CusButton } from '../components/button/Index'
|
import { CusButton } from '../components/button/Index'
|
||||||
import { Layout } from '../components/layout/Index'
|
import { Layout } from '../components/layout/Index'
|
||||||
import { Title } from '../components/title/Index'
|
import { Title } from '../components/title/Index'
|
||||||
import { ControlButton } from './components/Button'
|
|
||||||
import { CusMenuItem } from './components/MenuItem'
|
import { CusMenuItem } from './components/MenuItem'
|
||||||
import { RebootControl } from './utils/Control'
|
import { RebootControl } from './utils/Control'
|
||||||
import { router } from '@kit.ArkUI'
|
import { router } from '@kit.ArkUI'
|
||||||
@ -33,7 +32,7 @@ const button: string[][] =
|
|||||||
@Entry
|
@Entry
|
||||||
struct Control {
|
struct Control {
|
||||||
@State select: number = 0
|
@State select: number = 0
|
||||||
private menu: string[] = ["回到初始位置", "回到受理凭证位置", "回到充电位置", "自由控制"]
|
private menu: string[] = ["1", "2", "3", "4"]
|
||||||
private control: RebootControl = new RebootControl("", 0)
|
private control: RebootControl = new RebootControl("", 0)
|
||||||
private forward: (event: TouchEvent) => void = TouchEventWrapper(() => {
|
private forward: (event: TouchEvent) => void = TouchEventWrapper(() => {
|
||||||
this.control.forward()
|
this.control.forward()
|
||||||
@ -75,7 +74,7 @@ struct Control {
|
|||||||
Row() {
|
Row() {
|
||||||
Column() {
|
Column() {
|
||||||
Row() {
|
Row() {
|
||||||
Text("操作流程").fontFamily("Alimama").fontColor(0xffffff).fontSize(24)
|
Text("线路选择").fontFamily("Alimama").fontColor(0xffffff).fontSize(24)
|
||||||
}
|
}
|
||||||
.backgroundImage($rawfile("images/control/header.png"))
|
.backgroundImage($rawfile("images/control/header.png"))
|
||||||
.backgroundImageSize({ width: "100%", height: "100%" })
|
.backgroundImageSize({ width: "100%", height: "100%" })
|
||||||
@ -84,6 +83,7 @@ struct Control {
|
|||||||
.padding({ left: 48 })
|
.padding({ left: 48 })
|
||||||
.margin({ bottom: 24 })
|
.margin({ bottom: 24 })
|
||||||
|
|
||||||
|
Scroll() {
|
||||||
Column() {
|
Column() {
|
||||||
ForEach(this.menu, (menu: string, index: number) => {
|
ForEach(this.menu, (menu: string, index: number) => {
|
||||||
CusMenuItem({ text: menu, active: this.select === index }).margin({ bottom: 24 }).onClick(() => {
|
CusMenuItem({ text: menu, active: this.select === index }).margin({ bottom: 24 }).onClick(() => {
|
||||||
@ -91,69 +91,98 @@ struct Control {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}.width("100%").padding({ left: 24, right: 24 })
|
}.width("100%").padding({ left: 24, right: 24 })
|
||||||
|
}.width("100%").layoutWeight(1).align(Alignment.Top)
|
||||||
}
|
}
|
||||||
.width("30%")
|
.width("25%")
|
||||||
.height("100%")
|
.height("100%")
|
||||||
.margin({ right: 24 })
|
.margin({ right: 24 })
|
||||||
.backgroundColor(0xf4f4f5)
|
.backgroundColor(0xf4f4f5)
|
||||||
.border({ width: 1, color: 0xf1f1f1 })
|
.border({ width: 1, color: 0xf1f1f1 })
|
||||||
.borderRadius(5)
|
.borderRadius(5)
|
||||||
|
|
||||||
Row() {
|
Flex({ wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceAround }) {
|
||||||
|
CusButton({
|
||||||
|
normalImage: $rawfile("images/control/button.png"),
|
||||||
|
text: "采集初始位置",
|
||||||
|
style: { width: 160, height: 80, fontColor: 0x24F3FB }
|
||||||
|
}).margin({ bottom: 24 }).onClick(() => {
|
||||||
|
this.onCollectCommand()
|
||||||
|
})
|
||||||
|
CusButton({
|
||||||
|
normalImage: $rawfile("images/control/button.png"),
|
||||||
|
text: "回到初始位置",
|
||||||
|
style: { width: 160, height: 80, fontColor: 0x24F3FB }
|
||||||
|
}).margin({ bottom: 24 }).onClick(() => {
|
||||||
|
this.onMoveCommand()
|
||||||
|
})
|
||||||
|
CusButton({
|
||||||
|
normalImage: $rawfile("images/control/button.png"),
|
||||||
|
text: "采集扫码位置",
|
||||||
|
style: { width: 160, height: 80, fontColor: 0x24F3FB }
|
||||||
|
}).margin({ bottom: 24 }).onClick(() => {
|
||||||
|
this.onCollectCommand()
|
||||||
|
})
|
||||||
|
CusButton({
|
||||||
|
normalImage: $rawfile("images/control/button.png"),
|
||||||
|
text: "回到扫码位置",
|
||||||
|
style: { width: 160, height: 80, fontColor: 0x24F3FB }
|
||||||
|
}).margin({ bottom: 24 }).onClick(() => {
|
||||||
|
this.onMoveCommand()
|
||||||
|
})
|
||||||
|
CusButton({
|
||||||
|
normalImage: $rawfile("images/control/button.png"),
|
||||||
|
text: "采集充电位置",
|
||||||
|
style: { width: 160, height: 80, fontColor: 0x24F3FB }
|
||||||
|
}).margin({ bottom: 24 }).onClick(() => {
|
||||||
|
this.onCollectCommand()
|
||||||
|
})
|
||||||
|
CusButton({
|
||||||
|
normalImage: $rawfile("images/control/button.png"),
|
||||||
|
text: "回到充电位置",
|
||||||
|
style: { width: 160, height: 80, fontColor: 0x24F3FB }
|
||||||
|
}).margin({ bottom: 24 }).onClick(() => {
|
||||||
|
this.onMoveCommand()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
.layoutWeight(1)
|
||||||
|
.margin({ right: 24 })
|
||||||
|
|
||||||
if (this.select === 3) {
|
Row() {
|
||||||
Stack({ alignContent: Alignment.Center }) {
|
Stack({ alignContent: Alignment.Center }) {
|
||||||
Image($rawfile("images/control/center.png")).width(120)
|
Image($rawfile("images/control/center.png")).width(80)
|
||||||
Image($rawfile("images/control/left.png")).offset({ x: -140 })
|
Image($rawfile("images/control/left.png")).offset({ x: -100 })
|
||||||
.width(160).onTouch(this.left)
|
.width(120).onTouch(this.left)
|
||||||
Image($rawfile("images/control/right.png")).offset({ x: 140 })
|
Image($rawfile("images/control/right.png")).offset({ x: 100 })
|
||||||
.width(160).onTouch(this.right)
|
.width(120).onTouch(this.right)
|
||||||
Image($rawfile("images/control/up.png")).offset({ y: -140 })
|
Image($rawfile("images/control/up.png")).offset({ y: -100 })
|
||||||
.width(160).onTouch(this.forward)
|
.width(120).onTouch(this.forward)
|
||||||
Image($rawfile("images/control/down.png")).offset({ y: 140 })
|
Image($rawfile("images/control/down.png")).offset({ y: 100 })
|
||||||
.width(160).onTouch(this.backward)
|
.width(120).onTouch(this.backward)
|
||||||
Text("左")
|
Text("左")
|
||||||
.fontColor(0xffffff)
|
.fontColor(0xffffff)
|
||||||
.fontSize(28)
|
.fontSize(28)
|
||||||
.offset({ x: -100 })
|
.offset({ x: -70 })
|
||||||
.hitTestBehavior(HitTestMode.Transparent)
|
.hitTestBehavior(HitTestMode.Transparent)
|
||||||
Text("右")
|
Text("右")
|
||||||
.fontColor(0xffffff)
|
.fontColor(0xffffff)
|
||||||
.fontSize(28)
|
.fontSize(28)
|
||||||
.offset({ x: 100 })
|
.offset({ x: 70 })
|
||||||
.hitTestBehavior(HitTestMode.Transparent)
|
.hitTestBehavior(HitTestMode.Transparent)
|
||||||
Text("前")
|
Text("前")
|
||||||
.fontColor(0xffffff)
|
.fontColor(0xffffff)
|
||||||
.fontSize(28)
|
.fontSize(28)
|
||||||
.offset({ y: -100 })
|
.offset({ y: -70 })
|
||||||
.hitTestBehavior(HitTestMode.Transparent)
|
.hitTestBehavior(HitTestMode.Transparent)
|
||||||
Text("后")
|
Text("后")
|
||||||
.fontColor(0xffffff)
|
.fontColor(0xffffff)
|
||||||
.fontSize(28)
|
.fontSize(28)
|
||||||
.offset({ y: 100 })
|
.offset({ y: 70 })
|
||||||
.hitTestBehavior(HitTestMode.Transparent)
|
.hitTestBehavior(HitTestMode.Transparent)
|
||||||
}.width("100%").height("100%")
|
}.width("100%").height("100%")
|
||||||
|
|
||||||
} else {
|
}.layoutWeight(1)
|
||||||
ControlButton({
|
|
||||||
title: button[this.select][0], button: "采集", onCustomClick: () => {
|
|
||||||
this.onCollectCommand()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
ControlButton({
|
|
||||||
title: button[this.select][1], button: "前往", onCustomClick: () => {
|
|
||||||
this.onMoveCommand()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}.width("100%").layoutWeight(1).padding({ left: 12, right: 12 }).alignItems(VerticalAlign.Center)
|
||||||
.layoutWeight(1)
|
|
||||||
.height("100%")
|
|
||||||
.justifyContent(FlexAlign.SpaceAround)
|
|
||||||
.padding({ bottom: this.select === 3 ? 0 : 100 })
|
|
||||||
}.width("100%").layoutWeight(1).padding({ left: 12, right: 12 })
|
|
||||||
|
|
||||||
}.width("100%").height("100%").padding(18)
|
}.width("100%").height("100%").padding(18)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { CusButton } from '../components/button/Index'
|
|||||||
import { Layout } from '../components/layout/Index'
|
import { Layout } from '../components/layout/Index'
|
||||||
import { router } from '@kit.ArkUI'
|
import { router } from '@kit.ArkUI'
|
||||||
import { Option } from '../../typings/Common'
|
import { Option } from '../../typings/Common'
|
||||||
|
import { Title } from '../components/title/Index'
|
||||||
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ -25,6 +26,15 @@ struct Filing {
|
|||||||
build() {
|
build() {
|
||||||
Column() {
|
Column() {
|
||||||
Layout({ mode: 2 }) {
|
Layout({ mode: 2 }) {
|
||||||
|
Column() {
|
||||||
|
Row() {
|
||||||
|
Title({ title: "备案信息" })
|
||||||
|
CusButton({ normalImage: $rawfile("images/back.png"), style: { width: 120, height: 50 } })
|
||||||
|
.margin({ left: 24 }).onClick(() => {
|
||||||
|
router.back()
|
||||||
|
})
|
||||||
|
}.margin({ bottom: 18 })
|
||||||
|
|
||||||
Column() {
|
Column() {
|
||||||
ForEach(this.data, (item: Option) => {
|
ForEach(this.data, (item: Option) => {
|
||||||
Row() {
|
Row() {
|
||||||
@ -68,7 +78,8 @@ struct Filing {
|
|||||||
router.back()
|
router.back()
|
||||||
})
|
})
|
||||||
}.margin({ top: 24 })
|
}.margin({ top: 24 })
|
||||||
}.height("100%").padding({ left: 64, right: 64 }).justifyContent(FlexAlign.Center)
|
}.layoutWeight(1).padding({ left: 64, right: 64 }).justifyContent(FlexAlign.Center)
|
||||||
|
}.width("100%").height("100%").padding(18)
|
||||||
}
|
}
|
||||||
}.width("100%").height("100%")
|
}.width("100%").height("100%")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { Footer } from './components/Footer'
|
|||||||
import { Block } from './components/Block'
|
import { Block } from './components/Block'
|
||||||
import { LineCard } from './components/LineCard'
|
import { LineCard } from './components/LineCard'
|
||||||
import { WarnCard } from './components/WarnCard'
|
import { WarnCard } from './components/WarnCard'
|
||||||
|
import { RingOptions, RingProgress } from '../ring/Index'
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Entry
|
@Entry
|
||||||
@ -14,14 +14,14 @@ struct Home {
|
|||||||
@State line: number[] = [1, 2, 3, 4]
|
@State line: number[] = [1, 2, 3, 4]
|
||||||
@State warn: number[] = [1, 2, 3, 4]
|
@State warn: number[] = [1, 2, 3, 4]
|
||||||
@State select: number = 0
|
@State select: number = 0
|
||||||
private image: Resource[] = [
|
@State ring: RingOptions[] = [
|
||||||
$rawfile('images/home/备案信息.png'),
|
{ color: 0xffcc31, count: 10 },
|
||||||
$rawfile('images/home/线路监控.png'),
|
{ color: 0x33ff29, count: 20 },
|
||||||
$rawfile('images/home/预警处理.png'),
|
{ color: 0xff3a48, count: 30 },
|
||||||
$rawfile('images/home/结果查询.png'),
|
]
|
||||||
$rawfile('images/home/机器人控制.png'),
|
@State ring2: RingOptions[] = [
|
||||||
$rawfile('images/home/车型库采集.png'),
|
{ color: 0x034B61, count: 10, animate: false },
|
||||||
$rawfile('images/home/机器人重置.png'),
|
{ color: 0x06CDF5, count: 10 },
|
||||||
]
|
]
|
||||||
private timeTick: number = -1
|
private timeTick: number = -1
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ struct Home {
|
|||||||
label: item.toString(),
|
label: item.toString(),
|
||||||
select: this.select === index
|
select: this.select === index
|
||||||
})
|
})
|
||||||
}.width("100%").height(100).onClick(() => {
|
}.width("100%").constraintSize({ minHeight: 100 }).onClick(() => {
|
||||||
this.select = index
|
this.select = index
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -127,30 +127,8 @@ struct Home {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column() {
|
Column() {
|
||||||
Stack({ alignContent: Alignment.Center }) {
|
RingProgress({ option: this.ring, style: { width: 290, height: 290 } })
|
||||||
Circle()
|
.margin({ top: 45.5, left: 1.5 })
|
||||||
.width("100%")
|
|
||||||
.height("100%")
|
|
||||||
.strokeWidth(20)
|
|
||||||
.stroke(0xffcc31)
|
|
||||||
.fillOpacity(0)
|
|
||||||
Circle()
|
|
||||||
.width("100%")
|
|
||||||
.height("100%")
|
|
||||||
.strokeWidth(20)
|
|
||||||
.stroke(0x33ff29)
|
|
||||||
.fillOpacity(0)
|
|
||||||
Circle()
|
|
||||||
.width("100%")
|
|
||||||
.height("100%")
|
|
||||||
.strokeWidth(20)
|
|
||||||
.stroke(0xff3a48)
|
|
||||||
.fillOpacity(0)
|
|
||||||
Column() {
|
|
||||||
Text("查验数量").fontSize(32).fontColor(0xffffff).fontFamily("Alimama")
|
|
||||||
Text("86").fontSize(36).fontColor(0xffffff).fontFamily("Alimama")
|
|
||||||
}
|
|
||||||
}.width(290).height(290).margin({ top: 45.5, left: 1.5 })
|
|
||||||
|
|
||||||
Row() {
|
Row() {
|
||||||
Column() {
|
Column() {
|
||||||
@ -213,19 +191,14 @@ struct Home {
|
|||||||
Text("总预警异常事件个数").fontSize(14).fontColor(0xffffff)
|
Text("总预警异常事件个数").fontSize(14).fontColor(0xffffff)
|
||||||
}.height("100%").layoutWeight(1).justifyContent(FlexAlign.SpaceAround).alignItems(HorizontalAlign.Center)
|
}.height("100%").layoutWeight(1).justifyContent(FlexAlign.SpaceAround).alignItems(HorizontalAlign.Center)
|
||||||
|
|
||||||
|
|
||||||
Stack({ alignContent: Alignment.Center }) {
|
Stack({ alignContent: Alignment.Center }) {
|
||||||
Circle()
|
|
||||||
.width(72)
|
RingProgress({
|
||||||
.height(72)
|
option: this.ring2,
|
||||||
.strokeWidth(10)
|
style: { height: 72, width: 72 },
|
||||||
.stroke(0x034B61)
|
strokeWidth: 10
|
||||||
.fillOpacity(0)
|
})
|
||||||
Circle()
|
|
||||||
.width(72)
|
|
||||||
.height(72)
|
|
||||||
.strokeWidth(10)
|
|
||||||
.stroke(0x06CDF5)
|
|
||||||
.fillOpacity(0)
|
|
||||||
Column() {
|
Column() {
|
||||||
Text("75%").fontColor(0xffffff).fontSize(16)
|
Text("75%").fontColor(0xffffff).fontSize(16)
|
||||||
Text("已处理").fontColor(0xffffff).fontSize(14)
|
Text("已处理").fontColor(0xffffff).fontSize(14)
|
||||||
|
|||||||
@ -3,6 +3,51 @@ import { router } from '@kit.ArkUI'
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
export struct Footer {
|
export struct Footer {
|
||||||
|
@State mediaWidth: number = 0
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
buildMenu() {
|
||||||
|
Menu() {
|
||||||
|
MenuItem() {
|
||||||
|
CusButton({
|
||||||
|
normalImage: $rawfile("images/home/filing.png"),
|
||||||
|
activeImage: $rawfile("images/home/filing_active.png"),
|
||||||
|
style: { width: "100%", height: 54 }
|
||||||
|
}).margin({ bottom: 5 }).onClick(() => {
|
||||||
|
router.pushUrl({
|
||||||
|
url: "pages/filing/Index"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem() {
|
||||||
|
CusButton({
|
||||||
|
normalImage: $rawfile("images/home/reboot.png"),
|
||||||
|
activeImage: $rawfile("images/home/reboot_active.png"),
|
||||||
|
style: { width: "100%", height: 54 }
|
||||||
|
}).margin({ bottom: 5 }).onClick(() => {
|
||||||
|
router.pushUrl({
|
||||||
|
url: "pages/reboot/Index"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem() {
|
||||||
|
CusButton({
|
||||||
|
normalImage: $rawfile("images/home/config.png"),
|
||||||
|
activeImage: $rawfile("images/home/config_active.png"),
|
||||||
|
style: { width: "100%", height: 54 }
|
||||||
|
}).onClick(() => {
|
||||||
|
router.pushUrl({
|
||||||
|
url: "pages/setting/Index"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.width(this.mediaWidth)
|
||||||
|
.borderRadius(0)
|
||||||
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
Row() {
|
Row() {
|
||||||
Column() {
|
Column() {
|
||||||
@ -27,8 +72,8 @@ export struct Footer {
|
|||||||
})
|
})
|
||||||
|
|
||||||
CusButton({
|
CusButton({
|
||||||
normalImage: $rawfile("images/home/reboot.png"),
|
normalImage: $rawfile("images/home/robot.png"),
|
||||||
activeImage: $rawfile("images/home/reboot_active.png"),
|
activeImage: $rawfile("images/home/robot_active.png"),
|
||||||
style: { height: 64 }
|
style: { height: 64 }
|
||||||
}).layoutWeight(1).margin({ left: 4, right: 4 }).onClick(() => {
|
}).layoutWeight(1).margin({ left: 4, right: 4 }).onClick(() => {
|
||||||
router.pushUrl({
|
router.pushUrl({
|
||||||
@ -50,7 +95,11 @@ export struct Footer {
|
|||||||
normalImage: $rawfile("images/home/setting.png"),
|
normalImage: $rawfile("images/home/setting.png"),
|
||||||
activeImage: $rawfile("images/home/setting_active.png"),
|
activeImage: $rawfile("images/home/setting_active.png"),
|
||||||
style: { height: 64 }
|
style: { height: 64 }
|
||||||
}).layoutWeight(1).margin({ left: 8 })
|
}).layoutWeight(1).margin({ left: 8 }).bindMenu(this.buildMenu, {
|
||||||
|
borderRadius: 3,
|
||||||
|
}).onSizeChange((_, area) => {
|
||||||
|
this.mediaWidth = Number(area.width)
|
||||||
|
})
|
||||||
|
|
||||||
}.width("100%").height(100).alignItems(VerticalAlign.Bottom)
|
}.width("100%").height(100).alignItems(VerticalAlign.Bottom)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,48 +16,40 @@ export struct LineCard {
|
|||||||
.fontColor(0xfffff)
|
.fontColor(0xfffff)
|
||||||
.fontWeight(700)
|
.fontWeight(700)
|
||||||
.margin({ right: 12 })
|
.margin({ right: 12 })
|
||||||
Column() {
|
Blank()
|
||||||
Row() {
|
Row() {
|
||||||
|
Row() {
|
||||||
|
Image($rawfile("images/home/warn.png")).height(12).margin({ right: 4 })
|
||||||
|
Text("告警").fontColor(0xF3B43B).fontSize(12)
|
||||||
|
}.alignItems(VerticalAlign.Center).margin({ right: 6 })
|
||||||
|
|
||||||
|
Row() {
|
||||||
|
Image($rawfile("images/home/using.png")).height(12).margin({ right: 4 })
|
||||||
|
Text("使用中").fontColor(0x33FF29).fontSize(12)
|
||||||
|
}.alignItems(VerticalAlign.Center).margin({ right: 6 })
|
||||||
|
|
||||||
// Row() {
|
// Row() {
|
||||||
// Image($rawfile("images/home/error.png")).height(16).margin({ right: 4 })
|
// Image($rawfile("images/home/stop.png")).height(12).margin({ right: 4 })
|
||||||
// Text("故障").fontColor(0xFF3A48).fontSize(16)
|
// Text("未启动").fontColor(0xDBDBDB).fontSize(12)
|
||||||
// }.alignItems(VerticalAlign.Center).margin({ right: 6 })
|
// }.alignItems(VerticalAlign.Center).margin({ right: 6 })
|
||||||
|
|
||||||
Row() {
|
Row() {
|
||||||
Image($rawfile("images/home/warn.png")).height(16).margin({ right: 4 })
|
Image($rawfile("images/home/electric_normal.png")).height(12).margin({ right: 4 })
|
||||||
Text("告警").fontColor(0xF3B43B).fontSize(16)
|
Text("电量:65%").fontColor(0x33FF29).fontSize(12)
|
||||||
}.alignItems(VerticalAlign.Center).margin({ right: 6 })
|
|
||||||
|
|
||||||
Row() {
|
|
||||||
Image($rawfile("images/home/using.png")).height(16).margin({ right: 4 })
|
|
||||||
Text("使用中").fontColor(0x33FF29).fontSize(16)
|
|
||||||
}.alignItems(VerticalAlign.Center).margin({ right: 6 })
|
|
||||||
|
|
||||||
//
|
|
||||||
// Row() {
|
|
||||||
// Image($rawfile("images/home/stop.png")).height(16).margin({ right: 4 })
|
|
||||||
// Text("未启动").fontColor(0xDBDBDB).fontSize(16)
|
|
||||||
// }.alignItems(VerticalAlign.Center).margin({ right: 6 })
|
|
||||||
Row() {
|
|
||||||
Text("步骤一").fontColor(0x33FF29).fontSize(16)
|
|
||||||
}.alignItems(VerticalAlign.Center).margin({ right: 6 })
|
|
||||||
}.margin({ bottom: 6 })
|
|
||||||
|
|
||||||
Row() {
|
|
||||||
Row() {
|
|
||||||
Image($rawfile("images/home/electric_normal.png")).height(16).margin({ right: 4 })
|
|
||||||
Text("电量").fontColor(0x33FF29).fontSize(16)
|
|
||||||
}.alignItems(VerticalAlign.Center).margin({ right: 6 })
|
}.alignItems(VerticalAlign.Center).margin({ right: 6 })
|
||||||
|
|
||||||
// Row() {
|
// Row() {
|
||||||
// Image($rawfile("images/home/electric_warn.png")).height(16).margin({ right: 4 })
|
// Image($rawfile("images/home/electric_warn.png")).height(12).margin({ right: 4 })
|
||||||
// Text("电量").fontColor(0xFF3A48).fontSize(16)
|
// Text("电量").fontColor(0xFF3A48).fontSize(12)
|
||||||
// }.alignItems(VerticalAlign.Center)
|
// }.alignItems(VerticalAlign.Center)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
.justifyContent(FlexAlign.SpaceBetween)
|
||||||
.justifyContent(FlexAlign.End)
|
}.margin({ bottom: 8 }).width("100%")
|
||||||
.layoutWeight(1)
|
|
||||||
}.margin({ bottom: 12 })
|
Row() {
|
||||||
|
Text("当前步骤").fontSize(16).fontColor(0xffffff)
|
||||||
|
}.margin({ bottom: 12 }).width("100%")
|
||||||
|
|
||||||
Row() {
|
Row() {
|
||||||
CusButton({
|
CusButton({
|
||||||
@ -89,7 +81,6 @@ export struct LineCard {
|
|||||||
bottom: 6
|
bottom: 6
|
||||||
})
|
})
|
||||||
.width("100%")
|
.width("100%")
|
||||||
.height("100%")
|
|
||||||
.borderRadius(10)
|
.borderRadius(10)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
91
entry/src/main/ets/pages/ring/Index.ets
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
export interface RingOptions {
|
||||||
|
color: ResourceColor
|
||||||
|
count: number
|
||||||
|
animate?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
export struct RingProgress {
|
||||||
|
@Prop @Watch("setup") option: RingOptions[] = []
|
||||||
|
@Prop style: SizeOptions
|
||||||
|
@State percent: number[] = []
|
||||||
|
private total: number = 0
|
||||||
|
public strokeWidth: number = 20
|
||||||
|
|
||||||
|
aboutToAppear(): void {
|
||||||
|
this.setup()
|
||||||
|
}
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
this.total = this.option.reduce((p: number, c: RingOptions) => p + c.count, 0)
|
||||||
|
let prev = 0
|
||||||
|
this.option.forEach((item, index) => {
|
||||||
|
this.percent[index] = prev
|
||||||
|
prev += item.count / this.total
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
Stack({ alignContent: Alignment.Center }) {
|
||||||
|
ForEach(this.option, (item: RingOptions, index: number) => {
|
||||||
|
singleRing({
|
||||||
|
color: item.color,
|
||||||
|
style: this.style,
|
||||||
|
percent: this.percent[index] || 0,
|
||||||
|
animate: item.animate ?? true,
|
||||||
|
strokeWidth: this.strokeWidth
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
}.width(this.style.width).height(this.style.height)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
struct singleRing {
|
||||||
|
@Prop color: ResourceColor
|
||||||
|
@Prop style: SizeOptions
|
||||||
|
@Prop @Watch("setup") percent: number
|
||||||
|
@State dashOffset: number[] = [0, 0]
|
||||||
|
public strokeWidth: number = 20
|
||||||
|
public animate: boolean = true
|
||||||
|
|
||||||
|
aboutToAppear(): void {
|
||||||
|
let r = Number(this.style!.width!) / 2
|
||||||
|
let perimeter = Math.PI * 2 * r
|
||||||
|
this.dashOffset = [0, perimeter]
|
||||||
|
this.setup()
|
||||||
|
}
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
let r = Number(this.style!.width!) / 2
|
||||||
|
let perimeter = Math.PI * 2 * r
|
||||||
|
let changeLine = perimeter * (1 - this.percent) - this.dashOffset[0]
|
||||||
|
let changeDash = perimeter * this.percent - this.dashOffset[1]
|
||||||
|
let time = 0
|
||||||
|
|
||||||
|
let tick = setInterval(() => {
|
||||||
|
time++
|
||||||
|
if (time > 30) {
|
||||||
|
clearInterval(tick)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.dashOffset = [this.dashOffset[0] + changeLine / 30, this.dashOffset[1] + changeDash / 30]
|
||||||
|
}, 1000 / 60)
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
Circle()
|
||||||
|
.width(this.style.width)
|
||||||
|
.height(this.style.height)
|
||||||
|
.strokeWidth(this.strokeWidth)
|
||||||
|
.stroke(this.color)
|
||||||
|
.fillOpacity(0)
|
||||||
|
.strokeDashArray(this.dashOffset)
|
||||||
|
.rotate({
|
||||||
|
angle: -90
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,7 @@
|
|||||||
|
import { CusButton } from '../components/button/Index'
|
||||||
import { Layout } from '../components/layout/Index'
|
import { Layout } from '../components/layout/Index'
|
||||||
|
import { Title } from '../components/title/Index'
|
||||||
|
import { router } from '@kit.ArkUI'
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Entry
|
@Entry
|
||||||
@ -6,6 +9,15 @@ struct Setting {
|
|||||||
build() {
|
build() {
|
||||||
Column() {
|
Column() {
|
||||||
Layout({ mode: 2 }) {
|
Layout({ mode: 2 }) {
|
||||||
|
Column() {
|
||||||
|
Row() {
|
||||||
|
Title({ title: "系统配置" })
|
||||||
|
CusButton({ normalImage: $rawfile("images/back.png"), style: { width: 120, height: 50 } })
|
||||||
|
.margin({ left: 24 }).onClick(() => {
|
||||||
|
router.back()
|
||||||
|
})
|
||||||
|
}.margin({ bottom: 18 })
|
||||||
|
}.width("100%").height("100%").padding(18)
|
||||||
}
|
}
|
||||||
}.width("100%").height("100%")
|
}.width("100%").height("100%")
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 400 KiB |
BIN
entry/src/main/resources/rawfile/images/home/config.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
entry/src/main/resources/rawfile/images/home/config_active.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
entry/src/main/resources/rawfile/images/home/filing.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
entry/src/main/resources/rawfile/images/home/filing_active.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
BIN
entry/src/main/resources/rawfile/images/home/menu.png
Normal file
|
After Width: | Height: | Size: 175 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 6.6 KiB |
BIN
entry/src/main/resources/rawfile/images/home/robot.png
Normal file
|
After Width: | Height: | Size: 75 KiB |
BIN
entry/src/main/resources/rawfile/images/home/robot_active.png
Normal file
|
After Width: | Height: | Size: 33 KiB |