From eb17f44acd218786cc23e1ab6745494fbeeb9462 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 03 一月 2023 09:16:20 +0800
Subject: [PATCH] 2023-01-03

---
 src/mob/header/index.jsx                   |   16 -------
 src/views/appmanage/index.jsx              |    7 ++-
 src/views/mobdesign/menuform/index.jsx     |   12 ++++++
 src/views/appmanage/submutilform/index.jsx |   17 ++++++++
 src/views/mobdesign/index.jsx              |   51 ++++++++++++++++++++-----
 5 files changed, 74 insertions(+), 29 deletions(-)

diff --git a/src/mob/header/index.jsx b/src/mob/header/index.jsx
index 5bf90ea..38c5863 100644
--- a/src/mob/header/index.jsx
+++ b/src/mob/header/index.jsx
@@ -1,5 +1,4 @@
 import React, {Component} from 'react'
-import { Radio } from 'antd'
 
 import avatar from '@/assets/img/avatar.jpg'
 import MainLogo from '@/assets/img/main-logo.png'
@@ -8,26 +7,13 @@
 class MobHeader extends Component {
   state = {
     avatar: sessionStorage.getItem('CloudAvatar') || avatar,
-    userName: sessionStorage.getItem('CloudUserName'),
-    typename: sessionStorage.getItem('typename')
-  }
-
-  changeView = (e) => {
-    let val = e.target.value
-    this.props.changeView(val)
+    userName: sessionStorage.getItem('CloudUserName')
   }
 
   render () {
-    const { typename } = this.state
     return (
       <header className="mob-header-container">
         <div className="header-logo"><img src={MainLogo} alt=""/></div>
-        {typename === 'pad' ? <div className="change-view">
-          <Radio.Group defaultValue="vertical" onChange={this.changeView}>
-            <Radio value="vertical">绔栧睆</Radio>
-            <Radio value="horizontal">妯睆</Radio>
-          </Radio.Group>
-        </div> : null}
         <div className="header-user">
           <img src={this.state.avatar} alt=""/>
           <span>
diff --git a/src/views/appmanage/index.jsx b/src/views/appmanage/index.jsx
index a3512bd..2861ae7 100644
--- a/src/views/appmanage/index.jsx
+++ b/src/views/appmanage/index.jsx
@@ -466,6 +466,7 @@
               cell.delay = _param.delay || 0
               cell.statusBarColor = _param.statusBarColor || 'black'
               cell.sysBgColor = _param.sysBgColor || '#ffffff'
+              cell.direction = _param.direction || 'vertical'
               cell.adapter = _param.adapter || ''
               cell.share = _param.share || 'false' // 鍒嗕韩
               cell.share_des = _param.share_des || '' // 鍒嗕韩鎻忚堪
@@ -650,7 +651,7 @@
     })
 
     // 瀛愬簲鐢↖D銆乼ypename銆佸簲鐢↖D銆丆loudUserID銆乤ppkey銆乴ogin_types(鏄惁闇�瑕佺櫥褰曪紝宸插純鐢�)銆乴ink_type(鏄惁浣跨敤鐭繛鎺ワ紝宸插純鐢�)銆乺ole_type(鏄惁浣跨敤瑙掕壊绠$悊)銆乴ang銆乧ss(鐨偆)銆乼itle(鏍囬)銆乫avicon(鍥炬爣)銆乽ser_binding(鐢ㄦ埛缁戝畾)銆乻ms_id(鐭俊妯℃澘ID)銆佽嚜瀹氫箟
-    param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify({userbind: item.userbind || '', instantMessage: item.instantMessage || '', apptype: item.apptype || '', delay: item.delay || 0, statusBarColor: item.statusBarColor || 'black', sysBgColor: item.sysBgColor || '#ffffff', adapter: item.adapter || '', share: item.share || '', share_des: item.share_des || '', share_url: item.share_url || '', share_link: item.share_link || ''})))}'`)
+    param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify({userbind: item.userbind || '', instantMessage: item.instantMessage || '', apptype: item.apptype || '', delay: item.delay || 0, statusBarColor: item.statusBarColor || 'black', sysBgColor: item.sysBgColor || '#ffffff', direction: item.direction || 'vertical', adapter: item.adapter || '', share: item.share || '', share_des: item.share_des || '', share_url: item.share_url || '', share_link: item.share_link || ''})))}'`)
     param.LText = param.LText.join(' union all ')
     param.LText = Utils.formatOptions(param.LText)
     
