hd-idevvue3 3.0.7 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/{static/js/index-DbUA6jg0.js → index.js} +1 -1
  2. package/package.json +7 -2
  3. package/.env.development +0 -5
  4. package/.env.production +0 -5
  5. package/.eslintrc.js +0 -151
  6. package/dist/static/js/index-Dl4O91nB.js +0 -73768
  7. package/index.html +0 -18
  8. package/pnpm-lock.yaml +0 -3541
  9. package/src/App.vue +0 -11
  10. package/src/assets/sound/notify.wav +0 -0
  11. package/src/demo/demo.vue +0 -42
  12. package/src/demo/dropdemo.vue +0 -42
  13. package/src/demo/extsets.vue +0 -208
  14. package/src/demo/formedit.vue +0 -157
  15. package/src/demo/hightquery.vue +0 -366
  16. package/src/demo/inlineedit.vue +0 -182
  17. package/src/demo/selfdrop.vue +0 -58
  18. package/src/demo//350/241/214/345/206/205/347/272/247/350/201/224.txt +0 -2
  19. package/src/directive/el-dragDialog/drag.js +0 -124
  20. package/src/directive/el-dragDialog/index.js +0 -13
  21. package/src/errorLog.js +0 -16
  22. package/src/hdcom/BigGrid.js +0 -179
  23. package/src/hdcom/BillShow.vue +0 -111
  24. package/src/hdcom/BillUpload.vue +0 -311
  25. package/src/hdcom/BtnRight.vue +0 -101
  26. package/src/hdcom/ErrHint.vue +0 -42
  27. package/src/hdcom/ExtendColumn.vue +0 -115
  28. package/src/hdcom/ExtendCommon.js +0 -40
  29. package/src/hdcom/ExtendForm.vue +0 -141
  30. package/src/hdcom/FacePicUpload.vue +0 -80
  31. package/src/hdcom/FaceRecTest.vue +0 -114
  32. package/src/hdcom/GridChart.vue +0 -207
  33. package/src/hdcom/GridExField.vue +0 -375
  34. package/src/hdcom/GridShow.vue +0 -288
  35. package/src/hdcom/HdAside.vue +0 -225
  36. package/src/hdcom/HdBtn.vue +0 -125
  37. package/src/hdcom/HdButton.vue +0 -161
  38. package/src/hdcom/HdComFaceRec.vue +0 -106
  39. package/src/hdcom/HdComGrid.vue +0 -876
  40. package/src/hdcom/HdComQuery.vue +0 -362
  41. package/src/hdcom/HdComQueryDetail.vue +0 -205
  42. package/src/hdcom/HdComSortDetail.vue +0 -161
  43. package/src/hdcom/HdDatePicker.vue +0 -94
  44. package/src/hdcom/HdDialog.vue +0 -81
  45. package/src/hdcom/HdDrop.vue +0 -188
  46. package/src/hdcom/HdFileUpload.vue +0 -167
  47. package/src/hdcom/HdFilterBox.vue +0 -90
  48. package/src/hdcom/HdFooter.vue +0 -182
  49. package/src/hdcom/HdForm.vue +0 -351
  50. package/src/hdcom/HdFormBtn.vue +0 -131
  51. package/src/hdcom/HdFormItem.vue +0 -39
  52. package/src/hdcom/HdGctosGrid +0 -0
  53. package/src/hdcom/HdGrid.vue +0 -1022
  54. package/src/hdcom/HdGridEditBtn.vue +0 -58
  55. package/src/hdcom/HdGridExt.js +0 -250
  56. package/src/hdcom/HdGridSel.vue +0 -257
  57. package/src/hdcom/HdHeader.vue +0 -180
  58. package/src/hdcom/HdHotKey.vue +0 -84
  59. package/src/hdcom/HdInputHint.vue +0 -53
  60. package/src/hdcom/HdMain.vue +0 -41
  61. package/src/hdcom/HdMessage.vue +0 -201
  62. package/src/hdcom/HdNum.vue +0 -79
  63. package/src/hdcom/HdPopSel.vue +0 -80
  64. package/src/hdcom/HdRightMenu.vue +0 -63
  65. package/src/hdcom/HdSel/SelGridFieldcod.vue +0 -54
  66. package/src/hdcom/HdTableColumn.vue +0 -381
  67. package/src/hdcom/HdTempSave.vue +0 -162
  68. package/src/hdcom/HdTree.vue +0 -103
  69. package/src/hdcom/HdTreeTable/eval.js +0 -39
  70. package/src/hdcom/HdTreeTable/index.vue +0 -229
  71. package/src/hdcom/ImportExcel.vue +0 -178
  72. package/src/hdcom/index.js +0 -75
  73. package/src/idev.common.js +0 -79
  74. package/src/index.js +0 -11
  75. package/src/utils/HdQuery.js +0 -65
  76. package/src/utils/comutils.js +0 -120
  77. package/src/utils/gogocodeTransfer.js +0 -59
  78. package/src/utils/utils.js +0 -116
  79. package/src/vendor/Blob.js +0 -187
  80. package/src/vendor/Export2Excel.js +0 -231
  81. package/src/vendor/Export2Zip.js +0 -25
  82. package/src/views/layout/AppMain.vue +0 -34
  83. package/src/views/layout/HdLayout.vue +0 -90
  84. package/src/views/layout/header/ElasticSearch.vue +0 -262
  85. package/src/views/layout/header/HZRecorder.js +0 -259
  86. package/src/views/layout/header/HeaderSearch.vue +0 -218
  87. package/src/views/layout/header/Levelbar.vue +0 -55
  88. package/src/views/layout/header/MainHeader.vue +0 -315
  89. package/src/views/layout/header/Navbar.vue +0 -101
  90. package/src/views/layout/header/ScrollPane.vue +0 -103
  91. package/src/views/layout/header/TagsView.vue +0 -215
  92. package/src/views/layout/header/VocRec.vue +0 -105
  93. package/src/views/layout/header/changepswform.vue +0 -130
  94. package/src/views/layout/index.js +0 -10
  95. package/src/views/layout/menu/Hamburger.vue +0 -63
  96. package/src/views/layout/menu/HdMenu.vue +0 -204
  97. package/src/views/layout/menu/css/menu.css +0 -288
  98. package/src/views/layout/menu/index.vue +0 -27
  99. package/src/views/privilege/commsg/commsg.vue +0 -152
  100. package/src/views/privilege/commsg/commsgOrgn.vue +0 -51
  101. package/src/views/privilege/commsg/commsgRole.vue +0 -220
  102. package/src/views/privilege/commsg/commsgform.vue +0 -184
  103. package/src/views/privilege/commsg/commsgiframe.vue +0 -40
  104. package/src/views/privilege/commsg/commsgto.vue +0 -199
  105. package/src/views/privilege/commsg/commsgtoform.vue +0 -114
  106. package/src/views/privilege/commsg/commsgtrans.vue +0 -227
  107. package/src/views/privilege/exfield/comexcolumn.vue +0 -161
  108. package/src/views/privilege/exfield/comexcolumnform.vue +0 -128
  109. package/src/views/privilege/exfield/comexfield.vue +0 -29
  110. package/src/views/privilege/exfield/comexfieldform.vue +0 -112
  111. package/src/views/privilege/exfield/comexfieldsub.vue +0 -163
  112. package/src/views/privilege/index.js +0 -41
  113. package/src/views/privilege/menu/comMenu.vue +0 -49
  114. package/src/views/privilege/menu/menu.vue +0 -250
  115. package/src/views/privilege/menu/menuinfo.vue +0 -63
  116. package/src/views/privilege/menu/rolelist.vue +0 -92
  117. package/src/views/privilege/menu/userlist.vue +0 -92
  118. package/src/views/privilege/mobile/authmobileupdate.vue +0 -145
  119. package/src/views/privilege/mobile/authmobileupdateform.vue +0 -120
  120. package/src/views/privilege/orgDept/authOrgn.vue +0 -188
  121. package/src/views/privilege/orgDept/authorgnform.vue +0 -157
  122. package/src/views/privilege/orgDept/orgDept.vue +0 -38
  123. package/src/views/privilege/orgDept/orgTree.vue +0 -99
  124. package/src/views/privilege/orgDept/orgnselect.vue +0 -155
  125. package/src/views/privilege/personDept/authuser.vue +0 -229
  126. package/src/views/privilege/personDept/authuserform.vue +0 -206
  127. package/src/views/privilege/personDept/facerec.vue +0 -162
  128. package/src/views/privilege/personDept/orgncascader.vue +0 -144
  129. package/src/views/privilege/personDept/personDept.vue +0 -33
  130. package/src/views/privilege/quartz/comquartzjob.vue +0 -150
  131. package/src/views/privilege/quartz/comquartzjobform.vue +0 -115
  132. package/src/views/privilege/quartz/comquartzlog.vue +0 -143
  133. package/src/views/privilege/role/btnRole.vue +0 -173
  134. package/src/views/privilege/role/menuRole.vue +0 -84
  135. package/src/views/privilege/role/orgnRole.vue +0 -78
  136. package/src/views/privilege/role/role.vue +0 -84
  137. package/src/views/privilege/role/rolelist.vue +0 -136
  138. package/src/views/privilege/role/roleselect.vue +0 -74
  139. package/src/views/privilege/search/comsearch.vue +0 -196
  140. package/src/views/privilege/search/menu.vue +0 -68
  141. package/src/views/privilege/syscode/syscode.vue +0 -191
  142. package/src/views/privilege/syscode/sysfield.vue +0 -119
  143. package/src/views/privilege/syscode/sysfieldframe.vue +0 -30
  144. package/src/views/privilege/syslog/menulog.vue +0 -68
  145. package/src/views/privilege/syslog/syslog.vue +0 -182
  146. package/src/views/privilege/syslog/syslogconfig.vue +0 -128
  147. package/src/views/privilege/syslog/syslogform.vue +0 -85
  148. package/src/views/privilege/syslog/syslogframe.vue +0 -26
  149. package/src/views/privilege/userRole/userRole.vue +0 -220
  150. package/vite.config.js +0 -124
  151. /package/dist/{static/css/index-DRHIlcVU.css → index.css} +0 -0
