fix: 变量选择接口集没有排序问题

This commit is contained in:
suxiaoxin 2017-11-30 20:25:50 +08:00
parent fcfcc3699c
commit 6ce65f2b31
5 changed files with 13 additions and 7 deletions

View File

@ -11,7 +11,6 @@ function deleteLastObject(str) {
}
function deleteLastArr(str) {
// return str.split(/[\d]/g).slice(0, -1).join('.');
return str.replace(/\[.*?\]/g, '');
}
@ -41,9 +40,12 @@ class VariablesSelect extends Component {
async componentDidMount() {
const { currColId, fetchVariableParamsList } = this.props
let result = await fetchVariableParamsList(currColId);
let records = result.payload.data.data;
records = records.sort((a, b)=>{
return a.index - b.index
})
this.setState({
records: result.payload.data.data
// records:record
records
})
@ -52,7 +54,6 @@ class VariablesSelect extends Component {
handleSelect = (key) => {
if (key && key.indexOf(CanSelectPathPrefix) === 0) {
key = key.substr(CanSelectPathPrefix.length)
console.log(key)
this.props.click(key);
} else {
this.setState({

View File

@ -273,7 +273,7 @@ export default class Run extends Component {
if (hasPlugin) {
return '发送请求'
} else {
return '请安装cross-request插件'
return '请安装 cross-request 插件'
}
})()}>
<Button
@ -285,11 +285,14 @@ export default class Run extends Component {
>{loading ? '取消' : '发送'}</Button>
</Tooltip>
<Button
<Tooltip placement="bottom" title={()=>{
return this.props.type === 'inter' ? '保存到测试集' : '更新该用例'
}}><Button
onClick={this.props.save}
type="primary"
style={{ marginLeft: 10 }}
>{this.props.type === 'inter' ? '保存' : '更新'}</Button>
</Tooltip>
</div>

View File

@ -1,6 +1,6 @@
export default {
PAGE_LIMIT: 10, // 默认每页展示10条数据
NAME_LIMIT: 30, // 限制名称的字符长度(中文算两个长度)
NAME_LIMIT: 100, // 限制名称的字符长度(中文算两个长度)
HTTP_METHOD: {
'GET': {
request_body: false,

View File

@ -102,6 +102,7 @@ class Content extends Component {
});
}
render() {
document.getElementsByTagName('title')[0].innerText = this.props.curdata.title;
let InterfaceTabs = {
view: {
component: View,

View File

@ -223,6 +223,7 @@ class interfaceColController extends baseController {
bodyParams = typeof bodyParams === 'object' ? bodyParams : {}
}
item.params = Object.assign(pathParams, query, bodyParams)
item.index = result.index;
resultList[index] = item;
}