From 02546bc3c0ed7a4e471df15b80792008563d1d10 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 29 七月 2022 18:25:57 +0800
Subject: [PATCH] 2022-07-29

---
 src/pc/components/login/normal-login/index.jsx |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/pc/components/login/normal-login/index.jsx b/src/pc/components/login/normal-login/index.jsx
index ddd7413..226531c 100644
--- a/src/pc/components/login/normal-login/index.jsx
+++ b/src/pc/components/login/normal-login/index.jsx
@@ -25,7 +25,7 @@
 
   state = {
     card: null,
-    back: false
+    active: 'login'
   }
 
   UNSAFE_componentWillMount () {
@@ -68,7 +68,14 @@
       if (_card.wrap.link && _card.wrap.link === 'menu') {
         _card.wrap.linkmenu = _card.uuid
       }
+      _card.wrap.classify = _card.wrap.classify || 'login'
+
+      let active = 'login'
+      if (_card.wrap.classify === 'signin') {
+        active = 'signin'
+      }
       this.setState({
+        active,
         card: _card
       })
     }
@@ -146,17 +153,26 @@
 
     card.wrap = res
 
+    let active = 'login'
+    if (res.classify === 'signin') {
+      active = 'signin'
+    }
+    this.setState({
+      active
+    })
+
     this.updateComponent(card)
   }
 
   render() {
-    const { card } = this.state
+    const { card, active } = this.state
     let style = resetStyle(card.style)
-    if (card.wrap.maxWidth) {
-      style.maxWidth = card.wrap.maxWidth
+
+    if (card.style.width) {
       let left = style.marginLeft && style.marginLeft !== '0px' ? style.marginLeft : 'auto'
       let right = style.marginRight && style.marginRight !== '0px' ? style.marginRight : 'auto'
       style.margin = (style.marginTop || 0) + ' ' + right + ' ' + (style.marginBottom || 0) + ' ' + left
+      style.maxWidth = `calc(100% - ${style.marginLeft || '0px'} - ${style.marginRight || '0px'})`
       delete style.marginLeft
       delete style.marginRight
       delete style.marginTop
@@ -176,8 +192,8 @@
         } trigger="hover">
           <ToolOutlined />
         </Popover>
-        {card.wrap.loginWays ? <LoginForm wrap={card.wrap} /> : null}
-        {card.wrap.signWays ? <SignForm wrap={card.wrap} /> : null}
+        {card.wrap.loginWays && active === 'login' ? <LoginForm wrap={card.wrap} changeway={() => this.setState({active: 'signin'})}/> : null}
+        {card.wrap.signWays && active === 'signin' ? <SignForm wrap={card.wrap} changeway={() => this.setState({active: 'login'})}/> : null}
         <div className="component-name">
           <div className="center">
             <div className="title">{card.name}</div>

--
Gitblit v1.8.0