@@ -1,262 +0,0 @@
1
- <template>
2
- <div :class="{ show: show }" class="header-search">
3
- <svg
4
- @click="click"
5
- class="search-icon screenfull-svg"
6
- height="32"
7
- viewBox="-10 -10 150 150"
8
- width="32"
9
- xmlns="http://www.w3.org/2000/svg"
10
- >
11
- <path
12
- d="M124.884 109.812L94.256 79.166c-.357-.357-.757-.629-1.129-.914a50.366 50.366 0 0 0 8.186-27.59C101.327 22.689 78.656 0 50.67 0 22.685 0 0 22.688 0 50.663c0 27.989 22.685 50.663 50.656 50.663 10.186 0 19.643-3.03 27.6-8.201.286.385.557.771.9 1.114l30.628 30.632a10.633 10.633 0 0 0 7.543 3.129c2.728 0 5.457-1.043 7.543-3.115 4.171-4.157 4.171-10.915.014-15.073M50.671 85.338C31.557 85.338 16 69.78 16 50.663c0-19.102 15.557-34.661 34.67-34.661 19.115 0 34.657 15.559 34.657 34.675 0 19.102-15.557 34.661-34.656 34.661"
13
- />
14
- </svg>
15
- <el-select
16
- :placeholder="$t('菜单查询')"
17
- :remote-method="querySearch"
18
- @change="change"
19
- class="header-search-select"
20
- default-first-option
21
- filterable
22
- ref="headerSearchSelect"
23
- remote
24
- v-model="search"
25
- >
26
- <el-option-group
27
- :key="$t('检索菜单')"
28
- :label="$t('检索菜单')"
29
- v-if="options1.length > 0"
30
- >
31
- <el-option
32
- :key="index"
33
- :label="item.title.join(' > ')"
34
- :value="item"
35
- v-for="(item, index) in options1"
36
- />
37
- </el-option-group>
38
- <el-option-group
39
- :key="$t('更多结果')"
40
- :label="$t('更多结果')"
41
- v-if="options2.length > 0"
42
- >
43
- <el-option
44
- :key="index"
45
- :label="item.text"
46
- :value="item"
47
- v-for="(item, index) in options2"
48
- />
49
- </el-option-group>
50
- </el-select>
51
- </div>
52
- </template>
53
-
54
- <script>
55
- import Fuse from 'fuse.js'
56
- import path from 'path'
57
-
58
- export default {
59
- name: 'ElasticSearch',
60
- data() {
61
- return {
62
- search: '',
63
- options1: [],
64
- options2: [],
65
- searchPool: [],
66
- show: false,
67
- fuse: undefined,
68
- }
69
- },
70
- computed: {
71
- routes() {
72
- return this.$store.state.permission.hdMenu
73
- },
74
- lang() {
75
- return this.$store.getters.language
76
- },
77
- },
78
- watch: {
79
- lang() {
80
- this.searchPool = this.generateRoutes(this.routes)
81
- },
82
- routes() {
83
- this.searchPool = this.generateRoutes(this.routes)
84
- },
85
- searchPool(list) {
86
- this.initFuse(list)
87
- },
88
- show(value) {
89
- if (value) {
90
- document.body.addEventListener('click', this.close)
91
- } else {
92
- document.body.removeEventListener('click', this.close)
93
- }
94
- },
95
- },
96
- mounted() {
97
- this.searchPool = this.generateRoutes(this.routes)
98
- },
99
- methods: {
100
- click() {
101
- this.show = !this.show
102
- if (this.show) {
103
- this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus()
104
- }
105
- },
106
- close() {
107
- this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.blur()
108
- this.options1 = []
109
- this.options2 = []
110
- this.show = false
111
- },
112
- change(val) {
113
- this.$router.push(val.path)
114
- this.search = ''
115
- this.options1 = []
116
- this.options2 = []
117
- this.$nextTick(() => {
118
- this.show = false
119
- })
120
- },
121
- initFuse(list) {
122
- this.fuse = new Fuse(list, {
123
- shouldSort: true,
124
- threshold: 0.4,
125
- location: 0,
126
- distance: 100,
127
- maxPatternLength: 32,
128
- minMatchCharLength: 1,
129
- keys: [
130
- {
131
- name: 'title',
132
- weight: 0.7,
133
- },
134
- {
135
- name: 'path',
136
- weight: 0.3,
137
- },
138
- ],
139
- })
140
- },
141
- // Filter out the routes that can be displayed in the sidebar
142
- // And generate the internationalized title
143
- generateRoutes(routes, basePath = '/', prefixTitle = []) {
144
- let res = []
145
- for (const router of routes) {
146
- // skip hidden router
147
- if (router.hidden) {
148
- continue
149
- }
150
-
151
- const data = {
152
- path: path.resolve(basePath, router.path),
153
- title: [...prefixTitle],
154
- }
155
-
156
- if (router.meta && router.meta.title) {
157
- // generate internationalized title
158
- const i18ntitle =
159
- this.$i18n.locale == 'zh' ? router.meta.title : router.meta.enTitle
160
-
161
- data.title = [...data.title, i18ntitle]
162
-
163
- if (router.redirect !== 'noredirect') {
164
- // only push the routes with title
165
- // special case: need to exclude parent router without redirect
166
- res.push(data)
167
- }
168
- }
169
-
170
- // recursive child routes
171
- if (router.children) {
172
- const tempRoutes = this.generateRoutes(
173
- router.children,
174
- data.path,
175
- data.title
176
- )
177
- if (tempRoutes.length >= 1) {
178
- res = [...res, ...tempRoutes]
179
- }
180
- }
181
- }
182
-
183
- return res
184
- },
185
- querySearch(query) {
186
- if (query !== '') {
187
- this.options1 = this.fuse.search(query)
188
- } else {
189
- this.options1 = []
190
- }
191
-
192
- if (this.$store.state.app.elsearch) {
193
- //
194
- this.options2 = [{ text: this.$t('加载中...') }]
195
- this.$http
196
- .get(
197
- `/webresources/login/com/ComSearch/search?q=${query}&type=${this.$i18n.locale}`
198
- )
199
- .then((response) => {
200
- this.options2 = []
201
- response.data.forEach((v) => {
202
- let t = v.menuPath.reverse().join('=>')
203
- if (this.$i18n.locale == 'en') {
204
- t = v.menuEnPath.reverse().join('=>')
205
- }
206
-
207
- this.options2.push({
208
- path: '/' + v.menuUrl + '?q=' + query,
209
- text: t + '=>' + v.content,
210
- })
211
- })
212
- })
213
- }
214
- },
215
- },
216
- }
217
- </script>
218
-
219
- <style lang="scss" scoped>
220
- .header-search {
221
- font-size: 0 !important;
222
-
223
- .search-icon {
224
- font-size: 18px;
225
- vertical-align: middle;
226
- display: inline-block;
227
- cursor: pointer;
228
- fill: #e4e9ef;
229
- /* width: 20px;
230
- height: 20px;
231
- vertical-align: 10px;*/
232
- }
233
-
234
- .header-search-select {
235
- font-size: 18px;
236
- transition: width 0.2s;
237
- width: 0;
238
- overflow: hidden;
239
- background: transparent;
240
- border-radius: 0;
241
- display: inline-block;
242
- vertical-align: middle;
243
-
244
- :deep(.el-input__inner) {
245
- border-radius: 0;
246
- border: 0;
247
- padding-left: 0;
248
- padding-right: 0;
249
- box-shadow: none !important;
250
- border-bottom: 1px solid #d9d9d9;
251
- vertical-align: middle;
252
- }
253
- }
254
-
255
- &.show {
256
- .header-search-select {
257
- width: 150px;
258
- margin-left: 10px;
259
- }
260
- }
261
- }
262
- </style>
@@ -1,259 +0,0 @@
1
- var audioContext = null
2
-
3
- ;(function (window) {
4
- // 兼容
5
- window.URL = window.URL || window.webkitURL
6
- navigator.getUserMedia =
7
- navigator.getUserMedia ||
8
- navigator.webkitGetUserMedia ||
9
- navigator.mozGetUserMedia ||
10
- navigator.msGetUserMedia
11
- var audoStream = null
12
- var HZRecorder = function (stream, config) {
13
- config = config || {}
14
- config.sampleBits = config.sampleBits || 16 // 采样数位 8, 16
15
- config.sampleRate = config.sampleRate || 8000 // 采样率(1/6 44100)
16
- if (!audioContext) {
17
- audioContext = new AudioContext()
18
- }
19
- audoStream = stream
20
- var context = audioContext
21
- var audioInput = context.createMediaStreamSource(stream)
22
- var recorder = context.createScriptProcessor(4096, 1, 1)
23
- var audioData = {
24
- size: 0, // 录音文件长度
25
- buffer: [], // 录音缓存
26
- inputSampleRate: context.sampleRate, // 输入采样率
27
- inputSampleBits: 16, // 输入采样数位 8, 16
28
- outputSampleRate: config.sampleRate, // 输出采样率
29
- oututSampleBits: config.sampleBits, // 输出采样数位 8, 16
30
- input: function (data) {
31
- this.buffer.push(new Float32Array(data))
32
- this.size += data.length
33
- },
34
- compress: function () {
35
- // 合并压缩
36
- // 合并
37
- var data = new Float32Array(this.size)
38
- var offset = 0
39
- for (var i = 0; i < this.buffer.length; i++) {
40
- data.set(this.buffer[i], offset)
41
- offset += this.buffer[i].length
42
- }
43
- // 压缩
44
- var compression = parseInt(this.inputSampleRate / this.outputSampleRate)
45
- var length = data.length / compression
46
- var result = new Float32Array(length)
47
- var index = 0,
48
- j = 0
49
- while (index < length) {
50
- result[index] = data[j]
51
- j += compression
52
- index++
53
- }
54
- return result
55
- },
56
- encodeWAV: function () {
57
- var sampleRate = Math.min(this.inputSampleRate, this.outputSampleRate)
58
- var sampleBits = Math.min(this.inputSampleBits, this.oututSampleBits)
59
- var bytes = this.compress()
60
- var dataLength = bytes.length * (sampleBits / 8)
61
- var buffer = new ArrayBuffer(44 + dataLength)
62
- var data = new DataView(buffer)
63
-
64
- var channelCount = 1 // 单声道
65
- var offset = 0
66
-
67
- var writeString = function (str) {
68
- for (var i = 0; i < str.length; i++) {
69
- data.setUint8(offset + i, str.charCodeAt(i))
70
- }
71
- }
72
-
73
- // 资源交换文件标识符
74
- writeString('RIFF')
75
- offset += 4
76
- // 下个地址开始到文件尾总字节数,即文件大小-8
77
- data.setUint32(offset, 36 + dataLength, true)
78
- offset += 4
79
- // WAV文件标志
80
- writeString('WAVE')
81
- offset += 4
82
- // 波形格式标志
83
- writeString('fmt ')
84
- offset += 4
85
- // 过滤字节,一般为 0x10 = 16
86
- data.setUint32(offset, 16, true)
87
- offset += 4
88
- // 格式类别 (PCM形式采样数据)
89
- data.setUint16(offset, 1, true)
90
- offset += 2
91
- // 通道数
92
- data.setUint16(offset, channelCount, true)
93
- offset += 2
94
- // 采样率,每秒样本数,表示每个通道的播放速度
95
- data.setUint32(offset, sampleRate, true)
96
- offset += 4
97
- // 波形数据传输率 (每秒平均字节数) 单声道×每秒数据位数×每样本数据位/8
98
- data.setUint32(
99
- offset,
100
- channelCount * sampleRate * (sampleBits / 8),
101
- true
102
- )
103
- offset += 4
104
- // 快数据调整数 采样一次占用字节数 单声道×每样本的数据位数/8
105
- data.setUint16(offset, channelCount * (sampleBits / 8), true)
106
- offset += 2
107
- // 每样本数据位数
108
- data.setUint16(offset, sampleBits, true)
109
- offset += 2
110
- // 数据标识符
111
- writeString('data')
112
- offset += 4
113
- // 采样数据总数,即数据总大小-44
114
- data.setUint32(offset, dataLength, true)
115
- offset += 4
116
- // 写入采样数据
117
- if (sampleBits === 8) {
118
- for (var i = 0; i < bytes.length; i++, offset++) {
119
- var s = Math.max(-1, Math.min(1, bytes[i]))
120
- var val = s < 0 ? s * 0x8000 : s * 0x7fff
121
- val = parseInt(255 / (65535 / (val + 32768)))
122
- data.setInt8(offset, val, true)
123
- }
124
- } else {
125
- for (var i = 0; i < bytes.length; i++, offset += 2) {
126
- var s = Math.max(-1, Math.min(1, bytes[i]))
127
- data.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7fff, true)
128
- }
129
- }
130
-
131
- return new Blob([data], { type: 'audio/wav' })
132
- },
133
- }
134
-
135
- // 开始录音
136
- this.start = function () {
137
- audioInput.connect(recorder)
138
- recorder.connect(context.destination)
139
- }
140
-
141
- // 停止
142
- this.stop = function () {
143
- if (audioContext) {
144
- audioContext.close()
145
- }
146
- audoStream.getTracks()[0].stop()
147
- audioContext = null
148
- }
149
-
150
- // 获取音频文件
151
- this.getBlob = function () {
152
- // this.stop();
153
- return audioData.encodeWAV()
154
- }
155
-
156
- // 回放
157
- this.play = function (audio) {
158
- audio.src = window.URL.createObjectURL(this.getBlob())
159
- }
160
-
161
- // 上传
162
- this.upload = function (url, callback) {
163
- var fd = new FormData()
164
- fd.append('file', this.getBlob())
165
- fd.append('mp3Name', 'myname.wav')
166
- var xhr = new XMLHttpRequest()
167
- if (callback) {
168
- xhr.upload.addEventListener(
169
- 'progress',
170
- function (e) {
171
- callback('uploading', e)
172
- },
173
- false
174
- )
175
- xhr.addEventListener(
176
- 'load',
177
- function (e) {
178
- callback('ok', e)
179
- },
180
- false
181
- )
182
- xhr.addEventListener(
183
- 'error',
184
- function (e) {
185
- callback('error', e)
186
- },
187
- false
188
- )
189
- xhr.addEventListener(
190
- 'abort',
191
- function (e) {
192
- callback('cancel', e)
193
- },
194
- false
195
- )
196
- }
197
- xhr.open('POST', url)
198
- xhr.send(fd)
199
- }
200
-
201
- // 音频采集
202
- recorder.onaudioprocess = function (e) {
203
- audioData.input(e.inputBuffer.getChannelData(0))
204
- // record(e.inputBuffer.getChannelData(0));
205
- }
206
- }
207
- // 抛出异常
208
- HZRecorder.throwError = function (message) {
209
- alert(message)
210
- throw new (function () {
211
- this.toString = function () {
212
- return message
213
- }
214
- })()
215
- }
216
- // 是否支持录音
217
- HZRecorder.canRecording = navigator.getUserMedia != null
218
- // 获取录音机
219
- HZRecorder.get = function (callback, config) {
220
- if (callback) {
221
- if (navigator.getUserMedia) {
222
- navigator.getUserMedia(
223
- { audio: true }, // 只启用音频
224
- function (stream) {
225
- var rec = new HZRecorder(stream, config)
226
- callback(rec)
227
- },
228
- function (error) {
229
- switch (error.code || error.name) {
230
- case 'PERMISSION_DENIED':
231
- case 'PermissionDeniedError':
232
- HZRecorder.throwError(this.$t('用户拒绝提供信息。'))
233
- break
234
- case 'NOT_SUPPORTED_ERROR':
235
- case 'NotSupportedError':
236
- HZRecorder.throwError(this.$t('浏览器不支持硬件设备。'))
237
- break
238
- case 'MANDATORY_UNSATISFIED_ERROR':
239
- case 'MandatoryUnsatisfiedError':
240
- HZRecorder.throwError(this.$t('无法发现指定的硬件设备。'))
241
- break
242
- default:
243
- HZRecorder.throwError(
244
- this.$t('无法打开麦克风。异常信息:') +
245
- (error.code || error.name)
246
- )
247
- break
248
- }
249
- }
250
- )
251
- } else {
252
- HZRecorder.throwErr(this.$t('当前浏览器不支持录音功能。'))
253
- return
254
- }
255
- }
256
- }
257
-
258
- window.HZRecorder = HZRecorder
259
- })(window)