From b2891947d13e83363cccf0cbaaaa81f2487b0c35 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 15 六月 2023 17:41:06 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/menu/components/form/formaction/formconfig.jsx | 75 +++++--- /dev/null | 53 ------ src/menu/components/share/actioncomponent/actionform/index.jsx | 2 src/api/index.js | 59 +++---- src/templates/zshare/formconfig.jsx | 75 +++++--- src/menu/components/share/actioncomponent/formconfig.jsx | 150 +++++++++++------- src/templates/sharecomponent/actioncomponent/actionform/index.jsx | 2 src/menu/components/form/formaction/actionform/index.jsx | 2 src/tabviews/zshare/actionList/normalbutton/index.jsx | 29 ++ src/views/login/index.jsx | 2 10 files changed, 237 insertions(+), 212 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 0d4a8e1..ec0bb5f 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -23,19 +23,11 @@ axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' axios.defaults.withCredentials = false -axios.interceptors.request.use((config) => { - if (/LoginAndRedirect|getjsonresult|wxNativePay|postek/ig.test(config.url)) { - config.data = qs.stringify(config.data) - } else if (/\/doupload|\/dopreload|\/upload/.test(config.url)) { - config.headers = { 'Content-Type': 'multipart/form-data' } - } else if (config.method === 'post' && config.data) { - config.data = JSON.stringify(config.data) - } - - return config -}, (error) => { - return Promise.reject(error) -}) +// axios.interceptors.request.use((config) => { +// return config +// }, (error) => { +// return Promise.reject(error) +// }) const setCurrentUrl = (res) => { if (!!(window.history && window.history.pushState)) { @@ -95,7 +87,7 @@ return axios({ url: `/webapi/dostar${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -228,7 +220,7 @@ return axios({ url: url, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -267,7 +259,7 @@ return axios({ url, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -327,7 +319,7 @@ return axios({ url, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -517,7 +509,7 @@ return axios({ url, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -541,7 +533,7 @@ return axios({ url: `${url}/${param.func}`, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -573,7 +565,7 @@ return axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -613,7 +605,7 @@ axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }).then(res => { if (res.status && window.GLOB.IndexDB) { let msg = { @@ -639,7 +631,7 @@ axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }).then(res => { if (res.status) { window.GLOB.CacheMap.set(key, res) @@ -738,7 +730,7 @@ axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }).then(res => { if (res.status) { window.GLOB.CacheMap.set(_param, res) @@ -802,7 +794,7 @@ axios({ url: token.interface, method: 'post', - data: param + data: JSON.stringify(param) }).then(res => { _resolve(res) }) @@ -831,7 +823,7 @@ axios({ url, method: 'post', - data: _param + data: JSON.stringify(_param) }).then(result => { if (result.status) { window.GLOB.OuterToken[token.interface] = { @@ -849,7 +841,7 @@ axios({ url: token.interface, method: 'post', - data: param + data: JSON.stringify(param) }).then(res => { _resolve(res) }) @@ -921,7 +913,7 @@ return axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -932,7 +924,7 @@ axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }).then(result => { resolve(result) }) @@ -945,7 +937,7 @@ return axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }) } } @@ -986,7 +978,7 @@ return axios({ url, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -997,6 +989,7 @@ return axios({ url: '/webapi/doupload', method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, data: param }) } @@ -1008,6 +1001,7 @@ return axios({ url: '/webapi/dopreload', method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, data: param }) } @@ -1035,6 +1029,7 @@ return axios({ url: _url, method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, data: param }) } @@ -1048,7 +1043,7 @@ return axios({ url: _url, method: 'post', - data: param + data: qs.stringify(param) }) } @@ -1056,7 +1051,7 @@ return axios({ url: 'http://127.0.0.1:888/postek/print', method: 'post', - data: data + data: qs.stringify(data) }) } } diff --git a/src/menu/components/form/formaction/actionform/index.jsx b/src/menu/components/form/formaction/actionform/index.jsx index 7f5eae5..266c700 100644 --- a/src/menu/components/form/formaction/actionform/index.jsx +++ b/src/menu/components/form/formaction/actionform/index.jsx @@ -65,7 +65,7 @@ if (_intertype === 'custom') { _options.pop() - _options.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross') + _options.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify') if (_procMode === 'system') { _options.push('sql', 'sqlType') } else { diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx index 47ce8dd..823ad5f 100644 --- a/src/menu/components/form/formaction/formconfig.jsx +++ b/src/menu/components/form/formaction/formconfig.jsx @@ -201,35 +201,6 @@ }, { type: 'radio', - key: 'method', - label: '璇锋眰鏂瑰紡', - initVal: card.method || 'post', - required: true, - options: [{ - value: 'get', - text: 'GET' - }, { - value: 'post', - text: 'POST' - }] - }, - { - type: 'radio', - key: 'cross', - label: '璺ㄥ煙璇锋眰', - initVal: card.cross || 'true', - tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', - required: false, - options: [{ - value: 'true', - text: '鏀寔' - }, { - value: 'false', - text: '涓嶆敮鎸�' - }] - }, - { - type: 'radio', key: 'callbackType', label: '鍥炶皟鏂瑰紡', initVal: card.callbackType || 'script', @@ -266,6 +237,52 @@ }, { type: 'radio', + key: 'method', + label: '璇锋眰鏂瑰紡', + initVal: card.method || 'post', + required: true, + options: [{ + value: 'get', + text: 'GET' + }, { + value: 'post', + text: 'POST' + }] + }, + { + type: 'radio', + key: 'cross', + label: '鎺ュ彛璺ㄥ煙', + initVal: card.cross || 'true', + tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', + required: false, + options: [{ + value: 'true', + text: '鏀寔' + }, { + value: 'false', + text: '涓嶆敮鎸�' + }] + }, + { + type: 'radio', + key: 'stringify', + label: '搴忓垪鍖�', + initVal: card.stringify || 'text', + required: false, + options: [{ + value: 'text', + text: 'Text' + }, { + value: 'JSON', + text: 'JSON' + }, { + value: 'qs', + text: 'qs' + }] + }, + { + type: 'radio', key: 'Ot', label: '琛岃缃�', initVal: card.Ot, diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index b1d19ea..ddeb8b0 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -166,7 +166,7 @@ reOptions.intertype = this.state.interTypeOptions if (intertype === 'custom') { - shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross') + shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify') if (this.record.procMode === 'system') { shows.push('sql', 'sqlType') } else if (this.record.procMode === 'inner') { diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 9d6f7b7..d8fa383 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -481,35 +481,6 @@ }, { type: 'radio', - key: 'method', - label: '璇锋眰鏂瑰紡', - initVal: card.method || 'post', - required: true, - options: [{ - value: 'get', - text: 'GET' - }, { - value: 'post', - text: 'POST' - }] - }, - { - type: 'radio', - key: 'cross', - label: '璺ㄥ煙璇锋眰', - initVal: card.cross || 'true', - tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', - required: false, - options: [{ - value: 'true', - text: '鏀寔' - }, { - value: 'false', - text: '涓嶆敮鎸�' - }] - }, - { - type: 'radio', key: 'callbackType', label: '鍥炶皟鏂瑰紡', initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), @@ -542,6 +513,52 @@ label: '鍥炶皟鍑芥暟', initVal: card.callbackFunc || '', required: true + }, + { + type: 'radio', + key: 'method', + label: '璇锋眰鏂瑰紡', + initVal: card.method || 'post', + required: true, + options: [{ + value: 'get', + text: 'GET' + }, { + value: 'post', + text: 'POST' + }] + }, + { + type: 'radio', + key: 'cross', + label: '鎺ュ彛璺ㄥ煙', + initVal: card.cross || 'true', + tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', + required: false, + options: [{ + value: 'true', + text: '鏀寔' + }, { + value: 'false', + text: '涓嶆敮鎸�' + }] + }, + { + type: 'radio', + key: 'stringify', + label: '搴忓垪鍖�', + initVal: card.stringify || 'text', + required: false, + options: [{ + value: 'text', + text: 'Text' + }, { + value: 'JSON', + text: 'JSON' + }, { + value: 'qs', + text: 'qs' + }] }, { type: 'select', @@ -1507,35 +1524,6 @@ }, { type: 'radio', - key: 'method', - label: '璇锋眰鏂瑰紡', - initVal: card.method || 'post', - required: true, - options: [{ - value: 'get', - text: 'GET' - }, { - value: 'post', - text: 'POST' - }] - }, - { - type: 'radio', - key: 'cross', - label: '璺ㄥ煙璇锋眰', - initVal: card.cross || 'true', - tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', - required: false, - options: [{ - value: 'true', - text: '鏀寔' - }, { - value: 'false', - text: '涓嶆敮鎸�' - }] - }, - { - type: 'radio', key: 'callbackType', label: '鍥炶皟鏂瑰紡', initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), @@ -1570,6 +1558,52 @@ required: true }, { + type: 'radio', + key: 'method', + label: '璇锋眰鏂瑰紡', + initVal: card.method || 'post', + required: true, + options: [{ + value: 'get', + text: 'GET' + }, { + value: 'post', + text: 'POST' + }] + }, + { + type: 'radio', + key: 'cross', + label: '鎺ュ彛璺ㄥ煙', + initVal: card.cross || 'true', + tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', + required: false, + options: [{ + value: 'true', + text: '鏀寔' + }, { + value: 'false', + text: '涓嶆敮鎸�' + }] + }, + { + type: 'radio', + key: 'stringify', + label: '搴忓垪鍖�', + initVal: card.stringify || 'text', + required: false, + options: [{ + value: 'text', + text: 'Text' + }, { + value: 'JSON', + text: 'JSON' + }, { + value: 'qs', + text: 'qs' + }] + }, + { type: 'select', key: 'Ot', label: '琛岃缃�', diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index dad5061..8b9b3ea 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import moment from 'moment' +import qs from 'qs' import { is, fromJS } from 'immutable' import { Button, Modal, notification, message, Drawer, Switch, Checkbox, Progress } from 'antd' @@ -1367,15 +1368,29 @@ if (btn.cross === 'true') { if (JSON.stringify(param) !== '{}') { - _params.data = param + if (btn.stringify === 'qs') { + _params.data = qs.stringify(param) + } else if (btn.stringify === 'JSON') { + _params.data = param + } else { + _params.data = JSON.stringify(param) + } } } else { let _url = url - if (_params.method === 'get' && JSON.stringify(param) !== '{}') { - let keys = Object.keys(param).map(key => `${key}=${param[key]}`) - _url = _url + '?' + keys.join('&') - } else if (_params.method === 'post') { - _params.data = param + if (JSON.stringify(param) !== '{}') { + if (_params.method === 'get') { + let keys = Object.keys(param).map(key => `${key}=${param[key]}`) + _url = _url + '?' + keys.join('&') + } else if (_params.method === 'post') { + if (btn.stringify === 'qs') { + _params.data = qs.stringify(param) + } else if (btn.stringify === 'JSON') { + _params.data = param + } else { + _params.data = JSON.stringify(param) + } + } } _url = _url.replace(/&/ig, '%26') @@ -2338,7 +2353,7 @@ if (!res.oa_access_token) return params.forEach(n => { - Api.wxNginxRequest(`${domain2}cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', n).then(re => { + Api.wxNginxRequest(`${domain2}cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', JSON.stringify(n)).then(re => { if (verify.wxNoteCallback === 'true') { let msg = re.errmsg || '' diff --git a/src/tabviews/zshare/fileupload-pice/index.jsx b/src/tabviews/zshare/fileupload-pice/index.jsx deleted file mode 100644 index fc6b969..0000000 --- a/src/tabviews/zshare/fileupload-pice/index.jsx +++ /dev/null @@ -1,491 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import moment from 'moment' -import { Upload, Button, Progress, notification } from 'antd' -import { UploadOutlined } from '@ant-design/icons' -import SparkMD5 from 'spark-md5' -import Api from '@/api' -import './index.scss' - -class FileUpload extends Component { - static propTpyes = { - config: PropTypes.object, // 琛ㄥ崟淇℃伅 - onChange: PropTypes.func, // 琛ㄥ崟鍙樺寲 - } - - state = { - percent: 0, - accept: '', - accepts: null, - maxFile: null, - rduri: '', - limit: 2, - compress: false, - fileType: 'text', - showprogress: false, - filelist: [] - } - - UNSAFE_componentWillMount () { - const { config } = this.props - - let filelist = [] - if (config.initval) { - if (/^data:image/.test(config.initval)) { - filelist = [{ - uid: '0', - name: 'data:image/jpeg;base64', - status: 'done', - url: config.initval, - origin: true - }] - } else { - try { - filelist = config.initval.split(',').map((url, index) => { - return { - uid: `${index}`, - name: url.slice(url.lastIndexOf('/') + 1), - status: 'done', - url: url, - origin: true - } - }) - } catch (e) { - filelist = [] - } - } - } - - let accept = '' - let accepts = null - let compress = false - let maxFile = config.maxfile && config.maxfile > 0 ? config.maxfile : null - if (config.compress === 'true' || config.compress === 'base64') { - compress = true - accepts = ['.jpg', '.png', '.gif', '.jpeg'] - accept = accepts.join(',') - if (config.compress === 'base64') { - maxFile = 1 - } - } else if (config.suffix) { - accepts = config.suffix.split(',').map(item => { - if (!/^\./ig.test(item)) { - item = '.' + item - } - return item - }) - accept = accepts.join(',') - } - let rduri = config.rduri || '' - - if (window.GLOB.systemType === 'production') { - rduri = config.proRduri || '' - } - - this.setState({ - rduri, - accept, - accepts, - filelist, - compress, - limit: config.limit || 2, - maxFile: maxFile, - fileType: config.fileType || 'text' - }) - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) - } - - onChange = ({ fileList }) => { - fileList = fileList.map(item => { - if (item.status === 'error' && /^<!DOCTYPE html>/.test(item.response)) { - item.response = '' - } - return item - }) - - this.setState({filelist: fileList}) - } - - onRemove = file => { - const files = this.state.filelist.filter(v => v.uid !== file.uid) - - this.setState({filelist: files}) - - let vals = [] - - files.forEach(item => { - if (item.origin && item.url) { - vals.push(item.url) - } else if (!item.origin && item.status === 'done' && item.response) { - vals.push(item.response) - } - }) - - this.props.onChange(vals.join(',')) - } - - onUpdate = (url) => { - let filelist = fromJS(this.state.filelist).toJS() - - if (filelist[filelist.length -1]) { - filelist[filelist.length -1].status = 'done' - filelist[filelist.length -1].response = url - filelist[filelist.length -1].origin = false - } - - filelist = filelist.filter(item => !!(item.url || item.response)) - - let vals = [] - - filelist.forEach(item => { - if (item.origin && item.url) { - vals.push(item.url) - } else if (!item.origin && item.status === 'done' && item.response) { - vals.push(item.response) - } - }) - - this.setState({filelist}) - this.props.onChange(vals.join(',')) - } - - onFail = (msg) => { - let filelist = this.state.filelist.map(item => { - if (!item.url && !item.response && !item.status) { - item.status = 'error' - } - return item - }) - - this.setState({filelist, showprogress: false, percent: 0}) - - notification.warning({ - top: 92, - message: msg || '鏂囦欢涓婁紶澶辫触锛�', - duration: 5 - }) - } - - shardupload = (params) => { - let param = params.chunks.shift() - let form = new FormData() - - form.append('file', param.binary) - form.append('fileMd5', params.file.fileMd5) - form.append('shardingMd5', param.chunkMd5) - form.append('baseDomain', window.GLOB.baseurl) - form.append('rootPath', 'Content/images/upload/') - form.append('fileName', params.file.fileName) - form.append('fileExt', params.file.fileType) - form.append('shardingCnt', param.chunks) - form.append('shardingNo', param.chunk) - form.append('LoginUID', sessionStorage.getItem('LoginUID') || '') - form.append('UserID', sessionStorage.getItem('UserID') || '') - - Api.getLargeFileUpload(form).then(res => { - if (res.status) { - if (params.chunks.length > 0) { - this.setState({ - percent: Math.floor(100 * (param.chunk / param.chunks)) - }) - this.shardupload(params) - } else { - if (res.urlPath) { - this.onUpdate(res.urlPath) - } else { - this.onFail() - } - this.setState({ - percent: 100 - }, () => { - setTimeout(() => { - this.setState({ - showprogress: false, - percent: 0 - }) - }, 200) - }) - } - } else { - this.onFail(res.message) - } - }) - } - - getuuid = () => { - let uuid = [] - let _options = '0123456789abcdefghigklmnopqrstuv' - for (let i = 0; i < 19; i++) { - uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1)) - } - uuid = uuid.join('') - return uuid - } - - beforeUpload = (file) => { - const { accepts, compress, limit, rduri } = this.state - - if (accepts && file.name) { - let pass = false - accepts.forEach(type => { - if (new RegExp(type + '$', 'ig').test(file.name)) { - pass = true - } - }) - - if (!pass) { - setTimeout(() => { - this.onFail('鏂囦欢鏍煎紡閿欒锛�') - }, 10) - return false - } - } - - this.setState({ - showprogress: true, - percent: 0 - }) - - if (compress) { - let reader = new FileReader() - let fileSize = file.size / 1024 / 1024 - let compressRate = 0.9 - - if (fileSize / limit > 5) { - compressRate = 0.4 - } else if (fileSize / limit > 4) { - compressRate = 0.5 - } else if (fileSize / limit > 3) { - compressRate = 0.6 - } else if (fileSize / limit > 2) { - compressRate = 0.7 - } else if (fileSize > limit) { - compressRate = 0.8 - } - - reader.onload = (e) => { - let img = new Image() - let maxW = 640 - - img.onload = () => { - let cvs = document.createElement( 'canvas') - let ctx = cvs.getContext( '2d') - - if (img.width > maxW) { - img.height *= maxW / img.width - img.width = maxW - } - - cvs.width = img.width - cvs.height = img.height - - ctx.clearRect(0, 0, cvs.width, cvs.height) - ctx.drawImage(img, 0, 0, img.width, img.height) - - let param = {Base64Img: cvs.toDataURL('image/jpeg', compressRate)} - - if (this.props.config.compress === 'base64') { - this.onUpdate(param.Base64Img) - - this.setState({ - percent: 100 - }, () => { - setTimeout(() => { - this.setState({ - showprogress: false, - percent: 0 - }) - }, 200) - }) - } else { - if (rduri) { - param.rduri = rduri - } - - Api.fileuploadbase64(param).then(result => { - if (result.status && result.Images) { - let url = window.GLOB.baseurl + result.Images - - if (rduri) { - url = rduri.replace(/webapi(.*)$/, '') + result.Images - } - - this.onUpdate(url) - - this.setState({ - percent: 100 - }, () => { - setTimeout(() => { - this.setState({ - showprogress: false, - percent: 0 - }) - }, 200) - }) - } else { - this.onFail(result.message) - } - }) - } - } - - img.onerror = () => { - this.onFail('鍥剧墖璇诲彇澶辫触锛�') - } - - img.src = e.target.result - } - - reader.onerror = () => { - this.onFail('鏂囦欢璇诲彇澶辫触锛�') - } - - reader.readAsDataURL(file) - return false - } - - // 鍏煎鎬х殑澶勭悊 - let blobSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice - let chunkSize = 1024 * 1024 * 2 // 鍒囩墖姣忔2M - let chunks = Math.ceil(file.size / chunkSize) // 鍒囩墖鎬绘暟 - let currentChunk = 0 // 褰撳墠涓婁紶鐨刢hunk - let spark = new SparkMD5.ArrayBuffer() // 瀵筧rrayBuffer鏁版嵁杩涜md5鍔犲瘑锛屼骇鐢熶竴涓猰d5瀛楃涓� - let chunkFileReader = new FileReader() // 鐢ㄤ簬璁$畻鍑烘瘡涓猚hunkMd5 - let totalFileReader = new FileReader() // 鐢ㄤ簬璁$畻鍑烘�绘枃浠剁殑fileMd5 - let params = {chunks: [], file: {}} // 鐢ㄤ簬涓婁紶鎵�鏈夊垎鐗囩殑md5淇℃伅 - - params.file.fileName = file.name.replace(/\.{1}[^.]*$/ig, '') // 鏂囦欢鍚嶏紙鍘婚櫎鍚庣紑鍚嶏級 - params.file.fileType = file.name.replace(/^.*\.{1}/ig, '') // 鏂囦欢绫诲瀷 - params.file.fileSize = file.size // 鏂囦欢澶у皬 - params.file.fileChunks = chunks // 璁板綍鎵�鏈塩hunks鐨勯暱搴� - - if (!/^[A-Za-z0-9]+$/.test(params.file.fileName)) { // 鏂囦欢鍚嶇О鍚湁鑻辨枃鍙婃暟瀛椾箣澶栧瓧绗︽椂锛屽悕绉扮郴缁熺敓鎴� - params.file.fileName = moment().format('YYYYMMDDHHmmss') + this.getuuid() - } - - totalFileReader.readAsArrayBuffer(file) - totalFileReader.onload = (e) => { // 瀵规暣涓猼otalFile鐢熸垚md5 - spark.append(e.target.result) - params.file.fileMd5 = spark.end() // 璁$畻鏁翠釜鏂囦欢鐨刦ileMd5 - - let _param = new FormData() - _param.append('fileMd5', params.file.fileMd5) - - Api.getFilePreUpload(_param).then(res => { - if (res.status && res.urlPath) { - this.onUpdate(res.urlPath) - this.setState({ - percent: 100 - }, () => { - setTimeout(() => { - this.setState({ - showprogress: false, - percent: 0 - }) - }, 200) - }) - } else if (res.shardings && res.shardings.length > 0) { - res.shardings.forEach(shard => { - if (shard.shardingNo && parseInt(shard.shardingNo) > currentChunk) { - currentChunk = parseInt(shard.shardingNo) - } - }) - loadNext() - } else { - loadNext() - } - }) - } - - chunkFileReader.onload = (e) => { - spark.append(e.target.result) // 瀵规瘡涓�鐗囧垎鐗囪繘琛宮d5鍔犲瘑 - - params.chunks[params.chunks.length - 1].chunkMd5 = spark.end() // 娣诲姞鍒囩墖md5 - - currentChunk++ // 姣忎竴娆″垎鐗噊nload,currentChunk閮介渶瑕佸鍔狅紝浠ヤ究鏉ヨ绠楀垎鐗囩殑娆℃暟 - - if (currentChunk < chunks) { // 褰撳墠鍒囩墖鎬绘暟娌℃湁杈惧埌鎬绘暟鏃� - loadNext() - } else { - this.shardupload(params) - } - } - - chunkFileReader.onerror = () => { - this.onFail('鏂囦欢璇诲彇澶辫触锛�') - } - totalFileReader.onerror = () => { - this.onFail('鏂囦欢璇诲彇澶辫触锛�') - } - - let loadNext = () => { - let start = currentChunk * chunkSize // 璁$畻鍒嗙墖鐨勮捣濮嬩綅缃� - let end = Math.min(file.size, start + chunkSize) // 璁$畻鍒嗙墖鐨勭粨鏉熶綅缃� - - let obj = { // 姣忎竴涓垎鐗囬渶瑕佸寘鍚殑淇℃伅 - chunk: currentChunk + 1, - binary: file.slice(start, end), - start: start, - end: end, - chunks - } - - params.chunks.push(obj) - chunkFileReader.readAsArrayBuffer(blobSlice.call(file, start, end)) - } - - return false - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - } - - render() { - const { showprogress, percent, filelist, maxFile, fileType, accept } = this.state - - let uploadable = 'fileupload-form-container ' - - if (maxFile && filelist.length >= maxFile) { - uploadable += 'limit-fileupload' - } - - const props = { - name: 'file', - disabled: showprogress, - listType: fileType, - fileList: filelist, - action: null, - accept: accept, - method: 'post', - multiple: false, - onChange: this.onChange, - onRemove: this.onRemove, - beforeUpload: this.beforeUpload, - className: uploadable - } - - return ( - <Upload {...props}> - {fileType !== 'picture-card' ? <Button> - <UploadOutlined /> 鐐瑰嚮涓婁紶 - </Button> : null} - {fileType === 'picture-card' ? <span style={{whiteSpace: 'nowrap'}}> - <UploadOutlined /> 鐐瑰嚮涓婁紶 - </span> : null} - {showprogress ? <Progress percent={percent} size="small" /> : null} - </Upload> - ) - } -} - -export default FileUpload \ No newline at end of file diff --git a/src/tabviews/zshare/fileupload-pice/index.scss b/src/tabviews/zshare/fileupload-pice/index.scss deleted file mode 100644 index 86f8505..0000000 --- a/src/tabviews/zshare/fileupload-pice/index.scss +++ /dev/null @@ -1,53 +0,0 @@ -.fileupload-form-container { - .ant-progress-small.ant-progress-line { - position: absolute; - bottom: -20px; - left: 0px; - } - - .ant-upload-select-picture-card { - .ant-progress-small.ant-progress-line { - bottom: 0px; - } - } - .ant-upload-list-picture-card-container { - width: 90px; - height: 90px; - } - // .ant-upload-list-picture-card .ant-upload-list-item-undefined { - // border-color: #f5222d; - // .ant-upload-list-item-name { - // color: #f5222d; - // } - // } - .ant-upload-list-picture-card .ant-upload-list-item { - width: 90px; - height: 90px; - } - .ant-upload.ant-upload-select-picture-card { - width: 90px; - height: 90px; - } - a[href^="data"] { - pointer-events: none; - .anticon-eye-o { - display: none; - } - } -} -.fileupload-form-container.limit-fileupload { - > .ant-upload { - display: inline; - >.ant-upload { - >input { - display: none; - } - >button { - display: none; - } - } - } - > .ant-upload-select-picture-card { - display: none; - } -} \ No newline at end of file diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx index d3d1ea1..0661538 100644 --- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx @@ -148,7 +148,7 @@ reOptions.intertype = this.state.interTypeOptions if (intertype === 'custom') { - shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross') + shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify') if (this.record.procMode === 'system') { shows.push('sql', 'sqlType') } else if (this.record.procMode === 'inner') { diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index f14d109..d3ee589 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -1218,35 +1218,6 @@ }, { type: 'radio', - key: 'method', - label: '璇锋眰鏂瑰紡', - initVal: card.method || 'post', - required: true, - options: [{ - value: 'get', - text: 'GET' - }, { - value: 'post', - text: 'POST' - }] - }, - { - type: 'radio', - key: 'cross', - label: '璺ㄥ煙璇锋眰', - initVal: card.cross || 'true', - tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', - required: false, - options: [{ - value: 'true', - text: '鏀寔' - }, { - value: 'false', - text: '涓嶆敮鎸�' - }] - }, - { - type: 'radio', key: 'callbackType', label: '鍥炶皟鏂瑰紡', initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), @@ -1283,6 +1254,52 @@ }, { type: 'radio', + key: 'method', + label: '璇锋眰鏂瑰紡', + initVal: card.method || 'post', + required: true, + options: [{ + value: 'get', + text: 'GET' + }, { + value: 'post', + text: 'POST' + }] + }, + { + type: 'radio', + key: 'cross', + label: '鎺ュ彛璺ㄥ煙', + initVal: card.cross || 'true', + tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', + required: false, + options: [{ + value: 'true', + text: '鏀寔' + }, { + value: 'false', + text: '涓嶆敮鎸�' + }] + }, + { + type: 'radio', + key: 'stringify', + label: '搴忓垪鍖�', + initVal: card.stringify || 'text', + required: false, + options: [{ + value: 'text', + text: 'Text' + }, { + value: 'JSON', + text: 'JSON' + }, { + value: 'qs', + text: 'qs' + }] + }, + { + type: 'radio', key: 'position', label: '鏄剧ず浣嶇疆', initVal: card.position || 'toolbar', diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index b092d43..0f9cfa8 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -460,7 +460,7 @@ Api.directRequest({ url: _rduri + '/' + _func, method: 'post', - data: param + data: JSON.stringify(param) }).then(res => { if (res.status) { if (res.EPC === str) { -- Gitblit v1.8.0