UserInfoSetView.ets 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. import common from '@ohos.app.ability.common';
  2. import { MediaBean } from '../common/Bean/MediaBean';
  3. import { MediaHelper } from '../common/Bean/MediaHelper';
  4. import UserModel from '../model/database/UserModel';
  5. import UserInfo from '../model/UserInfo';
  6. ///关于弹窗
  7. @CustomDialog
  8. struct About {
  9. scroller: Scroller = new Scroller()
  10. @State navigation: number = 0
  11. @Link textValue: string
  12. @Link inputValue: string
  13. controller: CustomDialogController
  14. // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在最后
  15. cancel: () => void
  16. confirm: () => void
  17. build(){
  18. Column(){
  19. Text().width("100%")
  20. .height('13%')
  21. .onClick(()=>{
  22. this.controller.close()
  23. })
  24. Row(){
  25. Text().width('25%')
  26. .height('100%')
  27. .onClick(()=>{
  28. this.controller.close()
  29. })
  30. Column({space:10}){
  31. Text('关于')
  32. .fontSize('52px')
  33. .fontColor('#e6000000')
  34. .width('100%')
  35. .textAlign(TextAlign.Center)
  36. Image($r('app.media.OpenHarmony'))
  37. .width('100%')
  38. .height('263px')
  39. .borderRadius(15)
  40. Column({space:1}){
  41. Row(){
  42. Text('型号名称')
  43. Blank()
  44. Text('JG Industrial Pad')
  45. }
  46. .padding({left:10,right:10})
  47. .width('100%')
  48. .height('22%')
  49. Divider()
  50. .width('95%')
  51. Row(){
  52. Text('型号代码')
  53. Blank()
  54. Text('JG-W2024')
  55. }
  56. .padding({left:10,right:10})
  57. .width('100%')
  58. .height('22%')
  59. Divider()
  60. .width('95%')
  61. Row(){
  62. Text('OpenHarmonyOS版本')
  63. Blank()
  64. Text('4.0.0')
  65. }
  66. .padding({left:10,right:10})
  67. .width('100%')
  68. .height('22%')
  69. Divider()
  70. .width('95%')
  71. Row(){
  72. Text('序列号')
  73. Blank()
  74. Text('5JB0224111001129')
  75. }
  76. .padding({left:10,right:10})
  77. .width('100%')
  78. .height('22%')
  79. Divider().width('95%')
  80. }
  81. .width('100%')
  82. .height('40%')
  83. .backgroundColor('#ffff')
  84. .borderRadius(15)
  85. Column(){
  86. Row(){
  87. Text('运行内存')
  88. .fontSize('32px')
  89. Blank()
  90. Text('12GB')
  91. .fontSize('27px')
  92. .fontWeight(FontWeight.Regular)
  93. }.width('100%')
  94. .height('40%')
  95. .padding({left:10,right:10})
  96. Divider()
  97. .width('95%')
  98. Row(){
  99. Row() {
  100. Text('存储')
  101. .height('100%')
  102. .fontSize('32px')
  103. }
  104. .height('100%')
  105. .justifyContent(FlexAlign.Center)
  106. Blank()
  107. Column(){
  108. Text('可用空间:222.5GB')
  109. .fontSize('27px')
  110. Text('总内存:256GB')
  111. .fontSize('27px')
  112. }.width('40%')
  113. .height('100%')
  114. .alignItems(HorizontalAlign.End)
  115. .justifyContent(FlexAlign.Center)
  116. }
  117. .alignItems(VerticalAlign.Center)
  118. .justifyContent(FlexAlign.Center)
  119. .width('100%')
  120. .height('60%')
  121. .padding({left:10,right:10})
  122. }
  123. .width('100%')
  124. .height('20%')
  125. .borderRadius($r('app.float.general_border_radius'))
  126. .backgroundColor('#ffff')
  127. }.width('50%')
  128. .padding(10)
  129. .height('100%')
  130. .borderRadius(15)
  131. .backgroundColor('#F1F3F5')
  132. Text().width('25%')
  133. .height('100%')
  134. .onClick(()=>{
  135. this.controller.close()
  136. })
  137. }
  138. .width('100%')
  139. .height('74%')
  140. Text().width("100%")
  141. .height('13%')
  142. .onClick(()=>{
  143. this.controller.close()
  144. })
  145. }.width("100%")
  146. .height("100%")
  147. .backgroundColor('#4d000000')
  148. }
  149. }
  150. @Entry
  151. @Component
  152. export struct UserInfoSetView {
  153. @State mediaBean: MediaBean = new MediaBean();
  154. @State textValue: string = ''
  155. @State inputValue: string = ''
  156. aboutToDisappear() {
  157. this.AboutDialogController = undefined // 将dialogController置空
  158. }
  159. onCancel() {
  160. console.info('onCancel')
  161. }
  162. onAccept() {
  163. console.info(' onAccept')
  164. }
  165. existApp() {
  166. console.info(' existApp')
  167. }
  168. //关于弹窗控制器
  169. AboutDialogController: CustomDialogController = new CustomDialogController({
  170. builder: About({
  171. cancel: this.onCancel,
  172. confirm: this.onAccept,
  173. textValue: $textValue,
  174. inputValue: $inputValue,
  175. }),
  176. // gridCount: 3,
  177. cancel: this.existApp,
  178. //autoCancel: true,
  179. alignment: DialogAlignment.Center,
  180. //offset: { dx: 0, dy: -20 },
  181. gridCount: 4,
  182. customStyle: true,
  183. })
  184. @State SetUp:number=0
  185. build(){
  186. Row(){
  187. Column({space:10}){
  188. Text()
  189. .height('15%')
  190. Image(this.mediaBean.localUrl)
  191. .width('267px')
  192. .height('267px')
  193. .borderWidth(1)
  194. Text('王德发')
  195. .fontSize($r('app.float.process_card_large_font_size'))
  196. .fontColor($r('app.color.general_font_color'))
  197. .fontWeight(FontWeight.Medium)
  198. .opacity($r('app.float.general_font_opacity'))
  199. Row().height('2.6%')
  200. Text('退出登录')
  201. .width('90%')
  202. .height('11.2%')
  203. .borderRadius($r('app.float.robot_set_radius'))
  204. .textAlign(TextAlign.Center)
  205. .backgroundColor('#0f000000')
  206. Blank()
  207. }
  208. .width('34%')
  209. .height('100%')
  210. Column(){
  211. Text('用户')
  212. .fontColor('#e6000000')
  213. .width('100%')
  214. .height('7%')
  215. .fontSize($r('app.float.process_circulation_font_size'))
  216. .fontColor($r('app.color.general_font_color'))
  217. .fontWeight(FontWeight.Medium)
  218. .opacity($r('app.float.general_font_opacity'))
  219. Row(){
  220. Column({space: 5}){
  221. Text('保持登录')
  222. .fontSize($r('app.float.card_title_font_size'))
  223. .fontColor($r('app.color.general_font_color'))
  224. .fontWeight(FontWeight.Medium)
  225. .opacity($r('app.float.general_font_opacity'))
  226. Text('账号保持登录状态,直至手动退出')
  227. .fontSize($r('app.float.robot_set_font_size'))
  228. .fontColor($r('app.color.general_font_color'))
  229. .fontWeight(FontWeight.Regular)
  230. .opacity($r('app.float.card_font_default_opacity'))
  231. }
  232. .alignItems(HorizontalAlign.Start)
  233. .justifyContent(FlexAlign.Center)
  234. .height('100%')
  235. .width('80%')
  236. Row() {
  237. Toggle({ type: ToggleType.Switch,isOn: true })
  238. .width('96px')
  239. .height('53px')
  240. .onChange(async (isOn: boolean) => {
  241. let userInfo = await UserModel.getLast() as UserInfo
  242. if (isOn) {
  243. userInfo.maintainLoginStatus = 1
  244. } else {
  245. userInfo.maintainLoginStatus = 2
  246. }
  247. userInfo.updateTime = new Date().getTime()
  248. UserModel.updateUser(userInfo)
  249. })
  250. }
  251. .height('100%')
  252. .width('20%')
  253. .justifyContent(FlexAlign.End)
  254. .padding({right: 5})
  255. }.width('100%')
  256. .height('16.3%')
  257. .margin(5)
  258. .backgroundColor($r('app.color.general_card_background_color'))
  259. .borderRadius($r('app.float.general_border_radius'))
  260. .padding({left:10})
  261. Row(){
  262. Column({space: 5}){
  263. Text('技能')
  264. .fontSize($r('app.float.card_title_font_size'))
  265. .fontColor($r('app.color.general_font_color'))
  266. .fontWeight(FontWeight.Medium)
  267. .opacity($r('app.float.general_font_opacity'))
  268. Text('查看你的技能,技能掌握情况将决定某些工序能否执行')
  269. .fontSize($r('app.float.robot_set_font_size'))
  270. .fontColor($r('app.color.general_font_color'))
  271. .fontWeight(FontWeight.Regular)
  272. .opacity($r('app.float.card_font_default_opacity'))
  273. }
  274. .alignItems(HorizontalAlign.Start)
  275. .justifyContent(FlexAlign.Center)
  276. .height('100%')
  277. .width('80%')
  278. Row() {
  279. Image($r('app.media.subscript_space'))
  280. .height($r('app.float.card_subscript_new_size'))
  281. .width($r('app.float.card_subscript_new_size'))
  282. }
  283. .alignItems(VerticalAlign.Bottom)
  284. .justifyContent(FlexAlign.End)
  285. .height('100%')
  286. .width('20%')
  287. }.width('100%')
  288. .height('16.3%')
  289. .margin(5)
  290. .backgroundColor($r('app.color.general_card_background_color'))
  291. .borderRadius($r('app.float.general_border_radius'))
  292. .padding({left:10})
  293. Text('其他')
  294. .width('100%')
  295. .fontSize($r('app.float.process_circulation_font_size'))
  296. .fontColor($r('app.color.general_font_color'))
  297. .opacity($r('app.float.general_font_opacity'))
  298. Row(){
  299. Column(){
  300. Text('关于')
  301. .fontSize($r('app.float.card_title_font_size'))
  302. .fontColor($r('app.color.general_font_color'))
  303. .fontWeight(FontWeight.Medium)
  304. .opacity($r('app.float.general_font_opacity'))
  305. }
  306. .alignItems(HorizontalAlign.Start)
  307. .justifyContent(FlexAlign.Center)
  308. .height('100%')
  309. .width('80%')
  310. Row() {
  311. Image($r('app.media.subscript_space'))
  312. .height($r('app.float.card_subscript_new_size'))
  313. .width($r('app.float.card_subscript_new_size'))
  314. }
  315. .alignItems(VerticalAlign.Bottom)
  316. .justifyContent(FlexAlign.End)
  317. .height('100%')
  318. .width('20%')
  319. }.width('100%')
  320. .height('16.3%')
  321. .margin(5)
  322. .backgroundColor($r('app.color.general_card_background_color'))
  323. .borderRadius($r('app.float.general_border_radius'))
  324. .padding({left:10})
  325. .onClick(()=>{
  326. this.AboutDialogController.open()
  327. })
  328. }
  329. .width('66%')
  330. .padding(10)
  331. .height('100%')
  332. }
  333. .width('90%')
  334. .height('100%')
  335. .backgroundColor('#F1F3F5')
  336. }
  337. }