...
|
...
|
@@ -40,7 +40,7 @@ |
|
|
<div class="hint_info">提示:您可以选择推荐专家,平台会为您匹配对应专家;您也可以
|
|
|
选择其他专家。
|
|
|
</div>
|
|
|
<div class="info_item ">
|
|
|
<div class="info_item " >
|
|
|
<div class="title" data-id="1">
|
|
|
<text>病人主述</text>
|
|
|
<!--<text class="info_tab_box">-->
|
...
|
...
|
@@ -53,7 +53,7 @@ |
|
|
<p class="text_num"><span class="text-count">0</span>/1000</p>
|
|
|
</div>
|
|
|
<div class="voice_module" video-id="1">
|
|
|
<div class="voice_box voice_third">
|
|
|
<div class="voice_box voice_third" >
|
|
|
<div class="voice_item">
|
|
|
<text class="iconfont icon-luyin voice_icon"></text>
|
|
|
<text class="voice_font luyin">点击图标可播放 时长:10秒</text>
|
...
|
...
|
@@ -64,10 +64,10 @@ |
|
|
</div>
|
|
|
</div>
|
|
|
<!--<div class="voice_box voice_second" >-->
|
|
|
<!--<div class="voice_item">-->
|
|
|
<!--<text class="iconfont icon-luying_ongoing voice_icon"></text>-->
|
|
|
<!--<text class="voice_font luying_ongoing">正在播放 10秒/60秒</text>-->
|
|
|
<!--</div>-->
|
|
|
<!--<div class="voice_item">-->
|
|
|
<!--<text class="iconfont icon-luying_ongoing voice_icon"></text>-->
|
|
|
<!--<text class="voice_font luying_ongoing">正在播放 10秒/60秒</text>-->
|
|
|
<!--</div>-->
|
|
|
<!--</div>-->
|
|
|
<div class="voice_list">
|
|
|
<div class="voice_box voice_first">
|
...
|
...
|
@@ -104,10 +104,10 @@ |
|
|
</div>
|
|
|
</div>
|
|
|
<!--<div class="voice_box voice_second">-->
|
|
|
<!--<div class="voice_item">-->
|
|
|
<!--<text class="iconfont icon-luying_ongoing voice_icon"></text>-->
|
|
|
<!--<text class="voice_font luying_ongoing">正在播放 10秒/60秒</text>-->
|
|
|
<!--</div>-->
|
|
|
<!--<div class="voice_item">-->
|
|
|
<!--<text class="iconfont icon-luying_ongoing voice_icon"></text>-->
|
|
|
<!--<text class="voice_font luying_ongoing">正在播放 10秒/60秒</text>-->
|
|
|
<!--</div>-->
|
|
|
<!--</div>-->
|
|
|
<div class="voice_list">
|
|
|
<div class="voice_box voice_first">
|
...
|
...
|
@@ -174,7 +174,7 @@ |
|
|
<img class="" src="__TMPL__/public/assets/images/eicon12@2x.png" alt="">
|
|
|
</div>
|
|
|
<div class="popup_item next_step">
|
|
|
<img class="popup_icon" src="__TMPL__/public/assets/images/eicon10@2x.png" alt="">
|
|
|
<img class="popup_icon" src="__TMPL__/public/assets/images/eicon10@2x.png" alt="">
|
|
|
<div>下一步</div>
|
|
|
</div>
|
|
|
</div>
|
...
|
...
|
@@ -194,8 +194,8 @@ |
|
|
<img class="popup_icon " src="__TMPL__/public/assets/images/eicon15@2x.png" alt="">
|
|
|
<div>重新录制</div>
|
|
|
</div>
|
|
|
<div class="large_icon submit_voice">
|
|
|
<img class="popup_icon " src="__TMPL__/public/assets/images/eicon16@2x.png" alt="">
|
|
|
<div class="large_icon">
|
|
|
<img class="popup_icon upload" src="__TMPL__/public/assets/images/eicon16@2x.png" alt="">
|
|
|
<div>我要发送</div>
|
|
|
</div>
|
|
|
</div>
|
...
|
...
|
@@ -229,32 +229,26 @@ |
|
|
$this.val(_val.substring(0, 1000));
|
|
|
}
|
|
|
count = 1000 - $this.val().length;
|
|
|
$(this).siblings(".text_num").children('.text-count').text(count);
|
|
|
$(".text-count").text(count);
|
|
|
});
|
|
|
|
|
|
// 疾病分类下拉
|
|
|
$('.inquiry_type').click(function () {
|
|
|
weui.picker([
|
|
|
< volist
|
|
|
name = 'platment'
|
|
|
id = 'vo' >
|
|
|
{label: '{$vo.name}', value: {$vo.id}
|
|
|
},
|
|
|
<
|
|
|
/volist>
|
|
|
],
|
|
|
{
|
|
|
onChange: function (res) {
|
|
|
$('.expert_value').val('')
|
|
|
$('.expert_value').data('data-id', '')
|
|
|
}
|
|
|
,
|
|
|
onConfirm: function (res) {
|
|
|
$('.inquiry_value').val(res[0].label)
|
|
|
$('.inquiry_value').data('data-id', res[0].value)
|
|
|
<volist name='platment' id='vo'>
|
|
|
{label: '{$vo.name}', value: {$vo.id}},
|
|
|
</volist>
|
|
|
], {
|
|
|
onChange: function (res) {
|
|
|
$('.expert_value').val('')
|
|
|
$('.expert_value').data('data-id','')
|
|
|
},
|
|
|
onConfirm: function (res) {
|
|
|
$('.inquiry_value').val(res[0].label)
|
|
|
$('.inquiry_value').data('data-id',res[0].value)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
)
|
|
|
})
|
|
|
// 疾病分类下拉
|
|
|
$('.expert').click(function () {
|
...
|
...
|
@@ -337,21 +331,28 @@ |
|
|
//点击
|
|
|
$('.title').click(function () {
|
|
|
title_id = $(this).attr("data-id");
|
|
|
|
|
|
// 第一步点击语音按钮
|
|
|
if ($(this).children(".voice_btn").css("display") == "inline") {
|
|
|
$(this).children(".voice_btn").css("display", "none");
|
|
|
$(this).children(".icon-tianxie").css("display", "inline")
|
|
|
$(this).parents('.info_item').children('.textarea_box').hide()
|
|
|
$(this).parents('.info_item').find('.voice_first').show()
|
|
|
$(this).parents('.info_item').children('.voice_module').children('.voice_box').show()
|
|
|
$(this).parents('.info_item').children('.voice_module').children('.videoitem').show()
|
|
|
} else if ($(this).children(".icon-tianxie").css("display") == "inline") {
|
|
|
$(this).children(".voice_btn").css("display", "inline");
|
|
|
$(this).children(".icon-tianxie").css("display", "none")
|
|
|
$(this).children(".voice_btn").css("display","inline");
|
|
|
$(this).children(".icon-tianxie").css("display","none")
|
|
|
$(this).parents('.info_item').children('.textarea_box').show()
|
|
|
$(this).parents('.info_item').find('.voice_first').hide()
|
|
|
$(this).parents('.info_item').children('.voice_module').children('.voice_box').hide()
|
|
|
$(this).parents('.info_item').children('.voice_module').children('.videoitem').hide()
|
|
|
}
|
|
|
console.log(1111)
|
|
|
// $(this).next().show();
|
|
|
// $('.textarea_box').hide()
|
|
|
// $('.voice_btn').hide()
|
|
|
// $('.icon-tianxie').show()
|
|
|
// $('.voice_first').show()
|
|
|
})
|
|
|
|
|
|
|
|
|
//点击正在播放按钮
|
|
|
$('.icon-luying_ongoing').click(function () {
|
|
|
var videolist = $(".voice_module");
|
...
|
...
|
@@ -362,117 +363,40 @@ |
|
|
$(videolist[i]).children('.voice_second').hide()
|
|
|
$(videolist[i]).children('.voice_third').show();
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
|
|
|
|
|
|
//倒计时
|
|
|
var times = "60";//倒计时总秒数量
|
|
|
var time = "";
|
|
|
|
|
|
function countDown(times) {
|
|
|
var timer = null;
|
|
|
timer = setInterval(function () {
|
|
|
var day = 0,
|
|
|
hour = 0,
|
|
|
minute = 0,
|
|
|
second = 0;//时间默认值
|
|
|
if (times > 0) {
|
|
|
day = Math.floor(times / (60 * 60 * 24));
|
|
|
hour = Math.floor(times / (60 * 60)) - (day * 24);
|
|
|
minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
|
|
|
second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
|
|
|
}
|
|
|
if (day <= 9) day = '0' + day;
|
|
|
if (hour <= 9) hour = '0' + hour;
|
|
|
if (minute <= 9) minute = '0' + minute;
|
|
|
if (second <= 9) second = '0' + second;
|
|
|
|
|
|
$('#hour_show').html('<text id="h"></text>' + hour + ':');
|
|
|
$('#minute_show').html('<text></text>' + minute + ':');
|
|
|
$('#second_show').html('<text></text>' + second + '');
|
|
|
$('#second_test').html('<text></text>' + second + '');
|
|
|
|
|
|
//
|
|
|
// console.log(day + "天:" + hour + "小时:" + minute + "分钟:" + second + "秒");
|
|
|
times--;
|
|
|
|
|
|
}, 1000);
|
|
|
$('.pause').click(function () {
|
|
|
// timer(intDiff);
|
|
|
clearInterval(timer);
|
|
|
localStorage.setItem("times", times)
|
|
|
})
|
|
|
$('.stop').click(function () {
|
|
|
clearInterval(timer);
|
|
|
times = 0;
|
|
|
})
|
|
|
$('.stopping').click(function () {
|
|
|
clearInterval(timer);
|
|
|
localStorage.clear()
|
|
|
})
|
|
|
}
|
|
|
|
|
|
$('.start').click(function () {
|
|
|
time = localStorage.getItem("times")
|
|
|
if (time == null) {
|
|
|
times = parseInt(60)
|
|
|
} else {
|
|
|
times = time;
|
|
|
}
|
|
|
console.log(time)
|
|
|
// myTimer(intDiff);
|
|
|
countDown(times);
|
|
|
localStorage.setItem("times", times)
|
|
|
}
|
|
|
})
|
|
|
|
|
|
//添加一条新语音
|
|
|
var num = 0;
|
|
|
$('.voice_module').on('click', '.add_voice', function () {
|
|
|
times=60
|
|
|
// clearInterval(timer);
|
|
|
var day = 0,
|
|
|
hour = 0,
|
|
|
minute = 0,
|
|
|
second = 0;//时间默认值
|
|
|
if (day <= 9) day = '0' + day;
|
|
|
if (hour <= 9) hour = '0' + hour;
|
|
|
if (minute <= 9) minute = '0' + minute;
|
|
|
if (second <= 9) second = '0' + second;
|
|
|
|
|
|
$('#hour_show').html('<text id="h"></text>' + hour + ':');
|
|
|
$('#minute_show').html('<text></text>' + minute + ':');
|
|
|
$('#second_show').html('<text></text>' + second + '');
|
|
|
|
|
|
|
|
|
num = num + 1
|
|
|
var num=0
|
|
|
$('.add_voice').click(function () {
|
|
|
num=num+1
|
|
|
var parent = $(this).parents('.voice_module')
|
|
|
var html = '<div class="voice_list" voiceitemid="'+num+'">\n' +
|
|
|
'<div class="voice_box voice_third" style="display: none;">\n' +
|
|
|
' <div class="voice_item">\n' +
|
|
|
' <text class="iconfont icon-luyin voice_icon"></text>\n' +
|
|
|
' <text class="voice_font luyin">点击图标可播放 时长:10秒</text>\n' +
|
|
|
' </div>\n' +
|
|
|
' <div class="voice_btn_box">\n' +
|
|
|
' <text class="iconfont icon-quxiao cancle_voice"></text>\n' +
|
|
|
// ' <text class="iconfont icon-tianjia add_voice"></text>\n' +
|
|
|
' </div>\n' +
|
|
|
' </div>\n' +
|
|
|
' <div class="voice_box voice_first">\n' +
|
|
|
' <div class="voice_item">\n' +
|
|
|
' <text class="iconfont icon-huatong mike voice_icon"></text>\n' +
|
|
|
' <text class="voice_font huatong">点击图标开始语音语音最长60秒</text>\n' +
|
|
|
' </div>\n' +
|
|
|
' <div class="voice_btn_box">\n' +
|
|
|
' <text class="iconfont icon-quxiao icon_cancle cancle_voice"></text>\n' +
|
|
|
' </div>\n' +
|
|
|
' </div>\n' +
|
|
|
var html='<div class="videoitem" voiceitemid="'+num+'">\n' +
|
|
|
'<div class="voice_list">\n' +
|
|
|
' <div class="voice_box voice_first" voiceid="'+num+'">\n' +
|
|
|
' <div class="voice_item">\n' +
|
|
|
' <text class="iconfont icon-huatong mike voice_icon"></text>\n' +
|
|
|
' <text class="voice_font huatong">点击图标开始语音语音最长60秒</text>\n' +
|
|
|
' </div>\n' +
|
|
|
' <div class="voice_btn_box">\n' +
|
|
|
' <text class="iconfont icon-quxiao icon_cancle cancle_voice"></text>\n' +
|
|
|
' </div>\n' +
|
|
|
' </div>\n' +
|
|
|
' </div>\n' +
|
|
|
'\n' +
|
|
|
'\n' +
|
|
|
' <div class="voice_box voice_third" style="display:none">\n' +
|
|
|
' <div class="voice_item">\n' +
|
|
|
' <text class="iconfont icon-luyin voice_icon"></text>\n' +
|
|
|
' <text class="voice_font luyin">点击图标可播放 时长:10秒</text>\n' +
|
|
|
' </div>\n' +
|
|
|
' <div class="voice_btn_box">\n' +
|
|
|
' <text class="iconfont icon-quxiao icon_cancle cancle_voice"></text>\n' +
|
|
|
' </div>\n' +
|
|
|
' </div>\n' +
|
|
|
'</div>'
|
|
|
|
|
|
|
|
|
// parent.append($('.voice_list').html());
|
|
|
parent.append(html)
|
|
|
|
|
|
})
|
|
|
|
|
|
//删除语音
|
...
|
...
|
@@ -480,54 +404,44 @@ |
|
|
$(this).parents('.voice_third').remove()
|
|
|
});
|
|
|
|
|
|
$(".voice_module").on("click", ".cancle_voice", function () {
|
|
|
$(this).parents(".voice_list").remove();
|
|
|
$(".voice_module").on("click",".cancle_voice",function(){
|
|
|
$(this).parents(".voice_list").remove();
|
|
|
$(this).parents(".voice_third").remove();
|
|
|
|
|
|
})
|
|
|
|
|
|
//第二步开始
|
|
|
var vioceid = ""
|
|
|
|
|
|
|
|
|
|
|
|
var vioceid=""
|
|
|
//显示弹窗
|
|
|
var voiceBox;
|
|
|
$(document).on("click", ".mike", function () {
|
|
|
$(document).on("click", ".mike",function () {
|
|
|
$('.first').show()
|
|
|
$('.play').show()
|
|
|
$('.start').show()
|
|
|
$('.stopping').hide()
|
|
|
$('.stop').hide()
|
|
|
$('.next_step').hide();
|
|
|
// videoid=$(this).parents(".voice_module").attr("video-id")
|
|
|
|
|
|
// $(this).parents(".voice_first").hide();
|
|
|
// $(this).parents(".voice_first").siblings(".voice_third").show()
|
|
|
//
|
|
|
// // vioceid=$(this).parents(".voice_first").attr("voiceid");
|
|
|
//
|
|
|
|
|
|
voiceBox = $(this).parents('.voice_list');
|
|
|
|
|
|
// console.log(voiceBox)
|
|
|
// $('.submit_voice').attr('videoid')
|
|
|
//
|
|
|
// var videolist = $(".voice_module");
|
|
|
// console.log(videolist)
|
|
|
// for (var i = 0; i < videolist.length; i++) {
|
|
|
// if (videoid == title_id) {
|
|
|
// $(videolist[i]).children(".voice_list").children(".voice_list").hide();
|
|
|
// $(videolist[i]).children(".voice_list").children(".voice_third").show();
|
|
|
// }
|
|
|
// }
|
|
|
vioceid=$(this).parents(".voice_first").attr("voiceid");
|
|
|
|
|
|
});
|
|
|
//点击试听
|
|
|
$('.audition').click(function () {
|
|
|
wx.onVoicePlayEnd({
|
|
|
success: function (res) {
|
|
|
var localId = res.localId; // 返回音频的本地ID
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//删除语音
|
|
|
$(".voice_module").on("click",".cancle_voice",function(){
|
|
|
$(this).parents(".voice_box").remove();
|
|
|
})
|
|
|
wx.playVoice({
|
|
|
localId:localId //需要播放的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
|
|
|
var videolist = $(".videoitem");
|
|
|
for (var i = 0; i < videolist.length; i++) {
|
|
|
var videoid = $(videolist[i]).attr("voiceitemid");
|
|
|
if (videoid == vioceid) {
|
|
|
$(videolist[i]).children(".voice_list").hide();
|
|
|
$(videolist[i]).children(".voice_third").show();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
})
|
|
|
});
|
|
|
|
|
|
//开始录音
|
|
|
var localId
|
...
|
...
|
@@ -557,7 +471,7 @@ |
|
|
$('.pause').hide()
|
|
|
wx.stopRecord({
|
|
|
success: function (res) {
|
|
|
localId = res.localId;
|
|
|
localId = res.localId;
|
|
|
}
|
|
|
});
|
|
|
})
|
...
|
...
|
@@ -577,7 +491,7 @@ |
|
|
}
|
|
|
});
|
|
|
wx.playVoice({
|
|
|
localId: localId //需要播放的音频的本地ID,由stopRecord接口获得
|
|
|
localId:localId //需要播放的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
|
|
|
var videolist = $(".voice_module");
|
...
|
...
|
@@ -594,48 +508,42 @@ |
|
|
|
|
|
|
|
|
//列表中点击试听
|
|
|
$('.voice_third').click(
|
|
|
function () {
|
|
|
var tryId = $(this).attr('try-id');
|
|
|
wx.playVoice({
|
|
|
localId: tryId
|
|
|
});
|
|
|
$('.voice_third').click(
|
|
|
function () {
|
|
|
var tryId=$(this).attr('try-id');
|
|
|
wx.playVoice({
|
|
|
localId:tryId
|
|
|
});
|
|
|
}
|
|
|
)
|
|
|
|
|
|
//确认音频
|
|
|
$('.upload').click(function () {
|
|
|
var videolist = $(".voice_module");
|
|
|
for (var i = 0; i < videolist.length; i++) {
|
|
|
var videoid = $(videolist[i]).attr("video-id");
|
|
|
if (videoid == title_id) {
|
|
|
$('.second').hide()
|
|
|
$(videolist[i]).show();
|
|
|
$(videolist[i]).children('.voice_list').hide()
|
|
|
$(videolist[i]).children('.voice_third').show();
|
|
|
/*上面放上 音频id和本地地址*/
|
|
|
$(videolist[i]).children('.voice_third').attr('try-id',localId);
|
|
|
$(videolist[i]).children('.voice_third').data('data-try',localId);
|
|
|
$(videolist[i]).children('.voice_third').attr('id','audio'+videoid);
|
|
|
wx.uploadVoice({
|
|
|
localId: localId, // 需要上传的音频的本地ID,由stopRecord接口获得
|
|
|
isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
success: function (res) {
|
|
|
var serverId = res.serverId; // 返回音频的服务器端ID
|
|
|
$(videolist[i]).children('.voice_third').attr('server-id',serverId);
|
|
|
$(videolist[i]).children('.voice_third').data('data-server',serverId);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
|
|
|
//我要发送
|
|
|
$('.submit_voice').click(function () {
|
|
|
voiceBox.find('.voice_first').hide().siblings('.voice_third').show()
|
|
|
$('.second').hide()
|
|
|
})
|
|
|
|
|
|
//确认音频
|
|
|
// $('.upload').click(function () {
|
|
|
// var videolist = $(".voice_module");
|
|
|
// for (var i = 0; i < videolist.length; i++) {
|
|
|
// var videoid = $(videolist[i]).attr("video-id");
|
|
|
// if (videoid == title_id) {
|
|
|
// $('.second').hide()
|
|
|
// $(videolist[i]).show();
|
|
|
// $(videolist[i]).children('.voice_list').hide()
|
|
|
// $(videolist[i]).children('.voice_third').show();
|
|
|
// /*上面放上 音频id和本地地址*/
|
|
|
// $(videolist[i]).children('.voice_third').attr('try-id', localId);
|
|
|
// $(videolist[i]).children('.voice_third').data('data-try', localId);
|
|
|
// $(videolist[i]).children('.voice_third').attr('id', 'audio' + videoid);
|
|
|
// wx.uploadVoice({
|
|
|
// localId: localId, // 需要上传的音频的本地ID,由stopRecord接口获得
|
|
|
// isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
// success: function (res) {
|
|
|
// var serverId = res.serverId; // 返回音频的服务器端ID
|
|
|
// $(videolist[i]).children('.voice_third').attr('server-id', serverId);
|
|
|
// $(videolist[i]).children('.voice_third').data('data-server', serverId);
|
|
|
// }
|
|
|
// });
|
|
|
// }
|
|
|
// }
|
|
|
// })
|
|
|
|
|
|
//重新录制
|
|
|
$('.rerecord').click(function () {
|
|
|
$('.first').show()
|
...
|
...
|
@@ -820,69 +728,68 @@ |
|
|
}
|
|
|
})
|
|
|
</script>
|
|
|
<!--<script type="text/javascript">-->
|
|
|
<!--var times = "60";//倒计时总秒数量-->
|
|
|
<!--var time = "";-->
|
|
|
|
|
|
<!--function countDown(times) {-->
|
|
|
<!--var timer = null;-->
|
|
|
<!--timer = setInterval(function () {-->
|
|
|
<!--var day = 0,-->
|
|
|
<!--hour = 0,-->
|
|
|
<!--minute = 0,-->
|
|
|
<!--second = 0;//时间默认值-->
|
|
|
<!--if (times > 0) {-->
|
|
|
<!--day = Math.floor(times / (60 * 60 * 24));-->
|
|
|
<!--hour = Math.floor(times / (60 * 60)) - (day * 24);-->
|
|
|
<!--minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);-->
|
|
|
<!--second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);-->
|
|
|
<!--}-->
|
|
|
<!--if (day <= 9) day = '0' + day;-->
|
|
|
<!--if (hour <= 9) hour = '0' + hour;-->
|
|
|
<!--if (minute <= 9) minute = '0' + minute;-->
|
|
|
<!--if (second <= 9) second = '0' + second;-->
|
|
|
|
|
|
<!--$('#hour_show').html('<text id="h"></text>' + hour + ':');-->
|
|
|
<!--$('#minute_show').html('<text></text>' + minute + ':');-->
|
|
|
<!--$('#second_show').html('<text></text>' + second + '');-->
|
|
|
<!--$('#second_test').html('<text></text>' + second + '');-->
|
|
|
|
|
|
<!--//-->
|
|
|
<!--// console.log(day + "天:" + hour + "小时:" + minute + "分钟:" + second + "秒");-->
|
|
|
<!--times--;-->
|
|
|
|
|
|
<!--}, 1000);-->
|
|
|
<!--// if (times <= 0) {-->
|
|
|
<!--// clearInterval(timer);-->
|
|
|
<!--// }-->
|
|
|
|
|
|
<!--$('.pause').click(function () {-->
|
|
|
<!--// timer(intDiff);-->
|
|
|
<!--clearInterval(timer);-->
|
|
|
<!--localStorage.setItem("times", times)-->
|
|
|
<!--})-->
|
|
|
<!--$('.stop').click(function () {-->
|
|
|
<!--clearInterval(timer);-->
|
|
|
<!--times = 0;-->
|
|
|
<!--})-->
|
|
|
<!--$('.stopping').click(function () {-->
|
|
|
<!--clearInterval(timer);-->
|
|
|
<!--localStorage.clear()-->
|
|
|
<!--})-->
|
|
|
<!--}-->
|
|
|
|
|
|
<!--$('.start').click(function () {-->
|
|
|
<!--time = localStorage.getItem("times")-->
|
|
|
<!--if (time == null) {-->
|
|
|
<!--times = parseInt(60)-->
|
|
|
<!--} else {-->
|
|
|
<!--times = time;-->
|
|
|
<!--}-->
|
|
|
<!--console.log(time)-->
|
|
|
<!--// myTimer(intDiff);-->
|
|
|
<!--countDown(times);-->
|
|
|
<!--localStorage.setItem("times", times)-->
|
|
|
<!--})-->
|
|
|
<!--</script>-->
|
|
|
<script type="text/javascript">
|
|
|
var times = "60";//倒计时总秒数量
|
|
|
var time="";
|
|
|
function countDown(times) {
|
|
|
var timer = null;
|
|
|
timer = setInterval(function () {
|
|
|
var day = 0,
|
|
|
hour = 0,
|
|
|
minute = 0,
|
|
|
second = 0;//时间默认值
|
|
|
if (times > 0) {
|
|
|
day = Math.floor(times / (60 * 60 * 24));
|
|
|
hour = Math.floor(times / (60 * 60)) - (day * 24);
|
|
|
minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
|
|
|
second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
|
|
|
}
|
|
|
if (day <= 9) day = '0' + day;
|
|
|
if (hour <= 9) hour = '0' + hour;
|
|
|
if (minute <= 9) minute = '0' + minute;
|
|
|
if (second <= 9) second = '0' + second;
|
|
|
|
|
|
$('#hour_show').html('<text id="h"></text>' + hour + ':');
|
|
|
$('#minute_show').html('<text></text>' + minute + ':');
|
|
|
$('#second_show').html('<text></text>' + second + '');
|
|
|
$('#second_test').html('<text></text>' + second + '');
|
|
|
|
|
|
//
|
|
|
// console.log(day + "天:" + hour + "小时:" + minute + "分钟:" + second + "秒");
|
|
|
times--;
|
|
|
|
|
|
}, 1000);
|
|
|
// if (times <= 0) {
|
|
|
// clearInterval(timer);
|
|
|
// }
|
|
|
|
|
|
$('.pause').click(function () {
|
|
|
// timer(intDiff);
|
|
|
clearInterval(timer);
|
|
|
localStorage.setItem("times",times)
|
|
|
})
|
|
|
$('.stop').click(function () {
|
|
|
clearInterval(timer);
|
|
|
times=0;
|
|
|
})
|
|
|
$('.stopping').click(function () {
|
|
|
clearInterval(timer);
|
|
|
localStorage.clear()
|
|
|
})
|
|
|
}
|
|
|
|
|
|
$('.start').click(function () {
|
|
|
time=localStorage.getItem("times")
|
|
|
if(time==null){
|
|
|
times = parseInt(60)
|
|
|
}else{
|
|
|
times=time;
|
|
|
}
|
|
|
console.log(time)
|
|
|
// myTimer(intDiff);
|
|
|
countDown(times);
|
|
|
localStorage.setItem("times",times)
|
|
|
})
|
|
|
</script>
|
|
|
</body>
|
|
|
</html> |
|
|
\ No newline at end of file |
...
|
...
|
|