From fc32b691967b530f949f62cc3758a9d70dbd5a91 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 23 三月 2022 00:14:14 +0800
Subject: [PATCH] 2022-03-23

---
 src/mob/components/topbar/normal-navbar/options.jsx |   11 ++
 src/views/sso/index.jsx                             |  118 ++++++++++++++++++-----------
 src/mob/components/topbar/normal-navbar/index.jsx   |   19 ++++
 src/components/header/index.jsx                     |   56 ++++++++++---
 src/views/login/index.jsx                           |   20 -----
 5 files changed, 143 insertions(+), 81 deletions(-)

diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index 3761868..1b78675 100644
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -189,10 +189,19 @@
 
         const { menulist, thdMenuList } = this.getMenulist(result)
 
+        let systems = []
+        if ((options.sysType === 'local' || options.sysType === 'SSO') && result.sys_list) {
+          systems = result.sys_list
+
+          if (options.sysType === 'local' && window.GLOB.systemType !== 'production' && systems.length > 10) {
+            systems.length = 10
+          }
+        }
+
         this.setState({
           menulist,
           thdMenuList,
-          systems: window.GLOB.systemType === 'production' || options.sysType === 'SSO' ? (result.sys_list || []) : []
+          systems: systems
         })
         
         let mainMenu = menulist[0] || ''
@@ -446,7 +455,6 @@
             message: result.message,
             duration: 10
           })
-          return
         } else if (result.func_detail && result.func_detail.length > 0) {
           this.writeFuncs(result.func_detail)
         }
@@ -551,18 +559,40 @@
       url = url + '/'
     }
 
-    let href = url + 'index.html#/ssologin/' + window.btoa(window.encodeURIComponent(JSON.stringify({
-      UserID: sessionStorage.getItem('UserID'),
-      LoginUID: sessionStorage.getItem('LoginUID'),
-      User_Name: sessionStorage.getItem('User_Name'),
-      Full_Name: sessionStorage.getItem('Full_Name'),
-      avatar: sessionStorage.getItem('avatar'),
-      dataM: system.dataM ? 'true' : '',
-      debug: system.debug || '',
-      role_id: system.role_id || ''
-    })))
+    let key = Utils.getuuid()
 
-    window.open(href)
+    let _param = {
+      func: 'webapi_scan_binding_key',
+      binding_type: 'mk',
+      scan_type: 'toggle',
+      scan_appkey: system.scan_appkey,
+      id: key
+    }
+
+    Api.getSystemConfig(_param).then(res => {
+      if (!res.status) {
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 5
+        })
+      } else if (res.thd_party_appid && res.thd_party_member_id && res.thd_party_openid) {
+        let href = url + 'admin/index.html#/ssologin/' + window.btoa(window.encodeURIComponent(JSON.stringify({
+          appid: res.thd_party_appid,
+          memberId: res.thd_party_member_id,
+          openid: res.thd_party_openid,
+          key: key
+        })))
+
+        window.open(href)
+      } else {
+        notification.warning({
+          top: 92,
+          message: '淇℃伅缂哄け锛岃鑱旂郴绠$悊鍛橈紒',
+          duration: 5
+        })
+      }
+    })
   }
 
   dropdownMenuChange = (visible) => {
diff --git a/src/mob/components/topbar/normal-navbar/index.jsx b/src/mob/components/topbar/normal-navbar/index.jsx
index 0a3809a..e14304d 100644
--- a/src/mob/components/topbar/normal-navbar/index.jsx
+++ b/src/mob/components/topbar/normal-navbar/index.jsx
@@ -37,7 +37,8 @@
         subtype: card.subtype,
         wrap: { type: 'navbar', height: 50, title: 'NavBar', back: 'true', logout: 'false' },
         style: {boxShadow: '0 0 3px #D9D9D9', shadowColor: '#D9D9D9', shadowBlur: '3px', paddingLeft: '10px', paddingRight: '10px', lineHeight: '2.8', fontSize: '18px' },
-        searchStyle: {}
+        searchStyle: {},
+        titleStyle: {}
       }
 
       if (card.config) {
@@ -102,6 +103,8 @@
 
     if (comIds[1] === 'search') {
       _card.searchStyle = style
+    } else if (comIds[1] === 'title') {
+      _card.titleStyle = style
     } else {
       _card.style = style
     }
@@ -117,6 +120,12 @@
     const { card } = this.state
 
     MKEmitter.emit('changeStyle', [card.uuid], ['font', 'background', 'border', 'padding', 'shadow'], card.style)
+  }
+
+  changeTitleStyle = () => {
+    const { card } = this.state
+
+    MKEmitter.emit('changeStyle', [card.uuid, 'title'], ['font'], card.titleStyle || {})
   }
 
   changeSearchStyle = () => {
@@ -216,7 +225,13 @@
             {card.wrap.menuPosition === 'left' ? <div className="img" style={{backgroundImage: `url(${avatar})`}}></div> : null}
           </div>
           {card.wrap.type !== 'search' ?
-            <div className="am-navbar-title">{card.wrap.title || ''}</div> :
+            <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
+              <div className="mk-popover-control">
+                <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeTitleStyle}/>
+              </div>
+            } trigger="hover">
+              <div className="am-navbar-title" style={card.titleStyle}>{card.wrap.title || ''}</div>
+            </Popover> :
             <div className="am-navbar-search" onDoubleClick={this.setSearch}>
               <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
                 <div className="mk-popover-control">
