BottomOperateComp.ets 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. import router from '@ohos.router'
  2. import NoticeInfo from '../../model/NoticeInfo'
  3. @CustomDialog
  4. struct factoryCardDialog {
  5. @Link SmartFactoryCardDelete:number
  6. controller: CustomDialogController
  7. cancel: () => void
  8. confirm: () => void
  9. build(){
  10. Column(){
  11. Column(){
  12. Text('卡片服务')
  13. .margin(px2vp(5))
  14. .width('100%')
  15. .fontWeight(FontWeight.Medium)
  16. .fontSize(px2vp(38))
  17. .height('50%')
  18. .textAlign(TextAlign.Start)
  19. .onClick(()=>{
  20. this.controller.close()
  21. this.SmartFactoryCardDelete=0
  22. })
  23. Divider().width('80%')
  24. Text('删除卡片')
  25. .height('50%')
  26. .margin(px2vp(5))
  27. .width('100%')
  28. .fontWeight(FontWeight.Medium)
  29. .fontSize(px2vp(38))
  30. .textAlign(TextAlign.Start)
  31. .onClick(()=>{
  32. this.SmartFactoryCardDelete=1
  33. this.controller.close()
  34. })
  35. }
  36. .borderRadius(px2vp(15))
  37. .width('100%')
  38. .height('40%')
  39. .backgroundColor($r('app.color.process_divider_white_color'))
  40. Image($r('app.media.jg_circular_icon'))
  41. .width(px2vp(150))
  42. .height(px2vp(150))
  43. .borderRadius(15)
  44. }
  45. .alignItems(HorizontalAlign.Start)
  46. .width('10%')
  47. .height('30%')
  48. }
  49. }
  50. /*
  51. * 底部操作栏
  52. * */
  53. @Component
  54. export struct BottomOperateComp {
  55. @Link SmartFactoryCardDelete:number
  56. private isHomePage?: boolean = false
  57. @State isClick:boolean = false
  58. //弹窗
  59. dialogController: CustomDialogController = new CustomDialogController({
  60. builder: NoticeDialog({}),
  61. alignment: DialogAlignment.Center,
  62. customStyle:true,
  63. cancel:()=>{
  64. this.isClick =! this.isClick
  65. }
  66. })
  67. SmartFactoryCardDialogController: CustomDialogController = new CustomDialogController({
  68. builder:factoryCardDialog({
  69. SmartFactoryCardDelete:this.SmartFactoryCardDelete
  70. }
  71. ),
  72. alignment: DialogAlignment.Bottom,
  73. autoCancel:true,
  74. customStyle:true,
  75. offset: { dx: 20, dy: 50 }
  76. })
  77. build() {
  78. Stack() {
  79. Text()
  80. .width('100%')
  81. .height('100%')
  82. .backgroundColor($r('app.color.bottom_bar_background'))
  83. .opacity(this.isHomePage ? $r('app.float.bottom_bar_home_page_opacity') : $r('app.float.bottom_bar_general_opacity'))
  84. .backdropBlur(this.isHomePage ? 13 : 0)
  85. Row() {
  86. Row () {
  87. Image($r('app.media.home_page'))
  88. .height($r('app.float.robot_image_select_size'))
  89. .width($r('app.float.robot_image_select_size'))
  90. }
  91. .height('100%')
  92. .width('7%')
  93. .justifyContent(FlexAlign.Center)
  94. .onClick(()=>{
  95. router.replaceUrl({
  96. url:'pages/Index'
  97. })
  98. })
  99. Row(){
  100. Image($r('app.media.notice'))
  101. .height($r('app.float.robot_image_select_size'))
  102. .width($r('app.float.robot_image_select_size'))
  103. }
  104. .height('100%')
  105. .width('7%')
  106. .justifyContent(FlexAlign.Center)
  107. Row(){
  108. Image($r('app.media.jg_circular_icon'))
  109. .height($r('app.float.storage_space_set_size'))
  110. .width($r('app.float.storage_space_set_size'))
  111. }
  112. .height('100%')
  113. .width('7%')
  114. .justifyContent(FlexAlign.Center)
  115. .onClick(()=>{
  116. router.pushUrl({
  117. url:'pages/SmartFactory'
  118. })
  119. })
  120. .gesture(
  121. LongPressGesture({ repeat: false })
  122. .onActionEnd(() => {
  123. this.SmartFactoryCardDialogController.open()
  124. })
  125. )
  126. Row(){
  127. Image($r('app.media.page_flow'))
  128. .height($r('app.float.robot_image_select_size'))
  129. .width($r('app.float.robot_image_select_size'))
  130. }
  131. .height('100%')
  132. .width('7%')
  133. .justifyContent(FlexAlign.Center)
  134. Row(){
  135. Image($r('app.media.camera'))
  136. .height($r('app.float.robot_image_select_size'))
  137. .width($r('app.float.robot_image_select_size'))
  138. }
  139. .height('100%')
  140. .width('7%')
  141. .justifyContent(FlexAlign.Center)
  142. // Image($r('app.media.volume'))
  143. // .height($r('app.float.general_icon_size'))
  144. // .width($r('app.float.general_icon_size'))
  145. }
  146. .width('100%')
  147. .height('100%')
  148. .justifyContent(FlexAlign.Center)
  149. }
  150. .width('100%')
  151. .height('8%')
  152. }
  153. }
  154. //弹窗组件
  155. @CustomDialog
  156. struct NoticeDialog {
  157. controller: CustomDialogController
  158. Notices: NoticeInfo[]
  159. build() {
  160. Column({space: 10}) {
  161. Row() {
  162. Text('通知')
  163. .fontSize($r('app.float.notice_font_size'))
  164. .fontWeight(FontWeight.Medium)
  165. .fontColor($r('app.color.general_font_color'))
  166. .opacity($r('app.float.general_font_opacity'))
  167. }
  168. Row(){
  169. List(){
  170. ForEach(this.Notices, (item:NoticeInfo) => {
  171. ListItem(){
  172. Row(){
  173. Text(item.Notice)
  174. .fontSize($r('app.float.notice_fontSize_size'))
  175. .fontColor($r('app.color.general_font_color'))
  176. .opacity($r('app.float.general_font_opacity'))
  177. Text(item.NoticeDate)
  178. .fontSize($r('app.float.notice_fontSize_size'))
  179. .fontColor($r('app.color.general_font_color'))
  180. .opacity($r('app.float.card_font_default_opacity'))
  181. }
  182. .justifyContent(FlexAlign.SpaceBetween)
  183. .width('100%')
  184. }
  185. })
  186. }
  187. }
  188. .width('90%')
  189. .height('80%')
  190. .alignItems(VerticalAlign.Top)
  191. .borderRadius($r('app.float.notice_size'))
  192. .borderWidth($r('app.float.general_border_width'))
  193. .borderColor($r('app.color.general_border_color'))
  194. }
  195. .width('45%')
  196. .height('70%')
  197. .justifyContent(FlexAlign.Center)
  198. .backgroundColor($r('app.color.page_general_background'))
  199. .borderRadius($r('app.float.notice_size'))
  200. }
  201. }