@@ -896,7 +897,7 @@
           return item
         })
 
-        param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify({userbind: item.userbind || '', instantMessage: item.instantMessage || '', apptype: item.apptype || '', delay: item.delay || 0, statusBarColor: item.statusBarColor || 'black', sysBgColor: item.sysBgColor || '#ffffff', adapter: item.adapter || '', share: item.share || '', share_des: item.share_des || '', share_url: item.share_url || '', share_link: item.share_link || ''})))}'`)
+        param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify({userbind: item.userbind || '', instantMessage: item.instantMessage || '', apptype: item.apptype || '', delay: item.delay || 0, statusBarColor: item.statusBarColor || 'black', sysBgColor: item.sysBgColor || '#ffffff', direction: item.direction || 'vertical', adapter: item.adapter || '', share: item.share || '', share_des: item.share_des || '', share_url: item.share_url || '', share_link: item.share_link || ''})))}'`)
         param.LText = param.LText.join(' union all ')
         param.LText = Utils.formatOptions(param.LText)
       }
@@ -989,7 +990,7 @@
         return item
       })
 
-      param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify({userbind: item.userbind || '', instantMessage: item.instantMessage || '', apptype: item.apptype || '', delay: item.delay || 0, statusBarColor: item.statusBarColor || 'black', sysBgColor: item.sysBgColor || '#ffffff', adapter: item.adapter || '', share: item.share || '', share_des: item.share_des || '', share_url: item.share_url || '', share_link: item.share_link || ''})))}'`)
+      param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify({userbind: item.userbind || '', instantMessage: item.instantMessage || '', apptype: item.apptype || '', delay: item.delay || 0, statusBarColor: item.statusBarColor || 'black', sysBgColor: item.sysBgColor || '#ffffff', direction: item.direction || 'vertical', adapter: item.adapter || '', share: item.share || '', share_des: item.share_des || '', share_url: item.share_url || '', share_link: item.share_link || ''})))}'`)
       param.LText = param.LText.join(' union all ')
       param.LText = Utils.formatOptions(param.LText)
 
diff --git a/src/views/appmanage/submutilform/index.jsx b/src/views/appmanage/submutilform/index.jsx
index 18265b2..5c1b1d8 100644
--- a/src/views/appmanage/submutilform/index.jsx
+++ b/src/views/appmanage/submutilform/index.jsx
@@ -322,6 +322,23 @@
               )}
             </Form.Item>
           </Col>
