king
2021-02-25 08929dbc66fb157307921026974c459f762209e2
2021-02-25
11个文件已修改
1个文件已添加
144 ■■■■ 已修改文件
package.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/admin.html 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/options.json 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/header/index.jsx 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/index.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/appmanage/index.jsx 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/appmanage/submutilform/index.jsx 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/design/header/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/design/sidemenu/index.jsx 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/menuform/index.jsx 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/pcdesign/index.jsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json
@@ -188,7 +188,7 @@
      ]
    ]
  },
  "homepage": "./build",
  "homepage": ".",
  "devDependencies": {
    "typescript": "^4.0.2"
  }
public/admin.html
New file
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title></title>
  </head>
  <body>
    <script>
      if ('ActiveXObject' in window) {
        window.onload = function() {
          document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">您的浏览器<span style="color: #ff4d4f">不受支持</span></div>'
        }
      } else {
        fetch(`./options.json`)
          .then(function(response) {return response.json()})
          .catch(function() {
            document.body.innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">系统配置信息获取失败,请联系管理员!</div>'
          })
          .then(function(config) {
            if (!config) {
              document.body.innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">系统配置信息获取失败,请联系管理员!</div>'
            } else {
              var url = window.location.href.split(/(index.html)+/ig)[0]
              var appPort = 'admin/index.html'
              if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
                appPort = 'mob/index.html'
              } else {
                if (config.defaultApp) {
                  appPort = 'pc/'
                }
              }
              window.location.replace(url + appPort)
            }
          })
      }
    </script>
  </body>
</html>
public/options.json
@@ -5,5 +5,7 @@
  "systemType": "",
  "externalDatabase": "false",
  "lineColor": "",
  "filter": "false"
  "filter": "false",
  "defaultApp": "",
  "defaultLang": "zh-CN"
}
src/api/index.js
@@ -197,7 +197,10 @@
      if (options.cloudServiceApi) {
        param.rduri = options.cloudServiceApi.replace(/\/webapi(.*)/, '/webapi/dologon')
      }
    } else if (!isCloud && window.GLOB.mainSystemApi) {
    } else if (window.GLOB.mainSystemApi) {
      if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') {
        param.linkurl = window.GLOB.linkurl
      }
      param.rduri = window.GLOB.mainSystemApi.replace(/\/webapi(.*)/, '/webapi/dologon')
    }
@@ -228,7 +231,10 @@
      if (options.cloudServiceApi) {
        param.rduri = options.cloudServiceApi.replace(/\/webapi(.*)/, '/webapi/dologon')
      }
    } else if (!isCloud && window.GLOB.mainSystemApi) {
    } else if (window.GLOB.mainSystemApi) {
      if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') {
        param.linkurl = window.GLOB.linkurl
      }
      param.rduri = window.GLOB.mainSystemApi.replace(/\/webapi(.*)/, '/webapi/dologon')
    }
