| | |
| | | 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)) { |
| | |
| | | return axios({ |
| | | url: `/webapi/dostar${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url: url, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url: `${url}/${param.func}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url: `${url}${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | 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 = { |
| | |
| | | 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) |
| | |
| | | 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) |
| | |
| | | axios({ |
| | | url: token.interface, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | _resolve(res) |
| | | }) |
| | |
| | | axios({ |
| | | url, |
| | | method: 'post', |
| | | data: _param |
| | | data: JSON.stringify(_param) |
| | | }).then(result => { |
| | | if (result.status) { |
| | | window.GLOB.OuterToken[token.interface] = { |
| | |
| | | axios({ |
| | | url: token.interface, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | _resolve(res) |
| | | }) |
| | |
| | | return axios({ |
| | | url: `${url}${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | axios({ |
| | | url: `${url}${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }).then(result => { |
| | | resolve(result) |
| | | }) |
| | |
| | | return axios({ |
| | | url: `${url}${param.func ? '/' + param.func : ''}`, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | } |
| | |
| | | return axios({ |
| | | url, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url: '/webapi/doupload', |
| | | method: 'post', |
| | | headers: { 'Content-Type': 'multipart/form-data' }, |
| | | data: param |
| | | }) |
| | | } |
| | |
| | | return axios({ |
| | | url: '/webapi/dopreload', |
| | | method: 'post', |
| | | headers: { 'Content-Type': 'multipart/form-data' }, |
| | | data: param |
| | | }) |
| | | } |
| | |
| | | return axios({ |
| | | url: _url, |
| | | method: 'post', |
| | | headers: { 'Content-Type': 'multipart/form-data' }, |
| | | data: param |
| | | }) |
| | | } |
| | |
| | | return axios({ |
| | | url: _url, |
| | | method: 'post', |
| | | data: param |
| | | data: qs.stringify(param) |
| | | }) |
| | | } |
| | | |
| | |
| | | return axios({ |
| | | url: 'http://127.0.0.1:888/postek/print', |
| | | method: 'post', |
| | | data: data |
| | | data: qs.stringify(data) |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | 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 { |
| | |
| | | }, |
| | | { |
| | | 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: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'callbackType', |
| | | label: '回调方式', |
| | | initVal: card.callbackType || 'script', |
| | |
| | | }, |
| | | { |
| | | 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: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | 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, |
| | |
| | | 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') { |
| | |
| | | }, |
| | | { |
| | | 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: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'callbackType', |
| | | label: '回调方式', |
| | | initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), |
| | |
| | | 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: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | 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', |
| | |
| | | }, |
| | | { |
| | | 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: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'callbackType', |
| | | label: '回调方式', |
| | | initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), |
| | |
| | | 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: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | 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: '行设置', |
| | |
| | | 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' |
| | | |
| | |
| | | |
| | | if (btn.cross === 'true') { |
| | | if (JSON.stringify(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) !== '{}') { |
| | | 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') |
| | |
| | | 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 || '' |
| | | |
| | |
| | | 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') { |
| | |
| | | }, |
| | | { |
| | | 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: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'callbackType', |
| | | label: '回调方式', |
| | | initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), |
| | |
| | | }, |
| | | { |
| | | 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: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | 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', |
| | |
| | | Api.directRequest({ |
| | | url: _rduri + '/' + _func, |
| | | method: 'post', |
| | | data: param |
| | | data: JSON.stringify(param) |
| | | }).then(res => { |
| | | if (res.status) { |
| | | if (res.EPC === str) { |