+          {typename === 'pad' ? <Col span={12}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="绯荤粺榛樿灞忓箷鏂瑰悜锛屽崟涓〉闈㈡柟鍚戣鍦ㄩ〉闈腑閰嶇疆銆�">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                灞忓箷鏂瑰悜
+              </Tooltip>
+            }>
+              {getFieldDecorator('direction', {
+                initialValue: card ? card.direction || 'vertical' : 'vertical'
+              })(
+                <Radio.Group>
+                  <Radio value="vertical">绔栧睆</Radio>
+                  <Radio value="horizontal">妯睆</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
         </Row>
       </Form>
     )
diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx
index d83cd27..a3f934b 100644
--- a/src/views/mobdesign/index.jsx
+++ b/src/views/mobdesign/index.jsx
@@ -68,7 +68,6 @@
     menuloading: false,
     oriConfig: null,
     config: null,
-    direction: 'vertical',
     settingshow: true,
     controlshow: true,
     comloading: false,
@@ -91,6 +90,7 @@
         sessionStorage.setItem('typename', param.typename || 'mob')
         sessionStorage.setItem('adapter', param.adapter || '')
         sessionStorage.setItem('sysBgColor', param.sysBgColor || '#ffffff')
+        sessionStorage.setItem('direction', param.direction || 'vertical')
         sessionStorage.setItem('userbind', param.userbind || '')
         sessionStorage.setItem('instantMessage', param.instantMessage || '')
 
@@ -100,13 +100,6 @@
         window.GLOB.winHeight = 738
         window.GLOB.shellWidth = 376
         window.GLOB.shellHeight = 680
-
-        if (sessionStorage.getItem('typename') === 'pad') {
-          window.GLOB.winWidth = 736
-          window.GLOB.winHeight = 945
-          window.GLOB.shellWidth = 640
-          window.GLOB.shellHeight = 853
-        }
 
         let adapters = sessionStorage.getItem('adapter')
         if (adapters) {
@@ -498,7 +491,22 @@
         config.uuid = MenuId
         config.MenuID = MenuId
         config.open_edition = result.open_edition || ''
+        config.direction = config.direction || sessionStorage.getItem('direction') || 'vertical'
         window.GLOB.urlFields = config.urlFields || []
+
+        if (sessionStorage.getItem('typename') === 'pad') {
+          if (config.direction !== 'vertical') {
+            window.GLOB.winWidth = 992
+            window.GLOB.winHeight = 690
+            window.GLOB.shellWidth = 853
+            window.GLOB.shellHeight = 640
+          } else {
+            window.GLOB.winWidth = 736
+            window.GLOB.winHeight = 945
+            window.GLOB.shellWidth = 640
+            window.GLOB.shellHeight = 853
+          }
+        }
 
         if (config.version !== 2.0) {
           config.components = this.collectTB(config.components)
@@ -739,6 +747,21 @@
       config.MenuName = urlParam.MenuName || ''
       // config.MenuNo = urlParam.MenuNo || ''
       config.MenuNo = ''
+      config.direction = config.direction || sessionStorage.getItem('direction') || 'vertical'
+
+      if (sessionStorage.getItem('typename') === 'pad') {
+        if (config.direction !== 'vertical') {
+          window.GLOB.winWidth = 992
+          window.GLOB.winHeight = 690
+          window.GLOB.shellWidth = 853
+          window.GLOB.shellHeight = 640
+        } else {
+          window.GLOB.winWidth = 736
+          window.GLOB.winHeight = 945
+          window.GLOB.shellWidth = 640
+          window.GLOB.shellHeight = 853
+        }
+      }
 
       let navItem = null
       config.components.forEach(item => {
@@ -1809,6 +1832,8 @@
   }
 
   changeView = (val) => {
+    if (sessionStorage.getItem('typename') !== 'pad') return
+    
     if (val !== 'vertical') {
       window.GLOB.winWidth = 992
       window.GLOB.winHeight = 690
@@ -1822,7 +1847,6 @@
     }
 
     this.setState({
-      direction: val,
       comloading: true
     }, () => {
       this.setState({ comloading: false })
@@ -1849,7 +1873,7 @@
     return (
       <ConfigProvider locale={antdZhCN}>
         <div className={'mk-mob-view ' + viewType} id="mk-mob-design-view">
-          <Header changeView={this.changeView}/>
+          <Header/>
           {loading ? <Spin className="view-spin" size="large" /> : null}
           <DndProvider backend={HTML5Backend}>
             <div className={'menu-setting ' + (!settingshow ? 'hidden' : '')}>
@@ -1866,7 +1890,12 @@
                       config={config}
                       MenuId={MenuId}
                       adapters={adapters}
-                      updateConfig={this.updateConfig}
+                      updateConfig={(con) => {
+                        this.updateConfig(con)
+                        if (con.direction !== config.direction) {
+                          this.changeView(con.direction)
+                        }
+                      }}
                     /> : null}
                     {config ? <UrlFieldComponent config={config} updateConfig={this.updateConfig}/> : null}
                     {/* 琛ㄥ悕娣诲姞 */}
diff --git a/src/views/mobdesign/menuform/index.jsx b/src/views/mobdesign/menuform/index.jsx
index 14fae1f..ba65de4 100644
--- a/src/views/mobdesign/menuform/index.jsx
+++ b/src/views/mobdesign/menuform/index.jsx
@@ -185,6 +185,18 @@
               )}
             </Form.Item>
           </Col>
+          <Col span={24}>
+            <Form.Item label="灞忓箷鏂瑰悜">
+              {getFieldDecorator('direction', {
+                initialValue: config.direction || 'vertical'
+              })(
+                <Radio.Group onChange={(e) => {this.selectChange('direction', e.target.value)}}>
+                  <Radio value="vertical">绔栧睆</Radio>
+                  <Radio value="horizontal">妯睆</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
           {adapters.includes('app') || adapters.includes('wxmini') ? <Col span={24}>
             <Form.Item className="status-bar" label={
               <Tooltip placement="topLeft" title="鍦ㄦ槑绉戜簯APP鎴栧皬绋嬪簭涓紝鐘舵�佹爮鐨勮儗鏅壊銆�">

--
Gitblit v1.8.0