123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664 |
- import {componentLocation} from '../model/ComponentLocation'
- import { TitleStateComp } from '../common/component/TitleStateComp';
- import { BottomOperateComp } from '../common/component/BottomOperateComp';
- import router from '@ohos.router'
- import { TaskComp } from '../common/component/TaskComp'
- import { Warehousing}from '../common/component/Warehousing'
- import { SmartFactoryCard }from '../common/component/SmartFactoryCard'
- import CommonConstants from '../common/constants/CommonConstants'
- import UniversalCard from '../model/UniversalCard'
- @CustomDialog
- struct login {
- @Link textValue: string
- @Link inputValue: string
- controller: CustomDialogController
- cancel: () => void
- confirm: () => void
- build() {
- Column() {
- Text('退出登录')
- .textAlign(TextAlign.Center)
- .fontColor('#e6000000')
- .fontSize(px2vp(53))
- .fontWeight(FontWeight.Medium)
- .width('100%')
- .height('30%')
- Text('是否返回登录页?')
- .textAlign(TextAlign.Center)
- .width('100%')
- .height('30%')
- Row({space:10}){
- Text('取消')
- .width('40%')
- .borderRadius(21)
- .height('70%')
- .textAlign(TextAlign.Center)
- .backgroundColor('#0f000000')
- .fontColor('#0A59F7')
- .onClick(()=>{
- this.controller.close()
- })
- Text('确认')
- .width('40%')
- .height('70%')
- .borderRadius(21)
- .backgroundColor('#0A59F7')
- .textAlign(TextAlign.Center)
- .fontColor('#ffff')
- .onClick(()=>{
- this.controller.close()
- })
- }
- .width('100%')
- .justifyContent(FlexAlign.Center)
- .height('30%')
- }.width('25%')
- .height('20%')
- .borderRadius(15)
- .backgroundColor('#ffff')
- }
- }
- @CustomDialog
- struct confirmPopup {
- @Link cardServices:UniversalCard[]
- controller: CustomDialogController
- cancel: () => void
- confirm: () => void
- @Link x: number
- @Link y: number
- @Link index:number
- build(){
- Column(){
- Column(){
- Row(){
- Image($r('app.media.card'))
- .width(px2vp(50))
- .height(px2vp(50))
- Text('卡片服务')
- .padding({left:10})
- .margin(px2vp(5))
- .width('100%')
- .fontWeight(FontWeight.Medium)
- .fontSize(px2vp(38))
- .textAlign(TextAlign.Start)
- .onClick(()=>{
- this.controller.close()
- this.cardServices[this.index]= {
- id:this.cardServices[this.index].id,
- userId:this.cardServices[this.index].userId,
- cardType:this.cardServices[this.index].cardType,
- cardStatus:1,
- cardSort:this.cardServices[this.index].cardSort,
- }
- })
- }.width('100%')
- .height('80%')
- .padding({left:10})
- .borderRadius(px2vp(15))
- .backgroundColor($r('app.color.general_font_white_color'))
- Divider()
- .width('80%')
- }
- .margin({bottom:5})
- .borderRadius(px2vp(15))
- .height('20%')
- .width('120%')
- .backgroundColor($r('app.color.general_font_white_color'))
- Image(this.index===1?$r("app.media.processImages"):$r('app.media.storage'))
- .width(px2vp(220))
- .height(px2vp(220))
- .borderRadius(15)
- }
- .alignItems(HorizontalAlign.Start)
- .width('350px')
- .height('600px')
- .offset({x:this.x+20+'px', y:this.y-340+'px'})
- }
- }
- @CustomDialog
- struct shutdown {
- @Link shutdownTransparency:number
- @Link textValue: string
- @Link inputValue: string
- controller: CustomDialogController
- cancel: () => void
- confirm: () => void
- build() {
- Column() {
- Row(){
- Image($r('app.media.restart'))
- .width(px2vp(107))
- .height(px2vp(107))
- .onClick(()=>{
- this.shutdownTransparency=0
- this.controller.close()
- })
- Blank()
- Image($r('app.media.shutdown'))
- .width(px2vp(107))
- .height(px2vp(107))
- .onClick(()=>{
- this.shutdownTransparency=0
- this.controller.close()
- })
- }.width('100%')
- .height('50%')
- Row(){
- Text('重启')
- .fontWeight(FontWeight.Medium)
- .fontSize(px2vp(27))
- .width(px2vp(107))
- .height(px2vp(107))
- .textAlign(TextAlign.Center)
- .fontColor('#FFFFFF')
- Blank()
- Text('关机')
- .fontWeight(FontWeight.Medium)
- .fontSize(px2vp(27))
- .width(px2vp(107))
- .textAlign(TextAlign.Center)
- .height(px2vp(107))
- .fontColor('#FFFFFF')
- }.width('100%')
- .height('30%')
- }.width('20%')
- .height('20%')
- .borderRadius(15)
- }
- }
- @Entry
- @Component
- struct Index {
- @State index:number=0
- @State x:number=0
- @State y:number=0
- @State cardServices:UniversalCard[] = CommonConstants.Card_DATA
- @State SmartFactoryCardDelete:number=0
- @State SmartFactoryDelete:number=0
- @State SmartFactoryCarLongPressDelete:number=0
- @State storageCardDelete:number=0
- @State smartWarehouseCard:number=0
- @State avatarFrame:boolean=false
- @State deleteConfirmation:number=0
- @State longPressDelete:number=0
- scroller: Scroller = new Scroller()
- @State shutdownTransparency:number=0
- @State YanSe: number = 0
- @State carswitch:number=0
- private isHomePage: boolean = true
- @State textValue: string = ''
- @State inputValue: string = ''
- loginDialogController: CustomDialogController = new CustomDialogController({
- builder:login({
- textValue: $textValue,
- inputValue: $inputValue,
- }),
- alignment: DialogAlignment.Center,
- autoCancel:false,
- customStyle:true
- })
- shutdownDialogController: CustomDialogController = new CustomDialogController({
- builder:shutdown({
- textValue: $textValue,
- inputValue: $inputValue,
- shutdownTransparency:this.shutdownTransparency
- }),
- alignment: DialogAlignment.Center,
- autoCancel:false,
- customStyle:true
- })
- confirmPopupDialogController: CustomDialogController = new CustomDialogController({
- builder: confirmPopup({
- x:this.x,
- y:this.y,
- index:this.index,
- cardServices:this.cardServices
- }
- ),
- alignment: DialogAlignment.TopStart,
- autoCancel:true,
- customStyle:true,
- })
- build() {
- Stack(){
- Row() {
- Column() {
- TitleStateComp({ isHomePage: this.isHomePage })
- .onClick(()=>{
- this.avatarFrame=!this.avatarFrame
- })
- Row() {
- Flex({ wrap: FlexWrap.Wrap }) {
- if (this.cardServices[1].cardStatus===1){
- Stack(){
- Column(){
- TaskComp({isHomePage: this.isHomePage})
- Text('生产操作')
- .fontSize(px2vp(27))
- .margin({top:5})
- .fontWeight(FontWeight.Medium)
- .fontColor($r('app.color.robot_set_card_white'))
- }
- .height('40%')
- .width('32%')
- .gesture(
- LongPressGesture({ repeat: false })
- .onActionEnd(() => {
- this.deleteConfirmation=1
- })
- )
- if (this.deleteConfirmation===1){
- Row(){
- Text('取消')
- .fontWeight(FontWeight.Medium)
- .fontSize(px2vp(27))
- .textAlign(TextAlign.Center)
- .width('20%')
- .height('20%')
- .margin(10)
- .borderRadius(px2vp(21))
- .fontColor($r('app.color.robot_set_card_blue'))
- .backgroundColor($r('app.color.general_font_white_color'))
- .onClick(()=>{
- this.deleteConfirmation=0
- })
- Text('删除')
- .fontWeight(FontWeight.Medium)
- .fontSize(px2vp(27))
- .width('20%')
- .margin(10)
- .fontColor($r('app.color.general_font_white_color'))
- .borderRadius(px2vp(21))
- .height('20%')
- .textAlign(TextAlign.Center)
- .backgroundColor( $r('app.color.robot_set_card_blue'))
- .onClick(()=>{
- this.deleteConfirmation=0
- this.cardServices[1]= {
- id:this.cardServices[1].id,
- userId:this.cardServices[1].userId,
- cardType:this.cardServices[1].cardType,
- cardStatus:2,
- cardSort:this.cardServices[1].cardSort,
- }
- })
- }
- .justifyContent(FlexAlign.Center)
- .height('40%')
- .width('32%')
- }
- }
- }
- if (this.cardServices[0].cardStatus===1){
- Stack(){
- Column(){
- Warehousing()
- Text('智能仓储')
- .margin({top:5})
- .fontSize(px2vp(27))
- .fontWeight(FontWeight.Medium)
- .fontColor($r('app.color.robot_set_card_white'))
- }
- .height('40%')
- .width('32%')
- .margin({left:10})
- .onClick(()=>{
- router.pushUrl({
- url:'pages/Storage'
- })
- })
- .gesture(
- LongPressGesture({ repeat: false })
- .onActionEnd(() => {
- this.smartWarehouseCard=1
- })
- )
- if (this.smartWarehouseCard===1){
- Row(){
- Text('取消')
- .fontWeight(FontWeight.Medium)
- .fontSize(px2vp(27))
- .textAlign(TextAlign.Center)
- .width('20%')
- .height('20%')
- .margin(10)
- .borderRadius(px2vp(21))
- .fontColor($r('app.color.robot_set_card_blue'))
- .backgroundColor($r('app.color.general_font_white_color'))
- .onClick(()=>{
- this.smartWarehouseCard=0
- })
- Text('删除')
- .fontWeight(FontWeight.Medium)
- .fontSize(px2vp(27))
- .width('20%')
- .margin(10)
- .fontColor($r('app.color.general_font_white_color'))
- .borderRadius(px2vp(21))
- .height('20%')
- .textAlign(TextAlign.Center)
- .backgroundColor( $r('app.color.robot_set_card_blue'))
- .onClick(()=>{
- this.smartWarehouseCard=0
- this.cardServices[0]= {
- id:this.cardServices[0].id,
- userId:this.cardServices[0].userId,
- cardType:this.cardServices[0].cardType,
- cardStatus:2,
- cardSort:this.cardServices[0].cardSort,
- }
- })
- }
- .justifyContent(FlexAlign.Center)
- .height('40%')
- .width('32%')
- }
- }
- }
- if (this.SmartFactoryCardDelete===0){
- Stack(){
- Column(){
- SmartFactoryCard()
- Text('智汇工厂')
- .margin({top:5})
- .fontSize(px2vp(27))
- .fontWeight(FontWeight.Medium)
- .fontColor($r('app.color.robot_set_card_white'))
- }
- .height('40%')
- .width('32%')
- .margin({left:10})
- .onClick(()=>{
- router.pushUrl({
- url:'pages/SmartFactory'
- })
- })
- .gesture(
- LongPressGesture({ repeat: false })
- .onActionEnd(() => {
- this.SmartFactoryCarLongPressDelete=1
- })
- )
- if (this.SmartFactoryCarLongPressDelete===1){
- Row(){
- Text('取消')
- .fontWeight(FontWeight.Medium)
- .fontSize(px2vp(27))
- .textAlign(TextAlign.Center)
- .width('20%')
- .height('20%')
- .margin(10)
- .borderRadius(px2vp(21))
- .fontColor($r('app.color.robot_set_card_blue'))
- .backgroundColor($r('app.color.general_font_white_color'))
- .onClick(()=>{
- this.SmartFactoryCarLongPressDelete=0
- })
- Text('删除')
- .fontWeight(FontWeight.Medium)
- .fontSize(px2vp(27))
- .width('20%')
- .margin(10)
- .fontColor($r('app.color.general_font_white_color'))
- .borderRadius(px2vp(21))
- .height('20%')
- .textAlign(TextAlign.Center)
- .backgroundColor( $r('app.color.robot_set_card_blue'))
- .onClick(()=>{
- this.SmartFactoryCarLongPressDelete=0
- this.SmartFactoryCardDelete=1
- })
- }
- .justifyContent(FlexAlign.Center)
- .height('40%')
- .width('32%')
- }
- }
- }
- }
- .width('100%')
- .height('100%')
- }
- .justifyContent(FlexAlign.Center)
- .width('100%')
- .height('68%')
- Row({ space: 10 }) {
- Text().width('1%')
- Column({ space: 10 }) {
- Image($r("app.media.shezhi"))
- .width('60%')
- .height('60%')
- .margin({top:5})
- Text('设置')
- .width('100%')
- .textAlign(TextAlign.Center)
- .fontSize(16)
- .fontColor('#ffff')
- }
- .width('10%')
- .justifyContent(FlexAlign.Center)
- .backdropBlur(13)
- .height('90%')
- .borderRadius(15)
- .backgroundColor('#4d000000')
- .onClick(() => {
- router.pushUrl({
- url: 'pages/SetPage'
- })
- })
- Column({ space: 10 }) {
- Image($r("app.media.storage"))
- .width('60%')
- .height('60%')
- .margin({top:5})
- Text('智能仓储')
- .width('100%')
- .textAlign(TextAlign.Center)
- .fontSize(16)
- .fontColor('#ffff')
- }
- .width('10%')
- .justifyContent(FlexAlign.Center)
- .height('90%')
- .borderRadius(15)
- .backgroundColor('#4d000000')
- .id('smartWarehousing')
- .onClick(() => {
- router.pushUrl({
- url: 'pages/Storage'
- })
- })
- .gesture(
- LongPressGesture({ repeat: false })
- .onActionEnd(() => {
- let rect = componentLocation.getComponentRect('smartWarehousing')
- let touchPoint: TouchObject = {
- id: 1,
- x: rect.left, // 组件中心点x坐标
- y:rect.bottom, // 组件中心点y坐标
- type: TouchType.Down,
- screenX: rect.left + (rect.right - rect.left) / 2, // 组件中心点x坐标
- screenY: rect.left + (rect.right - rect.left) / 2, // 组件中心点y坐标
- }
- this.x=touchPoint.x
- this.y=touchPoint.y
- this.index=0
- this.confirmPopupDialogController.open()
- })
- )
- Column({ space: 10 }) {
- Image($r('app.media.jiqiren'))
- .width('60%')
- .height('60%')
- .margin({top:5})
- Text('机器人调试')
- .width('100%')
- .textAlign(TextAlign.Center)
- .fontSize(16)
- .fontColor('#ffff')
- }
- .width('10%')
- .justifyContent(FlexAlign.Center)
- .height('90%')
- .borderRadius(15)
- .backgroundColor('#4d000000')
- .onClick(() => {
- router.pushUrl({
- url: 'pages/RobotDebug'
- })
- })
- Column({ space: 10 }) {
- Image($r("app.media.processImages"))
- .width('60%')
- .height('60%')
- .margin({top:5})
- Text('工序操作')
- .width('100%')
- .textAlign(TextAlign.Center)
- .fontSize(16)
- .fontColor('#ffff')
- }
- .width('10%')
- .justifyContent(FlexAlign.Center)
- .height('90%')
- .borderRadius(15)
- .id('workingProcedure')
- .backgroundColor('#4d000000')
- .onClick(() => {
- router.pushUrl({
- url: 'pages/process/ProcessHome'
- })
- })
- .gesture(
- LongPressGesture({ repeat: false })
- .onActionEnd(() => {
- let rect = componentLocation.getComponentRect('workingProcedure')
- let touchPoint: TouchObject = {
- id: 1,
- x: rect.left, // 组件中心点x坐标
- y:rect.bottom, // 组件中心点y坐标
- type: TouchType.Down,
- screenX: rect.left + (rect.right - rect.left) / 2, // 组件中心点x坐标
- screenY: rect.left + (rect.right - rect.left) / 2, // 组件中心点y坐标
- }
- this.x=touchPoint.x
- this.y=touchPoint.y
- this.index=1
- this.confirmPopupDialogController.open()
- })
- )
- Column({ space: 10 }) {
- Image($r('app.media.baobiao'))
- .width('60%')
- .height('60%')
- .margin({top:5})
- Text('统计报表')
- .width('100%')
- .textAlign(TextAlign.Center)
- .fontSize(16)
- .fontColor('#ffff')
- }
- .width('10%')
- .justifyContent(FlexAlign.Center)
- .height('90%')
- .borderRadius(15)
- .backgroundColor('#4d000000')
- }
- .width('100%')
- .height('16%')
- BottomOperateComp({ isHomePage: this.isHomePage,
- }
- )
- }
- .backgroundImage($r('app.media.BG'))
- .backgroundImageSize({ width: '100%', height: '100%' })
- .width('100%')
- .height('100%')
- }
- .height('100%')
- .width('100%')
- if (this.avatarFrame){
- Column(){
- Text('个人设置')
- .height('33%')
- .fontSize(px2vp(32))
- .fontWeight(FontWeight.Medium)
- .fontColor('#e6000000')
- Divider()
- Text('退出登录')
- .height('33%')
- .fontSize(px2vp(32))
- .fontWeight(FontWeight.Medium)
- .fontColor('#e6000000')
- .onClick(()=>{
- this.loginDialogController.open()
- })
- Divider()
- Text('开关/重启')
- .height('33%')
- .fontSize(px2vp(32))
- .fontWeight(FontWeight.Medium)
- .fontColor('#e6000000')
- .onClick(()=>{
- this.shutdownTransparency=1
- this.shutdownDialogController.open()
- this.avatarFrame=!this.avatarFrame
- })
- }.width('15%')
- .height('25%')
- .backgroundColor('#ffff')
- .margin({top:'4%',right:'1%'})
- .borderRadius(21)
- }
- if (this.shutdownTransparency===1){
- Column(){
- }.width('100%')
- .backgroundColor('#cc000000')
- .height('100%')
- //.opacity(0.8)
- .blur(30)
- }
- }
- .alignContent(Alignment.TopEnd)
- .height('100%')
- .width('100%')
- }
- // 动画效果
- pageTransition() {
- // 设置1ms是为了使延时生效
- PageTransitionEnter({ duration: 1, curve: Curve.Linear, delay: 400 })
- .scale({
- x: 0,
- y: 0,
- z: 0,
- centerX: '50%',
- centerY: '50%'
- })
- PageTransitionExit({ duration: 0, curve: Curve.Linear })
- }
- }
|