房产评估重复提交问题

This commit is contained in:
尹吉欢
2018-04-17 14:28:05 +08:00
parent f67f0ffcda
commit a9b3401c70
2 changed files with 28 additions and 6 deletions
+6 -3
View File
@@ -1,6 +1,6 @@
axios.defaults.baseURL = BASE_PATH;
axios.defaults.headers.post['Content-Type'] = 'application/json';
axios.defaults.timeout = 10000;
axios.defaults.timeout = 15000;
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
@@ -15,14 +15,17 @@ axios.interceptors.request.use(function (config) {
axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if(error=="Error: Network Error"){
if (error.toString().indexOf('timeout') > -1) {
plus.nativeUI.alert("请求超时");
plus.nativeUI.closeWaiting();
}else if(error=="Error: Network Error"){
if(plus.webview.getWebviewById('error.html')==null){
clicked('error.html',true,false,{},{},function(){
window.location.reload();
})
}else{
$(".loadingBg").hide();
plus.nativeUI.closeWaiting();
plus.nativeUI.closeWaiting();
plus.webview.getWebviewById("error.html").show();
}
}
+22 -3
View File
@@ -1267,7 +1267,23 @@ function onPlusReady(){
$("#input_city").val("上海");
$(".nowCity").text("上海");
}
getRequestId();
}
// 生成请求ID,防止重复提交
var requestId = "";
function getRequestId() {
axios.get("/rest/index/id")
.then(function (response) {
if(response.data.status){
requestId = response.data.data;
}
})
.catch(function (error) {
console.log(error);
});
}
/* 弹出城市选择页面 */
$(document).on("click",".open-about01", function () {
$.popup(".popup-about01");
@@ -1828,7 +1844,7 @@ function checkIsLogin(){
function addEvaluation(){
var data={};
if(type==0){
data={cityDisplay: $("#input_city").val(),
data={id:requestId,cityDisplay: $("#input_city").val(),
region:$("input[name=region]").val(),
district:$("#input_address").val(),
address:$("input[name=address]").val(),
@@ -1844,7 +1860,7 @@ function addEvaluation(){
lastRentDate:$("#input_time03").val(),
houseStatus:0}
}else{
data={cityDisplay: $("#input_city").val(),
data={id:requestId,cityDisplay: $("#input_city").val(),
region:$("input[name=region]").val(),
district:$("#input_address").val(),
address:$("input[name=address]").val(),
@@ -1863,7 +1879,9 @@ function addEvaluation(){
var id = response.data.data.id;
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
plus.webview.getWebviewById('views/user/userInfo.html').reload();
clicked('/views/evaluate/evaluateReport.html',true,false,{},{hid:id})
clicked('/views/evaluate/evaluateReport.html',true,false,{},{hid:id},function(){
getRequestId();
})
}else{
$("#evaluation_btn").removeAttr("disabled");
$.toast(response.data.message);
@@ -1874,6 +1892,7 @@ function addEvaluation(){
});
}
/* 信息输入弹窗 */
$(document).on('click','.open-modal', function () {
$.modal({