Unverified Commit 2b3d0b65 authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

[Refactor][web] refactor login page (#1962)

* refactor login page * optimize login page layout * modify style import * modify style * modify style * fix lang hidden bug * fix lang hidden bug * added initialValues={{autoLogin: true}}
parent 12989375
...@@ -61,9 +61,10 @@ ...@@ -61,9 +61,10 @@
"rc-util": "^5.30.0", "rc-util": "^5.30.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-dev-inspector": "^1.8.1", "react-dev-inspector": "^1.8.1",
"react-monaco-editor": "^0.52.0",
"react-dom": "^18.0.0", "react-dom": "^18.0.0",
"react-helmet-async": "^1.3.0", "react-helmet-async": "^1.3.0",
"react-monaco-editor": "^0.52.0",
"react-spring": "^9.7.1",
"screenfull": "^6.0.2", "screenfull": "^6.0.2",
"use-sse": "^2.0.1" "use-sse": "^2.0.1"
}, },
......
<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin:auto;background:#ffffff;display:block;z-index:1;position:relative" width="1988" height="105" preserveAspectRatio="xMidYMid" viewBox="0 0 1988 105">
<g transform="translate(994,52.5) scale(1,-1) translate(-994,-52.5)"><linearGradient id="lg-0.3440145086338846" x1="0" x2="1" y1="0" y2="0">
<stop stop-color="#ff00ff" offset="0"></stop>
<stop stop-color="#00ffff" offset="1"></stop>
</linearGradient><path d="" fill="url(#lg-0.3440145086338846)" opacity="0.55">
<animate attributeName="d" dur="6.25s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline" keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="0s" values="M0 0L 0 49.77310379378919Q 198.8 47.591419390303145 397.6 28.87878983051168T 795.2 68.80668278878773T 1192.8 58.38233225466492T 1590.4 45.951716004376294T 1988 10.81670549876142L 1988 0 Z;M0 0L 0 26.067264772419293Q 198.8 131.19687752459023 397.6 81.50934965804032T 795.2 71.09291579597352T 1192.8 42.976082701973624T 1590.4 59.043319281491826T 1988 12.106366223214064L 1988 0 Z;M0 0L 0 58.57440737881901Q 198.8 67.58197559012001 397.6 25.55238930926856T 795.2 49.25681282683787T 1192.8 19.545554242791944T 1590.4 13.666495534524698T 1988 14.065825877750328L 1988 0 Z;M0 0L 0 49.77310379378919Q 198.8 47.591419390303145 397.6 28.87878983051168T 795.2 68.80668278878773T 1192.8 58.38233225466492T 1590.4 45.951716004376294T 1988 10.81670549876142L 1988 0 Z"></animate>
</path><path d="" fill="url(#lg-0.3440145086338846)" opacity="0.55">
<animate attributeName="d" dur="6.25s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline" keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-0.625s" values="M0 0L 0 35.212646996188084Q 198.8 101.92082872352839 397.6 58.25185973436038T 795.2 17.36125471693086T 1192.8 59.147486641965514T 1590.4 42.65808344456798T 1988 22.64992259633285L 1988 0 Z;M0 0L 0 25.801936920006348Q 198.8 50.649299491241244 397.6 35.385501256928514T 795.2 76.77051291832889T 1192.8 71.3347130131628T 1590.4 33.21834226011449T 1988 29.786740529086217L 1988 0 Z;M0 0L 0 64.63470815461491Q 198.8 92.2717528035123 397.6 78.1198271042176T 795.2 52.07107284980025T 1192.8 47.24819692325903T 1590.4 32.760647959388365T 1988 55.74663278478042L 1988 0 Z;M0 0L 0 35.212646996188084Q 198.8 101.92082872352839 397.6 58.25185973436038T 795.2 17.36125471693086T 1192.8 59.147486641965514T 1590.4 42.65808344456798T 1988 22.64992259633285L 1988 0 Z"></animate>
</path><path d="" fill="url(#lg-0.3440145086338846)" opacity="0.55">
<animate attributeName="d" dur="6.25s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline" keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-1.25s" values="M0 0L 0 55.29776657430067Q 198.8 81.23834346271076 397.6 61.1140545853359T 795.2 72.46024464214518T 1192.8 43.77810112675144T 1590.4 46.98160886461281T 1988 14.947607958393354L 1988 0 Z;M0 0L 0 42.69798354580878Q 198.8 84.33826828603652 397.6 43.61880025902809T 795.2 31.90323998094466T 1192.8 45.948108158903345T 1590.4 21.676969396610126T 1988 41.46375318836818L 1988 0 Z;M0 0L 0 54.686750323994865Q 198.8 81.7134889501481 397.6 50.825693841102265T 795.2 42.64523560853813T 1192.8 58.39732954608775T 1590.4 51.83446367505996T 1988 70.73871198724432L 1988 0 Z;M0 0L 0 55.29776657430067Q 198.8 81.23834346271076 397.6 61.1140545853359T 795.2 72.46024464214518T 1192.8 43.77810112675144T 1590.4 46.98160886461281T 1988 14.947607958393354L 1988 0 Z"></animate>
</path><path d="" fill="url(#lg-0.3440145086338846)" opacity="0.55">
<animate attributeName="d" dur="6.25s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline" keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-1.875s" values="M0 0L 0 34.6857105243959Q 198.8 66.59138782064306 397.6 30.638704091570915T 795.2 63.244917089949155T 1192.8 58.54020042791416T 1590.4 42.25971312199182T 1988 29.66383306012397L 1988 0 Z;M0 0L 0 71.9038254317467Q 198.8 116.67341134089699 397.6 80.8344876027779T 795.2 79.0831445156049T 1192.8 50.77216937889197T 1590.4 10.335362732876963T 1988 67.61692827833942L 1988 0 Z;M0 0L 0 23.926225505987063Q 198.8 95.63327206525955 397.6 66.02162071270287T 795.2 21.510248249725574T 1192.8 22.889932537767812T 1590.4 62.3390138953624T 1988 18.62668133085013L 1988 0 Z;M0 0L 0 34.6857105243959Q 198.8 66.59138782064306 397.6 30.638704091570915T 795.2 63.244917089949155T 1192.8 58.54020042791416T 1590.4 42.25971312199182T 1988 29.66383306012397L 1988 0 Z"></animate>
</path><path d="" fill="url(#lg-0.3440145086338846)" opacity="0.55">
<animate attributeName="d" dur="6.25s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline" keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-2.5s" values="M0 0L 0 28.646829695946604Q 198.8 85.34696018001291 397.6 48.160753414026615T 795.2 47.34223450093713T 1192.8 55.994341311074635T 1590.4 17.897558776482477T 1988 53.18652371537071L 1988 0 Z;M0 0L 0 64.07512018410384Q 198.8 65.23536139371348 397.6 46.10478413931787T 795.2 55.70111428528378T 1192.8 13.839120246534566T 1590.4 66.91857366902158T 1988 50.922125841214665L 1988 0 Z;M0 0L 0 23.378934932251845Q 198.8 60.44388165975765 397.6 19.206532763848173T 795.2 52.80794500963676T 1192.8 75.63807379659731T 1590.4 62.659677379793706T 1988 41.896138021356705L 1988 0 Z;M0 0L 0 28.646829695946604Q 198.8 85.34696018001291 397.6 48.160753414026615T 795.2 47.34223450093713T 1192.8 55.994341311074635T 1590.4 17.897558776482477T 1988 53.18652371537071L 1988 0 Z"></animate>
</path><path d="" fill="url(#lg-0.3440145086338846)" opacity="0.55">
<animate attributeName="d" dur="6.25s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline" keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-3.125s" values="M0 0L 0 84.99561987428305Q 198.8 78.255622480836 397.6 59.12192158308979T 795.2 34.741130018782734T 1192.8 76.1091147844124T 1590.4 36.38502180020273T 1988 63.981595131592016L 1988 0 Z;M0 0L 0 54.009070076397656Q 198.8 33.252818428798854 397.6 17.320467477720477T 795.2 67.90562660309753T 1192.8 66.95547602852336T 1590.4 22.267817382546696T 1988 69.94358979747106L 1988 0 Z;M0 0L 0 41.6103247027028Q 198.8 100.10909776518264 397.6 61.89100630345462T 795.2 64.25966519936196T 1192.8 67.11339711779277T 1590.4 54.347724856272386T 1988 24.38650324164197L 1988 0 Z;M0 0L 0 84.99561987428305Q 198.8 78.255622480836 397.6 59.12192158308979T 795.2 34.741130018782734T 1192.8 76.1091147844124T 1590.4 36.38502180020273T 1988 63.981595131592016L 1988 0 Z"></animate>
</path><path d="" fill="url(#lg-0.3440145086338846)" opacity="0.55">
<animate attributeName="d" dur="6.25s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline" keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-3.75s" values="M0 0L 0 63.63760891836589Q 198.8 66.15753985918884 397.6 52.80234518664156T 795.2 81.26779117619701T 1192.8 17.623250587192558T 1590.4 57.23303659288549T 1988 29.93392482024211L 1988 0 Z;M0 0L 0 65.31606014393662Q 198.8 80.6552384572708 397.6 38.940164801698124T 795.2 57.05943060056972T 1192.8 75.66047288690832T 1590.4 64.34126103258194T 1988 14.778387204625895L 1988 0 Z;M0 0L 0 34.61950110606294Q 198.8 92.72936144615372 397.6 66.15509310201895T 795.2 78.4676836742732T 1192.8 47.02495705006695T 1590.4 72.66487756922528T 1988 45.143645325303304L 1988 0 Z;M0 0L 0 63.63760891836589Q 198.8 66.15753985918884 397.6 52.80234518664156T 795.2 81.26779117619701T 1192.8 17.623250587192558T 1590.4 57.23303659288549T 1988 29.93392482024211L 1988 0 Z"></animate>
</path><path d="" fill="url(#lg-0.3440145086338846)" opacity="0.55">
<animate attributeName="d" dur="6.25s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline" keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-4.375s" values="M0 0L 0 71.00295180364716Q 198.8 100.62500360057024 397.6 64.0027107269344T 795.2 76.03629857417094T 1192.8 47.27326990114227T 1590.4 27.666953468314045T 1988 9.581222223692006L 1988 0 Z;M0 0L 0 22.957943456568994Q 198.8 39.65954460462298 397.6 22.430122147650152T 795.2 52.577892279855845T 1192.8 58.33945461703486T 1590.4 23.088799050512968T 1988 62.514904089128464L 1988 0 Z;M0 0L 0 40.24595447120785Q 198.8 55.63334677489573 397.6 27.91577431733779T 795.2 59.55219392545606T 1192.8 43.09794800699234T 1590.4 61.25776257348089T 1988 69.30518834369695L 1988 0 Z;M0 0L 0 71.00295180364716Q 198.8 100.62500360057024 397.6 64.0027107269344T 795.2 76.03629857417094T 1192.8 47.27326990114227T 1590.4 27.666953468314045T 1988 9.581222223692006L 1988 0 Z"></animate>
</path><path d="" fill="url(#lg-0.3440145086338846)" opacity="0.55">
<animate attributeName="d" dur="6.25s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline" keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-5s" values="M0 0L 0 47.474995208348105Q 198.8 72.34258829807102 397.6 37.53275662266394T 795.2 23.418864141552984T 1192.8 38.61303848852268T 1590.4 28.062746294628333T 1988 9.05301742161264L 1988 0 Z;M0 0L 0 46.22051394058336Q 198.8 58.27998552266746 397.6 34.45493640910362T 795.2 38.97102031880557T 1192.8 78.24395884672242T 1590.4 33.241049806540325T 1988 8.10199739727922L 1988 0 Z;M0 0L 0 83.84183939713206Q 198.8 82.98206490814151 397.6 62.5612909522332T 795.2 60.241353258436554T 1192.8 30.25437478132703T 1590.4 39.32566986398397T 1988 54.35898988471676L 1988 0 Z;M0 0L 0 47.474995208348105Q 198.8 72.34258829807102 397.6 37.53275662266394T 795.2 23.418864141552984T 1192.8 38.61303848852268T 1590.4 28.062746294628333T 1988 9.05301742161264L 1988 0 Z"></animate>
</path><path d="" fill="url(#lg-0.3440145086338846)" opacity="0.55">
<animate attributeName="d" dur="6.25s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline" keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-5.625s" values="M0 0L 0 23.064886742496768Q 198.8 100.51286101742167 397.6 80.6992691219958T 795.2 37.34271235938115T 1192.8 35.81233991899224T 1590.4 33.96432169278636T 1988 37.53680614828411L 1988 0 Z;M0 0L 0 81.5813361086314Q 198.8 36.40695655351495 397.6 15.451058676368893T 795.2 65.96505400060073T 1192.8 19.915696673437367T 1590.4 23.05946619372412T 1988 63.667265260558835L 1988 0 Z;M0 0L 0 41.88683800045314Q 198.8 55.346253687923074 397.6 24.07137461128161T 795.2 24.71884615197397T 1192.8 15.633415949559044T 1590.4 27.785512412282518T 1988 40.63191080673663L 1988 0 Z;M0 0L 0 23.064886742496768Q 198.8 100.51286101742167 397.6 80.6992691219958T 795.2 37.34271235938115T 1192.8 35.81233991899224T 1590.4 33.96432169278636T 1988 37.53680614828411L 1988 0 Z"></animate>
</path></g>
</svg>
<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
style="margin:auto;background:#ffffff;display:block;z-index:1;position:relative" width="1920" height="900"
preserveAspectRatio="xMidYMid" viewBox="0 0 1920 900">
<g transform="translate(960,450) scale(1,1) translate(-960,-450)">
<linearGradient id="lg-0.519274329747355" x1="0" x2="1" y1="0" y2="0">
<stop stop-color="#ff00ff" offset="0"></stop>
<stop stop-color="#00ffff" offset="1"></stop>
</linearGradient>
<path d="" fill="url(#lg-0.519274329747355)" opacity="0.4">
<animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline"
keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="0s"
values="M0 0L 0 785.259160569599Q 240 656.0433469925683 480 637.0752028346935T 960 557.6511412538559T 1440 538.1676182198316T 1920 422.9912052090322L 1920 0 Z;M0 0L 0 869.3686064070597Q 240 804.5310406677979 480 764.687604193349T 960 533.6611205206846T 1440 469.26735052182323T 1920 344.9492092972185L 1920 0 Z;M0 0L 0 776.2588822803325Q 240 756.123750936792 480 739.0851270344987T 960 593.2668471013939T 1440 602.4749771919371T 1920 491.8715740333309L 1920 0 Z;M0 0L 0 785.259160569599Q 240 656.0433469925683 480 637.0752028346935T 960 557.6511412538559T 1440 538.1676182198316T 1920 422.9912052090322L 1920 0 Z"></animate>
</path>
<path d="" fill="url(#lg-0.519274329747355)" opacity="0.4">
<animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline"
keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-1.6666666666666667s"
values="M0 0L 0 841.7278151678291Q 240 709.5691578182891 480 664.0626117076251T 960 576.8239855514423T 1440 490.9529427276996T 1920 379.75490287303495L 1920 0 Z;M0 0L 0 873.7966661736656Q 240 685.1417039527854 480 642.3100791748109T 960 637.5020456997963T 1440 501.68507752601516T 1920 410.41832016280705L 1920 0 Z;M0 0L 0 841.7634476827059Q 240 784.6401480971722 480 765.4623448919933T 960 559.3896033898495T 1440 452.68605339210575T 1920 458.91398611015785L 1920 0 Z;M0 0L 0 841.7278151678291Q 240 709.5691578182891 480 664.0626117076251T 960 576.8239855514423T 1440 490.9529427276996T 1920 379.75490287303495L 1920 0 Z"></animate>
</path>
<path d="" fill="url(#lg-0.519274329747355)" opacity="0.4">
<animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline"
keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-3.3333333333333335s"
values="M0 0L 0 786.8909553904731Q 240 701.2583618134627 480 681.4242125981768T 960 632.4496279828533T 1440 529.0590793857682T 1920 362.72498457606815L 1920 0 Z;M0 0L 0 833.9584624186427Q 240 735.4403353186682 480 702.4020046056404T 960 570.4767335180484T 1440 450.08759759097467T 1920 359.1040448444771L 1920 0 Z;M0 0L 0 765.4099774301828Q 240 704.7963548229467 480 673.7582827447468T 960 656.2104940291773T 1440 425.0093230246074T 1920 271.6894553796988L 1920 0 Z;M0 0L 0 786.8909553904731Q 240 701.2583618134627 480 681.4242125981768T 960 632.4496279828533T 1440 529.0590793857682T 1920 362.72498457606815L 1920 0 Z"></animate>
</path>
<path d="" fill="url(#lg-0.519274329747355)" opacity="0.4">
<animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline"
keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-5s"
values="M0 0L 0 822.4557366212265Q 240 765.5066045370316 480 719.2819384572789T 960 540.3639065906938T 1440 527.150908480367T 1920 414.5631837554528L 1920 0 Z;M0 0L 0 875.5260228215574Q 240 794.7141130311742 480 756.8415527267248T 960 651.9097097189215T 1440 550.8682975628969T 1920 337.0562067352248L 1920 0 Z;M0 0L 0 873.748659659927Q 240 797.5211793320077 480 781.1044419661057T 960 608.6345675815076T 1440 462.75312160161303T 1920 361.48332490728023L 1920 0 Z;M0 0L 0 822.4557366212265Q 240 765.5066045370316 480 719.2819384572789T 960 540.3639065906938T 1440 527.150908480367T 1920 414.5631837554528L 1920 0 Z"></animate>
</path>
<path d="" fill="url(#lg-0.519274329747355)" opacity="0.4">
<animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline"
keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-6.666666666666667s"
values="M0 0L 0 873.647875622009Q 240 765.5359005266773 480 737.8271639269435T 960 543.31426199662T 1440 454.9947328786053T 1920 429.06869345810384L 1920 0 Z;M0 0L 0 810.5839078080603Q 240 657.087523035116 480 631.0404451118314T 960 613.5463982001205T 1440 508.62448745772207T 1920 474.77480760232476L 1920 0 Z;M0 0L 0 879.1645841568322Q 240 708.8217616107146 480 676.661694158219T 960 502.78360994854404T 1440 406.1982594036439T 1920 347.64231444300896L 1920 0 Z;M0 0L 0 873.647875622009Q 240 765.5359005266773 480 737.8271639269435T 960 543.31426199662T 1440 454.9947328786053T 1920 429.06869345810384L 1920 0 Z"></animate>
</path>
<path d="" fill="url(#lg-0.519274329747355)" opacity="0.4">
<animate attributeName="d" dur="10s" repeatCount="indefinite" keyTimes="0;0.333;0.667;1" calcMode="spline"
keySplines="0.5 0 0.5 1;0.5 0 0.5 1;0.5 0 0.5 1" begin="-8.333333333333334s"
values="M0 0L 0 733.9093912932839Q 240 778.6160456622737 480 761.2933820552004T 960 532.4871003060606T 1440 530.0169721737684T 1920 334.6896655690745L 1920 0 Z;M0 0L 0 793.9134378152942Q 240 732.3392293126255 480 703.3910208231505T 960 553.26103152101T 1440 522.0902204190934T 1920 271.62904995207697L 1920 0 Z;M0 0L 0 775.4813280019614Q 240 765.9027552225774 480 714.7381461623293T 960 566.8546168573004T 1440 504.35305448396156T 1920 504.4404420245271L 1920 0 Z;M0 0L 0 733.9093912932839Q 240 778.6160456622737 480 761.2933820552004T 960 532.4871003060606T 1440 530.0169721737684T 1920 334.6896655690745L 1920 0 Z"></animate>
</path>
</g>
</svg>
...@@ -98,6 +98,7 @@ export const layout: RunTimeLayoutConfig = ({initialState, setInitialState}) => ...@@ -98,6 +98,7 @@ export const layout: RunTimeLayoutConfig = ({initialState, setInitialState}) =>
content: initialState?.currentUser?.user.username + " " + new Date().toLocaleString(), content: initialState?.currentUser?.user.username + " " + new Date().toLocaleString(),
fontColor: theme === THEME.light|| undefined ? "rgba(0, 0, 0, 0.15)" : "rgba(255, 255, 255, 0.15)", fontColor: theme === THEME.light|| undefined ? "rgba(0, 0, 0, 0.15)" : "rgba(255, 255, 255, 0.15)",
}, },
isChildrenLayout: true,
onPageChange: () => { onPageChange: () => {
const {location} = history; const {location} = history;
// 如果没有登录,重定向到 login // 如果没有登录,重定向到 login
...@@ -105,26 +106,6 @@ export const layout: RunTimeLayoutConfig = ({initialState, setInitialState}) => ...@@ -105,26 +106,6 @@ export const layout: RunTimeLayoutConfig = ({initialState, setInitialState}) =>
history.push(loginPath); history.push(loginPath);
} }
}, },
layoutBgImgList: [
{
src: "https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/D2LWSqNny4sAAAAAAAAAAAAAFl94AQBr",
left: 85,
bottom: 100,
height: "303px",
},
{
src: "https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/C2TWRpJpiC0AAAAAAAAAAAAAFl94AQBr",
bottom: -68,
right: -45,
height: "303px",
},
{
src: "https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/F6vSTbj8KpYAAAAAAAAAAAAAFl94AQBr",
bottom: 0,
left: 0,
width: "331px",
},
],
menuHeaderRender: undefined, menuHeaderRender: undefined,
// 自定义 403 页面 // 自定义 403 页面
unAccessible:<UnAccessible/>, unAccessible:<UnAccessible/>,
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {useSpring, animated} from "react-spring";
const FadeIn = (props: any) => {
const {children} = props;
const fadeIn = useSpring({
opacity: 1,
from: {opacity: 0},
config: {
duration: 1000,
delay: 1000,
},
});
return <animated.div style={fadeIn}>{children}</animated.div>;
};
export default FadeIn;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useSpring, animated } from 'react-spring';
const Scale = (props:any) => {
const {children} = props;
const scale = useSpring({
transform: 'scale(1)',
from: { transform: 'scale(0)' },
config: { tension: 2000, friction: 300, duration: 500 },
});
return (
<animated.div style={scale}>
{children}
</animated.div>
);
}
export default Scale
...@@ -24,9 +24,7 @@ const Footer: React.FC = () => { ...@@ -24,9 +24,7 @@ const Footer: React.FC = () => {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
return ( return (
<DefaultFooter <DefaultFooter
style={{ style={{background: 'none'}}
background: 'none',
}}
copyright={`${currentYear} ` + l('app.copyright.produced')} copyright={`${currentYear} ` + l('app.copyright.produced')}
links={[ links={[
{ {
......
...@@ -21,11 +21,77 @@ body, ...@@ -21,11 +21,77 @@ body,
height: 100%; height: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
overflow-x: auto;
overflow-y: auto;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji'; 'Noto Color Emoji';
} }
// .login-form style --- start ----
.content {
padding: 32px 0 24px;
}
.top {
text-align: center;
}
.header {
height: 100px;
line-height: 144px;
position: relative;
font-weight: 600;
font-size: 4rem;
font-family: PMingLiU-ExtB, 'Helvetica Neue', Arial, Helvetica, sans-serif;
}
.logo {
position: absolute;
width: 28vw;
left: -30vw;
top: -5vh;
display: flex;
flex: auto ;
flex-flow: column-reverse;
}
.desc {
margin-bottom: 2rem;
margin-top: 2rem;
color: @text-color-secondary;
font-size: @font-size-base;
}
.loginformMain {
display: flex;
flex: auto;
max-height: max-content;
padding: 0vh 6vh 30vh 2vh;
justify-content: center ;
align-items: center;
flex-direction: column;
background-size: cover;
background-position: left center;
background-repeat: no-repeat;
z-index: 1;
.form{
position: relative;
height: 100%;
box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.4);
margin-left: 60vw;
margin-bottom: -15vh;
}
.loginform {
padding: 2vh 2vw;
}
}
// .login-form style --- end ----
// scrollbar style --- start ---- // scrollbar style --- start ----
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 0.5vw; width: 0.5vw;
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import React from "react";
import {CheckCard} from "@ant-design/pro-components";
import {UserBaseInfo} from "@/types/User/data";
import {CheckGroupValueType} from "@ant-design/pro-card/es/components/CheckCard/Group";
type TenantCardProps = {
tenant: UserBaseInfo.Tenant[];
handleChangeTenant: (value :CheckGroupValueType) => void
}
const TenantCard: React.FC<TenantCardProps> = (props) => {
const {tenant,handleChangeTenant} = props;
const chooseCard = () => {
let cardList: any[] = [];
// if no tenant is selected, the confirm button is disabled
if (tenant) {
cardList = tenant.map((item: any) => {
return (
<CheckCard
size={"default"}
key={item?.id}
avatar="/icons/tenant_default.svg"
title={item?.tenantCode}
value={item?.id}
description={item?.note}
/>
);
});
}
return cardList;
};
return <>
<CheckCard.Group
multiple={false}
onChange={handleChangeTenant}
>
{chooseCard()}
</CheckCard.Group>
</>;
};
export default TenantCard;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {l} from "@/utils/intl";
import {Modal} from "antd";
import {setTenantStorageAndCookie} from "@/utils/function";
import React, {useState} from "react";
import {UserBaseInfo} from "@/types/User/data";
import TenantCard from "@/pages/Other/Login/ChooseModal/TenantCard";
import {NORMAL_MODAL_OPTIONS} from "@/services/constants";
import {CheckGroupValueType} from "@ant-design/pro-card/es/components/CheckCard/Group";
type ChooseModalProps = {
tenantVisible: boolean;
handleTenantVisible: () => void;
submitting: boolean;
handleChooseTenant: (tenantId: number) => void
tenant: UserBaseInfo.Tenant[]
}
const ChooseModal: React.FC<ChooseModalProps> = (props) => {
const {tenantVisible, handleTenantVisible, submitting, tenant,handleChooseTenant} = props;
const [check, setChecked] = useState<boolean>(true);
const [checkedTenantId, setCheckedTenantId] = useState<any>();
const tenantChange = (value: CheckGroupValueType) => {
if (value) {
// if no tenant is selected, the confirm button is disabled
setChecked(false);
setCheckedTenantId(value );
setTenantStorageAndCookie(value as number);
// setTenantIdParams(value as number);
} else {
setChecked(true);
}
};
return <>
<Modal
title={l("login.chooseTenant")}
open={tenantVisible}
{...NORMAL_MODAL_OPTIONS}
onCancel={handleTenantVisible}
onOk={() => handleChooseTenant(checkedTenantId)}
okText={l("button.confirm")}
okButtonProps={{
disabled: check,
loading: submitting
}}
>
<TenantCard tenant={tenant} handleChangeTenant={tenantChange}/>
</Modal>
</>;
};
export default ChooseModal;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {l} from "@/utils/intl";
import Settings from "../../../../../config/defaultSettings";
import {Helmet} from "@@/exports";
import React from "react";
export default () => {
return <>
<Helmet>
<title>
{l("menu.login")} - {Settings.title}
</title>
</Helmet>
</>
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {useEmotionCss} from "@ant-design/use-emotion-css";
import {SelectLang} from "@@/exports";
import React from "react";
const LangSwitch = () => {
const langClassName = useEmotionCss(({token}) => {
return {
width: 42,
lineHeight: "42px",
position: "absolute",
top: 10,
right: 10,
borderRadius: token.borderRadius,
zIndex: 9999,
":hover": {
backgroundColor: token.colorBgTextHover,
},
};
});
return <div className={langClassName}>
{SelectLang && <SelectLang/>}
</div>
;
};
export default LangSwitch;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {l} from "@/utils/intl";
import React from "react";
import Settings from "../../../../../../config/defaultSettings";
import style from "../../../../../global.less";
import Scale from "@/components/Animation/Scale";
const MainWithStyle = (props: any) => {
const {children} = props;
return <div
className={style.loginformMain}
style={{backgroundImage: `url('/icons/main-bg.svg')`}}
>
<Scale><img className={style.logo} src={Settings.logo}/></Scale>
<div className={style.form}>
<div className={style.top}>
<div className={style.header}>Dinky</div>
<div className={style.desc}>{l("layouts.userLayout.title")}</div>
</div>
{children}
</div>
</div>;
};
export default MainWithStyle;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import React, {useState} from "react";
import {l} from "@/utils/intl";
import {ProForm, ProFormCheckbox, ProFormText} from "@ant-design/pro-components";
import {LockOutlined, UserOutlined} from "@ant-design/icons";
import MainWithStyle from "./MainWithStyle";
import {SubmitterProps} from "@ant-design/pro-form/es/components";
import style from "../../../../global.less";
import FadeIn from "@/components/Animation/FadeIn";
type LoginFormProps = {
onSubmit: (values: any) => Promise<void>;
}
const LoginForm: React.FC<LoginFormProps> = (props) => {
const {onSubmit} = props;
const [form] = ProForm.useForm();
const [submitting, setSubmitting] = useState(false);
const handleClickLogin = async () => {
setSubmitting(true);
await onSubmit({...form.getFieldsValue()});
setSubmitting(false);
};
const renderLoginForm = () => {
return <>
<ProFormText
name="username"
width={"lg"}
fieldProps={{
prefix: <UserOutlined/>,
}}
required
placeholder={l("login.username.placeholder")}
rules={[
{
required: true,
message: l("login.username.required"),
},
]}
/>
<ProFormText.Password
name="password"
fieldProps={{
prefix: <LockOutlined/>,
}}
placeholder={l("login.password.placeholder")}
rules={[
{
required: true,
message: l("login.password.required"),
},
]}
/>
<ProFormCheckbox name="autoLogin">
{l("login.rememberMe")}
</ProFormCheckbox>
</>;
};
const proFormSubmitter: SubmitterProps = {
searchConfig: {submitText: l("menu.login")},
resetButtonProps: false,
submitButtonProps: {
loading: submitting,
size: "large",
shape: "round",
style: {width: "100%"}
}
};
return <MainWithStyle>
<FadeIn>
<ProForm
className={style.loginform}
form={form}
onFinish={handleClickLogin}
initialValues={{autoLogin: true}}
submitter={{...proFormSubmitter}}
>
{renderLoginForm()}
</ProForm>
</FadeIn>
</MainWithStyle>;
};
export default LoginForm;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import {history} from "@@/core/history";
/** 此方法会跳转到 redirect 参数所在的位置 */
export const gotoRedirectUrl = () => {
if (!history) return;
setTimeout(() => {
const urlParams = new URL(window.location.href).searchParams;
history.push(urlParams.get("redirect") || "/");
}, 10);
};
...@@ -15,72 +15,41 @@ ...@@ -15,72 +15,41 @@
* limitations under the License. * limitations under the License.
*/ */
import Footer from '@/components/Footer'; import Footer from "@/components/Footer";
import {setTenantStorageAndCookie} from "@/utils/function";
import { setTenantStorageAndCookie } from '@/utils/function'; import {l} from "@/utils/intl";
import { l } from '@/utils/intl'; import {useEmotionCss} from "@ant-design/use-emotion-css";
import { LockOutlined, UserOutlined } from '@ant-design/icons'; import {useModel} from "@umijs/max";
import { CheckCard, LoginForm, ProFormCheckbox, ProFormText } from '@ant-design/pro-components'; import React, {useState} from "react";
import { useEmotionCss } from '@ant-design/use-emotion-css'; import {flushSync} from "react-dom";
import { Helmet, history, SelectLang, useModel } from '@umijs/max';
import { Button, Modal } from 'antd';
import React, { useState } from 'react';
import { flushSync } from 'react-dom';
import Settings from '../../../../config/defaultSettings';
import {chooseTenantSubmit, login} from "@/services/BusinessCrud"; import {chooseTenantSubmit, login} from "@/services/BusinessCrud";
import { import {
ErrorMessage, ErrorMessage,
SuccessMessageAsync, SuccessMessageAsync,
} from "@/utils/messages"; } from "@/utils/messages";
import {UserBaseInfo} from "@/types/User/data";
/** 此方法会跳转到 redirect 参数所在的位置 */ import LoginForm from "./LoginForm";
const gotoRedirectUrl = () => { import HelmetTitle from "./HelmetTitle";
if (!history) return; import ChooseModal from "@/pages/Other/Login/ChooseModal";
setTimeout(() => { import {gotoRedirectUrl} from "@/pages/Other/Login/function";
const urlParams = new URL(window.location.href).searchParams; import LangSwitch from "@/pages/Other/Login/LangSwitch";
history.push(urlParams.get('redirect') || '/');
}, 10);
};
const Lang = () => {
const langClassName = useEmotionCss(({ token }) => {
return {
width: 42,
height: 42,
lineHeight: '42px',
position: 'fixed',
right: 16,
borderRadius: token.borderRadius,
':hover': {
backgroundColor: token.colorBgTextHover,
},
};
});
return (
<div className={langClassName} data-lang>
{SelectLang && <SelectLang />}
</div>
);
};
const Login: React.FC = () => { const Login: React.FC = () => {
const [submitting, setSubmitting] = useState(false); const [submitting, setSubmitting] = useState(false);
const { initialState, setInitialState } = useModel('@@initialState'); const {initialState, setInitialState} = useModel("@@initialState");
const [tenantVisible, handleTenantVisible] = useState<boolean>(false); const [tenantVisible, handleTenantVisible] = useState<boolean>(false);
const [checkDisabled, setCheckDisabled] = useState<boolean>(true);
const [tenant, setTenant] = useState<UserBaseInfo.Tenant[]>([]); const [tenant, setTenant] = useState<UserBaseInfo.Tenant[]>([]);
const [tenantIdParams, setTenantIdParams] = useState<number>();
const containerClassName = useEmotionCss(() => { const containerClassName = useEmotionCss(() => {
return { return {
display: 'flex', display: "flex",
flexDirection: 'column', width: "100%",
height: '100vh', flexDirection: "column",
overflow: 'auto', height: "100%",
backgroundImage: position: "relative",
"url('https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/V-_oS6r-i7wAAAAAAAAAAAAAFl94AQBr')", backgroundImage: "url(/icons/footer-bg.svg)",
backgroundSize: '100% 100%', backgroundPosition: "bottom center",
backgroundRepeat: "no-repeat",
}; };
}); });
...@@ -98,205 +67,101 @@ const Login: React.FC = () => { ...@@ -98,205 +67,101 @@ const Login: React.FC = () => {
const handleChooseTenant = async (chooseTenantResult: API.Result) => { const handleChooseTenant = async (chooseTenantResult: API.Result) => {
if (chooseTenantResult.code === 0) { if (chooseTenantResult.code === 0) {
await SuccessMessageAsync( await SuccessMessageAsync(l("login.chooseTenantSuccess", "", {
l('login.chooseTenantSuccess', '', { msg: chooseTenantResult.msg,
msg: chooseTenantResult.msg, tenantCode: chooseTenantResult.datas.tenantCode,
tenantCode: chooseTenantResult.datas.tenantCode, }),);
}),
);
/** /**
* After the selection is complete, refresh all user information * After the selection is complete, refresh all user information
*/ */
await fetchUserInfo(); await fetchUserInfo();
/** /**
* Redirect to home page * Redirect to home page
*/ */
gotoRedirectUrl(); gotoRedirectUrl();
} else { } else {
ErrorMessage(l('login.chooseTenantFailed')); ErrorMessage(l("login.chooseTenantFailed"));
return; return;
} }
}; };
const handleSubmit = async (values: API.LoginParams) => {
/**
* Determine whether the tenant list is empty
* @param tenantList
*/
const assertTenant = async (tenantList: UserBaseInfo.Tenant[]) => {
if (tenantList === null || tenantList.length === 0) {
ErrorMessage(l("login.notbindtenant"));
return;
} else {
setTenant(tenantList);
}
};
/**
* when login user has only one tenant ,directly login to the system
* @param tenantList
*/
const singleTenant = async (tenantList: UserBaseInfo.Tenant[]) => {
const tenantId = tenantList[0].id;
setTenantStorageAndCookie(tenantId);
const chooseTenantResult: API.Result = await chooseTenantSubmit({tenantId});
await handleChooseTenant(chooseTenantResult);
};
const handleSubmitLogin = async (values: API.LoginParams) => {
try { try {
// login // login
const result = await login({ ...values }); const result = await login({...values});
await SuccessMessageAsync(l('login.result', '', { msg: result.msg, time: result.time })); await SuccessMessageAsync(l("login.result", "", {msg: result.msg, time: result.time}));
/** /**
* After successful login, set the tenant list * After successful login, set the tenant list
*/ */
const tenantList: UserBaseInfo.Tenant[] = result.datas.tenantList; const tenantList: UserBaseInfo.Tenant[] = result.datas.tenantList;
if (tenantList === null || tenantList.length === 0) { await assertTenant(tenantList);
ErrorMessage(l('login.notbindtenant'));
return;
} else {
setTenant(tenantList);
}
/** /**
* Determine whether the current tenant list is multiple * Determine whether the current tenant list is multiple
* 1. If there are multiple execution pop-up modals, the user selects a specific tenant to enter the system * 1. If there are multiple execution pop-up modals, the user selects a specific tenant to enter the system
* 2. If it is a single, only use the unique tenant id to enter the system directly * 2. If it is a single, only use the unique tenant id to enter the system directly
*/ */
if (tenantList && tenantList.length > 1) { if (tenantList && tenantList.length > 1) {
handleTenantVisible(true); handleTenantVisible(true);
} else { } else {
setTenantIdParams(tenantList[0].id as number); await singleTenant(tenantList);
setTenantStorageAndCookie(tenantList[0].id as number);
const chooseTenantResult: API.Result = await chooseTenantSubmit({
tenantId: tenantList[0].id as number,
});
await handleChooseTenant(chooseTenantResult);
} }
return; return;
} catch (error:any) { } catch (error: any) {
return; return;
} }
}; };
const handleShowTenant = () => {
return ( /**
<> * Confirm the tenant selection of login users
<Modal * @param tenantId
title={l('login.chooseTenant')} */
open={tenantVisible} const handleConfirmChooseTenant = async (tenantId: number) => {
destroyOnClose={true} setSubmitting(true);
width={'60%'} const result = await chooseTenantSubmit({tenantId: tenantId});
onCancel={() => { await handleChooseTenant(result);
handleTenantVisible(false); handleTenantVisible(false);
}}
footer={[
<Button
key="back"
onClick={() => {
handleTenantVisible(false);
}}
>
{l('button.close')}
</Button>,
<Button
disabled={checkDisabled}
type="primary"
key="submit"
loading={submitting}
onClick={async () => {
setSubmitting(true);
const result = await chooseTenantSubmit({ tenantId: tenantIdParams as number });
await handleChooseTenant(result);
handleTenantVisible(false);
}}
>
{l('button.confirm')}
</Button>,
]}
>
<CheckCard.Group
multiple={false}
onChange={(value) => {
if (value) {
// if no tenant is selected, the confirm button is disabled
setCheckDisabled(false);
setTenantStorageAndCookie(value as number);
setTenantIdParams(value as number);
} else {
setCheckDisabled(true);
}
}}
>
{tenant?.map((item: any) => {
return (
<CheckCard
size={'default'}
key={item?.id}
avatar="/icons/tenant_default.svg"
title={item?.tenantCode}
value={item?.id}
description={item?.note}
/>
);
})}
</CheckCard.Group>
</Modal>
</>
);
}; };
return ( return (
<div className={containerClassName}> <div className={containerClassName}>
<Helmet> <HelmetTitle/>
<title> <LangSwitch/>
{l('menu.login')}- {Settings.title} <LoginForm onSubmit={handleSubmitLogin}/>
</title> <Footer/>
</Helmet> <ChooseModal
<Lang /> tenantVisible={tenantVisible}
<div handleTenantVisible={() => handleTenantVisible(false)}
style={{ submitting={submitting}
flex: '1', handleChooseTenant={(tenantId) => handleConfirmChooseTenant(tenantId)}
padding: '32px 0', tenant={tenant}
}} />
>
<LoginForm
contentStyle={{
minWidth: 280,
maxWidth: '75vw',
}}
logo={<img alt="logo" src={Settings.logo} />}
title="Dinky"
subTitle={l('layouts.userLayout.title')}
initialValues={{
autoLogin: true,
}}
onFinish={async (values) => {
await handleSubmit(values as API.LoginParams);
}}
>
<>
<ProFormText
name="username"
fieldProps={{
size: 'large',
prefix: <UserOutlined />,
}}
placeholder={l('login.username.placeholder')}
rules={[
{
required: true,
message: l('login.username.required'),
},
]}
/>
<ProFormText.Password
name="password"
fieldProps={{
size: 'large',
prefix: <LockOutlined />,
}}
placeholder={l('login.password.placeholder')}
rules={[
{
required: true,
message: l('login.password.required'),
},
]}
/>
</>
<div
style={{
marginBottom: 24,
}}
>
<ProFormCheckbox noStyle name="autoLogin">
{l('login.rememberMe')}
</ProFormCheckbox>
</div>
</LoginForm>
</div>
<Footer />
{handleShowTenant()}
</div> </div>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment