UNPKG

meetyou-gulp

Version:

This is a gulp task collection for MeetYou.

98 lines (90 loc) 2.98 kB
;(function() { "use strict"; $(function () { var share = function() { this.init(); }; share.prototype.init = function() { this.scrollData(); this.applyData(); }; share.prototype.scrollData = function() { var opt = {}; opt.date = { preset: 'date' }; opt.default = { setText: '确定', cancelText: '取消', theme: 'android-ics light', display: 'top', mode: 'scroller', dateFormat: 'yyyy-mm-dd', lang: 'zh', showNow: false, rows: 5, width: 70, height: 32, showLabel: true, useShortLabels: true, dateOrder: 'yyyymmdd', dayNames: ['周日', '周一;', '周二;', '周三', '周四', '周五', '周六'], dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'], dayText: '日', hourText: '时', minuteText: '分', monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], monthText: '月', secText: '秒', timeFormat: 'HH:ii', timeWheels: 'HHii', yearText: '年' }; $("#date").mobiscroll($.extend(opt['date'], opt['default'])); }; share.prototype.applyData = function() { $('#J_ok').on("click", function() { var timestamp = $('#time').val() || ""; var invite_code = $('#code').val() || ""; var jvalue = $('#date').val() || ""; if (jvalue == "") { $('#date').mobiscroll('show'); return; } var params = {"do":"h5", "invite_code":invite_code, "secret_answer":jvalue}; //console.log(params); $.ajax({ type: "POST", url: "http://test.baby.seeyouyima.com/invite_token", data: params, dataType: "json", cache: false, success: function($msg) { if($msg["data"]["code"] == 0 && $msg["data"]["token"] && $msg["data"]["baby_sn"]) { setTimeout(function() { window.location.href = "http://test.baby.seeyouyima.com/h5_review?"+"token="+$msg["data"]["token"]+"&baby_sn="+$msg["data"]["baby_sn"]+"&timestamp="+timestamp; }, 1); } else if ($msg["data"]["code"] == 1007) { showMess('答案不对哦!快问问家人吧?'); } else { showMess($msg["data"]["message"]); } } }); }); /*-------提示信息--------*/ function showMess(message, time) { var tid, msg = $('#mess'); var time = time || 2000; msg.text(message); msg.show().css('opacity', '1'); tid = setTimeout(function () { msg.css('opacity', '0').hide(); clearTimeout(tid); }, time); } }; return new share(); }); })();