king
2022-01-20 e62150eed77965519199d83d4988c4dde91f5069
src/views/imdesign/index.jsx
@@ -1,9 +1,7 @@
import React, { Component } from 'react'
import { DndProvider } from 'react-dnd'
import { withRouter } from 'react-router'
import { is, fromJS } from 'immutable'
import moment from 'moment'
import HTML5Backend from 'react-dnd-html5-backend'
import { ConfigProvider, notification, Modal, Collapse, Button, Spin } from 'antd'
import { DoubleLeftOutlined, DoubleRightOutlined, LeftOutlined, UserOutlined, EllipsisOutlined } from '@ant-design/icons'
@@ -49,7 +47,6 @@
    direction: 'vertical',
    settingshow: true,
    controlshow: true,
    adapters: [],
  }
  UNSAFE_componentWillMount() {
@@ -86,15 +83,7 @@
          window.GLOB.shellHeight = 853
        }
        let adapters = sessionStorage.getItem('adapter')
        if (adapters) {
          adapters = adapters.split(',')
        } else {
          adapters = []
        }
        this.setState({
          adapters,
          MenuId: param.MenuID,
        }, () => {
          this.getMenuParam()
@@ -106,12 +95,6 @@
        message: '菜单信息解析错误!',
        duration: 5
      })
    }
  }
  UNSAFE_componentWillReceiveProps(nextProps) {
    if (this.props.match.params.param !== nextProps.match.params.param) {
      window.location.reload()
    }
  }
@@ -205,6 +188,7 @@
      sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
      this.props.history.replace('/imdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: MenuID, type: 'view'}))))
      window.location.reload()
    })
  }
@@ -304,7 +288,8 @@
        })
        this.setState({loading: false})
        return
      } else {
      }
        let config = null
        let isCreate = false
@@ -319,8 +304,8 @@
          isCreate = true
          config = {
            version: 1.0,
            uuid: MenuId,
            MenuID: MenuId,
          // uuid: MenuId,
          // MenuID: MenuId,
            Template: 'imPage',
            enabled: false,
            MenuName: '即时通信',
@@ -344,7 +329,6 @@
          config: fromJS(config).toJS(),
          loading: false
        })
      }
    })
    this.getAppMenus()
  }
@@ -392,7 +376,6 @@
  }
  submitConfig = () => {
    const { adapters } = this.state
    let config = fromJS(this.state.config).toJS()
    if (!config.MenuName || !config.MenuNo) {
@@ -412,12 +395,6 @@
    })
    setTimeout(() => {
      let roleParam = {type: 'im', key: config.uuid, title: config.MenuName, children: []}
      if (adapters.includes('wxmini')) {
        config = this.getMiniStyle(config)
      }
      let param = {
        func: 'sPC_TrdMenu_AddUpt',
        FstID: 'mk_app',
@@ -432,17 +409,14 @@
        MenuName: config.MenuName || '',
        PageParam: JSON.stringify({Template: 'imPage'}),
        open_edition: config.open_edition,
        menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))),
        menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify({type: 'im', key: config.uuid, title: config.MenuName, children: []}))),
        LText: '',
        LTexttb: ''
      }
      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      param.secretkey = Utils.encrypt('', param.timestamp)
      let _config = fromJS(config).toJS()
      param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
      param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(config)))
      Api.getSystemConfig(param).then(res => {
        if (!res.status) {
@@ -496,14 +470,13 @@
  }
  render () {
    const { localedict, loading, settingshow, controlshow, dict, MenuId, config, menuloading, adapters } = this.state
    const { localedict, loading, settingshow, controlshow, dict, MenuId, config, menuloading } = this.state
    return (
      <ConfigProvider locale={localedict}>
        <div className="mk-mob-view" id="mk-mob-design-view">
          <Header/>
          {loading ? <Spin className="view-spin" size="large" /> : null}
          <DndProvider backend={HTML5Backend}>
            <div className={'menu-setting ' + (!settingshow ? 'hidden' : '')}>
              <div className="draw">
                {settingshow ? <DoubleLeftOutlined onClick={() => {this.setState({settingshow: false})}} /> : null}
@@ -518,7 +491,6 @@
                      dict={dict}
                      config={config}
                      MenuId={MenuId}
                      adapters={adapters}
                      updateConfig={this.updateConfig}
                    /> : null}
                  </Panel>
@@ -549,8 +521,8 @@
                <div className="instant-message" style={config ? config.style : null}>
                  <div className="header">
                    <LeftOutlined/>
                    <span className="title">friend</span>
                    {config && config.wrap.linkmenu ? <EllipsisOutlined onClick={this.changeEditMenu}/> : null}
                  <span className="title">朋友</span>
                  {config && config.wrap.linkmenu ? <EllipsisOutlined onDoubleClick={this.changeEditMenu}/> : null}
                  </div>
                  <div className="mk-content-wrap">
                    <div className="line-wrap">
@@ -560,7 +532,7 @@
                          <div className="img"><UserOutlined /></div>
                        </div>
                        <div className="msg">
                          <div className="title">friend</div>
                        <div className="title">朋友</div>
                          <div className="words">您好</div>
                        </div>
                      </div>
@@ -586,7 +558,6 @@
                </div>
              </div>
            </div>
          </DndProvider>
          <StyleController />
        </div>
      </ConfigProvider>