header-json.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. function getHeaderJson() {
  2. let headerJson = {
  3. "type": "page",
  4. "body": [
  5. {
  6. "type": "flex",
  7. "id": "u:e7752d0c1dbe",
  8. "justify": "flex-end",
  9. "items": [
  10. {
  11. "type": "dropdown-button",
  12. "label": "",
  13. "className": "header-menu",
  14. "buttons": [
  15. {
  16. "type": "button",
  17. "label": "中文",
  18. "id": "u:6911502c8fcc",
  19. "onEvent": {
  20. "click": {
  21. "actions": [
  22. {
  23. "script": "localStorage.setItem('language', 'zh-CN')\nlocation.reload()",
  24. "actionType": "custom",
  25. "args": {
  26. }
  27. }
  28. ],
  29. "weight": 0
  30. }
  31. }
  32. },
  33. {
  34. "type": "button",
  35. "label": "English",
  36. "id": "u:e702685a7a45",
  37. "onEvent": {
  38. "click": {
  39. "actions": [
  40. {
  41. "script": "localStorage.setItem('language', 'en-US')\r\nlocation.reload()",
  42. "actionType": "custom"
  43. }
  44. ],
  45. "weight": 0
  46. }
  47. },
  48. "actionType": "",
  49. "link": "/view/user_info"
  50. }
  51. ],
  52. "id": "u:4fedf7a987bf",
  53. "size": "md",
  54. "level": "default",
  55. "align": "right",
  56. "block": false,
  57. "hideCaret": true,
  58. "trigger": "hover",
  59. "icon": "./public/static/icon/language-change.png",
  60. "btnClassName": "no-border"
  61. },
  62. {
  63. "type": "dropdown-button",
  64. "label": "$userName",
  65. "className": "header-menu",
  66. "buttons": [
  67. {
  68. "type": "button",
  69. "label": "退出登录",
  70. "actionType": "",
  71. "id": "u:88d8afc464b5",
  72. "url": "/login/out",
  73. "blank": false,
  74. "api": "/api/logout",
  75. "onEvent": {
  76. "click": {
  77. "actions": [
  78. {
  79. "args": {
  80. "options": {
  81. "silent": false
  82. },
  83. "api": {
  84. "url": "/api/logout",
  85. "method": "post",
  86. "messages": {
  87. }
  88. }
  89. },
  90. "outputVar": "responseResult",
  91. "actionType": "ajax"
  92. }
  93. ],
  94. "weight": 0
  95. }
  96. }
  97. }
  98. ],
  99. "id": "u:d324269526b9",
  100. "size": "md",
  101. "level": "default",
  102. "align": "right",
  103. "block": true,
  104. "trigger": "hover"
  105. }
  106. ]
  107. }
  108. ],
  109. "id": "u:d16525b6aae6",
  110. "initApi": "/api/userInfo"
  111. }
  112. return headerJson
  113. }