UNPKG

h5-cli

Version:

hello

90 lines (72 loc) 3.11 kB
"use strict"; define("test/ticket-detail", function (require, exports, module) { var PageModule = require("component/PageModule"); //\u767b\u8bb0\u8bbe\u5907 token var page = PageModule.render({ init: function init() { this.ticketStatus = null; this._id = this.query.id; this.get(config.orderUrl + "/admin/query", { pwd: config.pwd, _id: this._id }); this.regEvent(); }, regEvent: function regEvent() { var self = this; $('#J_ReplySubmit').click(function () { var str = $.trim($('#J_ReplyContent').val()); if (str != "") { if (self.ticketStatus == 3) { if (!window.confirm("\u7528\u6237\u5df2\u5173\u95ed\u95ee\u9898\uff0c\u518d\u6b21\u56de\u590d\u4f1a\u91cd\u65b0\u6253\u5f00\u95ee\u9898")) { return; } } self.reply(str); } }); }, reply: function reply(content) { this.io.get(config.orderUrl + "/admin/reply", { pwd: config.pwd, _id: this._id, content: content }, function () { window.location.reload(); }, function () { alert("\u5931\u8d25"); }); }, onSuccess: function onSuccess(result) { /** { _id: "56e23534645597972f8111b0", uid: "11f147abe41a14940a9f0e3147c3e9b4", level: 1, date: "2016-03-11T03:02:12.980Z", status: 1, extension: "", ticketId: "", useragent: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1", contact: "13567154774", enclosure: "", content: "dsdfdfsdf", type: "\u6302\u53f7\u9884\u7ea6" } */ var self = this; var mainTmpl = '{@each list as item,index}' + '<div class="jumbotron {@if index == 0}main{@else}{@if item.uid != "system"}reply-user{@/if}{@/if}">' + '<h3 id="J_Type">${item.type}</h3>' + '<div id="J_Content" class="content">${item.content}</div>' + '{@if item.uid != "system"}' + '<div class="info">' + '{@if item.level == 1}<span class="J_Time">\u72b6\u6001:${strStatus(item.status)}</span><span class="J_Time">\u8054\u7cfb\u65b9\u5f0f:${item.contact}</span>{@/if} <span class="J_Time">\u65f6\u95f4:${formate(item.date)}</span> <span>\u6269\u5c55\u4fe1\u606f:{@if item.extension}${item.extension}{@else}\u65e0{@/if}</span>' + '<br/>' + '<span class="ua">${item.useragent}</div>' + '{@/if}' + '</div>' + '{@/each}'; this.juicer.register("formate", function (value) { return self.util.dateFormat(value); }); this.juicer.register("strStatus", function (value) { return { 1: "\u7528\u6237\u5df2\u56de\u590d", 2: "\u5ba2\u670d\u5df2\u56de\u590d", 3: "\u95ee\u9898\u5df2\u89e3\u51b3", 0: "\u65e0\u72b6\u6001" }[value] || "\u65e0"; }); this.renderTo(mainTmpl, { list: result.data }, "#J_Detail"); this.ticketStatus = result.data[0].status; }, onError: function onError(result) { console.log(result); } }); page.init(); module.exports = page; });