king
2023-03-08 8969147207be7ef066051da3525b473043ecff2a
2023-03-08
12个文件已修改
2个文件已添加
508 ■■■■ 已修改文件
src/menu/modulecell/index.jsx 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/components/formdragelement/card.jsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/modalconfig/source.jsx 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/index.jsx 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkVercode/index.jsx 220 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkVercode/index.scss 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/dragelement/card.jsx 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/source.jsx 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/formconfig.jsx 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/modalform/index.jsx 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/design/header/index.jsx 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobdesign/index.jsx 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/pcdesign/index.jsx 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/pcdesign/index.scss 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/modulecell/index.jsx
@@ -67,7 +67,8 @@
          { subType: 'hint', text: '提示', type: 'form' },
          { subType: 'split', text: '分隔线', type: 'form' },
          { subType: 'linkMain', text: '关联主表', type: 'form' },
          { subType: 'formula', text: '公式', type: 'form' }
          { subType: 'formula', text: '公式', type: 'form' },
          { subType: 'vercode', text: '验证码', type: 'form' }
        ]
      },
      {
src/mob/components/formdragelement/card.jsx
@@ -212,6 +212,8 @@
        </div>
      </div>
    </div>)
  } else if (card.type === 'vercode') {
    formItem = <div className="am-list-item"><div className="am-list-line"><div className="am-input-label">{card.label}</div><div className="am-input-control"><span style={{color: '#bcbcbc'}}>{card.placeholder || ''}</span></div><div className="am-list-extra" style={{width: 'auto', height: 'auto', backgroundColor: '#fafafa', padding: '0 15px'}}>获取验证码</div></div></div>
  }
  let style = {...card.style}
src/mob/modalconfig/source.jsx
@@ -109,6 +109,11 @@
    type: 'form',
    label: '公式',
    subType: 'formula',
  },
  {
    type: 'form',
    label: '验证码',
    subType: 'vercode',
  }
]
src/tabviews/zshare/mutilform/index.jsx
@@ -27,6 +27,7 @@
const MKColor = asyncComponent(() => import('./mkColor'))
const MkFormula = asyncComponent(() => import('./mkFormula'))
const MkCascader = asyncComponent(() => import('./mkCascader'))
const MkVercode = asyncComponent(() => import('./mkVercode'))
const MKEditor = asyncComponent(() => import('@/components/editor'))
class MainSearch extends Component {
@@ -41,7 +42,10 @@
  state = {
    formlist: [],    // 表单项
    ID: ''
    ID: '',
    send_type: '',
    timestamp: '',
    n_id: ''
  }
  record = {}
@@ -114,7 +118,7 @@
        item.precision = 'second'
      }
      if (!item.field || !['text', 'number', 'switch', 'rate', 'select', 'link', 'cascader', 'linkMain', 'funcvar', 'date', 'datemonth', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color'].includes(item.type)) return false
      if (!item.field || !['text', 'number', 'switch', 'rate', 'select', 'link', 'cascader', 'linkMain', 'funcvar', 'date', 'datemonth', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color', 'vercode'].includes(item.type)) return false
      if (/^\s+$/.test(item.label)) {
        item.style = item.style || {}
@@ -351,7 +355,7 @@
            message: formRule.input.formMessage.replace('@max', item.fieldlength)
          }
        ]
      } else if (item.type === 'linkMain') {
      } else if (item.type === 'linkMain' || item.type === 'vercode') {
        item.rules = [
          {
            required: item.required === 'true',
@@ -957,6 +961,8 @@
          content = (<MKTextArea config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})}/>)
        } else if (item.type === 'rate') {
          content = (<Rate count={item.rateCount} disabled={item.readonly} style={{color: item.color || '#fadb14'}} onChange={(val) => this.recordChange({[item.field]: val})} character={item.character ? <MkIcon type={item.character}/> : <StarFilled />} allowHalf={item.allowHalf}/>)
        } else if (item.type === 'vercode') {
          content = (<MkVercode config={item} record={this.record} onSend={(send_type, timestamp, n_id) => this.setState({send_type, timestamp, n_id})} onChange={(val) => this.recordChange({[item.field]: val})} onSubmit={this.props.inputSubmit}/>)
        } else if (item.type === 'brafteditor') {
          content = (<MKEditor config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>)
          label = item.hidelabel !== 'true' ? label : ''
@@ -988,7 +994,7 @@
  }
  handleConfirm = () => {
    const { formlist } = this.state
    const { formlist, send_type, timestamp, n_id } = this.state
    // 表单提交时检查输入值是否正确
    return new Promise((resolve, reject) => {
@@ -997,7 +1003,7 @@
          reject(err)
          return
        }
        let search = []
        let forms = []
        let record = {...this.record, ...values}
        formlist.forEach(item => {
@@ -1039,12 +1045,40 @@
            if (item.declareType === 'nvarchar(50)') {
              _item.type = 'text'
            }
          } else if (item.type === 'vercode') {
            _item.type = 'text'
            forms.push({
              type: 'text',
              readin: false,
              writein: false,
              fieldlen: 50,
              key: 'mk_timestamp',
              value: timestamp || ''
            })
            forms.push({
              type: 'text',
              readin: false,
              writein: false,
              fieldlen: 50,
              key: 'mk_send_type',
              value: send_type || ''
            })
            forms.push({
              type: 'text',
              readin: false,
              writein: false,
              fieldlen: 50,
              key: 'mk_n_id',
              value: n_id || ''
            })
          }
    
          search.push(_item)
          forms.push(_item)
        })
        resolve(search)
        resolve(forms)
      })
    })
  }
