import './View.scss'
import React, { Component } from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import { Table } from 'antd'
const mockEditor = require('./mockEditor.js')
import { formatTime } from '../../../../common.js';
import ErrMsg from '../../../../components/ErrMsg/ErrMsg.js';
// import { Card } from 'antd'
// import { getMockUrl } from '../../reducer/modules/news.js'
@connect(state=>{
// console.log(state);
return {
curData: state.inter.curdata,
currProject: state.project.currProject
}
})
class View extends Component {
constructor(props) {
super(props);
this.state = {
init: true
}
}
static propTypes = {
curData: PropTypes.object,
currProject: PropTypes.object
}
req_body_form(req_body_type,req_body_form){
if(req_body_type === 'json'){
return
接口名:
{this.props.curData.title}
请求方法:
{this.props.curData.method}
接口路径:
{this.props.currProject.basepath}{this.props.curData.path}
状态:
{status[this.props.curData.status]}
创建时间:
{formatTime(this.props.curData.add_time)}
更新时间:
{formatTime(this.props.curData.up_time)}
Mock地址:
{location.protocol + '//' + location.hostname + (location.port !== "" ? ":" + location.port : "") + `/mock/${this.props.currProject._id}${this.props.currProject.basepath}${this.props.curData.path}`}
{this.props.curData.desc?
接口描述:
{this.props.curData.desc}
:""}
{req_dataSource.length?
:""}
{dataSource.length?
:""}
{this.props.curData.req_query&&this.props.curData.req_query.length?
Query:
{this.req_query(this.props.curData.req_query)}
:""}
{/*
请求Body类型:
{this.props.curData.req_body_type}
*/}
{this.req_body_form(this.props.curData.req_body_type,this.props.curData.req_body_form)}
{/*
返回Body类型:
{this.props.curData.res_body_type}
*/}
{this.res_body(this.props.curData.res_body_type,this.props.curData.res_body)}
;
if(!this.props.curData.title){
if(this.state.init){
res =