| | |
| | | } else if (this.record.type === 'close' || this.record.type === 'reset') { |
| | | shows = ['typeName', 'label'] |
| | | } else { |
| | | shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton'] // 选项列表 |
| | | shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton', 'formCache'] // 选项列表 |
| | | |
| | | if (this.record.execSuccess === 'never') { |
| | | shows.push('resetForms') |
| | |
| | | text: '刷新' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'formCache', |
| | | label: '表单缓存', |
| | | initVal: card.formCache || 'false', |
| | | tooltip: '主要用于数据修改后,更新相关表单的选项,清空缓存后表单再次打开时数据会重新加载。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '不清空' |
| | | }, { |
| | | value: 'clear', |
| | | text: '清空' |
| | | }] |
| | | }, |
| | | ] |
| | | } |
| | |
| | | const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable')) |
| | | const acTyOptions = { |
| | | pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton'], |
| | | prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton'], |
| | | exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden', 'preButton'], |
| | | pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton', 'formCache'], |
| | | prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton', 'formCache'], |
| | | exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden', 'preButton', 'formCache'], |
| | | excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'width', 'hidden'], |
| | | excelOut: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'pagination', 'search', 'width', 'hidden'], |
| | | popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'popClose', 'width', 'display', 'ratio', 'syncComponent', 'clickouter', 'maskStyle', 'closeButton', 'hidden'], |
| | |
| | | } else if (_funcType === 'refund') { |
| | | shows.push('Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu') |
| | | reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value)) |
| | | } else if (_funcType === 'shareLink') { |
| | | shows.push('shortUrl', 'shareUrl', 'shareProUrl', 'shareTip') |
| | | // } else if (_funcType === 'expPdf') { |
| | | // shows.push('exportType') |
| | | } |
| | |
| | | shows.push('reason') |
| | | } |
| | | } |
| | | } else if (!(openType === 'funcbutton' && this.record.funcType === 'expPdf')) { |
| | | } else if (openType !== 'funcbutton' || !['expPdf', 'shareLink'].includes(this.record.funcType)) { |
| | | if (openType !== 'excelOut') { |
| | | reOptions.control = [ |
| | | { value: '', text: '无' }, |
| | |
| | | { value: 'refund', text: '退款' }, |
| | | { value: 'closetab', text: '标签关闭' }, |
| | | { value: 'expPdf', text: '导出PDF' }, |
| | | { value: 'shareLink', text: '分享链接' }, |
| | | { value: 'megvii', text: '旷视面板机' }, |
| | | { value: 'filezip', text: '文件压缩包' }, |
| | | ] |
| | |
| | | { value: 'clearCache', text: '清空本地配置' }, |
| | | { value: 'copyurl', text: '复制链接地址' }, |
| | | { value: 'expPdf', text: '导出PDF' }, |
| | | { value: 'shareLink', text: '分享链接' }, |
| | | { value: 'logout', text: '退出' }, |
| | | { value: 'goBack', text: '返回' }, |
| | | ] |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'shortUrl', |
| | | label: '短链接', |
| | | initVal: card.shortUrl || 'false', |
| | | options: [{ |
| | | value: 'false', |
| | | text: '禁用' |
| | | }, { |
| | | value: 'true', |
| | | text: '启用' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'shareUrl', |
| | | label: '链接地址', |
| | | initVal: card.shareUrl || '', |
| | | tooltip: '链接中如果存在@BID@或@ID@将自动替换。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'shareProUrl', |
| | | label: '正式链接', |
| | | initVal: card.shareProUrl || '', |
| | | tooltip: '链接中如果存在@BID@或@ID@将自动替换。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'shareTip', |
| | | label: '分享提示', |
| | | initVal: card.shareTip || '', |
| | | tooltip: '分享时对用户的提示信息。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 0, |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'formCache', |
| | | label: '表单缓存', |
| | | initVal: card.formCache || 'false', |
| | | tooltip: '主要用于数据修改后,更新相关表单的选项,清空缓存后表单再次打开时数据会重新加载。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '不清空' |
| | | }, { |
| | | value: 'clear', |
| | | text: '清空' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidden', |
| | | label: '隐藏', |
| | | initVal: card.hidden || 'false', |
| | |
| | | { value: 'refund', text: '退款' }, |
| | | { value: 'closetab', text: '标签关闭' }, |
| | | { value: 'expPdf', text: '导出PDF' }, |
| | | { value: 'shareLink', text: '分享链接' }, |
| | | { value: 'megvii', text: '旷视面板机' }, |
| | | { value: 'filezip', text: '文件压缩包' }, |
| | | ] |
| | |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '宽度', |
| | | initVal: card.width || 12, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | forbid: card.eleType !== 'button', |
| | | type: 'radio', |
| | | key: 'shortUrl', |
| | | label: '短链接', |
| | | initVal: card.shortUrl || 'false', |
| | | options: [{ |
| | | value: 'false', |
| | | text: '禁用' |
| | | }, { |
| | | value: 'true', |
| | | text: '启用' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'shareUrl', |
| | | label: '链接地址', |
| | | initVal: card.shareUrl || '', |
| | | tooltip: '链接中如果存在@BID@或@ID@将自动替换。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'shareProUrl', |
| | | label: '正式链接', |
| | | initVal: card.shareProUrl || '', |
| | | tooltip: '链接中如果存在@BID@或@ID@将自动替换。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'shareTip', |
| | | label: '分享提示', |
| | | initVal: card.shareTip || '', |
| | | tooltip: '分享时对用户的提示信息。', |
| | | required: false |
| | | }, |
| | | // { |
| | | // type: 'number', |
| | | // key: 'width', |
| | | // min: 1, |
| | | // max: 24, |
| | | // precision: 0, |
| | | // label: '宽度', |
| | | // initVal: card.width || 12, |
| | | // tooltip: '栅格布局,每行等分为24列。', |
| | | // forbid: card.eleType !== 'button', |
| | | // required: true |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | key: 'show', |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'formCache', |
| | | label: '表单缓存', |
| | | initVal: card.formCache || 'false', |
| | | tooltip: '主要用于数据修改后,更新相关表单的选项,清空缓存后表单再次打开时数据会重新加载。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '不清空' |
| | | }, { |
| | | value: 'clear', |
| | | text: '清空' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidden', |
| | | label: '隐藏', |
| | | initVal: card.hidden || 'false', |
| | |
| | | const FuncMegvii = asyncComponent(() => import('@/tabviews/zshare/actionList/funcMegvii')) |
| | | const FuncZip = asyncComponent(() => import('@/tabviews/zshare/actionList/funczip')) |
| | | const ExportPdf = asyncComponent(() => import('@/tabviews/zshare/actionList/exportPdf')) |
| | | const ShareLink = asyncComponent(() => import('@/tabviews/zshare/actionList/shareLink')) |
| | | const EditLine = asyncComponent(() => import('@/tabviews/zshare/actionList/editLine')) |
| | | const BarCode = asyncComponent(() => import('@/components/barcode')) |
| | | const QrCode = asyncComponent(() => import('@/components/qrcode')) |
| | |
| | | MkButton = <ExportPdf |
| | | btn={card} |
| | | /> |
| | | } else if (card.funcType === 'shareLink') { |
| | | MkButton = <ShareLink |
| | | BID={data.$$BID} |
| | | btn={card} |
| | | selectedData={_data} |
| | | /> |
| | | } else if (card.funcType === 'addline' || card.funcType === 'delline') { |
| | | MkButton = <EditLine |
| | | btn={card} |
| | |
| | | const FuncZip = asyncComponent(() => import('./funczip')) |
| | | const EditLine = asyncComponent(() => import('./editLine')) |
| | | const ExportPdf = asyncComponent(() => import('./exportPdf')) |
| | | const ShareLink = asyncComponent(() => import('./shareLink')) |
| | | |
| | | class ActionList extends Component { |
| | | static propTpyes = { |
| | |
| | | btn={item} |
| | | /> |
| | | ) |
| | | } else if (item.funcType === 'shareLink') { |
| | | return ( |
| | | <ShareLink |
| | | key={item.uuid} |
| | | BID={BID} |
| | | btn={item} |
| | | selectedData={selectedData} |
| | | /> |
| | | ) |
| | | } else if (item.funcType === 'addline' || item.funcType === 'delline') { |
| | | return ( |
| | | <EditLine |
| | |
| | | tabId = btn.refreshTab[btn.refreshTab.length - 1] |
| | | } |
| | | |
| | | if (btn.formCache === 'clear') { // 清除表单缓存 |
| | | window.GLOB.CacheMap = new Map() |
| | | } |
| | | |
| | | if (tabId && btn.$MenuID === tabId) { // 刷新当前菜单时,停止其他操作 |
| | | MKEmitter.emit('reloadMenuView', tabId, 'table') |
| | | return |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, notification, message, Modal } from 'antd' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | | |
| | | // import './index.scss' |
| | | |
| | | class ShareLink extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.string, |
| | | btn: PropTypes.object, |
| | | selectedData: PropTypes.any |
| | | } |
| | | |
| | | state = { |
| | | loading: false |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | |
| | | /** |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (triggerId) => { |
| | | const { btn, BID, selectedData } = this.props |
| | | const { loading } = this.state |
| | | |
| | | if (loading) return |
| | | if (triggerId && btn.uuid !== triggerId) return |
| | | |
| | | if (window.GLOB.systemType === 'production' && !btn.shareProUrl) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '尚未设置正式系统链接地址!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let bid = BID || '' |
| | | let id = '' |
| | | if (selectedData && selectedData[0]) { |
| | | id = selectedData[0].$$uuid || '' |
| | | } |
| | | |
| | | let url = btn.shareUrl |
| | | if (window.GLOB.systemType === 'production') { |
| | | url = btn.shareProUrl |
| | | } |
| | | |
| | | url = url.replace(/@BID@/ig, bid).replace(/@ID@/ig, id) |
| | | |
| | | if (btn.shortUrl === 'true') { |
| | | this.setState({ |
| | | loading: true |
| | | }, () => { |
| | | this.getShortUrl(url) |
| | | }) |
| | | } else { |
| | | this.copyUrl(url) |
| | | } |
| | | } |
| | | |
| | | getShortUrl = (url) => { |
| | | let _rduri = window.atob('aHR0cHM6Ly9lcGMubWs5aC5$mkjbi93ZWJhcGkvZG9zdGFycw=='.replace(/\$mk/ig, '')) |
| | | let _id = window.atob('YmgwYmFwYWJ0ZDQ1ZXBz$mkZ3JhNzlzZWdiY2g2YzFpYms='.replace(/\$mk/ig, '')) |
| | | |
| | | let param = { |
| | | func: 's_url_db_adduptdel', |
| | | appkey: window.GLOB.appkey, |
| | | userid: _id, |
| | | LoginUID: _id, |
| | | type: 'add_only', |
| | | validity: 15, |
| | | linkurl: url, |
| | | nonc: '' + new Date().getTime(), |
| | | id: md5(url + window.GLOB.appkey) |
| | | } |
| | | |
| | | let keys = Object.keys(param).sort() |
| | | let values = '' |
| | | keys.forEach(key => { |
| | | values += key + param[key] |
| | | }) |
| | | param.sign = md5(values) |
| | | param.t = new Date().getTime() |
| | | |
| | | Api.directRequest({ |
| | | url: _rduri + '/s_url_db_adduptdel', |
| | | method: 'post', |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | |
| | | if (res.status && res.id) { |
| | | this.copyUrl('https://mk9h.cn/m.asp?m=' + res.id) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message || '链接生成失败!', |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | copyUrl = (url) => { |
| | | const { btn } = this.props |
| | | |
| | | let oInput = document.createElement('input') |
| | | oInput.value = url |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | | document.body.removeChild(oInput) |
| | | |
| | | if (btn.shareTip) { |
| | | Modal.success({ |
| | | title: btn.shareTip |
| | | }) |
| | | } else { |
| | | message.success('已复制到剪切板。') |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { btn } = this.props |
| | | const { loading } = this.state |
| | | |
| | | let label = '' |
| | | let icon = '' |
| | | let type = 'link' |
| | | let className = '' |
| | | let style = {...btn.style} |
| | | |
| | | if (btn.show === 'button') { |
| | | label = btn.label |
| | | icon = btn.icon || '' |
| | | } else if (btn.show === 'link') { |
| | | label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> |
| | | icon = '' |
| | | } else if (btn.show === 'icon') { |
| | | icon = btn.icon || '' |
| | | } else if (!btn.$toolbtn) { |
| | | icon = btn.icon || '' |
| | | label = btn.label |
| | | className = 'mk-btn mk-' + btn.class |
| | | } else { |
| | | type = '' |
| | | icon = btn.icon || '' |
| | | label = btn.label |
| | | className = 'mk-btn mk-' + btn.class |
| | | } |
| | | |
| | | return ( |
| | | <Button |
| | | type={type} |
| | | title={btn.show === 'icon' ? btn.label : ''} |
| | | style={style} |
| | | loading={loading} |
| | | icon={icon} |
| | | className={className} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | | >{label}</Button> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default ShareLink |