作者 刘晓艳

测试

@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 <div class="hint_info">提示:您可以选择推荐专家,平台会为您匹配对应专家;您也可以 40 <div class="hint_info">提示:您可以选择推荐专家,平台会为您匹配对应专家;您也可以
41 选择其他专家。 41 选择其他专家。
42 </div> 42 </div>
43 - <div class="info_item "> 43 + <div class="info_item " >
44 <div class="title" data-id="1"> 44 <div class="title" data-id="1">
45 <text>病人主述</text> 45 <text>病人主述</text>
46 <!--<text class="info_tab_box">--> 46 <!--<text class="info_tab_box">-->
@@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
53 <p class="text_num"><span class="text-count">0</span>/1000</p> 53 <p class="text_num"><span class="text-count">0</span>/1000</p>
54 </div> 54 </div>
55 <div class="voice_module" video-id="1"> 55 <div class="voice_module" video-id="1">
56 - <div class="voice_box voice_third"> 56 + <div class="voice_box voice_third" >
57 <div class="voice_item"> 57 <div class="voice_item">
58 <text class="iconfont icon-luyin voice_icon"></text> 58 <text class="iconfont icon-luyin voice_icon"></text>
59 <text class="voice_font luyin">点击图标可播放 时长:10秒</text> 59 <text class="voice_font luyin">点击图标可播放 时长:10秒</text>
@@ -64,10 +64,10 @@ @@ -64,10 +64,10 @@
64 </div> 64 </div>
65 </div> 65 </div>
66 <!--<div class="voice_box voice_second" >--> 66 <!--<div class="voice_box voice_second" >-->
67 - <!--<div class="voice_item">-->  
68 - <!--<text class="iconfont icon-luying_ongoing voice_icon"></text>-->  
69 - <!--<text class="voice_font luying_ongoing">正在播放 10秒/60秒</text>-->  
70 - <!--</div>--> 67 + <!--<div class="voice_item">-->
  68 + <!--<text class="iconfont icon-luying_ongoing voice_icon"></text>-->
  69 + <!--<text class="voice_font luying_ongoing">正在播放 10秒/60秒</text>-->
  70 + <!--</div>-->
71 <!--</div>--> 71 <!--</div>-->
72 <div class="voice_list"> 72 <div class="voice_list">
73 <div class="voice_box voice_first"> 73 <div class="voice_box voice_first">
@@ -104,10 +104,10 @@ @@ -104,10 +104,10 @@
104 </div> 104 </div>
105 </div> 105 </div>
106 <!--<div class="voice_box voice_second">--> 106 <!--<div class="voice_box voice_second">-->
107 - <!--<div class="voice_item">-->  
108 - <!--<text class="iconfont icon-luying_ongoing voice_icon"></text>-->  
109 - <!--<text class="voice_font luying_ongoing">正在播放 10秒/60秒</text>-->  
110 - <!--</div>--> 107 + <!--<div class="voice_item">-->
  108 + <!--<text class="iconfont icon-luying_ongoing voice_icon"></text>-->
  109 + <!--<text class="voice_font luying_ongoing">正在播放 10秒/60秒</text>-->
  110 + <!--</div>-->
111 <!--</div>--> 111 <!--</div>-->
112 <div class="voice_list"> 112 <div class="voice_list">
113 <div class="voice_box voice_first"> 113 <div class="voice_box voice_first">
@@ -174,7 +174,7 @@ @@ -174,7 +174,7 @@
174 <img class="" src="__TMPL__/public/assets/images/eicon12@2x.png" alt=""> 174 <img class="" src="__TMPL__/public/assets/images/eicon12@2x.png" alt="">
175 </div> 175 </div>
176 <div class="popup_item next_step"> 176 <div class="popup_item next_step">
177 - <img class="popup_icon" src="__TMPL__/public/assets/images/eicon10@2x.png" alt=""> 177 + <img class="popup_icon" src="__TMPL__/public/assets/images/eicon10@2x.png" alt="">
178 <div>下一步</div> 178 <div>下一步</div>
179 </div> 179 </div>
180 </div> 180 </div>
@@ -194,8 +194,8 @@ @@ -194,8 +194,8 @@
194 <img class="popup_icon " src="__TMPL__/public/assets/images/eicon15@2x.png" alt=""> 194 <img class="popup_icon " src="__TMPL__/public/assets/images/eicon15@2x.png" alt="">
195 <div>重新录制</div> 195 <div>重新录制</div>
196 </div> 196 </div>
197 - <div class="large_icon submit_voice">  
198 - <img class="popup_icon " src="__TMPL__/public/assets/images/eicon16@2x.png" alt=""> 197 + <div class="large_icon">
  198 + <img class="popup_icon upload" src="__TMPL__/public/assets/images/eicon16@2x.png" alt="">