diff --git a/src/mob/components/topbar/normal-navbar/options.jsx b/src/mob/components/topbar/normal-navbar/options.jsx
index 0fca168..260e5b2 100644
--- a/src/mob/components/topbar/normal-navbar/options.jsx
+++ b/src/mob/components/topbar/normal-navbar/options.jsx
@@ -138,6 +138,17 @@
       }]
     },
     {
+      type: 'radio',
+      field: 'mode',
+      label: '寮规鑳屾櫙',
+      initval: wrap.mode || 'dark',
+      required: false,
+      options: [
+        {value: 'light', label: '鐧借壊'},
+        {value: 'dark', label: '榛戣壊'},
+      ]
+    },
+    {
       type: 'select',
       field: 'linkmenu',
       label: '鍏宠仈鑿滃崟',
diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx
index 39bfb4a..11df93c 100644
--- a/src/views/login/index.jsx
+++ b/src/views/login/index.jsx
@@ -74,13 +74,6 @@
    * @param {Object} param 鐢ㄦ埛鍚嶅瘑鐮佺瓑淇℃伅
    */
   async loginsubmit (param) {
-    if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 涓氬姟绯荤粺蹇呴』璁剧疆鍗曠偣鍦板潃
-      Modal.warning({
-        title: '鏈缃崟鐐规湇鍔″櫒鍦板潃锛岃鑱旂郴绠$悊鍛橈紒'
-      })
-      return
-    }
-
     let city = sessionStorage.getItem('city') || ''
     let ipAddress = sessionStorage.getItem('ipAddress') || ''
 
@@ -176,13 +169,6 @@
   }
 
   async phoneloginsubmit (param) {
-    if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 涓氬姟绯荤粺蹇呴』璁剧疆鍗曠偣鍦板潃
-      Modal.warning({
-        title: '鏈缃崟鐐规湇鍔″櫒鍦板潃锛岃鑱旂郴绠$悊鍛橈紒'
-      })
-      return
-    }
-
     let city = sessionStorage.getItem('city') || ''
     let ipAddress = sessionStorage.getItem('ipAddress') || ''
 
