UNPKG

h5-cli

Version:

hello

83 lines (72 loc) 2 kB
"use strict"; //define(function (require, exports, module) { define(function (require, exports, module) { var PageModule = require("component/PageModule"); var page = PageModule.render({ init: function init() { this.orderUrl = this.config.orderUrl; this.extension = "uid=" + this.util.getUID(); this.uid = this.util.getTID(); //this.util.getUID(); var self = this; try { var phone = cache.getCacheModule().get("phone"); if (phone) { $('#J_Phone').val(phone.value); } var text = this.query.text; if (text) { $('#J_Textarea').text(text); } } catch (e) {} this.regEvent(); }, regEvent: function regEvent() { var self = this; var icons = $('#J_Level .icon'); icons.click(function () { var index = $(this).data("index"); icons.removeClass("on"); $(icons.slice(0, index)).addClass("on"); $('#J_LevelInput').val(index); }); $('#J_Submit').click(function () { var text = $.trim($('#J_Textarea').val()); var contactWay = $('#J_Phone').val(); var type = $('#J_Select').val(); if (!type) { self.util.alert("\u8bf7\u9009\u62e9\u95ee\u9898\u7c7b\u578b"); return; } if (!text) { self.util.alert("\u8bf7\u586b\u5199\u53cd\u9988\u5efa\u8bae"); return; } if (!contactWay) { self.util.alert("\u8bf7\u586b\u5199\u8054\u7cfb\u65b9\u5f0f"); return; } self.util.alert("\u53cd\u9988\u63d0\u4ea4\u6210\u529f\uff0c\u611f\u8c22\u60a8\u5bf9\u6211\u4eec\u7684\u652f\u6301"); $('#J_Textarea').val(''); self.submit(text); }); }, submit: function submit(text) { var self = this; var url = self.orderUrl + "/submit"; this.get(url, { uid: self.uid, type: $('#J_Select').val(), content: text, enclosure: "", extension: self.extension, contact: $('#J_Phone').val() }); }, onComplate: function onComplate() { var self = this; self.util.goBack(true); } }); page.init(); module.exports = page; });