199 <div>我要发送</div> 199 <div>我要发送</div>
200 </div> 200 </div>
201 </div> 201 </div>
@@ -229,32 +229,26 @@ @@ -229,32 +229,26 @@
229 $this.val(_val.substring(0, 1000)); 229 $this.val(_val.substring(0, 1000));
230 } 230 }
231 count = 1000 - $this.val().length; 231 count = 1000 - $this.val().length;
232 - $(this).siblings(".text_num").children('.text-count').text(count); 232 + $(".text-count").text(count);
233 }); 233 });
234 234
235 // 疾病分类下拉 235 // 疾病分类下拉
236 $('.inquiry_type').click(function () { 236 $('.inquiry_type').click(function () {
237 weui.picker([ 237 weui.picker([
238 - < volist  
239 - name = 'platment'  
240 - id = 'vo' >  
241 - {label: '{$vo.name}', value: {$vo.id}  
242 - },  
243 - <  
244 - /volist>  
245 - ],  
246 - {  
247 - onChange: function (res) {  
248 - $('.expert_value').val('')  
249 - $('.expert_value').data('data-id', '')  
250 - }  
251 - ,  
252 - onConfirm: function (res) {  
253 - $('.inquiry_value').val(res[0].label)  
254 - $('.inquiry_value').data('data-id', res[0].value) 238 + <volist name='platment' id='vo'>
  239 + {label: '{$vo.name}', value: {$vo.id}},
  240 + </volist>
  241 + ], {
  242 + onChange: function (res) {
  243 + $('.expert_value').val('')
  244 + $('.expert_value').data('data-id','')
  245 + },
  246 + onConfirm: function (res) {
  247 + $('.inquiry_value').val(res[0].label)
  248 + $('.inquiry_value').data('data-id',res[0].value)
  249 + }
255 } 250 }
256 - }  
257 - ) 251 + )
258 }) 252 })
259 // 疾病分类下拉 253 // 疾病分类下拉
260 $('.expert').click(function () { 254 $('.expert').click(function () {
@@ -337,21 +331,28 @@ @@ -337,21 +331,28 @@
337 //点击 331 //点击
338 $('.title').click(function () { 332 $('.title').click(function () {
339 title_id = $(this).attr("data-id"); 333 title_id = $(this).attr("data-id");
  334 +
  335 + // 第一步点击语音按钮
340 if ($(this).children(".voice_btn").css("display") == "inline") { 336 if ($(this).children(".voice_btn").css("display") == "inline") {
341 $(this).children(".voice_btn").css("display", "none"); 337 $(this).children(".voice_btn").css("display", "none");
342 $(this).children(".icon-tianxie").css("display", "inline") 338 $(this).children(".icon-tianxie").css("display", "inline")
343 $(this).parents('.info_item').children('.textarea_box').hide() 339 $(this).parents('.info_item').children('.textarea_box').hide()
344 - $(this).parents('.info_item').find('.voice_first').show() 340 + $(this).parents('.info_item').children('.voice_module').children('.voice_box').show()
  341 + $(this).parents('.info_item').children('.voice_module').children('.videoitem').show()
345 } else if ($(this).children(".icon-tianxie").css("display") == "inline") { 342 } else if ($(this).children(".icon-tianxie").css("display") == "inline") {
346 - $(this).children(".voice_btn").css("display", "inline");  
347 - $(this).children(".icon-tianxie").css("display", "none") 343 + $(this).children(".voice_btn").css("display","inline");
  344 + $(this).children(".icon-tianxie").css("display","none")
348 $(this).parents('.info_item').children('.textarea_box').show() 345 $(this).parents('.info_item').children('.textarea_box').show()
349 - $(this).parents('.info_item').find('.voice_first').hide() 346 + $(this).parents('.info_item').children('.voice_module').children('.voice_box').hide()
  347 + $(this).parents('.info_item').children('.voice_module').children('.videoitem').hide()
350 } 348 }
351 - console.log(1111) 349 + // $(this).next().show();
  350 + // $('.textarea_box').hide()
  351 + // $('.voice_btn').hide()
  352 + // $('.icon-tianxie').show()
  353 + // $('.voice_first').show()
352 }) 354 })
353 355
354 -  
355 //点击正在播放按钮 356 //点击正在播放按钮
356 $('.icon-luying_ongoing').click(function () { 357 $('.icon-luying_ongoing').click(function () {
357 var videolist = $(".voice_module"); 358 var videolist = $(".voice_module");
@@ -362,117 +363,40 @@ @@ -362,117 +363,40 @@
362 $(videolist[i]).children('.voice_second').hide() 363 $(videolist[i]).children('.voice_second').hide()
363 $(videolist[i]).children('.voice_third').show(); 364 $(videolist[i]).children('.voice_third').show();
364 } 365 }
365 - }  
366 - })  
367 -  
368 -  
369 - //倒计时  
370 - var times = "60";//倒计时总秒数量  
371 - var time = "";  
372 -  
373 - function countDown(times) {  
374 - var timer = null;  
375 - timer = setInterval(function () {  
376 - var day = 0,  
377 - hour = 0,  
378 - minute = 0,  
379 - second = 0;//时间默认值  
380 - if (times > 0) {  
381 - day = Math.floor(times / (60 * 60 * 24));  
382 - hour = Math.floor(times / (60 * 60)) - (day * 24);  
383 - minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);  
384 - second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);  
385 - }  
386 - if (day <= 9) day = '0' + day;  
387 - if (hour <= 9) hour = '0' + hour;  
388 - if (minute <= 9) minute = '0' + minute;  
389 - if (second <= 9) second = '0' + second;  
390 -  
391 - $('#hour_show').html('<text id="h"></text>' + hour + ':');  
392 - $('#minute_show').html('<text></text>' + minute + ':');  
393 - $('#second_show').html('<text></text>' + second + '');  
394 - $('#second_test').html('<text></text>' + second + '');  
395 -  
396 - //  
397 - // console.log(day + "天:" + hour + "小时:" + minute + "分钟:" + second + "秒");  
398 - times--;  
399 -  
400 - }, 1000);  
401 - $('.pause').click(function () {  
402 - // timer(intDiff);  
403 - clearInterval(timer);  
404 - localStorage.setItem("times", times)  
405 - })  
406 - $('.stop').click(function () {  
407 - clearInterval(timer);  
408 - times = 0;  
409 - })  
410 - $('.stopping').click(function () {  
411 - clearInterval(timer);  
412 - localStorage.clear()  
413 - })  
414 - }  
415 -  
416 - $('.start').click(function () {  
417 - time = localStorage.getItem("times")  
418 - if (time == null) {  
419 - times = parseInt(60)  
420 - } else {  
421 - times = time;  
422 - }  
423 - console.log(time)  
424 - // myTimer(intDiff);  
425 - countDown(times);  
426 - localStorage.setItem("times", times) 366 + }
427 }) 367 })
428 368
429 //添加一条新语音 369 //添加一条新语音
430 - var num = 0;  
431 - $('.voice_module').on('click', '.add_voice', function () {  
432 - times=60  
433 - // clearInterval(timer);  
434 - var day = 0,  
435 - hour = 0,  
436 - minute = 0,  
437 - second = 0;//时间默认值  
438 - if (day <= 9) day = '0' + day;  
439 - if (hour <= 9) hour = '0' + hour;  
440 - if (minute <= 9) minute = '0' + minute;  
441 - if (second <= 9) second = '0' + second;  
442 -  
443 - $('#hour_show').html('<text id="h"></text>' + hour + ':');  
444 - $('#minute_show').html('<text></text>' + minute + ':');  
445 - $('#second_show').html('<text></text>' + second + '');  
446 -  
447 -  
448 - num = num + 1 370 + var num=0
  371 + $('.add_voice').click(function () {
  372 + num=num+1
449 var parent = $(this).parents('.voice_module') 373 var parent = $(this).parents('.voice_module')
450 - var html = '<div class="voice_list" voiceitemid="'+num+'">\n' +  
451 - '<div class="voice_box voice_third" style="display: none;">\n' +  
452 - ' <div class="voice_item">\n' +  
453 - ' <text class="iconfont icon-luyin voice_icon"></text>\n' +  
454 - ' <text class="voice_font luyin">点击图标可播放 时长:10秒</text>\n' +  
455 - ' </div>\n' +  
456 - ' <div class="voice_btn_box">\n' +  
457 - ' <text class="iconfont icon-quxiao cancle_voice"></text>\n' +  
458 - // ' <text class="iconfont icon-tianjia add_voice"></text>\n' +  
459 - ' </div>\n' +  
460 - ' </div>\n' +  
461 - ' <div class="voice_box voice_first">\n' +  
462 - ' <div class="voice_item">\n' +  
463 - ' <text class="iconfont icon-huatong mike voice_icon"></text>\n' +  
464 - ' <text class="voice_font huatong">点击图标开始语音语音最长60秒</text>\n' +  
465 - ' </div>\n' +  
466 - ' <div class="voice_btn_box">\n' +  
467 - ' <text class="iconfont icon-quxiao icon_cancle cancle_voice"></text>\n' +  
468 - ' </div>\n' +  
469 - ' </div>\n' + 374 + var html='<div class="videoitem" voiceitemid="'+num+'">\n' +
  375 + '<div class="voice_list">\n' +
  376 + ' <div class="voice_box voice_first" voiceid="'+num+'">\n' +
  377 + ' <div class="voice_item">\n' +
  378 + ' <text class="iconfont icon-huatong mike voice_icon"></text>\n' +
  379 + ' <text class="voice_font huatong">点击图标开始语音语音最长60秒</text>\n' +
  380 + ' </div>\n' +
  381 + ' <div class="voice_btn_box">\n' +
  382 + ' <text class="iconfont icon-quxiao icon_cancle cancle_voice"></text>\n' +
  383 + ' </div>\n' +
  384 + ' </div>\n' +
  385 + ' </div>\n' +
  386 + '\n' +
  387 + '\n' +
  388 + ' <div class="voice_box voice_third" style="display:none">\n' +
  389 + ' <div class="voice_item">\n' +
  390 + ' <text class="iconfont icon-luyin voice_icon"></text>\n' +
  391 + ' <text class="voice_font luyin">点击图标可播放 时长:10秒</text>\n' +
  392 + ' </div>\n' +
  393 + ' <div class="voice_btn_box">\n' +
  394 + ' <text class="iconfont icon-quxiao icon_cancle cancle_voice"></text>\n' +
  395 + ' </div>\n' +
  396 + ' </div>\n' +
470 '</div>' 397 '</div>'
471 -  
472 -  
473 // parent.append($('.voice_list').html()); 398 // parent.append($('.voice_list').html());
474 parent.append(html) 399 parent.append(html)
475 -  
476 }) 400 })
477 401
478 //删除语音 402 //删除语音
@@ -480,54 +404,44 @@ @@ -480,54 +404,44 @@
480 $(this).parents('.voice_third').remove() 404 $(this).parents('.voice_third').remove()
481 }); 405 });
482 406
483 - $(".voice_module").on("click", ".cancle_voice", function () {  
484 - $(this).parents(".voice_list").remove(); 407 + $(".voice_module").on("click",".cancle_voice",function(){
  408 + $(this).parents(".voice_list").remove();
485 $(this).parents(".voice_third").remove(); 409 $(this).parents(".voice_third").remove();
486 410
487 }) 411 })
488 412
489 //第二步开始 413 //第二步开始
490 - var vioceid = ""  
491 -  
492 -  
493 - 414 + var vioceid=""
494 //显示弹窗 415 //显示弹窗
495 - var voiceBox;  
496 - $(document).on("click", ".mike", function () { 416 + $(document).on("click", ".mike",function () {
497 $('.first').show() 417 $('.first').show()
498 $('.play').show() 418 $('.play').show()
499 - $('.start').show()  
500 $('.stopping').hide() 419 $('.stopping').hide()
501 - $('.stop').hide()  
502 - $('.next_step').hide();  
503 - // videoid=$(this).parents(".voice_module").attr("video-id")  
504 -  
505 - // $(this).parents(".voice_first").hide();  
506 - // $(this).parents(".voice_first").siblings(".voice_third").show()  
507 - //  
508 - // // vioceid=$(this).parents(".voice_first").attr("voiceid");  
509 - //  
510 -  
511 - voiceBox = $(this).parents('.voice_list');  
512 -  
513 - // console.log(voiceBox)  
514 - // $('.submit_voice').attr('videoid')  
515 - //  
516 - // var videolist = $(".voice_module");  
517 - // console.log(videolist)  
518 - // for (var i = 0; i < videolist.length; i++) {  
519 - // if (videoid == title_id) {  
520 - // $(videolist[i]).children(".voice_list").children(".voice_list").hide();  
521 - // $(videolist[i]).children(".voice_list").children(".voice_third").show();  
522 - // }  
523 - // } 420 + vioceid=$(this).parents(".voice_first").attr("voiceid");
524 421
525 - }); 422 + //点击试听
  423 + $('.audition').click(function () {
  424 + wx.onVoicePlayEnd({
  425 + success: function (res) {
  426 + var localId = res.localId; // 返回音频的本地ID
  427 + }
  428 + });
526 429
527 - //删除语音  
528 - $(".voice_module").on("click",".cancle_voice",function(){  
529 - $(this).parents(".voice_box").remove();  
530 - }) 430 + wx.playVoice({
  431 + localId:localId //需要播放的音频的本地ID,由stopRecord接口获得
  432 + });
  433 +
  434 + var videolist = $(".videoitem");
  435 + for (var i = 0; i < videolist.length; i++) {
  436 + var videoid = $(videolist[i]).attr("voiceitemid");
  437 + if (videoid == vioceid) {
  438 + $(videolist[i]).children(".voice_list").hide();
  439 + $(videolist[i]).children(".voice_third").show();
  440 + }
  441 + }
  442 +
  443 + })
  444 + });