src/tabviews/zshare/mutilform/mkVercode/index.jsx
New file
@@ -0,0 +1,220 @@
import React, { Component } from 'react'
import { is, fromJS } from 'immutable'
import { Input, Button, message } from 'antd'
import md5 from 'md5'
import moment from 'moment'
import Api from '@/api'
import MKEmitter from '@/utils/events.js'
// import './index.scss'
/**
 * @description 自定义文本输入
 */
class MkVercode extends Component {
  constructor(props) {
    super(props)
    this.state = {
      value: ''
    }
  }
  inputRef = React.createRef()
  timer = null
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.state), fromJS(nextState))
  }
  componentWillUnmount () {
    this.setState = () => {
      return
    }
  }
  handleChange = (e) => {
    let val = e.target.value
    val = val.replace(/\n/g, '')
    this.props.onChange(val)
    this.setState({value: val})
    if (val.length === 6) {
      setTimeout(() => {
        this.handleInputSubmit()
      }, 50)
    }
  }
  handleInputSubmit = () => {
    const { config } = this.props
    if (config.enter === 'false') return
    if (config.enter === 'tab') {
      MKEmitter.emit('mkFC', 'focus', config.tabUuid)
    } else {
      MKEmitter.emit('mkFC', 'focus', config.tabUuid)
      this.props.onSubmit()
    }
  }
  getvercode = () => {
    const { record, config } = this.props
    let _phone = record[config.phoneField] || ''
    if (!_phone) {
      message.warning('请输入手机号!')
      return
    } else if (!/^1[3456789]\d{9}$/.test(_phone)) {
      message.warning('手机号格式错误,请重填!')
      return
    }
    let timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    let send_type = 'web_no'
    let n_id = (() => {
      let uuid = []
      let timestamp = new Date().getTime()
      let _options = '0123456789abcdefghigklmnopqrstuv'
      for (let i = 0; i < 19; i++) {
        uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1))
      }
      uuid = timestamp + uuid.join('')
      return uuid
    })()
    this.setState({
      verdisabled: true,
      delay: 60
    })
    this.timer = setTimeout(this.resetVerCodeDelay, 1000)
    if (config.sendType === 'sso') {
      send_type = 'web'
      n_id = ''
      let _param = {
        func: 'mes_sms_send_code_sso',
        send_type: send_type,
        mob: _phone,
        ID: config.smsId,
        LText: 'minke',
        timestamp: timestamp,
      }
      _param.secretkey = md5(`${_param.LText}mingke${_param.timestamp}`)
      Api.getSystemConfig(_param).then(res => {
        if (!res.status || !res.n_id) {
          clearTimeout(this.timer)
          this.setState({
            verdisabled: false,
            delay: null
          })
          message.warning(res.message || '验证码获取失败!')
          return
        }
        n_id = res.n_id
        let param = {
          func: 'MSN_sms_send_code',
          send_type: send_type,
          mob: _phone,
          timestamp: timestamp,
          ID: config.smsId,
          n_id: res.n_id
        }
        param.LText = md5(`${_phone}mingke${window.GLOB.appkey}${param.timestamp}`)
        param.secretkey = md5(`${param.LText}mingke${param.timestamp}`)
        param.rduri = 'https://sso.mk9h.cn/webapi/dostars'
        param.userid = 'bh0bapabtd45epsgra79segbch6c1ibk'
        param.LoginUID = 'bh0bapabtd45epsgra79segbch6c1ibk'
        Api.genericInterface(param).then(res => {
          if (!res.status) {
            clearTimeout(this.timer)
            this.setState({
              verdisabled: false,
              delay: null
            })
            message.warning(res.message)
          } else {
            this.props.onSend(send_type, timestamp, n_id)
          }
        }, () => {
          clearTimeout(this.timer)
          this.setState({
            verdisabled: false,
            delay: null
          })
        })
      })
    } else {
      let param = {
        func: 'MSN_sms_send_code',
        send_type: send_type,
        mob: _phone,
        timestamp: timestamp,
        ID: config.smsId,
        n_id: n_id
      }
      param.LText = md5(`${_phone}mingke${window.GLOB.appkey}${param.timestamp}`)
      param.secretkey = md5(`${param.LText}mingke${param.timestamp}`)
      param.rduri = 'https://sso.mk9h.cn/webapi/dostars'
      param.userid = 'bh0bapabtd45epsgra79segbch6c1ibk'
      param.LoginUID = 'bh0bapabtd45epsgra79segbch6c1ibk'
      Api.genericInterface(param).then(res => {
        if (!res.status) {
          clearTimeout(this.timer)
          this.setState({
            verdisabled: false,
            delay: null
          })
          message.warning(res.message)
        } else {
          this.props.onSend(send_type, timestamp, n_id)
        }
      }, () => {
        clearTimeout(this.timer)
        this.setState({
          verdisabled: false,
          delay: null
        })
      })
    }
  }
  resetVerCodeDelay = () => {
    const { delay } = this.state
    if (delay && delay > 1) {
      this.setState({delay: delay - 1})
      this.timer = setTimeout(this.resetVerCodeDelay, 1000)
    } else {
      this.setState({
        verdisabled: false,
        delay: null
      })
    }
  }
  render() {
    const { config } = this.props
    const { value, verdisabled, delay } = this.state
    return <Input ref={this.inputRef} className="mk-form-input" allowClear placeholder={config.placeholder || ''} value={value} autoComplete="off" disabled={config.readonly} onChange={this.handleChange} onPressEnter={this.handleInputSubmit} addonAfter={
      <Button type="link" disabled={verdisabled} style={{padding: 0, minWidth: '70px'}} size="small" onClick={this.getvercode}>
        {delay ? `${delay}s` : '获取验证码'}
      </Button>
    }/>
  }
}
export default MkVercode
src/tabviews/zshare/mutilform/mkVercode/index.scss
src/templates/modalconfig/dragelement/card.jsx
@@ -135,6 +135,12 @@
    formItem = <div style={{marginTop: '8px', color: 'rgba(0, 0, 0, 0.85)', lineHeight: '1.5', ...card.style}}>{card.formula}{card.postfix || ''}</div>
  } else if (card.type === 'split') {
    formItem = <div className="split-line" style={card.style}>{card.label}</div>
  } else if (card.type === 'vercode') {
    formItem = <Input style={{marginTop: '4px'}} placeholder={card.placeholder || ''} value={card.initval} addonAfter={
      <Button type="link" style={{padding: 0}} size="small">
        获取验证码
      </Button>
    }/>
  } else if (card.type === 'checkcard') {
    className += ' checkcard'
    formItem = <CheckCard config={card} />
src/templates/modalconfig/source.jsx
@@ -179,6 +179,11 @@
    type: 'form',
    label: '公式',
    subType: 'formula',
  },
  {
    type: 'form',
    label: '验证码',
    subType: 'vercode',
  }
]
src/templates/zshare/formconfig.jsx
@@ -2408,6 +2408,23 @@
    roleList = []
  }
  let msgTemps = sessionStorage.getItem('msgTemplate')
  if (msgTemps) {
    try {
      msgTemps = JSON.parse(msgTemps)
      msgTemps = msgTemps.map(item => {
        item.value = item.ID
        item.label = item.SignName + ' - ' + item.TemplateCode
        return item
      })
    } catch (e) {
      msgTemps = []
    }
  } else {
    msgTemps = []
  }
  inputfields = inputfields.map((item, index) => {
    item.label = `${index + 1}、${item.field || ''}(${item.label})`
    return item
@@ -2498,6 +2515,9 @@
  }, {
    value: 'formula',
    text: '公式'
  }, {
    value: 'vercode',
    text: '验证码'
  }]
  let _fieldlength = 50
