king
2022-11-21 f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89
src/pc/createview/index.jsx
@@ -5,7 +5,7 @@
import moment from 'moment'
import Utils from '@/utils/utils.js'
import MenuUtils from '@/utils/utils-custom.js'
import MenuUtils, { getTables } from '@/utils/utils-custom.js'
import SettingForm from './settingform'
import Api from '@/api'
import './index.scss'
@@ -56,7 +56,7 @@
      })
      let config = {
        version: 1.0,
        version: 2.0,
        uuid: menuId,
        MenuID: menuId,
        Template: 'webPage',
@@ -170,6 +170,11 @@
            config.tables = _config.tables || []
            config.style = _config.style || {}
            config.statusBarbgColor = _config.statusBarbgColor || ''
            if (config.version !== 2.0) {
              config.components = this.collectTB(config.components)
              config.version = 2.0
            }
          }
  
          param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(config)))
@@ -201,6 +206,36 @@
    })
  }
  collectTB = (components) => {
    return components.map(item => {
      if (item.type === 'tabs') {
        item.subtabs.forEach(tab => {
          delete tab.floor
          delete tab.hasSearch
          delete tab.parentId
          tab.components = this.collectTB(tab.components)
        })
      } else if (item.type === 'group') {
        item.components = this.collectTB(item.components)
      } else if (!['search', 'navbar', 'login', 'topbar', 'officialAccount'].includes(item.type)) {
        item.$tables = getTables(item)
      }
      if (item.subtype === 'tablecard') { // 兼容
        item.type = 'card'
      }
      delete item.tabId
      delete item.parentId
      delete item.btnlog
      delete item.floor
      delete item.dataName
      return item
    })
  }
  render () {
    const { config } = this.props
    const { visible, loading } = this.state