Light12306/Web12306/js/profile/Profile.js

63 lines
1.7 KiB
JavaScript
Raw Normal View History

2014-03-13 15:06:01 +08:00
define(function(require) {
var eo = require("../platform/EventObject.js");
function Profile(impdata) {
var __ = this;
this.name = "当前模式";
this.reset = function () {
__.selectedSeatType = ['O', '3', '1'];
__.selectedTrain = [];
__.selectSeatFirst = true;
__.hideNotInListTrain = false;
__.hideNoTicket = false;
__.hideNotSameFrom = false;
__.hideNotSameTo = false;
__.autoWaitToSell = true;
__.timeRangeDepFrom = 0;
__.timeRangeDepTo = 23;
__.timeRangeArrFrom = 0;
__.timeRangeArrTo = 23;
__.passengers = [];
__.dateloop = [];
__.partialSubmitEnabled = false; //是否允许部分提交
__.autoRefreshDelay = null; //null使用默认值
__.autoSubmitEnabled = false; //是否启用自动提交订单
__.studentTicket = false; //学生票?
__.fromText = ""; //始发站名称
__.toText = ""; //到站名称
__.fromCode = ""; //始发站电报码
__.toCode = ""; //到站电报码
__.depDate = ""; //出发日期
};
__.reset();
this.save = function () {
/// <summary>请求保存配置</summary>
__.fireEvent("requireSave");
};
if (impdata) {
$.extend(this, _.omit(impdata, "passengers", "selectedSeatType", "selectedTrain", "dateloop"));
var extAtt = ["selectedSeatType", "selectedTrain", "dateloop"];
_.each(extAtt, function (e) {
var att = e + '';
__[att] = _.clone(impdata[att]);
});
$.each(impdata.passengers, function () {
__.passengers.push(new Passenger(this.name, this.type, this.typename, this.idtype, this.idtypeName, this.id, this.firstLetter));
});
}
return this;
}
Profile.prototype = Object.create(eo);
Profile.constructor = Profile;
return Profile;
});