作者 刘晓艳

Merge branch 'master' of http://114.215.101.231:8099/root/jyht into liuxiaoyan

# Conflicts:
#	public/themes/simpleboot3/user/index/inquiry.html
@@ -355,6 +355,533 @@ @@ -355,6 +355,533 @@
355 <script src="__TMPL__/public/assets/js/jquery-2.1.0.js"></script> 355 <script src="__TMPL__/public/assets/js/jquery-2.1.0.js"></script>
356 <script src="__TMPL__/public/assets/js/weui.js"></script> 356 <script src="__TMPL__/public/assets/js/weui.js"></script>
357 <script src="__TMPL__/public/assets/js/myweui.js"></script> 357 <script src="__TMPL__/public/assets/js/myweui.js"></script>
358 -<script src="__TMPL__/public/assets/js/referral.js"></script> 358 +<!--<script src="__TMPL__/public/assets/js/referral.js"></script>-->
  359 +<script>
  360 + //文本框显示字数
  361 + $(".area").on("input propertychange", function () {
  362 +
  363 + var $this = $(this),
  364 + _val = $this.val(),
  365 + count = "";
  366 + if (_val.length > 1000) {
  367 + $this.val(_val.substring(0, 1000));
  368 + }
  369 + count = 1000 - $this.val().length;
  370 + $(this).siblings(".text_num").children('.text-count').text(count);
  371 + });
  372 +
  373 + // 疾病分类下拉
  374 + $('.inquiry_type').click(function () {
  375 + weui.picker([
  376 + {label: '一类', value: 0},
  377 + {label: '二类', value: 1}
  378 + ], {
  379 + onChange: function (res) {
  380 + console.log(res)
  381 + },
  382 + onConfirm: function (res) {
  383 + $('.inquiry_value').val(res[0].label)
  384 + }
  385 + }
  386 + )
  387 + })
  388 + // 疾病分类下拉
  389 + $('.expert').click(function () {
  390 + weui.picker([
  391 + {label: '王医生', value: 0},
  392 + {label: '刘易斯', value: 1}
  393 + ], {
  394 + onChange: function (res) {
  395 + console.log(res)
  396 + },
  397 + onConfirm: function (res) {
  398 + $('.expert_value').val(res[0].label)
  399 + }
  400 + }
  401 + )
  402 + })
  403 + // 性别分类
  404 + $('.sex_type').click(function () {
  405 + weui.picker([
  406 + {label: '男', value: 0},
  407 + {label: '女', value: 1}
  408 + ], {
  409 + onChange: function (res) {
  410 + console.log(res)
  411 + },
  412 + onConfirm: function (res) {
  413 + $('.sex_value').val(res[0].label)
  414 + }
  415 + }
  416 + )
  417 + })
  418 + // 性别分类
  419 + $('.unit_type').click(function () {
  420 + weui.picker([
  421 + {label: '国企', value: 0},
  422 + {label: '私企', value: 1}
  423 + ], {
  424 + onChange: function (res) {
  425 + console.log(res)
  426 + },
  427 + onConfirm: function (res) {
  428 + $('.unit_value').val(res[0].label)
  429 + }
  430 + }
  431 + )
  432 + })
  433 +
  434 + var title_id = ''
  435 + //语音模块
  436 + $('.icon-tianxie').hide()
  437 + $('.voice_first').hide()
  438 + $('.voice_second').hide()
  439 + $('.voice_third').hide()
  440 + $('.icon_cancle').hide()
  441 + // $('.voice_module').hide()
  442 +
  443 +
  444 + //点击
  445 + $('.title').click(function () {
  446 + title_id = $(this).attr("data-id");
  447 + if ($(this).children(".voice_btn").css("display") == "inline") {
  448 + $(this).children(".voice_btn").css("display", "none");
  449 + $(this).children(".icon-tianxie").css("display", "inline")
  450 + $(this).parents('.info_item').children('.textarea_box').hide()
  451 + $(this).parents('.info_item').find('.voice_first').show()
  452 + // if($(this).children(".voice_third").css("display") == "inline"){
  453 + // $(this).parents('.info_item').children('.textarea_box').hide()
  454 + // }
  455 +
  456 + } else if ($(this).children(".icon-tianxie").css("display") == "inline") {
  457 + $(this).children(".voice_btn").css("display","inline");
  458 + $(this).children(".icon-tianxie").css("display","none")
  459 + $(this).parents('.info_item').children('.textarea_box').show()
  460 + $(this).parents('.info_item').find('.voice_first').hide()
  461 + // if($(this).children(".voice_third").css("display") == "inline"){
  462 + // $(this).parents('.info_item').children('.textarea_box').hide()
  463 + // }
  464 + }
  465 + })
  466 +
  467 +
  468 + //点击正在播放按钮
  469 + $('.icon-luying_ongoing').click(function () {
  470 + var videolist = $(".voice_module");
  471 + for (var i = 0; i < videolist.length; i++) {
  472 + var videoid = $(videolist[i]).attr("video-id");
  473 + if (videoid == title_id) {
  474 + $(videolist[i]).show();
  475 + $(videolist[i]).children('.voice_second').hide()
  476 + $(videolist[i]).children('.voice_third').show();
  477 + }
  478 + }
  479 + })
  480 +
  481 +
  482 + var times = "";//倒计时总秒数量
  483 + var time = "";
  484 +
  485 + function countDown(times) {
  486 + var timer = null;
  487 + timer = setInterval(function () {
  488 + var day = 0,
  489 + hour = 0,
  490 + minute = 0,
  491 + second = 0;//时间默认值
  492 + if (times > 0) {
  493 + day = Math.floor(times / (60 * 60 * 24));
  494 + hour = Math.floor(times / (60 * 60)) - (day * 24);
  495 + minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
  496 + second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
  497 + }
  498 + if (day <= 9) day = '0' + day;
  499 + if (hour <= 9) hour = '0' + hour;
  500 + if (minute <= 9) minute = '0' + minute;
  501 + if (second <= 9) second = '0' + second;
  502 +
  503 + $('#hour_show').html('<text id="h"></text>' + hour + ':');
  504 + $('#minute_show').html('<text></text>' + minute + ':');
  505 + $('#second_show').html('<text></text>' + second + '');
  506 +
  507 + //
  508 + console.log(day + "天:" + hour + "小时:" + minute + "分钟:" + second + "秒");
  509 + times--;
  510 +
  511 + }, 1000);
  512 + // if (times <= 0) {
  513 + // clearInterval(timer);
  514 + // }
  515 +
  516 + $('.pause').click(function () {
  517 + // timer(intDiff);
  518 + clearInterval(timer);
  519 + localStorage.setItem("times", times)
  520 + })
  521 + $('.stop').click(function () {
  522 + clearInterval(timer);
  523 + times = 0;
  524 + })
  525 + $('.stopping').click(function () {
  526 + clearInterval(timer);
  527 + localStorage.clear()
  528 + })
  529 + }
  530 +
  531 + $('.start').click(function () {
  532 + time = localStorage.getItem("times")
  533 + if (time == null) {
  534 + times = parseInt(60)
  535 + } else {
  536 + times = time;
  537 + }
  538 + console.log(time)
  539 + countDown(times);
  540 + localStorage.setItem("times", times)
  541 + })
  542 +
  543 +
  544 + //添加一条新语音
  545 + var num = 0;
  546 + $('.voice_module').on('click', '.add_voice', function () {
  547 + // $('.voice_module').append($('.voice_list').html());
  548 + // $('.voice_list .voice_first').show()
  549 + // $('.add_icon').show()
  550 +
  551 +
  552 + // var parent = $(this).parents('.voice_module')
  553 + // parent.append($('.temp_list').clone());
  554 +
  555 +
  556 + // var videolist = $(".voice_module");
  557 + // for (var i = 0; i < videolist.length; i++) {
  558 + //
  559 + // var videoid = $(videolist[i]).attr("video-id");
  560 + // if (videoid == title_id) {
  561 + // $(videolist[i]).show();
  562 + // $(videolist[i]).append($('.voice_list').html());
  563 + // $(videolist[i]).children('.voice_list .voice_first').show();
  564 + // $('.icon_cancle').show()
  565 + // }
  566 + // }
  567 +
  568 + times=60
  569 + // clearInterval(timer);
  570 + var day = 0,
  571 + hour = 0,
  572 + minute = 0,
  573 + second = 0;//时间默认值
  574 + if (day <= 9) day = '0' + day;
  575 + if (hour <= 9) hour = '0' + hour;
  576 + if (minute <= 9) minute = '0' + minute;
  577 + if (second <= 9) second = '0' + second;
  578 +
  579 + $('#hour_show').html('<text id="h"></text>' + hour + ':');
  580 + $('#minute_show').html('<text></text>' + minute + ':');
  581 + $('#second_show').html('<text></text>' + second + '');
  582 +
  583 +
  584 + num = num + 1
  585 + var parent = $(this).parents('.voice_module')
  586 + var html = '<div class="voice_list" voiceitemid="'+num+'">\n' +
  587 + '<div class="voice_box voice_third" style="display: none;">\n' +
  588 + ' <div class="voice_item">\n' +
  589 + ' <text class="iconfont icon-luyin voice_icon"></text>\n' +
  590 + ' <text class="voice_font luyin">点击图标可播放 时长:10秒</text>\n' +
  591 + ' </div>\n' +
  592 + ' <div class="voice_btn_box">\n' +
  593 + ' <text class="iconfont icon-quxiao cancle_voice"></text>\n' +
  594 + // ' <text class="iconfont icon-tianjia add_voice"></text>\n' +
  595 + ' </div>\n' +
  596 + ' </div>\n' +
  597 + ' <div class="voice_box voice_first">\n' +
  598 + ' <div class="voice_item">\n' +
  599 + ' <text class="iconfont icon-huatong mike voice_icon"></text>\n' +
  600 + ' <text class="voice_font huatong">点击图标开始语音语音最长60秒</text>\n' +
  601 + ' </div>\n' +
  602 + ' <div class="voice_btn_box">\n' +
  603 + ' <text class="iconfont icon-quxiao icon_cancle cancle_voice"></text>\n' +
  604 + ' </div>\n' +
  605 + ' </div>\n' +
  606 + '</div>'
  607 +
  608 +
  609 + // parent.append($('.voice_list').html());
  610 + parent.append(html)
  611 +
  612 + })
  613 +
  614 + //显示弹窗
  615 + var videoid=''
  616 + //生命全局唯一 音频
  617 + var voiceBox;
  618 + $(document).on("click", ".mike", function () {
  619 + $('.first').show()
  620 + $('.play').show()
  621 + $('.start').show()
  622 + $('.stopping').hide()
  623 + $('.stop').hide()
  624 + $('.next_step').hide();
  625 + voiceBox = $(this).parents('.voice_list');
  626 + });
  627 +
  628 + //删除语音
  629 + $(".voice_module").on("click",".cancle_voice",function(){
  630 + $(this).parents(".voice_box").remove();
  631 + })
  632 +
  633 + //开始录音
  634 + $('.start').click(function () {
  635 + $('.start').hide()
  636 + $('.play').hide()
  637 + $('.pause').show()
  638 + $('.stopping').show()
  639 + $('.next_step').hide()
  640 + })
  641 +
  642 + //暂停
  643 + $('.pause').click(function () {
  644 + $('.pause').hide()
  645 + $('.start').show()
  646 + $('.stopping').hide()
  647 +
  648 + })
  649 +
  650 + //停止录音
  651 + $('.stopping').click(function () {
  652 + $('.next_step').show()
  653 + $('.stop').show()
  654 + $('.pause').hide()
  655 + })
  656 +
  657 + //下一步
  658 + $('.next_step').click(function () {
  659 + $('.first').hide()
  660 + $('.second').show()
  661 + })
  662 +
  663 + //点击试听
  664 + $('.audition').click(function () {
  665 + // var videolist = $(".voice_module");
  666 + // for (var i = 0; i < videolist.length; i++) {
  667 + // var videoid = $(videolist[i]).attr("video-id");
  668 + // if (videoid == title_id) {
  669 + // $('.second').hide()
  670 + // $(videolist[i]).show();
  671 + // $(videolist[i]).children('.voice_list').hide()
  672 + // $(videolist[i]).children('.voice_third').show();
  673 + // }
  674 + // }
  675 + })
  676 +
  677 +
  678 + //我要发送
  679 + $('.submit_voice').click(function () {
  680 +
  681 + // var videolist = $(".voice_module");
  682 + // console.log(videolist,videolist.length)
  683 + // for (var i = 0; i<videolist.length; i++) {
  684 + // videoid = $(videolist[i]).attr("video-id");
  685 + // if (videoid == title_id) {
  686 + // $('.second').hide()
  687 + // $(videolist[i]).children(".voice_list").children('.voice_first').hide()
  688 + // $(videolist[i]).children(".voice_list").children('.voice_third').show();
  689 + // }
  690 + // }
  691 +
  692 +
  693 + voiceBox.find('.voice_first').hide().siblings('.voice_third').show()
  694 + $('.second').hide()
  695 +
  696 + })
  697 +
  698 + //重新录制
  699 + $('.rerecord').click(function () {
  700 + $('.first').show()
  701 + $('.second').hide()
  702 + $('.stop').hide()
  703 + $('.stopping').hide()
  704 + $('.start').show()
  705 + $('.start').show()
  706 + })
  707 + //上传图片
  708 + $(function () {
  709 + var tmpl = '<li class="weui-uploader__file" style="background-image:url(#url#)"></li>',
  710 + $gallery = $("#gallery"), $galleryImg = $("#galleryImg"),
  711 + $uploaderInput = $("#uploaderInput"),
  712 + $uploaderFiles = $("#uploaderFiles")
  713 + ;
  714 +
  715 + $uploaderInput.on("change", function (e) {
  716 + // console.log(e)
  717 + var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files;
  718 + for (var i = 0, len = files.length; i < len; ++i) {
  719 + var file = files[i];
  720 + console.log(url.createObjectURL(file))
  721 +
  722 + if (url) {
  723 + src = url.createObjectURL(file);
  724 + // var
  725 + } else {
  726 + src = e.target.result;
  727 + }
  728 + $uploaderFiles.append($(tmpl.replace('#url#', src)));
  729 + }
  730 + });
  731 + $uploaderFiles.on("click", "li", function () {
  732 + $galleryImg.attr("style", this.getAttribute("style"));
  733 + $gallery.fadeIn(100);
  734 + });
  735 + $gallery.on("click", function () {
  736 + $gallery.fadeOut(100);
  737 + });
  738 + });
  739 +
  740 + //提交按钮
  741 + // $('.submit').click(function () {
  742 + // $('.box').show().delay(2000).hide(2)
  743 + // })
  744 +
  745 + //我要转诊表单判断
  746 + $('.referral_btn').click(function () {
  747 + var user_name = $('#user_name').val()
  748 + var user_sex = $('#user_sex').val()
  749 + var user_age = $('#user_age').val()
  750 + var user_address = $('#user_address').val()
  751 + var disease_type = $('#disease_type').val()
  752 + var expert = $('#expert').val()
  753 + var behavior = $('#behavior').val()
  754 + var examination = $('#examination').val()
  755 + var diagnosis = $('#diagnosis').val()
  756 + var drugs = $('#drugs').val()
  757 + var confused = $('#confused').val()
  758 +
  759 + if (user_name == '') {
  760 + $('.form_popup_box').show()
  761 + $('.form_popup_box').text('姓名不能为空')
  762 + $('.form_popup_box').delay(1000).hide(0);
  763 + } else if (user_sex == '') {
  764 + $('.form_popup_box').show()
  765 + $('.form_popup_box').text('性别不能为空')
  766 + $('.form_popup_box').delay(1000).hide(0);
  767 + } else if (user_age == '') {
  768 + $('.form_popup_box').show()
  769 + $('.form_popup_box').text('年龄不能为空')
  770 + $('.form_popup_box').delay(1000).hide(0);
  771 + } else if (user_address == '') {
  772 + $('.form_popup_box').show()
  773 + $('.form_popup_box').text('地址不能为空')
  774 + $('.form_popup_box').delay(1000).hide(0);
  775 + } else if (disease_type == '') {
  776 + $('.form_popup_box').show()
  777 + $('.form_popup_box').text('疾病种类不能为空')
  778 + $('.form_popup_box').delay(1000).hide(0);
  779 + } else if (expert == '') {
  780 + $('.form_popup_box').show()
  781 + $('.form_popup_box').text('转诊专家不能为空')
  782 + $('.form_popup_box').delay(1000).hide(0);
  783 + } else if (behavior == '') {
  784 + $('.form_popup_box').show()
  785 + $('.form_popup_box').text('临床表现不能为空')
  786 + $('.form_popup_box').delay(1000).hide(0);
  787 + } else if (examination == '') {
  788 + $('.form_popup_box').show()
  789 + $('.form_popup_box').text('已做检查不能为空')
  790 + $('.form_popup_box').delay(1000).hide(0);
  791 + } else if (diagnosis == '') {
  792 + $('.form_popup_box').show()
  793 + $('.form_popup_box').text('目前诊断不能为空')
  794 + $('.form_popup_box').delay(1000).hide(0);
  795 + } else if (drugs == '') {
  796 + $('.form_popup_box').show()
  797 + $('.form_popup_box').text('已用药物不能为空')
  798 + $('.form_popup_box').delay(1000).hide(0);
  799 + } else if (confused == '') {
  800 + $('.form_popup_box').show()
  801 + $('.form_popup_box').text('当前困惑不能为空')
  802 + $('.form_popup_box').delay(1000).hide(0);
  803 + } else {
  804 + $('.box').show().delay(2000).hide(2)
  805 + }
  806 + })
  807 +
  808 + //我要进修表单判断
  809 + $('.train_btn').click(function () {
  810 + var unit = $('#unit').val()
  811 + var user_name = $('#user_name').val()
  812 + var profession = $('#profession').val()
  813 + var duration = $('#duration').val()
  814 + var level = $('#level').val()
  815 + var card_num = $('#card_num').val()
  816 + var id_card = $('#id_card').val()
  817 + var nation = $('#nation').val()
  818 + var school = $('#school').val()
  819 + var principal = $('#principal').val()
  820 + var phone_num = $('#phone_num').val()
  821 + var unit_address = $('#unit_address').val()
  822 + var job_title = $('#job_title').val()
  823 + var need_info = $('#need_info').val()
  824 +
  825 + if (unit == '') {
  826 + $('.form_popup_box').show()
  827 + $('.form_popup_box').text('单位不能为空')
  828 + $('.form_popup_box').delay(1000).hide(0);
  829 + } else if (user_name == '') {
  830 + $('.form_popup_box').show()
  831 + $('.form_popup_box').text('姓名不能为空')
  832 + $('.form_popup_box').delay(1000).hide(0);
  833 + } else if (profession == '') {
  834 + $('.form_popup_box').show()
  835 + $('.form_popup_box').text('进修专业不能为空')
  836 + $('.form_popup_box').delay(1000).hide(0);
  837 + } else if (duration == '') {
  838 + $('.form_popup_box').show()
  839 + $('.form_popup_box').text('进修时长不能为空')
  840 + $('.form_popup_box').delay(1000).hide(0);
  841 + } else if (level == '') {
  842 + $('.form_popup_box').show()
  843 + $('.form_popup_box').text('文化程度不能为空')
  844 + $('.form_popup_box').delay(1000).hide(0);
  845 + } else if (card_num == '') {
  846 + $('.form_popup_box').show()
  847 + $('.form_popup_box').text('医师资格证号不能为空')
  848 + $('.form_popup_box').delay(1000).hide(0);
  849 + } else if (id_card == '') {
  850 + $('.form_popup_box').show()
  851 + $('.form_popup_box').text('身份证号不能为空')
  852 + $('.form_popup_box').delay(1000).hide(0);
  853 + } else if (nation == '') {
  854 + $('.form_popup_box').show()
  855 + $('.form_popup_box').text('民族不能为空')
  856 + $('.form_popup_box').delay(1000).hide(0);
  857 + } else if (school == '') {
  858 + $('.form_popup_box').show()
  859 + $('.form_popup_box').text('毕业学校不能为空')
  860 + $('.form_popup_box').delay(1000).hide(0);
  861 + } else if (principal == '') {
  862 + $('.form_popup_box').show()
  863 + $('.form_popup_box').text('科室负责人不能为空')
  864 + $('.form_popup_box').delay(1000).hide(0);
  865 + } else if (phone_num == '') {
  866 + $('.form_popup_box').show()
  867 + $('.form_popup_box').text('科室电话不能为空')
  868 + $('.form_popup_box').delay(1000).hide(0);
  869 + } else if (unit_address == '') {
  870 + $('.form_popup_box').show()
  871 + $('.form_popup_box').text('单位地址不能为空')
  872 + $('.form_popup_box').delay(1000).hide(0);
  873 + } else if (job_title == '') {
  874 + $('.form_popup_box').show()
  875 + $('.form_popup_box').text('当前职称不能为空')
  876 + $('.form_popup_box').delay(1000).hide(0);
  877 + } else if (need_info == '') {
  878 + $('.form_popup_box').show()
  879 + $('.form_popup_box').text('进修要求不能为空')
  880 + $('.form_popup_box').delay(1000).hide(0);
  881 + } else {
  882 + $('.box').show().delay(2000).hide(2)
  883 + }
  884 + })
  885 +</script>
359 </body> 886 </body>
360 </html> 887 </html>