login-json.js 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. function getLoginJson() {
  2. let headerJson = {
  3. "type": "wrapper",
  4. "className": "fixed login_layout m:h-screen m:w-full bg-gray-50",
  5. "body": {
  6. "type": "form",
  7. "className": "h-full pc:p-9 m:p-4 m:pt-20",
  8. "api": {
  9. "method":"post",
  10. "url":"http://localhost:8081/api/login",
  11. "dataType":"form",
  12. "headers": {
  13. "Authorization": 'Bearer ' + getToken()
  14. },
  15. "requestAdaptor":function(data){
  16. data.data.captchaToken = getCaptchaCode()
  17. return data;
  18. },
  19. "adaptor": function (data, response) {
  20. // token 续期的问题,在app.html中进行续期判断.
  21. if (data.status != "200") {
  22. // 登录请求提交后,刷新验证码
  23. refresh_code();
  24. }
  25. // 存储登录token
  26. let token = data.data.token;
  27. return {
  28. ...data,
  29. status: 500
  30. };
  31. }
  32. },
  33. // "redirect": "http://www.baidu.com",
  34. "wrapWithPanel": false,
  35. "body": [
  36. {
  37. "type":"html",
  38. "className":"text-center",
  39. "html":"<h1 class='title-name'>Roma 平台</h1>"
  40. },
  41. {
  42. "type": "input-group",
  43. "label": "",
  44. "body": [
  45. {
  46. "type": "icon",
  47. "icon": "./public/static/icon/shield-user-line.svg"
  48. },
  49. {
  50. "type": "input-text",
  51. "label": false,
  52. "placeholder": "用户名",
  53. "name": "api_name",
  54. "required": true
  55. }
  56. ]
  57. },
  58. {
  59. "type": "input-group",
  60. "label": "",
  61. "body": [
  62. {
  63. "type": "icon",
  64. "icon": "./public/static/icon/lock-password-line.svg",
  65. },
  66. {
  67. "type": "input-password",
  68. "label": false,
  69. "placeholder": "密码",
  70. "name": "api_password",
  71. "required": true
  72. }
  73. ]
  74. },
  75. {
  76. "type": "input-group",
  77. "label": "",
  78. "body": [
  79. {
  80. "type": "icon",
  81. "icon": "./public/static/icon/shield-check-line.svg"
  82. },
  83. {
  84. "type": "input-text",
  85. "label": false,
  86. "placeholder": "验证码",
  87. "name": "api_captcha",
  88. "required": true
  89. },
  90. {
  91. "type": "action",
  92. "body": {
  93. "type": "image",
  94. "height": "38px",
  95. "width": "110px",
  96. "name":"codeUrl",
  97. "imageClassName":"code_img b-none",
  98. "imageMode":"original",
  99. "src": ""
  100. },
  101. // 点击图片 刷新二维码
  102. "onClick": "refresh_code()"
  103. }
  104. ]
  105. },
  106. {
  107. "type": "hidden",
  108. "name": "captchaToken",
  109. "value": ""
  110. },
  111. {
  112. "label": "登 录",
  113. "type": "action",
  114. "actionType": "submit",
  115. "level": "primary",
  116. "className":"w-full h-2.5",
  117. },
  118. {
  119. "type": "wrapper",
  120. "body": [
  121. {
  122. "type": "flex",
  123. "id": "u:e7752d0c1dbe",
  124. "justify": "flex-end",
  125. "items": [
  126. {
  127. "type": "container",
  128. "body": [
  129. {
  130. "type": "tooltip-wrapper",
  131. "tooltip": "请联系管理员,邮箱xxxxx@xxx.com",
  132. "body": [
  133. {
  134. "type": "tpl",
  135. "tpl": "忘记密码?",
  136. "id": "u:47f172268df5",
  137. "wrapperComponent": "",
  138. "hidden": false,
  139. "className": "m-l-none"
  140. }
  141. ],
  142. "enterable": true,
  143. "showArrow": true,
  144. "offset": [
  145. 8,
  146. 6
  147. ],
  148. "id": "u:3878dcf435b8",
  149. "trigger": [
  150. "hover"
  151. ],
  152. "mouseEnterDelay": 0,
  153. "mouseLeaveDelay": 0,
  154. "placement": "bottom",
  155. "inline": true
  156. }
  157. ],
  158. "size": "xs",
  159. "style": {
  160. "position": "static",
  161. "display": "block",
  162. "flex": "1 1 auto",
  163. "flexGrow": 1,
  164. "flexBasis": "auto"
  165. },
  166. "wrapperBody": false,
  167. "isFixedHeight": false,
  168. "isFixedWidth": false,
  169. "id": "u:ec685674b43d"
  170. },
  171. {
  172. "type": "dropdown-button",
  173. "label": "",
  174. "className": "header-menu",
  175. "buttons": [
  176. {
  177. "type": "button",
  178. "label": "中文",
  179. "id": "u:6911502c8fcc",
  180. "onEvent": {
  181. "click": {
  182. "actions": [
  183. {
  184. "script": "localStorage.setItem('language', 'zh-CN')\nlocation.reload()",
  185. "actionType": "custom",
  186. "args": {
  187. }
  188. }
  189. ],
  190. "weight": 0
  191. }
  192. }
  193. },
  194. {
  195. "type": "button",
  196. "label": "English",
  197. "id": "u:e702685a7a45",
  198. "onEvent": {
  199. "click": {
  200. "actions": [
  201. {
  202. "script": "localStorage.setItem('language', 'en-US')\r\nlocation.reload()",
  203. "actionType": "custom"
  204. }
  205. ],
  206. "weight": 0
  207. }
  208. },
  209. "actionType": "",
  210. "link": "/view/user_info"
  211. }
  212. ],
  213. "id": "u:4fedf7a987bf",
  214. "size": "md",
  215. "level": "default",
  216. "align": "right",
  217. "block": false,
  218. "hideCaret": true,
  219. "trigger": "hover",
  220. "icon": "./public/static/icon/language-change.png",
  221. "btnClassName": "no-border"
  222. }
  223. ]
  224. }
  225. ],
  226. "id": "u:d16525b6aae6",
  227. "asideResizor": false,
  228. "pullRefresh": {
  229. "disabled": true
  230. }
  231. },
  232. {
  233. "type": "divider",
  234. "id": "u:4ba78892d2e9"
  235. },
  236. {
  237. "type":"html",
  238. "className":"text-center",
  239. "html":"<p class='mt-10 text-gray-600'>© 2023, Roma Services LLC. All Rights Reserved. An Roma Company</p>"
  240. }
  241. ]
  242. }
  243. };
  244. return headerJson;
  245. }