mui.plusReady(function() { var self = plus.webview.currentWebview(); var doctorCode = self.doctorCode; var dept =self.dept; var name = self.name; var src = self.photo; if (name) { document.getElementById("doc_name").innerHTML = name + ''; } if (dept) { document.getElementById("doc_dept").innerHTML = dept; } if (src) { document.getElementById("doc_img").src = getImgUrl(src); } var userAgent = plus.storage.getItem(agentName); if(userAgent){ var jsonstr = $.parseJSON(userAgent); var uid = jsonstr.uid; var name = decodeURI(jsonstr.name); document.getElementById("labName").innerHTML = name; // var params = {}; // params.code = uid; // mui.ajax(server + "patient/info", { // data: params, // type: 'POST', // dataType: 'json', // error: function(res) { // mui.toast('用户获取失败'); // plus.nativeUI.closeWaiting(); // }, // success: function(res) { // plus.nativeUI.closeWaiting(); // if (res.status == 200) { // var name = res.data.name; // document.getElementById("labName").innerHTML = name; // } else { // mui.toast('用户获取失败') // } // } // }); } document.querySelector("#commit").addEventListener("tap", function() { var data = {}; data.doctor = doctorCode; data.content = $("#remark").val(); data.scheduling = ""; data.appo_date = "2016-05-09"; data.appo_week = 1; data.hour_begin = "08:30:00"; data.hour_end = "18:00:00"; if (validate(data)) { //验证通过执行 //upload(data); plus.nativeUI.closeWaiting(); mui.openWindow({ url: "vedio-consulting-commit-success.html", id: "vedio-consulting-commit-success", extras: { type: 1 }, waiting: { autoShow: false } }); } }); }) //验证信息 function validate(data) { if (data.content == '') { plus.nativeUI.closeWaiting(); mui.toast('请详细描述您的症状'); return false; } if (data.content.length > 500) { plus.nativeUI.closeWaiting(); mui.toast('请用500字以内完成您的症状描述'); return false; } return true; } // 上传文件 function upload(data) { plus.nativeUI.showWaiting(); var files = getImages(); if (files.length <= 0) { data.images = ""; data.imageUrls = ""; doSubmit(data); } else { var task = plus.uploader.createUpload(server + 'upload/image', { method: "POST" }, function(t, status) { //上传完成 if (status == 200) { var jsonstr = $.parseJSON(t.responseText); if(jsonstr.status == 200){ data.images = jsonstr.images; data.imageUrls = jsonstr.urls; doSubmit(data); } else { plus.nativeUI.closeWaiting(); mui.toast(jsonstr.msg); } } else { plus.nativeUI.closeWaiting(); mui.toast("上传失败:" + status); } } ); task.addData("client", "HelloH5+"); task.addData("uid", getUid()); for (var i = 0; i < files.length; i++) { var f = files[i]; task.addFile(f, {}); } task.start(); } } //提交咨询 function doSubmit(data) { sendPost('patient/consult_movi/add', data, 'json', 'post', submitFailed, submitSuccess); } function submitFailed(res) { plus.nativeUI.closeWaiting(); if (res && res.msg) { plus.nativeUI.toast(res.msg); } else { plus.nativeUI.toast("提交失败"); } } function submitSuccess(res) { plus.nativeUI.closeWaiting(); if (res.status == 200) { mui.openWindow({ url: "vedio-consulting-commit-success.html", id: "vedio-consulting-commit-success", extras: { type: 1 }, waiting: { autoShow: false } }); mui.toast('提交成功'); } else { submitFailed(res); } } function voicePop(n) { $(".win-broadcast,.win-broadcast-mb").show(); $("#voice-finish").click(function() { $("#voice" + n).show(); $(".win-broadcast,.win-broadcast-mb").hide(); }); } function voicePopClose() { $(".win-broadcast,.win-broadcast-mb").hide(); } $(function() { $('.broadcast-icon').on('click',function(){ $('.broadcast-shadow-panel').removeClass('c-hide'); }); $('.win-cancle').on('click',function(){ $('.broadcast-shadow-panel').addClass('c-hide'); }); //显示隐藏选择图片按钮 $(".add-btn").on("click", function() { //getImages(); $(".over-lay").show(); $(".ins-img-btn").show(); }); $("[data-btn=cancelOver]").on("click", function() { $(".over-lay").hide(); $(".ins-img-btn").hide(); }); }); //查看图片 function viewImg(dom) { var $img = $(dom); var thissrc = $img.attr("date"); var mWid = $(window).width(); var mHei = $(window).height(); var nHtml = '