531 445
532 //开始录音 446 //开始录音
533 var localId 447 var localId
@@ -557,7 +471,7 @@ @@ -557,7 +471,7 @@
557 $('.pause').hide() 471 $('.pause').hide()
558 wx.stopRecord({ 472 wx.stopRecord({
559 success: function (res) { 473 success: function (res) {
560 - localId = res.localId; 474 + localId = res.localId;
561 } 475 }
562 }); 476 });
563 }) 477 })
@@ -577,7 +491,7 @@ @@ -577,7 +491,7 @@
577 } 491 }
578 }); 492 });
579 wx.playVoice({ 493 wx.playVoice({
580 - localId: localId //需要播放的音频的本地ID,由stopRecord接口获得 494 + localId:localId //需要播放的音频的本地ID,由stopRecord接口获得
581 }); 495 });
582 496
583 var videolist = $(".voice_module"); 497 var videolist = $(".voice_module");
@@ -594,48 +508,42 @@ @@ -594,48 +508,42 @@
594 508
595 509
596 //列表中点击试听 510 //列表中点击试听
597 - $('.voice_third').click(  
598 - function () {  
599 - var tryId = $(this).attr('try-id');  
600 - wx.playVoice({  
601 - localId: tryId  
602 - }); 511 + $('.voice_third').click(
  512 + function () {
  513 + var tryId=$(this).attr('try-id');
  514 + wx.playVoice({
  515 + localId:tryId
  516 + });
  517 + }
  518 + )
  519 +
  520 + //确认音频
  521 + $('.upload').click(function () {
  522 + var videolist = $(".voice_module");
  523 + for (var i = 0; i < videolist.length; i++) {
  524 + var videoid = $(videolist[i]).attr("video-id");
  525 + if (videoid == title_id) {
  526 + $('.second').hide()
  527 + $(videolist[i]).show();
  528 + $(videolist[i]).children('.voice_list').hide()
  529 + $(videolist[i]).children('.voice_third').show();
  530 + /*上面放上 音频id和本地地址*/
  531 + $(videolist[i]).children('.voice_third').attr('try-id',localId);
  532 + $(videolist[i]).children('.voice_third').data('data-try',localId);
  533 + $(videolist[i]).children('.voice_third').attr('id','audio'+videoid);
  534 + wx.uploadVoice({
  535 + localId: localId, // 需要上传的音频的本地ID,由stopRecord接口获得
  536 + isShowProgressTips: 1, // 默认为1,显示进度提示
  537 + success: function (res) {
  538 + var serverId = res.serverId; // 返回音频的服务器端ID
  539 + $(videolist[i]).children('.voice_third').attr('server-id',serverId);
  540 + $(videolist[i]).children('.voice_third').data('data-server',serverId);
  541 + }
  542 + });
  543 + }
603 } 544 }
604 - )  
605 -  
606 - //我要发送  
607 - $('.submit_voice').click(function () {  
608 - voiceBox.find('.voice_first').hide().siblings('.voice_third').show()  
609 - $('.second').hide()  
610 }) 545 })
611 546
612 - //确认音频  
613 - // $('.upload').click(function () {  
614 - // var videolist = $(".voice_module");  
615 - // for (var i = 0; i < videolist.length; i++) {  
616 - // var videoid = $(videolist[i]).attr("video-id");  
617 - // if (videoid == title_id) {  
618 - // $('.second').hide()  
619 - // $(videolist[i]).show();  
620 - // $(videolist[i]).children('.voice_list').hide()  
621 - // $(videolist[i]).children('.voice_third').show();  
622 - // /*上面放上 音频id和本地地址*/  
623 - // $(videolist[i]).children('.voice_third').attr('try-id', localId);  
624 - // $(videolist[i]).children('.voice_third').data('data-try', localId);  
625 - // $(videolist[i]).children('.voice_third').attr('id', 'audio' + videoid);  
626 - // wx.uploadVoice({  
627 - // localId: localId, // 需要上传的音频的本地ID,由stopRecord接口获得  
628 - // isShowProgressTips: 1, // 默认为1,显示进度提示  
629 - // success: function (res) {  
630 - // var serverId = res.serverId; // 返回音频的服务器端ID  
631 - // $(videolist[i]).children('.voice_third').attr('server-id', serverId);  
632 - // $(videolist[i]).children('.voice_third').data('data-server', serverId);  
633 - // }  
634 - // });  
635 - // }  
636 - // }  
637 - // })  
638 -  
639 //重新录制 547 //重新录制
640 $('.rerecord').click(function () { 548 $('.rerecord').click(function () {
641 $('.first').show() 549 $('.first').show()
@@ -820,69 +728,68 @@ @@ -820,69 +728,68 @@
820 } 728 }
821 }) 729 })
822 </script> 730 </script>
823 -<!--<script type="text/javascript">-->  
824 - <!--var times = "60";//倒计时总秒数量-->  
825 - <!--var time = "";-->  
826 -  
827 - <!--function countDown(times) {-->  
828 - <!--var timer = null;-->  
829 - <!--timer = setInterval(function () {-->  
830 - <!--var day = 0,-->  
831 - <!--hour = 0,-->  
832 - <!--minute = 0,-->  
833 - <!--second = 0;//时间默认值-->  
834 - <!--if (times > 0) {-->  
835 - <!--day = Math.floor(times / (60 * 60 * 24));-->  
836 - <!--hour = Math.floor(times / (60 * 60)) - (day * 24);-->  
837 - <!--minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);-->  
838 - <!--second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);-->  
839 - <!--}-->  
840 - <!--if (day <= 9) day = '0' + day;-->  
841 - <!--if (hour <= 9) hour = '0' + hour;-->  
842 - <!--if (minute <= 9) minute = '0' + minute;-->  
843 - <!--if (second <= 9) second = '0' + second;-->  
844 -  
845 - <!--$('#hour_show').html('<text id="h"></text>' + hour + ':');-->  
846 - <!--$('#minute_show').html('<text></text>' + minute + ':');-->  
847 - <!--$('#second_show').html('<text></text>' + second + '');-->  
848 - <!--$('#second_test').html('<text></text>' + second + '');-->  
849 -  
850 - <!--//-->  
851 - <!--// console.log(day + "天:" + hour + "小时:" + minute + "分钟:" + second + "秒");-->  
852 - <!--times&#45;&#45;;-->  
853 -  
854 - <!--}, 1000);-->  
855 - <!--// if (times <= 0) {-->  
856 - <!--// clearInterval(timer);-->  
857 - <!--// }-->  
858 -  
859 - <!--$('.pause').click(function () {-->  
860 - <!--// timer(intDiff);-->  
861 - <!--clearInterval(timer);-->  
862 - <!--localStorage.setItem("times", times)-->  
863 - <!--})-->  
864 - <!--$('.stop').click(function () {-->  
865 - <!--clearInterval(timer);-->  
866 - <!--times = 0;-->  
867 - <!--})-->  
868 - <!--$('.stopping').click(function () {-->  
869 - <!--clearInterval(timer);-->  
870 - <!--localStorage.clear()-->  
871 - <!--})-->  
872 - <!--}-->  
873 -  
874 - <!--$('.start').click(function () {-->  
875 - <!--time = localStorage.getItem("times")-->  
876 - <!--if (time == null) {-->  
877 - <!--times = parseInt(60)-->  
878 - <!--} else {-->  
879 - <!--times = time;-->  
880 - <!--}-->  
881 - <!--console.log(time)-->  
882 - <!--// myTimer(intDiff);-->  
883 - <!--countDown(times);-->  
884 - <!--localStorage.setItem("times", times)-->  
885 - <!--})-->  
886 -<!--</script>--> 731 +<script type="text/javascript">
  732 + var times = "60";//倒计时总秒数量
  733 + var time="";
  734 + function countDown(times) {
  735 + var timer = null;
  736 + timer = setInterval(function () {
  737 + var day = 0,
  738 + hour = 0,
  739 + minute = 0,
  740 + second = 0;//时间默认值
  741 + if (times > 0) {
  742 + day = Math.floor(times / (60 * 60 * 24));
  743 + hour = Math.floor(times / (60 * 60)) - (day * 24);
  744 + minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
  745 + second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
  746 + }
  747 + if (day <= 9) day = '0' + day;
  748 + if (hour <= 9) hour = '0' + hour;
  749 + if (minute <= 9) minute = '0' + minute;
  750 + if (second <= 9) second = '0' + second;
  751 +
  752 + $('#hour_show').html('<text id="h"></text>' + hour + ':');
  753 + $('#minute_show').html('<text></text>' + minute + ':');
  754 + $('#second_show').html('<text></text>' + second + '');
  755 + $('#second_test').html('<text></text>' + second + '');
  756 +
  757 + //
  758 + // console.log(day + "天:" + hour + "小时:" + minute + "分钟:" + second + "秒");
  759 + times--;
  760 +
  761 + }, 1000);
  762 + // if (times <= 0) {
  763 + // clearInterval(timer);
  764 + // }
  765 +
  766 + $('.pause').click(function () {
  767 + // timer(intDiff);
  768 + clearInterval(timer);
  769 + localStorage.setItem("times",times)
  770 + })
  771 + $('.stop').click(function () {
  772 + clearInterval(timer);
  773 + times=0;
  774 + })
  775 + $('.stopping').click(function () {
  776 + clearInterval(timer);
  777 + localStorage.clear()
  778 + })
  779 + }
  780 +
  781 + $('.start').click(function () {
  782 + time=localStorage.getItem("times")
  783 + if(time==null){
  784 + times = parseInt(60)
  785 + }else{
  786 + times=time;
  787 + }
  788 + console.log(time)
  789 + // myTimer(intDiff);
  790 + countDown(times);
  791 + localStorage.setItem("times",times)
  792 + })
  793 +</script>
887 </body> 794 </body>
888 </html> 795 </html>