index.js
1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
var $ = Dom7;
var myApp = new Framework7({
root: '#app',
theme: 'ios',
routes: routes,
});
var $loading = $('#loading');
$loading.addClass('fade-out');
setTimeout(function () {
$loading.remove();
},300);
$('.search-area-inner').on('click', function () {
wx.startRecord();
myApp.dialog.create({
title: '正在录音...',
buttons: [
{
text: '完成',
onClick:function () {
wx.stopRecord({
success: function (res) {
myApp.dialog.preloader();
var localId = res.localId;
wx.translateVoice({
localId: localId, // 需要识别的音频的本地Id,由录音相关接口获得
isShowProgressTips: 0, // 默认为1,显示进度提示
success: function (res) {
jQuery.get("/home/search",{keyword:res.translateResult},function (data) {
myApp.dialog.close();
if(data.code=="OK"){
myApp.view.main.router.load({
url:data.data
});
}else{
myApp.dialog.alert(data.message);
$('.j_search_input').val(res.translateResult);
}
})
}
});
}
});
}
}
]
}).open();
});