mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-18 13:04:46 +08:00
fix: 变量选择接口集没有排序问题
This commit is contained in:
parent
fcfcc3699c
commit
6ce65f2b31
@ -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({
|
||||
|
@ -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>
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
export default {
|
||||
PAGE_LIMIT: 10, // 默认每页展示10条数据
|
||||
NAME_LIMIT: 30, // 限制名称的字符长度(中文算两个长度)
|
||||
NAME_LIMIT: 100, // 限制名称的字符长度(中文算两个长度)
|
||||
HTTP_METHOD: {
|
||||
'GET': {
|
||||
request_body: false,
|
||||
|
@ -102,6 +102,7 @@ class Content extends Component {
|
||||
});
|
||||
}
|
||||
render() {
|
||||
document.getElementsByTagName('title')[0].innerText = this.props.curdata.title;
|
||||
let InterfaceTabs = {
|
||||
view: {
|
||||
component: View,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user