king
2024-06-19 9ff5920c0a58771219b134a7b46b7d0c1e1542ad
src/views/imdesign/index.jsx
@@ -7,7 +7,6 @@
import Api from '@/api'
import Utils from '@/utils/utils.js'
import antdEnUS from 'antd/es/locale/en_US'
import antdZhCN from 'antd/es/locale/zh_CN'
// import MKEmitter from '@/utils/events.js'
import asyncComponent from '@/utils/asyncComponent'
@@ -26,14 +25,12 @@
const StyleController = asyncComponent(() => import('@/menu/stylecontroller'))
const NormalForm = asyncComponent(() => import('@/components/normalform'))
sessionStorage.setItem('isEditState', 'true')
sessionStorage.setItem('appType', 'mob')       // 应用类型
document.body.className = ''
window.GLOB.CacheIndependent = new Map()
class ImDesign extends Component {
  state = {
    localedict: sessionStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS,
    loading: true,
    MenuId: '',
    MenuName: '',
@@ -50,10 +47,12 @@
    try {
      let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
      if (param.lang) {
        sessionStorage.setItem('lang', param.lang)
      }
      if (param.type === 'app') {
        sessionStorage.setItem('appId', param.ID || '')
        sessionStorage.setItem('appName', param.remark || '')
        sessionStorage.setItem('lang', param.lang || 'zh-CN')
        sessionStorage.setItem('kei_no', param.kei_no || '')
        sessionStorage.setItem('typename', param.typename || 'mob')
        sessionStorage.setItem('adapter', param.adapter || '')
@@ -61,9 +60,6 @@
        sessionStorage.setItem('userbind', param.userbind || '')
        sessionStorage.setItem('instantMessage', param.instantMessage || '')
        this.setState({
          localedict: sessionStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS,
        })
        this.getAppMessage(param.MenuID)
      } else if (param.type === 'view') {
        window.GLOB.winWidth = 420
@@ -98,10 +94,6 @@
  }
  componentDidMount () {
    setTimeout(() => {
      this.getAppPictures()
    }, 1000)
    document.onkeydown = (event) => {
      let e = event || window.event
      let keyCode = e.keyCode || e.which || e.charCode
@@ -154,7 +146,8 @@
    let param = {
      MenuID: config.wrap.linkmenu,
      copyMenuId: '',
      type: 'view'
      type: 'view',
      lang: sessionStorage.getItem('lang')
    }
    param = window.btoa(window.encodeURIComponent(JSON.stringify(param)))
@@ -163,7 +156,7 @@
  }
  getAppMessage = (MenuID) => {
    Api.getSystemConfig({
    Api.getCloudConfig({
      func: 's_get_keyids',
      bid: sessionStorage.getItem('appId')
    }).then(res => {
@@ -182,47 +175,8 @@
      }
      sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
      this.props.history.replace('/imdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: MenuID, type: 'view'}))))
      this.props.history.replace('/imdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: MenuID, type: 'view', lang: sessionStorage.getItem('lang')}))))
      window.location.reload()
    })
  }
  getAppPictures = () => {
    if (sessionStorage.getItem('app_videos') || sessionStorage.getItem('app_pictures')) return
    Api.getSystemConfig({
      func: 's_url_db_adduptdel',
      PageIndex: 0,  // 0 代表全部
      PageSize: 0,   // 0 代表全部
      typecharone: 'image',
      type: 'search'
    }).then(res => {
      if (res.status) {
        sessionStorage.setItem('app_pictures', JSON.stringify(res.data || []))
      }
      Api.getSystemConfig({
        func: 's_url_db_adduptdel',
        PageIndex: 0,  // 0 代表全部
        PageSize: 0,   // 0 代表全部
        typecharone: 'video',
        type: 'search'
      }).then(res => {
        if (res.status) {
          sessionStorage.setItem('app_videos', JSON.stringify(res.data || []))
        }
      })
      Api.getSystemConfig({
        func: 's_url_db_adduptdel',
        PageIndex: 0,  // 0 代表全部
        PageSize: 0,   // 0 代表全部
        typecharone: 'color',
        type: 'search'
      }).then(res => {
        if (res.status) {
          sessionStorage.setItem('app_colors', JSON.stringify(res.data || []))
        }
      })
    })
  }
@@ -274,7 +228,7 @@
      MenuID: MenuId
    }
    Api.getSystemConfig(param).then(result => {
    Api.getCloudConfig(param).then(result => {
      if (!result.status) {
        notification.warning({
          top: 92,
@@ -339,7 +293,7 @@
    _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)
    Api.getSystemConfig(_param).then(res => {
    Api.getCloudConfig(_param).then(res => {
      if (!res.status) {
        notification.warning({
          top: 92,
@@ -405,15 +359,15 @@
        PageParam: JSON.stringify({Template: 'imPage'}),
        open_edition: config.open_edition,
        menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify({type: 'im', key: config.uuid, title: config.MenuName, children: []}))),
        LText: '',
        LTexttb: ''
        // LText: '',
        // LTexttb: ''
      }
      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      param.secretkey = Utils.encrypt('', param.timestamp)
      param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(config)))
      Api.getSystemConfig(param).then(res => {
      Api.getCloudConfig(param).then(res => {
        if (!res.status) {
          notification.warning({
            top: 92,
@@ -465,10 +419,10 @@
  }
  render () {
    const { localedict, loading, settingshow, controlshow, MenuId, config, menuloading } = this.state
    const { loading, settingshow, controlshow, MenuId, config, menuloading } = this.state
    return (
      <ConfigProvider locale={localedict}>
      <ConfigProvider locale={antdZhCN}>
        <div className="mk-mob-view" id="mk-mob-design-view">
          <Header/>
          {loading ? <Spin className="view-spin" size="large" /> : null}