index.js
1.25 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
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) {
var localId = res.localId;
wx.translateVoice({
localId: localId, // 需要识别的音频的本地Id,由录音相关接口获得
isShowProgressTips: 1, // 默认为1,显示进度提示
success: function (res) {
myApp.view.main.router.load({
url:'/home/search?keyword='+res.translateResult
});
}
});
}
});
}
}
]
}).open();
});