123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403 |
- mui.plusReady(function() {
- var self = plus.webview.currentWebview();
- var name = self.name;
- var photo = self.src;
- var cost = self.money;
- var depart = self.depart;
- if (name) {
- document.getElementById("doc_name").innerText = name;
- }
- if (photo) {
- document.getElementById("doc_pic").src = photo;
- }
- if (cost) {
- document.getElementById("doc_cost").innerHTML = cost;
- }
- if (depart) {
- document.getElementById("doc_dept").innerText = depart + " 心血管内科";
- }
- // var self = plus.webview.currentWebview();
- //设置医生信息
- if (self.doctorName) {
- document.getElementById("doc_name").innerHTML = self.doctorName;
- document.getElementById("doc_name").setAttribute("data-code", self.doctorCode);
- }
- if (self.doctorDept) {
- document.getElementById("doc_dept").innerHTML = self.doctorDept;
- }
- if (self.doctorPic) {
- document.getElementById("doc_pic").setAttribute("src", self.doctorPic);
- }
- if (self.cost == "0") {
- document.getElementById("doc_cost").innerHTML = '<span class="c-ff8100">限免</span>';
- } else {
- document.getElementById("doc_cost").innerHTML = '<span class="c-ff8100">' + self.cost + '</span>元/次';
- }
- //医生主页链接
- document.getElementById('doc_info').addEventListener("tap", function() {
- mui.openWindow({
- url: '../../zndz/html/doctor-home.html',
- id: 'doctor-home',
- extras: {
- name: self.doctorName,
- photo: self.doctorPic
- },
- waiting: {
- autoShow: false
- }
- });
- });
- //var userAgent = {uid:'111',imei:'222',token:'333'};
- // 设置userAgent
- //plus.navigator.setUserAgent(userAgent);
- document.querySelector("#consult_commit").addEventListener("tap", function() {
- var detail = plus.webview.getWebviewById("assign-consulting-detail");
- var assignConsult = plus.webview.getWebviewById("assign-consulting-free");
- var dh = plus.webview.getWebviewById("doctor-home");
- //医生信息
- //var doctorInfo = detail.info;
- var data = {};
- //data.doctor = "1";
- data.doctor = commonDoctorCode;
- data.disease = "";
- data.type = 1; //咨询类别 0公共咨询,1医生,2团队)
- //data.user = $("input[data-time=illName]").attr('data-user');
- data.user = commonUserCode;
- data.name = $("input[data-time=illName]").val();
- data.age = $('#age_value').val();
- //data.ageUnit = $('#age_unit').val();
- data.province = $('#area_province').val();
- data.city = $("#area_city").val();
- data.fbrq = $('input[data-time=illTime]').val();
- data.symptoms = $("#symptoms").val();
- data.visitsDoctor = $("#visits_doctor").val();
- data.wouldHelp = $("#would_help").val();
- data.sex = $('input:radio[name="r0"]:checked').val();
- //data.read = 0;//0已读,1未读
- if (document.getElementById("read_check").checked) {
- data.read = 0;
- } else {
- data.read = 1;
- }
- //data.consultType = 'self';
- if (data.user == '为其他人咨询') {
- //data.consultType = 'other';
- }
- if (validate(data)) {
- //验证通过执行
- upload(data, self, detail, dh);
- }
- /*mui.openWindow({
- url: "assign-consulting-commit-success.html",
- id: "assign-consulting-commit-success"
- })*/
- });
- });
- // 上传文件
- function upload(data, self, detail, dh) {
- plus.nativeUI.showWaiting();
- var files = getImages();
- if (files.length <= 0) {
- //mui.toast("没有添加上传文件!");
- data.imageCodes = "";
- doSubmit(data, self, detail, dh);
- //return;
- } else {
- //mui.toast("开始上传")
- //var wt=plus.nativeUI.showWaiting();
- var task = plus.uploader.createUpload(commonServerUrl + '/ssgg/upload/image', {
- method: "POST"
- },
- function(t, status) { //上传完成
- plus.nativeUI.closeWaiting();
- if (status == 200) {
- //mui.toast("上传成功:" + t.responseText);
- var res = eval('(' + t.responseText + ')');
- data.imageCodes = res.images;
- doSubmit(data, self, detail, dh);
- //plus.storage.setItem("uploader",t.responseText);
- /*var w=plus.webview.create("uploader_ret.html","uploader_ret.html",{scrollIndicator:'none',scalable:false});
- w.addEventListener("loaded",function(){
- wt.close();
- w.show("slide-in-right",300);
- },false);*/
- //wt.close();
- } else {
- mui.toast("上传失败:" + status);
- //wt.close();
- }
- }
- );
- 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 validate(data) {
- // if (data.user == '') {
- // mui.toast('请填写咨询患者!');
- // return false;
- // }
- // if (data.fbrq == '') {
- // mui.toast('请填写发病日期!');
- // return false;
- // }
- // if (data.symptoms == '') {
- // mui.toast('请填写主要症状!');
- // $("#symptoms").focus();
- // return false;
- // } else if (data.symptoms.length < 10) {
- // mui.toast('主要症状至少填写10个字!');
- // $("#symptoms").focus();
- // return false;
- // }
- // if (data.wouldHelp == '') {
- // mui.toast('请填写所需帮助!');
- // $("#would_help").focus();
- // return false;
- // } else if (data.wouldHelp.length < 10) {
- // mui.toast('所需帮助至少填写10个字!');
- // $("#would_help").focus();
- // return false;
- // }
- return true;
- }
- //提交咨询
- function doSubmit(params) {
- sendPost('patient/consult/commit', params, '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: "assign-consulting-commit-success.html",
- id: "assign-consulting-commit-success",
- waiting: {
- autoShow: false
- }
- });
- mui.toast('提交成功!');
- // var wb = plus.webview.getWebviewById("2-12-professor-list");
- // if(wb){
- // wb.close("none");
- // }
- } else {
- submitFailed(res);
- }
- }
- //function voicePop() {
- // setTimeout(function() {
- // $(".win-broadcast,.win-broadcast-mb").show();
- // }, 300);
- //}
- 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() {
- //显示隐藏选择图片按钮
- $(".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();
- });
- //字数限制(指定限制字数的节点和最大字数)
- statInputNum(".r-textarea", 300);
- });
- //字数限制
- function statInputNum(textArea, numItem) {
- var $text = $(textArea);
- var max = numItem;
- $text.on("input propertychange", function() {
- var $curText = $(this);
- var $count = $curText.parents("li").siblings("li").find(".word-count");
- var curLength = $curText.val().length;
- if (curLength >= max) {
- var num = $curText.val().substr(0, max - 1);
- $curText.val(num);
- $count.text(max + "/" + max);
- } else {
- $count.text(curLength + "/" + max);
- }
- });
- };
- //查看图片
- function viewImg(dom) {
- var $img = $(dom);
- var thissrc = $img.attr("date");
- var mWid = $(window).width();
- var mHei = $(window).height();
- var nHtml = '<div class="delimgpop"><div class="del-img-box"><div class="del-img-con"><img class="del-pop-img" src="' + thissrc + '" style="max-width:' + mWid + 'px; max-height:' + mHei + 'px;"></div></div></div>';
- $("body").append(nHtml);
- $(".delimgpop").click(function() {
- $(this).remove()
- });
- };
- //删除图片
- function delImg(dom) {
- var $li = $(dom).parent();
- $li.remove();
- return;
- }
- //选择发病时间
- var hh = $('li.ill-time').mobiscroll({
- theme: 'ios',
- lang: 'zh',
- formatValue: function(d) {
- return d.join(',');
- },
- customWheels: true,
- wheels: [
- [{
- keys: ['0', '1', '2', '3', '4', '5'],
- values: ['最近24小时', '最近一周', '最近三个月', '最近一年', '一年以上', '不清楚']
- }]
- ],
- onSelect: function(valueText, inst) {
- var dd = eval("[" + valueText + "]");
- $('input[data-time=illTime]').val(dd[0].values);
- }
- });
- var jj = $('li.ill-name').mobiscroll({
- theme: 'ios',
- lang: 'zh',
- formatValue: function(d) {
- return d.join(',');
- },
- customWheels: true,
- wheels: [
- [{
- keys: ['0', '1', '2', '3'],
- values: ['李碧玉', '杨旭', '杨天琪', '杨慧琳']
- }]
- ],
- onSelect: function(valueText, inst) {
- var dd = eval("[" + valueText + "]");
- $('input[data-time=illName]').val(dd[0].values);
- $('input[data-time=illName]').attr('data-user', dd[0].keys);
- if (dd[0].values == "为其他人咨询") {
- $(".ax-consultation").show();
- } else {
- $(".ax-consultation").hide();
- }
- }
- });
- /* 复选框兼容 */
- $(document).on("click", ".input-group-pack > input[type=checkbox]", function() {
- var $cpChk = $(this).parent();
- if ($(this).attr("checked") == "checked") {
- $cpChk.removeClass("checked");
- $(this).removeAttr("checked");
- } else {
- $cpChk.addClass("checked");
- $(this).attr("checked", true);
- }
- });
- //咨询说明
- $("#askintro").click(function() {
- var zxNotes = dialog({
- title: "<h2 class='c-37a6ed'>咨询说明</h2>",
- titlePadding: "10px 0 0 0",
- padding: "0 15px 10px 15px",
- contentBlock: true,
- content: "<div class='scroll-include'><ul class='zx-notes'><li>1.请详细描述问题,合理使用标点符号,便于专家更好了解患者情况。</li><li>2.医生平时工作繁忙,在空余之时会第一时间回复您的问题,请耐心等待</li><li>3.郑重申明:网上交流不能替代医生面诊,医生的咨询建议仅供参考,具体诊疗请一定到正规医院在专业医生指导下进行!医生言论仅代表其个人观点,不代表本站同意其说法,本站不承担由此引起的法律责任。</li><li>4.咨询内容不得带有任何非法、骚扰、中伤他人、辱骂、伤害、庸俗、淫秽等刺激性文字及非健康咨询方面的内容,一经发现,本站有权删除相关咨询内容。</li></ul></div>",
- okValue: "确定",
- ok: function() {}
- }).showModal();
- var scScroll = new IScroll('.scroll-include', {
- click: true
- });
- zxNotes.show(scScroll.refresh())
- });
- // 拍照添加文件
- function appendByCamera() {
- plus.camera.getCamera().captureImage(function(p) {
- //拍照完成,隐藏选择对话框
- hideImageChooseDialog();
- plus.io.resolveLocalFileSystemURL(p, function(entry) {
- var localurl = entry.toLocalURL();
- appendFile(localurl);
- });
- }, function(e) {
- //取消拍照,隐藏选择对话框
- hideImageChooseDialog();
- });
- };
- //隐藏图片方法
- function hideImageChooseDialog() {
- $(".over-lay").hide();
- $(".ins-img-btn").hide();
- };
- // 从相册添加文件
- function appendByGallery() {
- plus.gallery.pick(function(p) {
- appendFile(p);
- });
- }
- // 从相册中选择多张图片
- function galleryImgs() {
- // 从相册中选择图片
- plus.gallery.pick(function(e) {
- for (var i in e.files) {
- appendFile(e.files[i]);
- }
- }, function(e) {
- console.log("取消选择图片");
- }, {
- filter: "image",
- multiple: true
- });
- }
- // 添加文件
- function appendFile(p) {
- var $li = $('<li>' + ' <img src="' + p + '" date="' + p + '" onclick="viewImg(this)">' + ' <a href="javascript:;" class="del-img" onclick="delImg(this)"><i class="iconfont icon-laji"></i></a>' + '</li>');
- var $add_img_li = $("#add_img_li");
- $add_img_li.before($li);
- $(".over-lay").hide();
- $(".ins-img-btn").hide();
- }
- // 产生一个随机数
- function getUid() {
- return Math.floor(Math.random() * 100000000 + 10000000).toString();
- }
- //获取需要上传的图片
- function getImages() {
- var images = [];
- $("#img_ul").find("img").each(function() {
- var imgSrc = $(this).attr("src");
- images.push(imgSrc);
- });
- return images;
- }
|