require.config({
baseUrl: "/newecenter/",
paths: {
datePicker: "js/tools/My97DatePicker/WdatePicker",
personalInfoModel: "js/models/accountCenter/personalInfoModel",
personalInfoView: "js/views/accountCenter/personalInfoView",
personalInfoService: "js/services/accountCenter/personalInfoService",
baseModel: "js/models/baseModel",
checkUtil: "js/tools/checkUtil",
dropDown: "js/tools/dropDown"
}
});
define(['jquery', 'backbone', 'datePicker','personalInfoModel','personalInfoView','personalInfoService','security','dropDown','baseModel'], function ($, Backbone, datePicker,personalModel,personalView,personalInfoService,security,dropDown,baseModel) {
function init() {
var personalInfoModel = new personalModel.PersonalInfoModel();
//post方法
personalInfoModel.save(
{
rand:Math.random(),
},
{
success: function (model, data) {
//显示 界面
var personalInfoView = new personalView.PersonalInfoView({model: data});
personalInfoView.setTemplate($("#personalInfo").html());
if(data.resultFlag == "0") {
window.location.reload();
return;
}
personalInfoView.render();
//初始化城市数组
personalInfoService.initCitysJson();
//绑定 下拉选择框的事件
dropDown.dropDown();
if(data.bindEmail == '') {
$("#showBindEmail").html("暂未绑定邮箱,绑定后可作为登录凭证");
$("#openChangeEmailbtn").html("绑定");
$("#openChangeEmailbtn").parent().find(".head_word i").attr("class","icon_exl");
}else {
$("#showBindEmail").html(data.bindEmail);
$("#openChangeEmailbtn").html("修改");
$("#openChangeEmailbtn").parent().find(".head_word i").attr("class","icon_safety");
}
if(data.bindMobile == '') {
$("#showBindMobile").html("暂未绑定手机,绑定后可作为登录凭证");
$("#openChangeMobilebtn").html("绑定");
$("#openChangeMobilebtn").parent().find(".head_word i").attr("class","icon_exl");
}else {
$("#showBindMobile").html(data.bindMobile);
$("#openChangeMobilebtn").html("修改");
$("#openChangeMobilebtn").parent().find(".head_word i").attr("class","icon_safety");
}
//显示提示语
personalView.showMarkerWord();
//显示昵称
$("#changeNickNameBtn").parent().siblings(".show_inputbox").removeClass("show_text");
//显示用户密码强度
if(data.pwdStrong == '' || data.pwdStrong == '0' ) {
$("#userPwdStrong").attr("class","scoring_warn one fl");
}else if(data.pwdStrong == '1') {
$("#userPwdStrong").attr("class","scoring_warn two fl");
}else {
$("#userPwdStrong").attr("class","scoring_warn three fl");
}
if(data.userAnk != "1") {//初级会员
//升高级会员的提示语
$("#hintToSenior").show();
//更多个人信息按钮
$("#moreInfoBtn").hide();
$("#userAnk").html("初级会员");
}else{
$("#hintToSenior").hide();
$("#userAnk").html("高级会员");
$("#cName").val(data.cName)
$("#identifyNum").val(data.identifyNum);
$("#birthDate").val(data.birthDate);
if(data.sex == "00" || data.sex == "0") {
$("#showSex").val("00");
}else {
$("#showSex").val("01");
}
$("#identifyType").val(personalInfoService.getIdentify(data.identifyType));
$("#provinceInfo").val(personalInfoService.getProvince(data.province));
$("#cityInfo").val(personalInfoService.getCity(data.province, data.city));
personalInfoService.showSeniorMsg(true);
//更多信息
$("#address").val(data.address);
$("#maritalStatus").val(personalInfoService.getMaritalStatus(data.maritalStatus));
$("#industryType").val(personalInfoService.getIndustry(data.industryType));
$("#salary").val(data.salary);
$("#hobbys").val(data.hobby);
$("#vipCardNum").val(data.vipCardNum);
personalInfoService.showMoreSeniorMsg(true);
}
},
error: function () {
}
}
);
}
return {
init : init
}
baseUrl: "/newecenter/",
paths: {
datePicker: "js/tools/My97DatePicker/WdatePicker",
personalInfoModel: "js/models/accountCenter/personalInfoModel",
personalInfoView: "js/views/accountCenter/personalInfoView",
personalInfoService: "js/services/accountCenter/personalInfoService",
baseModel: "js/models/baseModel",
checkUtil: "js/tools/checkUtil",
dropDown: "js/tools/dropDown"
}
});
define(['jquery', 'backbone', 'datePicker','personalInfoModel','personalInfoView','personalInfoService','security','dropDown','baseModel'], function ($, Backbone, datePicker,personalModel,personalView,personalInfoService,security,dropDown,baseModel) {
function init() {
var personalInfoModel = new personalModel.PersonalInfoModel();
//post方法
personalInfoModel.save(
{
rand:Math.random(),
},
{
success: function (model, data) {
//显示 界面
var personalInfoView = new personalView.PersonalInfoView({model: data});
personalInfoView.setTemplate($("#personalInfo").html());
if(data.resultFlag == "0") {
window.location.reload();
return;
}
personalInfoView.render();
//初始化城市数组
personalInfoService.initCitysJson();
//绑定 下拉选择框的事件
dropDown.dropDown();
if(data.bindEmail == '') {
$("#showBindEmail").html("暂未绑定邮箱,绑定后可作为登录凭证");
$("#openChangeEmailbtn").html("绑定");
$("#openChangeEmailbtn").parent().find(".head_word i").attr("class","icon_exl");
}else {
$("#showBindEmail").html(data.bindEmail);
$("#openChangeEmailbtn").html("修改");
$("#openChangeEmailbtn").parent().find(".head_word i").attr("class","icon_safety");
}
if(data.bindMobile == '') {
$("#showBindMobile").html("暂未绑定手机,绑定后可作为登录凭证");
$("#openChangeMobilebtn").html("绑定");
$("#openChangeMobilebtn").parent().find(".head_word i").attr("class","icon_exl");
}else {
$("#showBindMobile").html(data.bindMobile);
$("#openChangeMobilebtn").html("修改");
$("#openChangeMobilebtn").parent().find(".head_word i").attr("class","icon_safety");
}
//显示提示语
personalView.showMarkerWord();
//显示昵称
$("#changeNickNameBtn").parent().siblings(".show_inputbox").removeClass("show_text");
//显示用户密码强度
if(data.pwdStrong == '' || data.pwdStrong == '0' ) {
$("#userPwdStrong").attr("class","scoring_warn one fl");
}else if(data.pwdStrong == '1') {
$("#userPwdStrong").attr("class","scoring_warn two fl");
}else {
$("#userPwdStrong").attr("class","scoring_warn three fl");
}
if(data.userAnk != "1") {//初级会员
//升高级会员的提示语
$("#hintToSenior").show();
//更多个人信息按钮
$("#moreInfoBtn").hide();
$("#userAnk").html("初级会员");
}else{
$("#hintToSenior").hide();
$("#userAnk").html("高级会员");
$("#cName").val(data.cName)
$("#identifyNum").val(data.identifyNum);
$("#birthDate").val(data.birthDate);
if(data.sex == "00" || data.sex == "0") {
$("#showSex").val("00");
}else {
$("#showSex").val("01");
}
$("#identifyType").val(personalInfoService.getIdentify(data.identifyType));
$("#provinceInfo").val(personalInfoService.getProvince(data.province));
$("#cityInfo").val(personalInfoService.getCity(data.province, data.city));
personalInfoService.showSeniorMsg(true);
//更多信息
$("#address").val(data.address);
$("#maritalStatus").val(personalInfoService.getMaritalStatus(data.maritalStatus));
$("#industryType").val(personalInfoService.getIndustry(data.industryType));
$("#salary").val(data.salary);
$("#hobbys").val(data.hobby);
$("#vipCardNum").val(data.vipCardNum);
personalInfoService.showMoreSeniorMsg(true);
}
},
error: function () {
}
}
);
}
return {
init : init
}
});
confing是要引用的其他js文件。如果a.js引用了b.js,那么当c.js引用a.js时就把b.js也引用了。
define是定义本js中的别名。当引用到其他js时,应该怎样去引用。
define(["findPay","account"function( a,b{
那么当你想用findPayl里的方法时,就得写成a.方法名。
});