@@ -2560,6 +2580,9 @@
    }, {
      value: 'formula',
      text: '公式'
    }, {
      value: 'vercode',
      text: '验证码'
    }]
  }
@@ -3632,6 +3655,38 @@
      }]
    },
    {
      type: 'radio',
      key: 'sendType',
      label: '发送方式',
      initVal: card.sendType || 'local',
      tooltip: '短信发送时是否通过单点系统。',
      required: false,
      options: [{
        value: 'local',
        text: '本地'
      }, {
        value: 'sso',
        text: '单点'
      }]
    },
    {
      type: 'select',
      key: 'phoneField',
      label: '手机号',
      initVal: card.phoneField || '',
      required: true,
      options: inputfields
    },
    {
      type: 'select',
      key: 'smsId',
      label: '短信模板',
      initVal: card.smsId || '',
      tooltip: '请选择适当的短信模板。',
      required: true,
      options: msgTemps
    },
    {
      type: 'number',
      key: 'span',
      min: 1,
src/templates/zshare/modalform/index.jsx
@@ -41,7 +41,8 @@
  formula: ['label', 'type', 'marginTop', 'marginBottom', 'splitline', 'span', 'labelwidth', 'formula', 'eval', 'postfix'],
  brafteditor: ['required', 'hidelabel', 'hidden', 'readin', 'fieldlength', 'readonly', 'span', 'labelwidth', 'tooltip', 'extra', 'encryption', 'marginTop', 'marginBottom'],
  funcvar: ['span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'],
  linkMain: ['readonly', 'required', 'hidden','declare', 'span', 'labelwidth', 'tooltip', 'interception', 'extra', 'marginTop', 'marginBottom']
  linkMain: ['readonly', 'required', 'hidden','declare', 'span', 'labelwidth', 'tooltip', 'interception', 'extra', 'marginTop', 'marginBottom'],
  vercode: ['label', 'field', 'type', 'blacklist', 'supField', 'readonly', 'required', 'hidden', 'span', 'labelwidth', 'tooltip', 'marginTop', 'marginBottom', 'placeholder', 'enter', 'smsId', 'phoneField', 'sendType']
}
class MainSearch extends Component {
@@ -120,7 +121,7 @@
    reRequired.field = true
    if (['hint', 'split', 'formula'].includes(type)) {
    if (['hint', 'split', 'formula', 'vercode'].includes(type)) {
      reRequired.field = false
      shows = fromJS(modalTypeOptions[type]).toJS()
    }
@@ -154,6 +155,10 @@
      if (sessionStorage.getItem('appType') === 'mob') { // 移动端右侧扩展信息
        shows.push('placeholder')
      }
    } else if (type === 'vercode') {
      if (this.record.enter === 'tab' || this.record.enter === 'sub') {
        shows.push('tabField')
      }
    } else if (type === 'linkMain') {
      if (this.record.declare === 'nvarchar') {
        shows.push('fieldlength')
src/views/design/header/index.jsx
@@ -335,6 +335,41 @@
      }
    })
  }
  getSmStemp = () => {
    if (!sessionStorage.getItem('msgTemplate')) {
      let _sql = `select ID,TemplateCode,SignName+'_'+describe as SignName from (select * from bd_msn_sms_temp where deleted=0 and status=20 ) a
        inner join (select openid from sapp where id='${window.GLOB.appkey}') b
        on a.openid=b.openid`
      _sql = Utils.formatOptions(_sql)
      let param = {
        func: 'sPC_Get_SelectedList',
        LText: _sql,
        obj_name: 'data',
        arr_field: 'ID,TemplateCode,SignName'
      }
      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      param.secretkey = Utils.encrypt(param.LText, param.timestamp)
      param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 云端数据验证
      Api.getSystemConfig(param).then(res => {
        let msgs = []
        if (!res.status) {
          notification.warning({
            top: 92,
            message: res.message,
            duration: 5
          })
        } else if (res.data) {
          msgs = res.data
        }
        sessionStorage.setItem('msgTemplate', JSON.stringify(msgs))
      })
    }
  }
  
  UNSAFE_componentWillMount () {
    sessionStorage.setItem('isEditState', 'true')
@@ -390,7 +425,8 @@
      setTimeout(() => {
        this.setSystemFuncs()
      }, 200)
        this.getSmStemp()
      }, 500)
    }
  }
