From fe6e87bacbb4be97260427346321edeeee26258e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 21 七月 2020 18:45:01 +0800
Subject: [PATCH] 2020-07-21

---
 src/page/main/index.jsx |   55 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/src/page/main/index.jsx b/src/page/main/index.jsx
index 96ee4a9..36d48c4 100644
--- a/src/page/main/index.jsx
+++ b/src/page/main/index.jsx
@@ -1,26 +1,59 @@
 import React, {Component} from 'react';
+import { Toast } from 'antd-mobile'
+
+import Api from '@/api'
 import asyncComponent from '@/utils/asyncPage'
 import './index.scss';
 
 const Login1 = asyncComponent(() => import('@/components/login/login-1'))
 
 class Main extends Component {
+  state = {
+    viewId: this.props.match.params.viewId,
+    config: ''
+  }
 
+  UNSAFE_componentWillMount () {
+    const { viewId } = this.state
+
+    Api.getSystemConfig({
+      func: 'sPC_Get_LongParam',
+      MenuID: viewId,
+      TypeCharOne: 'mob'
+    }).then((res) => {
+      if (res.status) {
+        let config = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
+        this.setState({
+          config: config
+        })
+      } else {
+        Toast.fail(res.message, 3)
+      }
+    })
+  }
+
+  getComponents = () => {
+    const { config } = this.state
+
+    if (!config) return null
+
+    let components = []
+
+    config.components.forEach(item => {
+      if (item.type === 'login') {
+        if (item.subtype === 'mob-login-1') {
+          components.push(<Login1 key={item.uuid} config={item} />)
+        }
+      }
+    })
+
+    return components
+  }
 
   render () {
-    const config = {
-      type: 'login',
-      subtype: 'mob-login-1',
-      box: { eleType: 'box', style: {color: '#ffffff', backgroundImage: 'linear-gradient(#378DBE, #46C29E, #48A9D6)'}},
-      logo: { eleType: 'img', style: {} },
-      title: { eleType: 'text', content: '鏄庣鍟嗕笟鏅鸿兘寮�鏀惧钩鍙�', style: {fontSize: '20px', fontWeight: 'bold', color: '#ffffff', textAlign: 'center', marginTop: '15px', marginBottom: '30px'}},
-      login: { eleType: 'button', content: '鐧诲綍', style: {fontSize: '18px', color: '#ffffff', textAlign: 'center', lineHeight: 2.4, borderRadius: '25px'}},
-      copyright: { eleType: 'textarea', content: 'Copyright漏2017  鎵�鏈夌浉鍏崇増鏉冨綊  鍖椾含鏄庣鏅崕淇℃伅鎶�鏈湁闄愬叕鍙�', style: {fontSize: '12px', color: '#ffffff', textAlign: 'center'} }
-    }
-
     return (
       <div className="main-page">
-        <Login1 config={config} />
+        {this.getComponents()}
       </div>
     );
   }

--
Gitblit v1.8.0