GET
fetch(`/----/productDelete?id=${id}`, { credentials: 'include',method: 'GET'}).then(response => response.json())
.then(res => {
if (res.success) {
message.success('删除成功!');
$('.submit-btn').click();
} else {
}
});
var proxy = require('-------') ;
var con = 'http://---------'
exports.GET = {
params: [],
handler(req, res){
let url = con + '---'
proxy.send(req, url, function (data, success) {
if (success){
return res.send(proxy.renderSend(data));
}else{
return res.send(data);
}
}, {
method: 'GET',
json: true,
params: req.query
}, function (body, err) {
return res.send(proxy.renderErrSend(err));
});
}
};
POST
-let save_params = {
"ProductId":this.state.ProductId.toString(),
"itemId": this.state.query_params.itemId,
"ruleOfValue":this.state.ruleOfValue,
"riskSign":this.state.riskSign,//是否有 1有0没有',"
"markUpPriceType":this.state.markUpPriceType
};
if(!save_params.dfProductId){
notification['warning']({
message: '提示',
description: '不能为空',
duration: 3.5
});
return false
}
fetch(`----`, { credentials: 'include',method: 'POST', headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},body: JSON.stringify(save_params)}).then(response => response.json())
.then(res => {
if (res.success) {
notification['success']({
message: '提示',
description: res.msg||'绑定成功',
duration: 3.5
});
} else {
notification['error']({
message: '提示',
description: res.msg||'绑定失败',
duration: 3.5
});
}
});
var proxy = require('-----') ;
var con = 'http://----------'
exports.POST = {
params: [],
handler(req, res){
let url = con + '---';
let params = req.body;
params.dfProductId = params.dfProductId.trim();
proxy.send(req, url, function (data, success) {
if (success){
return res.send(proxy.renderSend(data));
}else{
return res.send(data);
}
}, {
method: 'POST',
json: true,
params: params
}, function (body, err) {
return res.send(proxy.renderErrSend(err));
});
}
};