非常抱歉截图上传不上来。。
这里是json
api: {
method: 'post',
url: '/admin/api/common/listAndCount',
requestAdaptor: requestAdaptorNftList,
}
js
function requestAdaptorNftList(api) {
const baseApi = '/admin/api/common/listAndCount?';
const baseParams = {
sortField: 'createdTime',
sortRule: 'DESC',
page: api.body.page,
limit: api.body.limit,
};
api.method = 'get';
const key = api.body.id;
delete api.body.id;
if (key?.length === 11) {
request
.request({
method: 'get',
url: `${baseApi}${QueryString.stringify(
baseParams,
)}&modelName=AccountModel&phone=${key}`,
})
.then((result) => {
api.method = 'get';
api.url = `${baseApi}${baseParams}`;
const accountId =
result.data?.data?.list?.length > 0
? result?.data?.data?.list[0].accountId
: null;
if (accountId) {
const body = _.pickBy({
modelName: 'NftModel',
accountId: accountId,
cid: api.body.cid,
});
api.url = `${baseApi}${QueryString.stringify(
baseParams,
)}&${QueryString.stringify(body)}`;
api.method = 'get';
return {
...api,
};
} else {
notification.error({
type: 'error',
message: '当前手机号没有注册用户',
});
return {
};
}
});
} else {
api.method = 'get';
api.body.nftRuleId = key;
const params = QueryString.stringify(api.body);
api.url = `${baseApi}${params}`;
return api;
}
}
在这里return的api 并没有按照写的配置进行返回
1条答案
按热度按时间1bqhqjot1#
是不是可以外面套一个service组件先请求然后 内部组件加个sendOn等外部service组件返回的某个值存在了再去请求呢?