src/views/mobdesign/index.jsx
@@ -148,7 +148,6 @@
    MKEmitter.addListener('changeEditMenu', this.changeEditMenu)
    setTimeout(() => {
      this.getAppPictures()
      this.getSmStemp()
      this.getRoleFields()
      setGLOBFuncs()
    }, 1000)
@@ -337,41 +336,6 @@
      return false
    }
    return true
  }
  getSmStemp = () => {
    if (!sessionStorage.getItem('msgTemplate')) {
      let _sql = `select ID,TemplateCode,SignName+'_'+describe as SignName from (select * from bd_msn_sms_temp where deleted=0 and status=20 ) a
        inner join (select openid from sapp where id='${window.GLOB.appkey}') b
        on a.openid=b.openid`
      _sql = Utils.formatOptions(_sql)
      let param = {
        func: 'sPC_Get_SelectedList',
        LText: _sql,
        obj_name: 'data',
        arr_field: 'ID,TemplateCode,SignName'
      }
      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      param.secretkey = Utils.encrypt(param.LText, param.timestamp)
      param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 云端数据验证
      Api.getSystemConfig(param).then(res => {
        let msgs = []
        if (!res.status) {
          notification.warning({
            top: 92,
            message: res.message,
            duration: 5
          })
        } else if (res.data) {
          msgs = res.data
        }
        sessionStorage.setItem('msgTemplate', JSON.stringify(msgs))
      })
    }
  }
  changeEditMenu = (menu) => {
src/views/pcdesign/index.jsx
@@ -133,7 +133,6 @@
    setTimeout(() => {
      this.getAppPictures()
      this.getSmStemp()
      this.getRoleFields()
      setGLOBFuncs()
    }, 1000)
@@ -313,83 +312,6 @@
        this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: MenuID || homeId, type: 'view'}))))
      }
    })
  }
  getSmStemp = () => {
    if (!sessionStorage.getItem('msgTemplate')) {
      let _sql = `select ID,TemplateCode,SignName+'_'+describe as SignName from (select * from bd_msn_sms_temp where deleted=0 and status=20 ) a
        inner join (select openid from sapp where id='${window.GLOB.appkey}') b
        on a.openid=b.openid`
      _sql = Utils.formatOptions(_sql)
      let param = {
        func: 'sPC_Get_SelectedList',
        LText: _sql,
        obj_name: 'data',
        arr_field: 'ID,TemplateCode,SignName'
      }
      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      param.secretkey = Utils.encrypt(param.LText, param.timestamp)
      param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 云端数据验证
      Api.getSystemConfig(param).then(res => {
        let msgs = []
        if (!res.status) {
          notification.warning({
            top: 92,
            message: res.message,
            duration: 5
          })
        } else if (res.data) {
          msgs = res.data
          sessionStorage.setItem('msgTemplate', JSON.stringify(msgs))
        }
      })
    }
    if (!sessionStorage.getItem('printTemps')) {
      let _sql = `select ID,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate
      where appkey= @appkey@ and Deleted=0 and typechartwo='web_print'
      union select ID,Images,a.PrintTempNO+PrintTempName as PN
      from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='web_print') a
      left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b
      on a.PrintTempNO=b.PrintTempNO
      left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c
      on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null`
      let param = {
        func: 'sPC_Get_SelectedList',
        LText: Utils.formatOptions(_sql),
        obj_name: 'data',
        arr_field: 'PN,ID,Images'
      }
      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      param.secretkey = Utils.encrypt(param.LText, param.timestamp)
      param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 云端数据验证
      Api.getSystemConfig(param).then(res => {
        if (res.status) {
          let temps = res.data.map(temp => {
            return {
              value: temp.ID,
              text: temp.PN
            }
          })
          sessionStorage.setItem('printTemps', JSON.stringify(temps))
        } else {
          notification.warning({
            top: 92,
            message: res.message,
            duration: 5
          })
        }
      })
    }
  }
  getAppPictures = () => {
src/views/pcdesign/index.scss
@@ -267,6 +267,9 @@
    background: rgba(0, 0, 0, 0);
  }
}
.mk-pc-view + .modal-form-board {
  padding-top: 0px;
}
body {
  overflow-y: hidden;