...
|
...
|
@@ -364,83 +364,159 @@ |
|
|
}
|
|
|
})
|
|
|
|
|
|
//倒计时
|
|
|
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)
|
|
|
})
|
|
|
|
|
|
//添加一条新语音
|
|
|
var num=0
|
|
|
$('.add_voice').click(function () {
|
|
|
num=num+1
|
|
|
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 parent = $(this).parents('.voice_module')
|
|
|
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' +
|
|
|
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' +
|
|
|
'</div>'
|
|
|
// parent.append($('.voice_list').html());
|
|
|
parent.append(html)
|
|
|
})
|
|
|
|
|
|
//删除语音
|
|
|
$('.cancle_voice').click(function () {
|
|
|
$(this).parents('.voice_third').remove()
|
|
|
});
|
|
|
|
|
|
$(".voice_module").on("click",".cancle_voice",function(){
|
|
|
$(this).parents(".voice_list").remove();
|
|
|
$(this).parents(".voice_third").remove();
|
|
|
// parent.append($('.voice_list').html());
|
|
|
parent.append(html)
|
|
|
|
|
|
})
|
|
|
|
|
|
//第二步开始
|
|
|
var vioceid=""
|
|
|
//显示弹窗
|
|
|
$(document).on("click", ".mike",function () {
|
|
|
var videoid=''
|
|
|
//生命全局唯一 音频
|
|
|
var voiceBox;
|
|
|
$(document).on("click", ".mike", function () {
|
|
|
$('.first').show()
|
|
|
$('.play').show()
|
|
|
$('.start').show()
|
|
|
$('.stopping').hide()
|
|
|
vioceid=$(this).parents(".voice_first").attr("voiceid");
|
|
|
|
|
|
//点击试听
|
|
|
$('.audition').click(function () {
|
|
|
wx.onVoicePlayEnd({
|
|
|
success: function (res) {
|
|
|
var localId = res.localId; // 返回音频的本地ID
|
|
|
}
|
|
|
});
|
|
|
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
$('.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();
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
})
|
|
|
});
|
|
|
|
|
|
//删除语音
|
|
|
$(".voice_module").on("click",".cancle_voice",function(){
|
|
|
$(this).parents(".voice_box").remove();
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
//开始录音
|
|
|
var localId
|
|
|
$('.start').click(function () {
|
...
|
...
|
@@ -515,33 +591,39 @@ |
|
|
}
|
|
|
)
|
|
|
|
|
|
//确认音频
|
|
|
$('.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()
|
...
|
...
|
|