src/components/header/index.jsx
@@ -168,9 +168,6 @@
    // 获取主菜单参数
    let menudefer = new Promise(resolve => {
      let _param = {func: 's_get_pc_menus', systemType: options.sysType}
      if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') {
        _param.linkurl = window.GLOB.linkurl
      }
      _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : ''
      
      Api.getSystemConfig(_param).then(result => {
src/index.js
@@ -45,7 +45,6 @@
  )
}
if (sessionStorage.getItem('loginError')) {
  try {
    let res = JSON.parse(sessionStorage.getItem('loginError'))
@@ -58,10 +57,12 @@
sessionStorage.setItem('role_id', sessionStorage.getItem('localRole_id') || '')
sessionStorage.setItem('dataM', sessionStorage.getItem('localDataM') || '')
fetch(`./options.json`)
// 测试系统文件置于admin中
fetch(process.env.NODE_ENV === 'production' && options.sysType === 'local' ? '../options.json' : './options.json')
  .then(response => response.json())
  .catch(() => {
    console.warn('系统配置信息获取失败,请联系管理员!')
    document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">系统配置信息获取失败,请联系管理员!</div>'
  })
  .then(config => {
    if (!config) return
@@ -186,7 +187,7 @@
    }
    if (process.env.NODE_ENV === 'production') { // 用于校验是否存在开发权限
      let _service = window.location.href.replace(/\/index.html(.*)|\/#(.*)/ig, '').replace(new RegExp(document.location.origin + '/?', 'ig'), '')
      let _service = window.location.href.replace(/(\/admin)?\/index.html(.*)|(\/admin)?\/#(.*)/ig, '').replace(new RegExp(document.location.origin + '/?', 'ig'), '')
      GLOB.linkurl = _href
      if (!/index.html/ig.test(GLOB.linkurl)) {
        GLOB.linkurl = GLOB.linkurl + 'index.html'
src/views/appmanage/index.jsx
@@ -90,9 +90,17 @@
        }
      },
      {
        title: '标题', dataIndex: 'title', key: 'title', align: 'center', width: '150px'
      },
      {
        title: '图标', dataIndex: 'favicon', key: 'favicon', align: 'center', width: '150px',
        render: (text, record) => (text ? <img style={{width: '32px', height: '32px'}} src={text} alt="" /> : null)
      },
      {
        title: 'Action',
        key: 'action',
        align: 'center',
        width: '120px',
        render: (text, record) => (
          <div>
            <Button type="link" onClick={() => this.deleteSubApp(record)} style={{color: '#ff4d4f'}}>删除</Button>
@@ -376,7 +384,7 @@
      param.secretkey = Utils.encrypt('', param.timestamp)
      if (visible === 'edit') {
        param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css}'`)
        param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}'`)
        param.LText = param.LText.join(' union all ')
        param.LText = Utils.formatOptions(param.LText)
      }
@@ -462,7 +470,7 @@
        })
      }
      param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css}'`)
      param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}'`)
      param.LText = param.LText.join(' union all ')
      param.LText = Utils.formatOptions(param.LText)
@@ -558,7 +566,7 @@
          </Modal>
          <Modal
            title={'编辑子应用'}
            width={'600px'}
            width={'750px'}
            maskClosable={false}
            visible={!!subVisible}
            onCancel={() => this.setState({subVisible: false})}
src/views/appmanage/submutilform/index.jsx
@@ -1,7 +1,11 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Select, Radio } from 'antd'
import { Form, Row, Col, Select, Radio, Input } from 'antd'
import asyncComponent from '@/utils/asyncComponent'
import './index.scss'
const FileUpload = asyncComponent(() => import('@/tabviews/zshare/fileupload'))
class MainSearch extends Component {
  static propTpyes = {
@@ -19,6 +23,11 @@
    return new Promise(resolve => {
      this.props.form.validateFieldsAndScroll((err, values) => {
        if (!err) {
          if (values.favicon && values.favicon.length > 0 && values.favicon[0].status === 'done') {
            values.favicon = values.favicon[0].response || values.favicon[0].url || ''
          } else {
            values.favicon = ''
          }
          resolve(values)
        }
      })
@@ -43,13 +52,26 @@
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 12 }
        sm: { span: 16 }
      }
    }
    let filelist = []
    if (type === 'edit' && card && card.favicon) {
      filelist = [{
        uid: `favicon`,
        name: card.favicon.slice(card.favicon.lastIndexOf('/') + 1),
        status: 'done',
        url: card.favicon,
        origin: true
      }]
    }
    return (
      <Form {...formItemLayout} className="mob-card-edit-form">
        <Row gutter={24}>
          <Col span={24}>
          <Col span={12}>
            <Form.Item label="应用类型">
              {getFieldDecorator('typename', {
                initialValue: card ? card.typename : 'mob'
@@ -61,7 +83,7 @@
              )}
            </Form.Item>
          </Col>
          <Col span={24}>
          <Col span={12}>
            <Form.Item label="语言">
              {getFieldDecorator('lang', {
                initialValue: card ? card.lang || 'zh-CN' : 'zh-CN'
@@ -73,7 +95,7 @@
              )}
            </Form.Item>
          </Col>
          <Col span={24}>
          <Col span={12}>
            <Form.Item label="登录">
              {getFieldDecorator('login_types', {
                initialValue: card ? card.login_types || 'true' : 'true'
@@ -85,7 +107,7 @@
              )}
            </Form.Item>
          </Col>
          <Col span={24}>
          <Col span={12}>
            <Form.Item label="权限管理">
              {getFieldDecorator('role_type', {
                initialValue: card ? card.role_type || 'true' : 'true'
@@ -97,7 +119,7 @@
              )}
            </Form.Item>
          </Col>
          <Col span={24}>
          <Col span={12}>
            <Form.Item label="短连接">
              {getFieldDecorator('link_type', {
                initialValue: card ? card.link_type || 'true' : 'true'
@@ -109,7 +131,7 @@
              )}
            </Form.Item>
          </Col>
          <Col span={24}>
          <Col span={12}>
            <Form.Item label="皮肤">
              {getFieldDecorator('css', {
                initialValue: card ? card.css : 'bg_black_style_blue'
@@ -147,6 +169,20 @@
              )}
            </Form.Item>
          </Col>
          <Col span={12}>
            <Form.Item label="标题">
              {getFieldDecorator('title', {
                initialValue: card ? card.title || '' : ''
              })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)}
            </Form.Item>
          </Col>
          <Col span={12}>
            <Form.Item label="图标">
              {getFieldDecorator('favicon', {
                initialValue: filelist
              })(<FileUpload accept=".jpg,.png,.gif,.pjp,.pjpeg,.jpeg,.jfif,.webp,.ico" maxFile={1} fileType={'text'} />)}
            </Form.Item>
          </Col>
        </Row>
      </Form>
    )
src/views/design/header/index.jsx
@@ -63,10 +63,6 @@
  async loadmenu () {
    // 获取主菜单
    let _param = {func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'}
    if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') {
      _param.linkurl = window.GLOB.linkurl
    }
    _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : ''
    let result = await Api.getSystemConfig(_param)
src/views/design/sidemenu/index.jsx
@@ -139,9 +139,6 @@
  reload = () => {
    const { mainMenu } = this.props
    let _param = {func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'}
    if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') {
      _param.linkurl = window.GLOB.linkurl
    }
    _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : ''
    Api.getSystemConfig(_param).then(result => {
src/views/menudesign/menuform/index.jsx
@@ -26,9 +26,6 @@
  UNSAFE_componentWillMount () {
    const { MenuId, config } = this.props
    let _param = {func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'}
    if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') {
      _param.linkurl = window.GLOB.linkurl
    }
    _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : ''
    Api.getSystemConfig(_param).then(result => {
src/views/pcdesign/index.jsx
@@ -547,6 +547,8 @@
        MenuNo: _config.MenuNo || '',
        EasyCode: _config.easyCode || '',
        Template: 'webPage',
        TypeCharOne: sessionStorage.getItem('kei_no'),
        Typename: 'pc',
        MenuName: _config.MenuName || '',
        PageParam: JSON.stringify({Template: 'webPage'}),
        LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(_config))),