@@ -232,12 +218,6 @@
   }
 
   authLogin = (appid, openid, memberid, scanId) => {
-    if (options.sysType === 'local' && !window.GLOB.mainSystemApi) { // 涓氬姟绯荤粺蹇呴』璁剧疆鍗曠偣鍦板潃
-      Modal.warning({
-        title: '鏈缃崟鐐规湇鍔″櫒鍦板潃锛岃鑱旂郴绠$悊鍛橈紒'
-      })
-      return
-    }
     Api.getTouristMsg(appid, openid, memberid, scanId).then(res => {
       if (res.status) {
         sessionStorage.setItem('UserID', res.UserID)
diff --git a/src/views/sso/index.jsx b/src/views/sso/index.jsx
index ee0c674..03a7c03 100644
--- a/src/views/sso/index.jsx
+++ b/src/views/sso/index.jsx
@@ -1,5 +1,5 @@
 import React, {Component} from 'react'
-import { Spin } from 'antd'
+import { Spin, notification } from 'antd'
 import { connect } from 'react-redux'
 import md5 from 'md5'
 import moment from 'moment'
@@ -16,23 +16,41 @@
       let _param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
 
       if (typeof(_param) === 'object') {
-        _param.UserID && sessionStorage.setItem('UserID', _param.UserID)
-        _param.LoginUID && sessionStorage.setItem('LoginUID', _param.LoginUID)
-        _param.User_Name && sessionStorage.setItem('User_Name', _param.User_Name)
-        _param.Full_Name && sessionStorage.setItem('Full_Name', _param.Full_Name)
-        _param.debug && sessionStorage.setItem('debug', _param.debug)
-        _param.dataM && sessionStorage.setItem('dataM', _param.dataM)
-        _param.dataM && sessionStorage.setItem('localDataM', _param.dataM)
-        _param.avatar && sessionStorage.setItem('avatar', _param.avatar)
-        _param.role_id && sessionStorage.setItem('role_id', _param.role_id)
-        _param.role_id && sessionStorage.setItem('localRole_id', _param.role_id)
+        this.authLogin(_param.appid, _param.openid, _param.memberId, _param.key)
       } else {
         this.props.history.replace('/login')
       }
-      this.getMessage()
     } catch (e) {
       this.props.history.replace('/login')
     }
+  }
+
+  authLogin = (appid, openid, memberid, scanId) => {
+    Api.getTouristMsg(appid, openid, memberid, scanId).then(res => {
+      if (res.status) {
+        sessionStorage.setItem('UserID', res.UserID)
+        sessionStorage.setItem('LoginUID', res.LoginUID)
+        sessionStorage.setItem('User_Name', res.UserName)
+        sessionStorage.setItem('Full_Name', res.FullName)
+        sessionStorage.setItem('avatar', res.icon || '')
+        sessionStorage.setItem('dataM', res.dataM ? 'true' : '')
+        sessionStorage.setItem('localDataM', res.dataM ? 'true' : '')
+        sessionStorage.setItem('debug', res.debug || '')
+        sessionStorage.setItem('role_id', res.role_id || '')
+        sessionStorage.setItem('departmentcode', res.departmentcode || '')
+        sessionStorage.setItem('organization', res.organization || '')
+        sessionStorage.setItem('localRole_id', res.role_id || '')
+        
+        this.getMessage()
+      } else {
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 5
+        })
+        this.props.history.replace('/login')
+      }
+    })
   }
 
   getMessage = () => {
@@ -47,7 +65,16 @@
 
     Api.getSystemConfig(_param).then(res => {
       if (res.status) {
-        let _url = window.location.href.split('#')[0] + 'system'
+        if (/^https/.test(window.location.protocol)) { // https杞崲
+          res.Banner = res.Banner ? res.Banner.replace(/^http:/ig, 'https:') : ''
+          res.doclogo = res.doclogo ? res.doclogo.replace(/^http:/ig, 'https:') : ''
+          res.indexlogo = res.indexlogo ? res.indexlogo.replace(/^http:/ig, 'https:') : ''
+          res.loginlogo = res.loginlogo ? res.loginlogo.replace(/^http:/ig, 'https:') : ''
+          res.titlelogo = res.titlelogo ? res.titlelogo.replace(/^http:/ig, 'https:') : ''
+        }
+
+        const _href = window.location.href.split('#')[0]
+        let _url = _href + 'system'
         let systemMsg = {
           favicon: res.titlelogo || '',
           platTitle: res.titleName || '',
@@ -59,7 +86,30 @@
           mainlogo: res.indexlogo || '',
           doclogo: res.doclogo || '',
           style: res.CSS || '',
-          webSite: res.WebSite || ''
+          showline: res.split_line_show || 'true',
+          webSite: res.WebSite || '',
+          navBar: res.menu_type,
+          app_version: res.app_version
+        }
+
+        let level = res.pwd_level || ''
+
+        if (level && !['letter_num', 'char_num', 'char_num_90'].includes(level)) {
+          level = ''
+        }
+
+        localStorage.setItem(_href + 'pwdlevel', level)
+
+        if (res.srcid) {
+          localStorage.setItem(_href + 'srcId', res.srcid)
+        } else {
+          localStorage.removeItem(_href + 'srcId')
+        }
+
+        sessionStorage.setItem('home_background', res.index_background_color || '')
+        if (res.sys_datetime) {
+          sessionStorage.setItem('sys_datetime', res.sys_datetime)
+          sessionStorage.setItem('app_datetime', new Date().getTime())
         }
 
         // url鏍囬
@@ -71,42 +121,13 @@
           localStorage.removeItem(_url)
         }
 
-        let _loginurl = window.location.href.split('#')[0] + 'loginways'
-        let login_ways = []
-        let login_types = []
-        if (res.login_ways && res.login_ways.length > 0) {
-          res.login_ways.forEach(item => {
-            // 鐭俊楠岃瘉鐮佺櫥褰曪紝蹇呴』璁剧疆鐭俊Id
-            if (item.way_no === 'sms_vcode' && !item.sms_id) return
-            if (login_types.includes(item.way_no)) return
-
-            login_types.push(item.way_no)
-
-            login_ways.push({
-              label: item.way_name,
-              type: item.way_no,
-              smsId: item.sms_id
-            }) 
-          })
-        } else {
-          login_ways.push({
-            label: '璐﹀彿瀵嗙爜鐧诲綍',
-            type: 'uname_pwd',
-            smsId: ''
-          })
-        }
-
-        try {
-          localStorage.setItem(_loginurl, window.btoa(window.encodeURIComponent(JSON.stringify(login_ways))))
-        } catch (e) {
-          localStorage.removeItem(_loginurl)
-        }
-
         window.GLOB.mainlogo = systemMsg.mainlogo
         window.GLOB.style = systemMsg.style
+        window.GLOB.navBar = systemMsg.navBar
+        window.GLOB.appVersion = systemMsg.app_version
     
         if (window.GLOB.style && styles[window.GLOB.style]) {
-          document.body.className = styles[window.GLOB.style]
+          document.body.className = styles[window.GLOB.style] + ' ' + (res.split_line_show === 'false' ? 'hidden-split-line' : '')
         }
 
         if (res.titlelogo && window.GLOB.favicon !== res.titlelogo) {
@@ -125,6 +146,11 @@
         }
         this.props.history.replace('/main')
       } else {
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 5
+        })
         this.props.history.replace('/login')
       }
     }, () => {

--
Gitblit v1.8.0