修正提交订单的跨天日期有错以及引导的问题

This commit is contained in:
iFish 2014-09-09 15:56:01 +08:00
parent ce405c6142
commit fbbe68c00b
4 changed files with 62 additions and 15 deletions

View File

@ -101,6 +101,9 @@
var notInstallExtension = function () { var notInstallExtension = function () {
seajs.use("ui/noextension"); seajs.use("ui/noextension");
}; };
var extensionDisabled = function () {
seajs.use("ui/extesniondisabled");
};
window.targetExtensionId = null; window.targetExtensionId = null;
$(function () { $(function () {
//确保内容脚本启动 //确保内容脚本启动
@ -115,7 +118,10 @@
}); });
}); });
start.fail(function () { start.fail(function (reason) {
if (reason === "disabled")
extensionDisabled();
else
notInstallExtension(); notInstallExtension();
}); });
start.always(function () { start.always(function () {
@ -150,18 +156,39 @@
//完成! //完成!
start.resolve(); start.resolve();
}; };
var timeout = 3000;
var waitForStart = function () {
if (document.body.dataset["mobileSupportInitialized"]) { if (document.body.dataset["mobileSupportInitialized"]) {
checkExtensionInfo(); checkExtensionInfo();
} else { } else {
var timer = setTimeout(function () { var timer = setTimeout(function () {
start.reject(); start.reject();
}, 1500); }, timeout);
document.addEventListener("mobileSupportInitialized", function () { document.addEventListener("mobileSupportInitialized", function () {
window.clearTimeout(timer); window.clearTimeout(timer);
checkExtensionInfo(); checkExtensionInfo();
}); });
} }
};
var extJson = null;
if (window.external.GetExtensionInfoListJson && (extJson = window.external.GetExtensionInfoListJson())) {
var ext = _.findWhere(JSON.parse(extJson), { id: "gkbheeokbgmmnbjhhlphckobccejghjn" });
if (ext) {
if (!ext.enabled)
start.reject("disabled");
else {
timeout = 10000;
waitForStart();
}
} else {
waitForStart();
}
} else {
waitForStart();
}
}); });
})(window, document); })(window, document);

View File

@ -44,7 +44,7 @@
return data; return data;
}; };
var transferData = function (data, noProcess, noAction) { var transferData = function (date, data, noProcess, noAction) {
var result = data; var result = data;
if (!Array.isArray(result.data) || !result.data.length || !result.data[0].queryLeftNewDTO) { if (!Array.isArray(result.data) || !result.data.length || !result.data[0].queryLeftNewDTO) {
exports.events.fireEvent("requestFailed"); exports.events.fireEvent("requestFailed");
@ -91,7 +91,7 @@
saleTime: t.queryLeftNewDTO.sale_time, saleTime: t.queryLeftNewDTO.sale_time,
secureStr: t.secretStr, secureStr: t.secretStr,
selltime: null, selltime: null,
date: t.queryLeftNewDTO.start_train_date.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"), date: date,
limitSellInfo: t.buttonTextInfo && t.buttonTextInfo.indexOf("暂售") != -1 ? t.buttonTextInfo.replace(/<[^>]+>/i, "") : null limitSellInfo: t.buttonTextInfo && t.buttonTextInfo.indexOf("暂售") != -1 ? t.buttonTextInfo.replace(/<[^>]+>/i, "") : null
}; };
var kp = getTicketInfo(t.queryLeftNewDTO.yp_info); var kp = getTicketInfo(t.queryLeftNewDTO.yp_info);
@ -165,7 +165,7 @@
queryTicketUrl = this.model.c_url; queryTicketUrl = this.model.c_url;
sendQueryRequest(); sendQueryRequest();
} else { } else {
var data = transferData(this.model, noProcess, noAction); var data = transferData(date, this.model, noProcess, noAction);
def.resolveWith(data); def.resolveWith(data);
} }
}, function () { }, function () {

View File

@ -0,0 +1,20 @@
define(function (require, exports, module) {
require("./widget_modalDialog.js");
var btns = [
{
text: "刷新",
type: "primary",
callback: function () {
self.location.reload();
return false;
}
}
];
$.showModalDialog("您启用<u>12306订票助手扩展</u>才可以使用极速版订票,当前已禁用。请进入“我的应用”中启用 :-(", {
image: "/images/cat.png",
buttons: btns,
closeOnAction: false
});
});

View File

@ -169,7 +169,7 @@
}); });
} }
$.showModalDialog("您需要安装" + (isLb ? "" : "<u>猎豹浏览器</u>和") + "<u>最新版12306订票助手扩展</u>才可以使用极速版订票。请安装后刷新此页面 :-)", { $.showModalDialog("您需要安装" + (isLb ? "" : "<u>猎豹浏览器</u>并") + "启用<u>最新版12306订票助手扩展</u>才可以使用极速版订票。请安装后刷新此页面。如果已安装,请检查是否不小心禁用了 :-(", {
image: "/images/cat.png", image: "/images/cat.png",
buttons: btns, buttons: btns,
closeOnAction: false closeOnAction: false