king
2024-08-20 58826d6f4eab9f8c9acf9fa8696f60039c645cfe
src/views/mobdesign/index.jsx
@@ -9,7 +9,7 @@
import md5 from 'md5'
import Api from '@/api'
import Utils, { setGLOBFuncs } from '@/utils/utils.js'
import Utils from '@/utils/utils.js'
import MKEmitter from '@/utils/events.js'
import MenuUtils, { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js'
import asyncComponent from '@/utils/asyncComponent'
@@ -74,7 +74,9 @@
    viewType: 'menu',
    view: '',
    eyeopen: false,
    needUpdate: false
    needUpdate: false,
    appLoginId: '',
    appHomeId: ''
  }
  UNSAFE_componentWillMount() {
@@ -139,10 +141,29 @@
          adapters = []
        }
        let appLoginId = ''
        let appHomeId = ''
        if (sessionStorage.getItem('appViewList')) {
          try {
            let appMenus = JSON.parse(sessionStorage.getItem('appViewList'))
            appMenus.forEach(item => {
              if (item.keys_type === 'login') {
                appLoginId = item.keys_id
              } else if (item.keys_type === 'index') {
                appHomeId = item.keys_id
              }
            })
          } catch (e) {
          }
        }
        this.setState({
          adapters,
          MenuId: param.MenuID,
          viewType: /^userbind/.test(param.MenuID) ? 'userbind' : 'menu'
          viewType: /^userbind/.test(param.MenuID) ? 'userbind' : 'menu',
          appLoginId: appLoginId,
          appHomeId: appHomeId
        }, () => {
          this.getMenuParam(param)
        })
@@ -182,7 +203,7 @@
    setTimeout(() => {
      this.getRoleFields()
      setGLOBFuncs()
      // setGLOBFuncs()
    }, 1000)
    document.onkeydown = (event) => {
@@ -1304,6 +1325,7 @@
    let traversal = (components) => {
      return components.map(item => {
        item.miniStyle = ''
        if (item.style) {
          item.miniStyle = this.transferStyle(item.style)
        }
@@ -1319,12 +1341,18 @@
        }
        if (item.type === 'tabs') {
          if (item.setting.backgroundColor) {
            item.miniStyle += `--tabs-header-background: ${item.setting.backgroundColor};`
          }
          item.subtabs.forEach(tab => {
            tab.components = traversal(tab.components)
          })
        } else if (item.type === 'group') {
          item.components = traversal(item.components)
        } else if (['card', 'carousel', 'timeline'].includes(item.type)) {
          if (item.wrap.display === 'hidden') {
            item.miniStyle += 'display:none;'
          }
          item.subcards.forEach(card => {
            card.miniStyle = this.transferStyle(card.style)
            card.elements = card.elements.map(cell => {
@@ -1425,7 +1453,7 @@
      })
      return
    } else if (this.checklog()) {
      if (sessionStorage.getItem('applangList') && !config.trans) {
      if ((sessionStorage.getItem('applangList') && !config.trans) || (adapters.includes('wxmini') && !config.hasOwnProperty('miniStyle'))) {
      } else {
        notification.success({
@@ -1506,6 +1534,9 @@
        roleParam.pass = true
      }
      delete config.miniTitle
      delete config.miniReloadUp
      config.components.forEach(item => {
        if (item.type === 'login') {
          roleParam.login = true
@@ -1513,6 +1544,13 @@
          config.loginview = true
        } else if (item.type === 'navbar') {
          config.tabview = true
        } else if (item.type === 'topbar' && adapters.includes('wxmini')) {
          if (item.wrap.minishow !== 'true') {
            config.miniTitle = item.wrap.title || ''
          }
          if (item.wrap.reload === 'true') {
            config.miniReloadUp = true
          }
        }
      })
@@ -1942,6 +1980,8 @@
    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    param.secretkey = Utils.encrypt('', param.timestamp)
    const that = this
    confirm({
      title: '确定设置本页面为首页吗?',
      content: '',
@@ -1955,6 +1995,10 @@
            })
          } else {
            sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
            that.setState({
              appHomeId: config.MenuID
            })
          }
        })
      },
@@ -2002,6 +2046,7 @@
    param.secretkey = Utils.encrypt('', param.timestamp)
    let hasLogin = config.components.findIndex(item => item.type === 'login') > -1
    const that = this
    confirm({
      title: '确定设置本页面为登录页吗?',
@@ -2016,6 +2061,10 @@
            })
          } else {
            sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
            that.setState({
              appLoginId: config.MenuID
            })
          }
        })
      },
@@ -2080,7 +2129,7 @@
  render () {
    const { view, viewType, comloading, loading, settingshow, controlshow, activeKey, MenuId, config, menuloading, adapters, eyeopen, needUpdate } = this.state
    const { view, viewType, comloading, loading, settingshow, controlshow, activeKey, MenuId, config, menuloading, adapters, eyeopen, needUpdate, appLoginId, appHomeId } = this.state
    return (
      <div className={'mk-mob-view ' + viewType} id="mk-mob-design-view">
@@ -2148,8 +2197,8 @@
              <PictureController/>
              <Quotecomponent config={config} updateConfig={this.updateConfig}/>
              <StyleCombControlButton menu={config} />
              <Button className="mk-border-green set-home" onClick={this.setHomeView}><HomeOutlined /> 设为首页</Button>
              <Button className="mk-border-purple set-login" onClick={this.setLoginView}><LoginOutlined /> 设为登录页</Button>
              <Button className="mk-border-green set-home" disabled={MenuId === appHomeId} onClick={this.setHomeView}><HomeOutlined /> 设为首页</Button>
              <Button className="mk-border-purple" disabled={MenuId === appLoginId} onClick={this.setLoginView}><LoginOutlined /> 设为登录页</Button>
              <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
              <Transfer MenuID={MenuId} />
              {config ? <Versions MenuId={MenuId} Template="webPage" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null}