作者 刘晓艳

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

# Conflicts:
#	public/themes/simpleboot3/user/index/inquiry.html
@@ -276,6 +276,427 @@ @@ -276,6 +276,427 @@
276 <script src="__TMPL__/public/assets/js/weui.js"></script> 276 <script src="__TMPL__/public/assets/js/weui.js"></script>
277 <script src="__TMPL__/public/assets/js/myweui.js"></script> 277 <script src="__TMPL__/public/assets/js/myweui.js"></script>
278 <script src="__TMPL__/public/assets/js/referral.js"></script> 278 <script src="__TMPL__/public/assets/js/referral.js"></script>
  279 +<script>
  280 + //文本框显示字数
  281 + $(".area").on("input propertychange", function () {
279 282
  283 + var $this = $(this),
  284 + _val = $this.val(),
  285 + count = "";
  286 + if (_val.length > 1000) {
  287 + $this.val(_val.substring(0, 1000));
  288 + }
  289 + count = 1000 - $this.val().length;
  290 + $(this).siblings(".text_num").children('.text-count').text(count);
  291 + });
  292 +
  293 + // 疾病分类下拉
  294 + $('.inquiry_type').click(function () {
  295 + weui.picker([
  296 + {label: '一类', value: 0},
  297 + {label: '二类', value: 1}
  298 + ], {
  299 + onChange: function (res) {
  300 + console.log(res)
  301 + },
  302 + onConfirm: function (res) {
  303 + $('.inquiry_value').val(res[0].label)
  304 + }
  305 + }
  306 + )
  307 + })
  308 + // 疾病分类下拉
  309 + $('.expert').click(function () {
  310 + weui.picker([
  311 + {label: '王医生', value: 0},
  312 + {label: '刘易斯', value: 1}
  313 + ], {
  314 + onChange: function (res) {
  315 + console.log(res)
  316 + },
  317 + onConfirm: function (res) {
  318 + $('.expert_value').val(res[0].label)
  319 + }
  320 + }
  321 + )
  322 + })
  323 + // 性别分类
  324 + $('.sex_type').click(function () {
  325 + weui.picker([
  326 + {label: '男', value: 0},
  327 + {label: '女', value: 1}
  328 + ], {
  329 + onChange: function (res) {
  330 + console.log(res)
  331 + },
  332 + onConfirm: function (res) {
  333 + $('.sex_value').val(res[0].label)
  334 + }
  335 + }
  336 + )
  337 + })
  338 + // 性别分类
  339 + $('.unit_type').click(function () {
  340 + weui.picker([
  341 + {label: '国企', value: 0},
  342 + {label: '私企', value: 1}
  343 + ], {
  344 + onChange: function (res) {
  345 + console.log(res)
  346 + },
  347 + onConfirm: function (res) {
  348 + $('.unit_value').val(res[0].label)
  349 + }
  350 + }
  351 + )
  352 + })
  353 + //就诊时间
  354 + $('#showDatePicker').on('click', function () {
  355 + weui.datePicker({
  356 + start: 2019,
  357 + end: new Date().getFullYear(),
  358 + onChange: function (result) {
  359 + console.log(result);
  360 + },
  361 + onConfirm: function (result) {
  362 + console.log(result[0].label+' - '+result[1].label+' - '+result[2].label)
  363 + $('.time_value').val(result[0].value+' - '+result[1].value+' - '+result[2].value)
  364 + }
  365 + });
  366 + });
  367 +
  368 +
  369 +
  370 + //语音模块
  371 + // $('.icon-tianxie').hide()
  372 + // $('.voice_first').hide()
  373 + // $('.voice_second').hide()
  374 + $('.voice_third').hide()
  375 + $('.icon_cancle').hide()
  376 + // $('.voice_module').hide()
  377 +
  378 + var title_id = ''
  379 +
  380 + //点击
  381 + $('.info_item').on('click','.title',function () {
  382 + $(this).parent().toggleClass('voice')
  383 +
  384 + // title_id = $(this).attr("data-id");
  385 + // if ($(this).children(".voice_btn").css("display") == "inline") {
  386 + // $(this).children(".voice_btn").css("display", "none");
  387 + // $(this).children(".icon-tianxie").css("display", "inline")
  388 + // $(this).parents('.info_item').children('.textarea_box').hide()
  389 + // // $(this).parents('.info_item').find('.voice_first').show()
  390 + // $(this).parents('.info_item').find('.voice_module').show()
  391 + // // if($(this).children(".voice_third").css("display") == "inline"){
  392 + // // $(this).parents('.info_item').children('.textarea_box').hide()
  393 + // // }
  394 + // } else if ($(this).children(".icon-tianxie").css("display") == "inline") {
  395 + // $(this).children(".voice_btn").css("display","inline");
  396 + // $(this).children(".icon-tianxie").css("display","none")
  397 + // $(this).parents('.info_item').children('.textarea_box').show()
  398 + // $(this).parents('.info_item').find('.voice_first').hide()
  399 + // // if($(this).children(".voice_third").css("display") == "inline"){
  400 + // // $(this).parents('.info_item').children('.textarea_box').hide()
  401 + // // }
  402 + // }
  403 + })
  404 +
  405 +
  406 + //点击正在播放按钮
  407 + $('.icon-luying_ongoing').click(function () {
  408 + var videolist = $(".voice_module");
  409 + for (var i = 0; i < videolist.length; i++) {
  410 + var videoid = $(videolist[i]).attr("video-id");
  411 + if (videoid == title_id) {
  412 + $(videolist[i]).show();
  413 + $(videolist[i]).children('.voice_second').hide()
  414 + $(videolist[i]).children('.voice_third').show();
  415 + }
  416 + }
  417 + })
  418 +
  419 +
  420 + var times = "";//倒计时总秒数量
  421 + var time = "";
  422 +
  423 + function countDown(times) {
  424 + var timer = null;
  425 + timer = setInterval(function () {
  426 + var day = 0,
  427 + hour = 0,
  428 + minute = 0,
  429 + second = 0;//时间默认值
  430 + if (times > 0) {
  431 + day = Math.floor(times / (60 * 60 * 24));
  432 + hour = Math.floor(times / (60 * 60)) - (day * 24);
  433 + minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
  434 + second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
  435 + }
  436 + if (day <= 9) day = '0' + day;
  437 + if (hour <= 9) hour = '0' + hour;
  438 + if (minute <= 9) minute = '0' + minute;
  439 + if (second <= 9) second = '0' + second;
  440 +
  441 + $('#hour_show').html('<text id="h"></text>' + hour + ':');
  442 + $('#minute_show').html('<text></text>' + minute + ':');
  443 + $('#second_show').html('<text></text>' + second + '');
  444 +
  445 + //
  446 + console.log(day + "天:" + hour + "小时:" + minute + "分钟:" + second + "秒");
  447 + times--;
  448 +
  449 + }, 1000);
  450 + // if (times <= 0) {
  451 + // clearInterval(timer);
  452 + // }
  453 +
  454 + $('.pause').click(function () {
  455 + // timer(intDiff);
  456 + clearInterval(timer);
  457 + localStorage.setItem("times", times)
  458 + })
  459 + $('.stop').click(function () {
  460 + clearInterval(timer);
  461 + times = 0;
  462 + })
  463 + $('.stopping').click(function () {
  464 + clearInterval(timer);
  465 + localStorage.clear()
  466 + })
  467 + }
  468 +
  469 + $('.start').click(function () {
  470 + time = localStorage.getItem("times")
  471 + if (time == null) {
  472 + times = parseInt(60)
  473 + } else {
  474 + times = time;
  475 + }
  476 + console.log(time)
  477 + countDown(times);
  478 + localStorage.setItem("times", times)
  479 + })
  480 +
  481 +
  482 + //添加一条新语音
  483 + var num = 0;
  484 + $('.voice_module').on('click', '.add_voice', function () {
  485 + // $('.voice_module').append($('.voice_list').html());
  486 + // $('.voice_list .voice_first').show()
  487 + // $('.add_icon').show()
  488 +
  489 +
  490 + // var parent = $(this).parents('.voice_module')
  491 + // parent.append($('.temp_list').clone());
  492 +
  493 +
  494 + // var videolist = $(".voice_module");
  495 + // for (var i = 0; i < videolist.length; i++) {
  496 + //
  497 + // var videoid = $(videolist[i]).attr("video-id");
  498 + // if (videoid == title_id) {
  499 + // $(videolist[i]).show();
  500 + // $(videolist[i]).append($('.voice_list').html());
  501 + // $(videolist[i]).children('.voice_list .voice_first').show();
  502 + // $('.icon_cancle').show()
  503 + // }
  504 + // }
  505 +
  506 + times=60
  507 + // clearInterval(timer);
  508 + var day = 0,
  509 + hour = 0,
  510 + minute = 0,
  511 + second = 0;//时间默认值
  512 + if (day <= 9) day = '0' + day;
  513 + if (hour <= 9) hour = '0' + hour;
  514 + if (minute <= 9) minute = '0' + minute;
  515 + if (second <= 9) second = '0' + second;
  516 +
  517 + $('#hour_show').html('<text id="h"></text>' + hour + ':');
  518 + $('#minute_show').html('<text></text>' + minute + ':');
  519 + $('#second_show').html('<text></text>' + second + '');
  520 +
  521 +
  522 + num = num + 1
  523 + var parent = $(this).parents('.voice_module')
  524 + var html = '<div class="voice_list" voiceitemid="'+num+'">\n' +
  525 + '<div class="voice_box voice_third" style="display: none;">\n' +
  526 + ' <div class="voice_item">\n' +
  527 + ' <text class="iconfont icon-luyin voice_icon"></text>\n' +
  528 + ' <text class="voice_font luyin">点击图标可播放 时长:10秒</text>\n' +
  529 + ' </div>\n' +
  530 + ' <div class="voice_btn_box">\n' +
  531 + ' <text class="iconfont icon-quxiao cancle_voice"></text>\n' +
  532 + // ' <text class="iconfont icon-tianjia add_voice"></text>\n' +
  533 + ' </div>\n' +
  534 + ' </div>\n' +
  535 + ' <div class="voice_box voice_first">\n' +
  536 + ' <div class="voice_item">\n' +
  537 + ' <text class="iconfont icon-huatong mike voice_icon"></text>\n' +
  538 + ' <text class="voice_font huatong">点击图标开始语音语音最长60秒</text>\n' +
  539 + ' </div>\n' +
  540 + ' <div class="voice_btn_box">\n' +
  541 + ' <text class="iconfont icon-quxiao icon_cancle cancle_voice"></text>\n' +
  542 + ' </div>\n' +
  543 + ' </div>\n' +
  544 + '</div>'
  545 +
  546 +
  547 + // parent.append($('.voice_list').html());
  548 + parent.append(html)
  549 +
  550 + })
  551 +
  552 + //显示弹窗
  553 + var videoid=''
  554 + //生命全局唯一 音频
  555 + var voiceBox;
  556 + $(document).on("click", ".mike", function () {
  557 + $('.first').show()
  558 + $('.play').show()
  559 + $('.start').show()
  560 + $('.stopping').hide()
  561 + $('.stop').hide()
  562 + $('.next_step').hide();
  563 + // videoid=$(this).parents(".voice_module").attr("video-id")
  564 +
  565 + // $(this).parents(".voice_first").hide();
  566 + // $(this).parents(".voice_first").siblings(".voice_third").show()
  567 + //
  568 + // // vioceid=$(this).parents(".voice_first").attr("voiceid");
  569 + //
  570 +
  571 + voiceBox = $(this).parents('.voice_list');
  572 +
  573 + // console.log(voiceBox)
  574 + // $('.submit_voice').attr('videoid')
  575 + //
  576 + // var videolist = $(".voice_module");
  577 + // console.log(videolist)
  578 + // for (var i = 0; i < videolist.length; i++) {
  579 + // if (videoid == title_id) {
  580 + // $(videolist[i]).children(".voice_list").children(".voice_list").hide();
  581 + // $(videolist[i]).children(".voice_list").children(".voice_third").show();
  582 + // }
  583 + // }
  584 +
  585 + });
  586 +
  587 + //删除语音
  588 + $(".voice_module").on("click",".cancle_voice",function(){
  589 + $(this).parents(".voice_box").remove();
  590 + })
  591 +
  592 + //开始录音
  593 + $('.start').click(function () {
  594 + $('.start').hide()
  595 + $('.play').hide()
  596 + $('.pause').show()
  597 + $('.stopping').show()
  598 + $('.next_step').hide()
  599 + })
  600 +
  601 + //暂停
  602 + $('.pause').click(function () {
  603 + $('.pause').hide()
  604 + $('.start').show()
  605 + $('.stopping').hide()
  606 +
  607 + })
  608 +
  609 + //停止录音
  610 + $('.stopping').click(function () {
  611 + $('.next_step').show()
  612 + $('.stop').show()
  613 + $('.pause').hide()
  614 + })
  615 +
  616 + //下一步
  617 + $('.next_step').click(function () {
  618 + $('.first').hide()
  619 + $('.second').show()
  620 + })
  621 +
  622 + //点击试听
  623 + $('.audition').click(function () {
  624 + // var videolist = $(".voice_module");
  625 + // for (var i = 0; i < videolist.length; i++) {
  626 + // var videoid = $(videolist[i]).attr("video-id");
  627 + // if (videoid == title_id) {
  628 + // $('.second').hide()
  629 + // $(videolist[i]).show();
  630 + // $(videolist[i]).children('.voice_list').hide()
  631 + // $(videolist[i]).children('.voice_third').show();
  632 + // }
  633 + // }
  634 + })
  635 +
  636 +
  637 + //我要发送
  638 + $('.submit_voice').click(function () {
  639 +
  640 + // var videolist = $(".voice_module");
  641 + // console.log(videolist,videolist.length)
  642 + // for (var i = 0; i<videolist.length; i++) {
  643 + // videoid = $(videolist[i]).attr("video-id");
  644 + // if (videoid == title_id) {
  645 + // $('.second').hide()
  646 + // $(videolist[i]).children(".voice_list").children('.voice_first').hide()
  647 + // $(videolist[i]).children(".voice_list").children('.voice_third').show();
  648 + // }
  649 + // }
  650 +
  651 +
  652 + voiceBox.find('.voice_first').hide().siblings('.voice_third').show()
  653 + $('.second').hide()
  654 +
  655 + })
  656 +
  657 + //重新录制
  658 + $('.rerecord').click(function () {
  659 + $('.first').show()
  660 + $('.second').hide()
  661 + $('.stop').hide()
  662 + $('.stopping').hide()
  663 + $('.start').show()
  664 + $('.start').show()
  665 + })
  666 +
  667 + //上传图片
  668 + $(function () {
  669 + var tmpl = '<li class="weui-uploader__file" style="background-image:url(#url#)"></li>',
  670 + $gallery = $("#gallery"), $galleryImg = $("#galleryImg"),
  671 + $uploaderInput = $("#uploaderInput"),
  672 + $uploaderFiles = $("#uploaderFiles")
  673 + ;
  674 +
  675 + $uploaderInput.on("change", function (e) {
  676 + // console.log(e)
  677 + var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files;
  678 + for (var i = 0, len = files.length; i < len; ++i) {
  679 + var file = files[i];
  680 + console.log(url.createObjectURL(file))
  681 +
  682 + if (url) {
  683 + src = url.createObjectURL(file);
  684 + // var
  685 + } else {
  686 + src = e.target.result;
  687 + }
  688 + $uploaderFiles.append($(tmpl.replace('#url#', src)));
  689 + }
  690 + });
  691 + $uploaderFiles.on("click", "li", function () {
  692 + $galleryImg.attr("style", this.getAttribute("style"));
  693 + $gallery.fadeIn(100);
  694 + });
  695 + $gallery.on("click", function () {
  696 + $gallery.fadeOut(100);
  697 + });
  698 + });
  699 +
  700 +</script>
280 </body> 701 </body>
281 </html> 702 </html>