增加自动换站点轮询;修正验证码错误时通栏bug
This commit is contained in:
parent
8e61490e31
commit
8ebc5e65c1
@ -130,7 +130,7 @@
|
||||
#chat_container .chat-editor > header > .editor-group {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
vertical-align: bottom;
|
||||
overflow: hidden;
|
||||
margin-right: -1px;
|
||||
}
|
||||
|
@ -762,25 +762,23 @@
|
||||
</section>
|
||||
<section class="ticket-submit-info-status-failed">
|
||||
<header>
|
||||
出 票 失 败
|
||||
出票失败了...
|
||||
<i class="fa fa-times cancel-button"></i>
|
||||
</header>
|
||||
<div>
|
||||
<p>
|
||||
<strong>错误信息:</strong>
|
||||
<strong>12306返回信息:</strong>
|
||||
<span></span>
|
||||
</p>
|
||||
<p>
|
||||
<strong>购票提示:</strong>
|
||||
提示余票不足时,请尽量更换车次或席别,看到的有票可能是系统错误。
|
||||
<br />
|
||||
当然,可以重试一次,如果依然如此,建议及时更换车次或席别。
|
||||
<strong>提示:</strong>
|
||||
提示没有足够的票时,请尽量更换车次或席别,可能已经没票了。
|
||||
</p>
|
||||
</div>
|
||||
<footer>
|
||||
<button class="button button-primary">
|
||||
<i class="fa fa-repeat"></i>
|
||||
再次提交
|
||||
再提交试试
|
||||
</button>
|
||||
<button class="button button-default cancel-button">
|
||||
<i class="fa fa-ban"></i>
|
||||
@ -973,6 +971,10 @@
|
||||
<br />
|
||||
<a href="http://bbs.liebao.cn/forum-2-1.html" target="_blank">猎豹论坛</a> | <a href="http://weibo.com/liebaocn" target="_blank">猎豹官微</a> | <a href="http://www.fishlee.net/about/" target="_blank">订票求助</a> | <a href="http://weibo.com/imcfish" target="_blank">木鱼微博</a>
|
||||
</section>
|
||||
<section class="chat-item chat-item-warning">
|
||||
<i class="fa fa-exclamation-triangle"></i>
|
||||
<strong>系统信息:</strong>聊天室将会从2014年9月22日起关闭。希望保持交流的票友同学请尽量加入 <a href="http://www.fishlee.net/about/" target="_blank">助手QQ群</a>。希望各位都能买到自己想要的车票!
|
||||
</section>
|
||||
</script>
|
||||
<script type="text/x-dot-template" id="chat_connect_server">
|
||||
<section class="chat-item chat-state chat-state-{{!it.state}}">
|
||||
|
@ -131,7 +131,7 @@
|
||||
} else {
|
||||
page += "?";
|
||||
}
|
||||
page += "bv=" + (document.body.dataset["browserVersion"]||"") + "&ev=" + (document.body.dataset["targetExtensionVersion"]||"");
|
||||
page += "bv=" + (document.body.dataset["browserVersion"] || "") + "&ev=" + (document.body.dataset["targetExtensionVersion"] || "");
|
||||
//加入百度统计
|
||||
window._hmt = window._hmt || [];
|
||||
_hmt.push(['_setAutoPageview', false]);
|
||||
|
@ -154,8 +154,8 @@
|
||||
return date >= exports.minDate;
|
||||
};
|
||||
exports.isAutoBookEnabled = function (profile) {
|
||||
return profile.selectedTrain && profile.selectedTrain.length
|
||||
&& profile.selectedSeatType && profile.selectedSeatType.length;
|
||||
return (profile.selectedTrain && profile.selectedTrain.length)
|
||||
|| (profile.selectedSeatType && profile.selectedSeatType.length);
|
||||
};
|
||||
//查找默认的日期
|
||||
(function () {
|
||||
|
@ -24,7 +24,10 @@
|
||||
|
||||
ajax.sendPost("leftTicket/submitOrderRequest", "leftTicket/init", data, "json", function (data) {
|
||||
if (!data.status) {
|
||||
def.reject({ msg: parser.getError(data).message });
|
||||
var msg = parser.getError(json).message;
|
||||
if (msg.indexOf("未登录") !== -1)
|
||||
msg = "12306取消了您的登录,请重新登录...";
|
||||
def.reject({ msg: msg || "12306返回了未知的状态信息,请刷新重试。" });
|
||||
} else {
|
||||
ajax.sendPost(profile.resign ? "confirmPassenger/initGc" : "confirmPassenger/initDc", "leftTicket/init", null, "text", function (html) {
|
||||
parseFields(html);
|
||||
@ -86,9 +89,12 @@
|
||||
var autoSubmitRequest = function () {
|
||||
ajax.sendPost("confirmPassenger/autoSubmitOrderRequest", "leftTicket/init", data, "json", function (json) {
|
||||
if (!json.status || !json.data) {
|
||||
def.reject({ msg: parser.getError(json).message || "12306返回了未知的状态信息,请刷新重试。" });
|
||||
var msg = parser.getError(json).message;
|
||||
if (msg.indexOf("未登录") !== -1)
|
||||
msg = "12306取消了您的登录,请重新登录...";
|
||||
def.reject({ msg: msg || "12306返回了未知的状态信息,请刷新重试。" });
|
||||
} else if (json.data.isRelogin) {
|
||||
def.reject({ msg: "请重新登录" });
|
||||
def.reject({ msg: "12306取消了您的登录,请重新登录" });
|
||||
} else if (json.data.errMsg) {
|
||||
def.reject({ msg: "无法提交订单:" + json.data.errMsg });
|
||||
} else {
|
||||
@ -183,7 +189,10 @@
|
||||
|
||||
ajax.sendPost(url, "leftTicket/init", data, "json", function (json) {
|
||||
if (!json || !json.status || !json.data) {
|
||||
def.reject({ msg: parser.getError(json) });
|
||||
var msg = parser.getError(json).message;
|
||||
if (msg.indexOf("未登录") !== -1)
|
||||
msg = "12306取消了您的登录,请重新登录...";
|
||||
def.reject({ msg: msg || "12306返回了未知的状态信息,请刷新重试。" });
|
||||
} else if (!json.data.submitStatus) {
|
||||
def.reject({ msg: json.data.errMsg || "提交订单错误,错误原因未知..." });
|
||||
} else {
|
||||
@ -287,7 +296,7 @@
|
||||
if (!json || !json.status || !json.data) {
|
||||
def.reject({ msg: parser.getError(json) });
|
||||
} else if (json.data.isRelogin) {
|
||||
def.reject({ msg: "登录状态异常,请重新登录。" });
|
||||
def.reject({ msg: "12306取消了您的登录,请重新登录。" });
|
||||
} else if (!json.data.submitStatus || json.data.get608Msg) {
|
||||
def.reject({ msg: json.data.errMsg || json.data.get608Msg || parser.getError(json) });
|
||||
} else {
|
||||
@ -322,7 +331,7 @@
|
||||
if (!json || !json.status || !json.data) {
|
||||
def.reject({ msg: (parser.getError(json) || { message: "未知错误" }).message });
|
||||
} else if (json.data.isRelogin) {
|
||||
def.reject({ msg: "登录状态异常,请重新登录。" });
|
||||
def.reject({ msg: "12306取消了您的登录,请重新登录。" });
|
||||
} else if (json.data.op_2 === "true") {
|
||||
def.reject({ msg: "排队人数过多,12306禁止提交订单。" });
|
||||
} else {
|
||||
|
@ -46,13 +46,14 @@
|
||||
return data;
|
||||
};
|
||||
|
||||
var transferData = function (date, data, noProcess, noAction) {
|
||||
var transferData = function (query, data, noProcess, noAction) {
|
||||
var result = data;
|
||||
if (!Array.isArray(result.data) || !result.data.length || !result.data[0].queryLeftNewDTO) {
|
||||
exports.events.fireEvent("requestFailed");
|
||||
};
|
||||
|
||||
var trainData = { raw: result, rawTrainMap: {}, trainMap: {}, auto: null, nextTime: null, noProcess: noProcess, noAction: noAction };
|
||||
var date = query.date;
|
||||
var trainData = { query: query, raw: result, rawTrainMap: {}, trainMap: {}, auto: null, nextTime: null, noProcess: noProcess, noAction: noAction };
|
||||
|
||||
_.each(result.data, function (t) {
|
||||
var train = {
|
||||
@ -150,7 +151,7 @@
|
||||
return trainData;
|
||||
};
|
||||
|
||||
exports.queryTicket = function (from, fromName, to, toName, date, student, resign, noProcess, noAction) {
|
||||
exports.queryTicket = function (from, fromName, to, toName, date, student, resign, noProcess, noAction, byAuto) {
|
||||
var def = new $.Deferred();
|
||||
var queryCount = 0;
|
||||
|
||||
@ -158,6 +159,22 @@
|
||||
exports.events.fireEvent("requestFailed");
|
||||
});
|
||||
|
||||
//before query event.
|
||||
if (!noAction && !noProcess) {
|
||||
var evdata = {
|
||||
from: from,
|
||||
fromName: fromName,
|
||||
to: to,
|
||||
toName: toName,
|
||||
auto: byAuto || false
|
||||
};
|
||||
exports.events.fireEvent("beforeQueryTicket", evdata);
|
||||
from = evdata.from;
|
||||
to = evdata.to;
|
||||
fromName = evdata.fromName;
|
||||
toName = evdata.toName;
|
||||
}
|
||||
|
||||
var sendQueryRequest = function () {
|
||||
var p = {
|
||||
"leftTicketDTO.train_date": date,
|
||||
@ -188,7 +205,16 @@
|
||||
var error = (this.model.messages || ["查询失败"]).join("");
|
||||
def.reject(error);
|
||||
} else {
|
||||
var data = transferData(date, this.model, noProcess, noAction);
|
||||
var data = transferData({
|
||||
from: from,
|
||||
fromName: fromName,
|
||||
to: to,
|
||||
toName: toName,
|
||||
auto: byAuto || false,
|
||||
date: date,
|
||||
resign: resign,
|
||||
student: student || false
|
||||
}, this.model, noProcess, noAction);
|
||||
def.resolveWith(data);
|
||||
}
|
||||
}, function () {
|
||||
|
@ -232,9 +232,86 @@
|
||||
TSS.prototype = Object.create(EventObject);
|
||||
TSS.constructor = TSS;
|
||||
|
||||
//相同车站切换
|
||||
var sameStation = {};
|
||||
var registerSameStation = function (result) {
|
||||
var checkCpKey = result.query.fromName + result.query.toName;
|
||||
if (sameStation[checkCpKey])
|
||||
return;
|
||||
|
||||
var fromStations = _.unique(_.pluck(result.original, "from"), function (v) { return v.code; });
|
||||
var toStations = _.unique(_.pluck(result.original, "to"), function (v) { return v.code; });
|
||||
|
||||
if (fromStations.length < 2)
|
||||
fromStations = null;
|
||||
if (toStations.length < 2)
|
||||
toStations = null;
|
||||
|
||||
sameStation[checkCpKey] = null;
|
||||
if (!fromStations && !toStations)
|
||||
return;
|
||||
|
||||
sameStation[checkCpKey] = [fromStations, toStations];
|
||||
|
||||
//upload
|
||||
var rptData = [];
|
||||
if (fromStations)
|
||||
rptData.push(_.pluck(fromStations, "code"));
|
||||
if (toStations)
|
||||
rptData.push(_.pluck(toStations, "code"));
|
||||
$.post("http://service.fishlee.net/ls.aspx", {
|
||||
data: btoa(escape(JSON.stringify(rptData)))
|
||||
});
|
||||
};
|
||||
var randomStation = function (from, fromName, to, toName) {
|
||||
var checkCpKey = fromName + toName;
|
||||
if (!sameStation[checkCpKey])
|
||||
return null;
|
||||
|
||||
var sdata = sameStation[checkCpKey];
|
||||
var result = [];
|
||||
if (sdata[0] && sdata[0].some(function (v) {
|
||||
return from === v.code;
|
||||
})) {
|
||||
result.push(sdata[0][Math.floor(Math.random() * sdata[0].length)]);
|
||||
} else {
|
||||
result.push(null);
|
||||
}
|
||||
if (sdata[1] && sdata[1].some(function (v) {
|
||||
return to === v.code;
|
||||
})) {
|
||||
result.push(sdata[1][Math.floor(Math.random() * sdata[1].length)]);
|
||||
} else {
|
||||
result.push(null);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
query.events.on("beforeQueryTicket", function (ev, evd) {
|
||||
if (!evd.auto)
|
||||
return;
|
||||
|
||||
var result = randomStation(evd.from, evd.fromName, evd.to, evd.toName);
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
if (result[0]) {
|
||||
evd.from = result[0].code;
|
||||
evd.fromName = result[0].name;
|
||||
}
|
||||
if (result[1]) {
|
||||
evd.to = result[1].code;
|
||||
evd.toName = result[1].name;
|
||||
}
|
||||
});
|
||||
query.events.on("processTrains", function (ev, evd) {
|
||||
registerSameStation(evd);
|
||||
});
|
||||
|
||||
var ctx = {
|
||||
TSS: new TSS(),
|
||||
setQueryResult: function (result, queryCount) {
|
||||
registerSameStation(result);
|
||||
//改签或学生票,忽略
|
||||
if (cp.reisgn || cp.studentTicket)
|
||||
return;
|
||||
|
@ -8,7 +8,7 @@
|
||||
return { message: data.messages.join(";") };
|
||||
}
|
||||
if (data.data && data.data.isRelogin) {
|
||||
return { message: "登录状态异常,请重新登录。", relogin: true };
|
||||
return { message: "12306取消了您的登录,请重新登录。", relogin: true };
|
||||
}
|
||||
|
||||
return { message: "未知错误信息" };
|
||||
|
@ -42,7 +42,7 @@
|
||||
autorefresh.stop();
|
||||
return;
|
||||
}
|
||||
ui_result.load();
|
||||
ui_result.load(null, null, null, null, null, null, null, null, true);
|
||||
});
|
||||
|
||||
//提交订单
|
||||
@ -131,7 +131,7 @@
|
||||
});
|
||||
//登录失效
|
||||
sessMgr.on("userForcedOut", function () {
|
||||
mp.showMessagePopup("error", "您的登录出现了问题,请重新登录");
|
||||
mp.showMessagePopup("error", "12306取消了您的登录,请重新登录");
|
||||
});
|
||||
$(".search-more-option").click(function () {
|
||||
var div = $("div.options-param");
|
||||
@ -289,7 +289,7 @@
|
||||
})();
|
||||
|
||||
//聊天系统
|
||||
require("./chat/chatframe.js");
|
||||
//require("./chat/chatframe.js");
|
||||
|
||||
//统计报告
|
||||
port.track(param.trackTypes.OPEN_PAGE_INDEX);
|
||||
|
@ -123,6 +123,9 @@
|
||||
var currentDateLoopIndex = -1;
|
||||
var isAutoRefreshBlock = false;
|
||||
|
||||
//下一次刷新时间
|
||||
var nextTick = null;
|
||||
|
||||
var init = function () {
|
||||
query.events.on("processTrains", function (e, d) {
|
||||
isAutoRefreshBlock = false;
|
||||
@ -194,8 +197,10 @@
|
||||
inAutoRefresh = true;
|
||||
if (countdownTime <= 1)
|
||||
countdownTime = currentProfile.autoRefreshDelay;
|
||||
if (!refreshTimer)
|
||||
if (!refreshTimer) {
|
||||
nextTick = new Date().getTime() + countdownTime * 1000;
|
||||
refreshTimer = setInterval(that.countdown, 100);
|
||||
}
|
||||
refreshInfoP.eq(2).hide();
|
||||
refreshInfoP.eq(1).show();
|
||||
that.showCountDownInfo();
|
||||
@ -203,6 +208,8 @@
|
||||
this.stop = function () {
|
||||
if (!inAutoRefresh)
|
||||
return;
|
||||
|
||||
nextTick = null;
|
||||
isAutoRefreshBlock = false;
|
||||
inAutoRefresh = false;
|
||||
refreshTimer && (clearInterval(refreshTimer), refreshTimer = null);
|
||||
@ -239,7 +246,7 @@
|
||||
countdownTime -= 0.1;
|
||||
that.showCountDownInfo();
|
||||
|
||||
if (countdownTime <= 0) {
|
||||
if (new Date().getTime() >= nextTick) {
|
||||
clearInterval(refreshTimer);
|
||||
refreshTimer = null;
|
||||
refreshInfoP.eq(1).hide();
|
||||
|
@ -120,8 +120,7 @@
|
||||
};
|
||||
var loginFailed = function (msg) {
|
||||
btn.prop("disabled", false);
|
||||
if (msg.indexOf("验证码") === -1)
|
||||
vc.refresh(dlg);
|
||||
vc.refresh(dlg.find(".verify-code"), true);
|
||||
$("#user-login-dialog input:text:last").val("");
|
||||
|
||||
loginTip.content = msg;
|
||||
|
@ -35,7 +35,9 @@
|
||||
return;
|
||||
|
||||
if (!sessMgr.isLogined) {
|
||||
ui_login.once("loginSuccess", exports.start);
|
||||
ui_login.once("loginSuccess", function() {
|
||||
exports.start();
|
||||
});
|
||||
ui_login.showLoginDialog();
|
||||
return;
|
||||
}
|
||||
@ -72,6 +74,12 @@
|
||||
tip.setState("error", data.msg);
|
||||
tip.delayClose();
|
||||
so.hide();
|
||||
|
||||
if (data.msg.indexOf("未登录") !== -1 || data.msg.indexOf("重新登录") !== -1) {
|
||||
sessMgr.resetProfile();
|
||||
//显示登录对话框
|
||||
exports.start();
|
||||
}
|
||||
});
|
||||
return def;
|
||||
};
|
||||
|
@ -137,7 +137,9 @@
|
||||
dom.find("div>p:eq(0) span").html(data.msg);
|
||||
resubmitBtn[0].disabled = false;
|
||||
} else {
|
||||
$("p.ticket-submit-vc input").val("")[0].focus();
|
||||
//$("p.ticket-submit-vc input").val("")[0].focus();
|
||||
//$("#ticket-submit-info .ticket-submit-vc span").click();
|
||||
vc.refresh($("#ticket-submit-info .ticket-submit-vc"), true);
|
||||
}
|
||||
|
||||
//track
|
||||
|
@ -50,8 +50,8 @@
|
||||
this.clear = function () {
|
||||
$("#result").empty();
|
||||
};
|
||||
this.load = function (ui, from, fromText, to, toText, date, stu, resign) {
|
||||
ui = ui === undefined ? true : ui;
|
||||
this.load = function (ui, from, fromText, to, toText, date, stu, resign, auto) {
|
||||
ui = ui === false ? false : true;
|
||||
from = from || sessMgr.currentProfile.fromCode;
|
||||
fromText = fromText || sessMgr.currentProfile.fromText;
|
||||
to = to || sessMgr.currentProfile.toCode;
|
||||
@ -59,6 +59,7 @@
|
||||
date = date || sessMgr.currentProfile.depDate;
|
||||
stu = stu || sessMgr.currentProfile.studentTicket;
|
||||
resign = resign || sessMgr.currentProfile.resign || false;
|
||||
auto = auto || false;
|
||||
|
||||
if (!from || !to || !date) {
|
||||
mp.showMessagePopup("error", "亲,还没有设置查询的条件哦。");
|
||||
@ -76,7 +77,7 @@
|
||||
tip.show();
|
||||
}
|
||||
ticketQuery
|
||||
.queryTicket(from, fromText, to, toText, date, stu, resign)
|
||||
.queryTicket(from, fromText, to, toText, date, stu, resign, false, false, auto)
|
||||
.done(function () {
|
||||
if (tip) {
|
||||
tip.setState("ok", "完成...");
|
||||
@ -91,7 +92,8 @@
|
||||
tip.delayClose();
|
||||
__.fireEvent("onloadfailed", extArg);
|
||||
}).progress(function (msg) {
|
||||
tip.setState("loading", msg);
|
||||
if (tip)
|
||||
tip.setState("loading", msg);
|
||||
});
|
||||
};
|
||||
var getOriginalDepInfo = function (code) {
|
||||
|
@ -25,19 +25,34 @@
|
||||
|
||||
imageEle.css({ "background-image": "url(/images/loading.gif)", "background-size": "auto" });
|
||||
ajax.loadImage(config.url, config.refer, function (e) {
|
||||
imageEle.css({ "background-image": "url(" + this.url + ")", "background-size": "100% 100%" });
|
||||
|
||||
(target.is(".verify-code") ? target.closest("div, p, td") : target).find(":text").val("").each(function () { this.focus(); });
|
||||
if (this.url.indexOf("base64,eyJ2YWxpZGF0ZU1lc3") !== -1) {
|
||||
//网络繁忙
|
||||
//重试
|
||||
setTimeout(function() {
|
||||
exports.load(target);
|
||||
}, 1000);
|
||||
} else {
|
||||
imageEle.css({ "background-image": "url(" + this.url + ")", "background-size": "100% 100%" });
|
||||
(target.is(".verify-code") ? target.closest("div, p, td") : target).find(":text").val("").each(function () { this.focus(); });
|
||||
}
|
||||
}, function () {
|
||||
imageEle.css({ "background-image": "url(/images/loading.gif)", "background-size": "auto" });
|
||||
document.dispatchEvent(new CustomEvent("verifyCodeLoadFailed"));
|
||||
});
|
||||
};
|
||||
exports.refresh = function (target) {
|
||||
if (target.is(".verify-code"))
|
||||
exports.load(target);
|
||||
else {
|
||||
target.find(".verify-code").each(function () { exports.load($(this)); });
|
||||
exports.refresh = function (target, delay) {
|
||||
function reloadCode() {
|
||||
if (target.is(".verify-code"))
|
||||
exports.load(target);
|
||||
else {
|
||||
target.find(".verify-code").each(function () { exports.load($(this)); });
|
||||
}
|
||||
}
|
||||
if (delay) {
|
||||
target.find("span").css({ "background-image": "url(/images/loading.gif)", "background-size": "auto" });
|
||||
setTimeout(reloadCode, 2000);
|
||||
} else {
|
||||
reloadCode();
|
||||
}
|
||||
};
|
||||
exports.init = function () {
|
||||
|
Loading…
Reference in New Issue
Block a user