123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- var postUrl = "doctor/message/getPrescriptionMessage";
- var pagesize = 10;
- var curpage = 1;
- var type;
- mui.plusReady(function() {
- backParent();
- plus.nativeUI.showWaiting();
- self = plus.webview.currentWebview();
- type = self.type;
- queryData();
- })
- function queryData() {
- sendGet(postUrl, {
- page: curpage,
- pagesize: pagesize,
- type: type
- }, null, function(res) {
- if(res.status == 200) {
- console.log(res)
- plus.nativeUI.closeWaiting();
- if(res.list.length < pagesize) { //加载更多按钮显示隐藏
- $("#load_more").closest(".view-more").hide();
- }
- if(res.list.length == 0) {
- $("#wushuju").removeClass("c-hide");
- return;
- }
- if(!$("#wushuju").hasClass("c-hide")) {
- !$("#wushuju").addClass("c-hide");
- }
- var cont = template("sign_tmpl", res);
- $("#sign_list").html(cont);
- $("#load_more").removeClass("c-hide");
- } else {
- mui.toast("加载消息出错!");
- }
- })
- }
- function backParent() {
- var old_back = mui.back;
- mui.back = function() {
- var self = plus.webview.currentWebview();
- if(self.opener && self.opener()) {
- mui.fire(self.opener(), "refresh");
- }
- old_back();
- }
- }
- $("#load_more").click(function() {
- var $this = $(this);
- var id = $("#sign_list").children("ul").last().attr("data-id");
- curpage++;
- sendGet(postUrl, {
- page: curpage,
- pagesize: pagesize,
- type: type
- }, null, function(res) {
- if(res.status == 200) {
- if(res.list.length < pagesize) {
- $this.text("无更多记录");
- $("#load_more").off('click')
- }
- var cont = template("sign_tmpl", res);
- $("#sign_list").append(cont);
- }
- })
- })
- mui("#sign_list").on("tap", "ul", function() {
- var type = this.getAttribute("data-type");
- var code = this.getAttribute("data-sessionId");
- var name = this.getAttribute("data-sessionName");
- var pcode = this.getAttribute("data-pcode");
- var tcode = this.getAttribute("data-tcode");
- if(type == 6) {
- var Url = '../../message/html/xufangzixun.html';
- mui.openWindow(Url, 'xufangzixun', {
- extras: {
- type: type,
- sessionId: code,
- sessionName: name
- }
- });
- }
- if(type == 7) {
- var Url = 'dingdangenzong.html';
- mui.openWindow(Url, 'dingdangenzong', {
- extras: {
- prescriptionCode: pcode,
- teamCode: tcode
- }
- })
- }
- })
- window.addEventListener("refreshPage", function() {
- curpage = 1
- $("#sign_list").empty()
- queryData()
- });
|