UNPKG

yqb

Version:

Static Package Manager

95 lines (85 loc) 3.09 kB
/* * 注册Api接口处理 * author: <%= author %> * version: <%= version %> * website: http://www.431103.com */ (function(root, factory) { if (typeof exports === 'object') { factory(exports); } else if (typeof define === 'function' && define.amd) { define(['exports'], factory); } else { factory(root); } }(this, function(exports) { var register = function(option, onSuccess, onFail) { // 默认参数 this.data = option || { activityId: "", mobilePhone: "", verifyCode: "", appId: "6fYG0kV6gd", businessId: "CMSTYHDZCH5", channelId: "W-100002", mcId: "", msgId: $('#msgId').val(), referee: "" } this.mtpUrl = until.getMTPURL(); }; register.prototype = { requestServices: function(url, postData, onSuccess, onFail) { $.ajax({ url: url, data: JSON.stringify(postData), type: 'post', dataType: 'json', contentType: "application/json", success: function(data) { var code = data.resultCode, message = data.resultMsg; // code 码转换 if (code == 1000) { onSuccess(message, data, code); } else { onFail(message, data, code); } }, error: function(error) { console.error(this.url, this.data, error); } }); }, sendUserInfo: function(onSuccess, onFail) { var url = this.mtpUrl + '/mtp-web/h5/op_common_register.json'; var postData = { "appId": "6fYG0kV6gd", "mobilePhone": this.data.mobilePhone, "verifyCode": this.data.verifyCode, "msgId": $('#msgId').val(), "referee": "", "businessId": this.data.businessId, "channelId": this.data.channelId, "activityId": this.data.activityId, "mcId": this.data.mcId }; if (this.data.password) { postData.password = this.data.password; postData.loginPasswdStrength = this.data.pwdStrength; } this.requestServices(url, postData, onSuccess, onFail); }, checkActivityStatus: function(onSuccess, onFail) { var url = this.mtpUrl + '/mtp-web/p2/op_hqb_check_can_participate.json'; var postData = { "clientId": "common_register", "appId": "100001", "activityId": this.data.activityId }; this.requestServices(url, postData, onSuccess, onFail); } } exports.register = register; return register; }));