king
2021-06-18 bb47f06e3c5eaf568aaecf870736787373ce73aa
src/views/mobdesign/index.jsx
@@ -25,6 +25,7 @@
const Header = asyncComponent(() => import('@/mob/header'))
const MenuForm = asyncComponent(() => import('./menuform'))
const MobShell = asyncComponent(() => import('@/mob/mobshell'))
const CreateView = asyncComponent(() => import('@/pc/createview'))
const SourceWrap = asyncComponent(() => import('@/mob/modulesource'))
const BgController = asyncComponent(() => import('@/pc/bgcontroller'))
const SysInterface = asyncComponent(() => import('@/menu/sysinterface'))
@@ -64,6 +65,8 @@
    config: null,
    visible: false,
    customComponents: [],
    direction: 'vertical',
    comloading: false
  }
  UNSAFE_componentWillMount() {
@@ -75,9 +78,9 @@
        sessionStorage.setItem('appId', param.ID || '')
        sessionStorage.setItem('lang', param.lang || 'zh-CN')
        sessionStorage.setItem('kei_no', param.kei_no || '')
        sessionStorage.setItem('link_type', param.link_type || 'true')
        sessionStorage.setItem('role_type', param.role_type || 'true')
        sessionStorage.setItem('login_types', param.login_types || 'true')
        sessionStorage.setItem('typename', param.typename || 'mob')
        this.setState({
          localedict: sessionStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS,
@@ -85,6 +88,18 @@
        })
        this.getAppMessage()
      } else if (param.type === 'view') {
        window.GLOB.winWidth = 420
        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
        }
        this.setState({
          MenuId: param.MenuID
        }, () => {
@@ -193,9 +208,6 @@
      type: 'view'
    }
    if (menu.fixed && menu.MenuNo && menu.MenuName) {
      param.fixed = true
    }
    param.MenuNo = menu.MenuNo || ''
    param.MenuName = menu.MenuName || ''
@@ -309,7 +321,7 @@
  updateCustomComponent = () => {
    Api.getSystemConfig({
      func: 's_get_custom_components',
      typename: 'mob',
      typename: sessionStorage.getItem('typename'),
      typecharone: ''
    }).then(res => {
      let coms = []
@@ -410,7 +422,7 @@
    let param = {
      func: 'sPC_Get_LongParam',
      TypeCharOne: sessionStorage.getItem('kei_no'),
      typename: 'mob',
      typename: sessionStorage.getItem('typename'),
      MenuID: MenuId
    }
@@ -460,10 +472,6 @@
        config.open_edition = result.open_edition || ''
        window.GLOB.urlFields = config.urlFields || []
        if (urlParam.fixed && urlParam.MenuName && urlParam.MenuNo) {
          config.fixed = true
        }
        let indeComs = []
        config.components.forEach(item => {
          if (item.type === 'navbar') {
@@ -491,7 +499,7 @@
    let _param = {
      func: 's_get_app_menus',
      TypeCharOne: sessionStorage.getItem('kei_no'),
      typename: 'mob',
      typename: sessionStorage.getItem('typename'),
      LText: `select '${window.GLOB.appkey}'`,
      timestamp: moment().format('YYYY-MM-DD HH:mm:ss')
    }
@@ -523,7 +531,7 @@
    let param = {
      func: 'sPC_Get_LongParam',
      TypeCharOne: sessionStorage.getItem('kei_no'),
      typename: 'mob',
      typename: sessionStorage.getItem('typename'),
      MenuID: urlParam.copyMenuId
    }
@@ -578,6 +586,8 @@
      config.uuid = MenuId
      config.MenuID = MenuId
      config.open_edition = ''
      config.MenuName = urlParam.MenuName || ''
      config.MenuNo = urlParam.MenuNo || ''
      let indeComs = []
      config.components.forEach(item => {
@@ -606,7 +616,7 @@
        Api.getSystemConfig({
          func: 'sPC_Get_LongParam',
          TypeCharOne: sessionStorage.getItem('kei_no'),
          typename: 'mob',
          typename: sessionStorage.getItem('typename'),
          MenuID: item.uuid
        }).then(res => {
          res.uuid = item.uuid
@@ -810,7 +820,7 @@
        EasyCode: '',
        Template: 'webPage',
        TypeCharOne: sessionStorage.getItem('kei_no'),
        Typename: 'mob',
        Typename: sessionStorage.getItem('typename'),
        MenuName: config.MenuName || '',
        PageParam: JSON.stringify({Template: 'webPage'}),
        open_edition: config.open_edition,
@@ -880,7 +890,7 @@
                EasyCode: '',
                Template: item.type,
                TypeCharOne: sessionStorage.getItem('kei_no'),
                Typename: 'mob',
                Typename: sessionStorage.getItem('typename'),
                MenuName: item.name || '',
                PageParam: JSON.stringify({Template: item.type}),
                open_edition: item.open_edition || '',
@@ -1424,13 +1434,34 @@
    })
  }
  changeView = (val) => {
    if (val !== '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
    }
    this.setState({
      direction: val,
      comloading: true
    }, () => {
      this.setState({ comloading: false })
    })
  }
  render () {
    const { localedict, loading, activeKey, dict, MenuId, config, menuloading, customComponents } = this.state
    const { localedict, comloading, loading, activeKey, dict, MenuId, config, menuloading, customComponents } = this.state
    return (
      <ConfigProvider locale={localedict}>
        <div className="mk-mob-view" id="mk-mob-design-view">
          <Header />
          <Header changeView={this.changeView}/>
          {loading ? <Spin className="view-spin" size="large" /> : null}
          <DndProvider backend={HTML5Backend}>
            <div className="menu-setting">
@@ -1465,6 +1496,7 @@
            <div className="menu-control">
              <Button type="primary" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button>
              <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config && config.enabled} onChange={this.onEnabledChange} />
              <CreateView resetmenu={this.getAppMenus} />
              <PasteController type="menu" Tab={null} insert={this.insert} />
              <StyleCombControlButton menu={config} />
              <SysInterface config={config} updateConfig={this.updateConfig}/>
@@ -1475,8 +1507,8 @@
              <Button type="default" onClick={this.closeView}>关闭</Button>
            </div>
            <div className={'menu-body ' + (menuloading ? 'saving' : '')}>
              <div className="mob-shell">
                {config ? <MobShell menu={config} handleList={this.updateConfig} /> : null}
              <div className="mob-shell" style={{width: window.GLOB.shellWidth, height: window.GLOB.shellHeight}}>
                {config && !comloading ? <MobShell menu={config} handleList={this.updateConfig} /> : null}
              </div>
            </div>
          </DndProvider>