Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
huamu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郭铭瑶
huamu
Commits
622e50b1
Commit
622e50b1
authored
Oct 21, 2021
by
郭铭瑶
🤘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
10/21第2~6点改动测试
parent
3498feca
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
37 deletions
+43
-37
useInitMap.ts
src/hooks/useInitMap.ts
+3
-2
useVoiceRecorder.ts
src/hooks/useVoiceRecorder.ts
+4
-16
iat-recorder.js
src/util/iat-recorder.js
+7
-6
map.vue
src/view/components/map.vue
+1
-1
new-activity-drawer.vue
src/view/components/new-activity-drawer.vue
+28
-12
No files found.
src/hooks/useInitMap.ts
View file @
622e50b1
...
...
@@ -14,7 +14,7 @@ import store from '@/store'
export
default
async
function
useInitMap
(
el
:
HTMLElement
,
camera
:
any
,
show
Area
:
any
,
show
Committee
:
any
,
showBuilding
:
any
,
)
{
const
config
=
api
.
MAP_CONFIG
...
...
@@ -300,13 +300,14 @@ export default async function useInitMap(
data
?.[
'管辖范围'
]?.
map
(
(
item
:
any
)
=>
item
?.[
'范围名称'
],
)
||
[]
areas
.
forEach
((
area
)
=>
show
Area
(
area
))
areas
.
forEach
((
area
)
=>
show
Committee
(
area
))
// TODO 待测试
}
else
if
(
data
?.[
'类别'
]?.
includes
(
'两新'
))
{
const
buildings
=
data
?.[
'管辖楼宇'
]?.
map
((
item
:
any
)
=>
item
?.
OBJECTID
)
||
[]
buildings
.
forEach
((
building
)
=>
showBuilding
(
building
))
// window.modelHighlight = buildings.map((building) => building && layerView.highlight(building))
// TODO 待测试
}
}
else
if
(
data
?.
isList
)
{
...
...
src/hooks/useVoiceRecorder.ts
View file @
622e50b1
import
IatRecorder
from
'@/util/iat-recorder'
import
{
onBeforeUnmount
,
ref
}
from
'vue'
type
Status
=
'init'
|
'ing'
|
'end'
type
Status
=
'init'
|
'ing'
|
'
stop'
|
'
end'
export
default
function
useVoiceRecorder
()
{
const
iatRecorder
:
any
=
new
IatRecorder
()
const
result
=
ref
(
''
)
const
status
=
ref
<
Status
>
(
'init'
)
const
timer
:
any
=
null
iatRecorder
.
onTextChange
=
function
(
txt
:
string
)
{
result
.
value
=
txt
}
iatRecorder
.
onWillStatusChange
=
function
(
_
,
curStatus
:
Status
)
{
status
.
value
=
curStatus
// let seconds = 0
// if (curStatus === 'ing') {
// timer = setInterval(() => {
// seconds += 1
// if (seconds >= 60) {
// iatRecorder.stop()
// clearInterval(timer)
// }
// }, 1000)
// }
}
onBeforeUnmount
(()
=>
{
iatRecorder
.
stop
()
timer
&&
clearInterval
(
timer
)
resetRecorder
()
})
function
toggleRecorder
()
{
...
...
@@ -37,12 +25,12 @@ export default function useVoiceRecorder() {
}
}
function
reset
()
{
function
reset
Recorder
()
{
iatRecorder
.
stop
()
iatRecorder
.
status
===
'init'
status
.
value
=
'init'
result
.
value
=
''
}
return
{
result
,
toggleRecorder
,
status
,
reset
}
return
{
result
,
toggleRecorder
,
status
,
reset
Recorder
}
}
src/util/iat-recorder.js
View file @
622e50b1
...
...
@@ -87,10 +87,10 @@ export default class IatRecorder {
this
.
result
(
e
.
data
)
}
iatWS
.
onerror
=
(
e
)
=>
{
this
.
recorderStop
()
this
.
recorderStop
(
'end'
)
}
iatWS
.
onclose
=
(
e
)
=>
{
this
.
recorderStop
()
this
.
recorderStop
(
'end'
)
}
})
}
...
...
@@ -197,7 +197,7 @@ export default class IatRecorder {
}
}
// 暂停录音
recorderStop
()
{
recorderStop
(
status
)
{
// safari下suspend后再次resume录音内容将是空白,设置safari下不做suspend
if
(
!
(
...
...
@@ -206,7 +206,7 @@ export default class IatRecorder {
)
{
this
.
audioContext
&&
this
.
audioContext
.
suspend
()
}
this
.
setStatus
(
'end'
)
this
.
setStatus
(
status
)
}
// 处理音频数据
// transAudioData(audioData) {
...
...
@@ -237,8 +237,9 @@ export default class IatRecorder {
language
:
this
.
language
,
//小语种可在控制台--语音听写(流式)--方言/语种处添加试用
domain
:
'iat'
,
accent
:
this
.
accent
,
//中文方言可在控制台--语音听写(流式)--方言/语种处添加试用
vad_eos
:
5
000
,
vad_eos
:
2
000
,
dwa
:
'wpgs'
,
//为使该功能生效,需到控制台开通动态修正功能(该功能免费)
ptt
:
1
,
},
data
:
{
status
:
0
,
...
...
@@ -329,6 +330,6 @@ export default class IatRecorder {
this
.
setResultText
({
resultText
:
''
,
resultTextTemp
:
''
})
}
stop
()
{
this
.
recorderStop
()
this
.
recorderStop
(
'stop'
)
}
}
src/view/components/map.vue
View file @
622e50b1
...
...
@@ -25,7 +25,7 @@ onMounted(async () => {
await
nextTick
()
if
(
mapRef
.
value
)
{
// eslint-disable-next-line
await
useInitMap
(
mapRef
.
value
,
camera
,
show
Area
,
showBuilding
)
await
useInitMap
(
mapRef
.
value
,
camera
,
show
Committee
,
showBuilding
)
}
})
...
...
src/view/components/new-activity-drawer.vue
View file @
622e50b1
...
...
@@ -266,6 +266,7 @@
v-model:value=
"detailData.attachment"
placeholder=
"请输入活动内容描述(800字以内)"
type=
"textarea"
:on-input=
"onInput"
/>
</n-form-item-gi>
<n-form-item-gi
...
...
@@ -339,18 +340,24 @@ import useAliOss from '@/hooks/useAliOss'
import
useExportDocx
from
'@/hooks/useExportDocx'
import
useVoiceRecorder
from
'@/hooks/useVoiceRecorder'
const
{
result
,
toggleRecorder
,
status
}
=
useVoiceRecorder
()
watch
(
()
=>
result
.
value
,
(
txt
)
=>
{
console
.
log
(
'txt'
,
txt
)
if
(
!
detailData
.
value
.
attachment
)
{
detailData
.
value
.
attachment
=
txt
const
{
result
,
toggleRecorder
,
status
,
resetRecorder
}
=
useVoiceRecorder
()
const
activityDescribtion
=
ref
(
''
)
watch
([()
=>
result
.
value
,
()
=>
status
.
value
],
([
txt
,
sta
])
=>
{
if
(
!
txt
)
return
if
(
activityDescribtion
.
value
)
{
detailData
.
value
.
attachment
=
activityDescribtion
.
value
+
txt
}
else
{
detailData
.
value
.
attachment
+
=
txt
detailData
.
value
.
attachment
=
txt
}
},
)
if
(
sta
===
'end'
)
{
activityDescribtion
.
value
=
detailData
.
value
.
attachment
}
})
function
onInput
(
val
)
{
if
(
!
val
)
{
resetRecorder
()
}
}
const
message
=
useMessage
()
const
props
=
defineProps
({
data
:
{
...
...
@@ -391,6 +398,7 @@ watch(
const
show
=
computed
(()
=>
store
.
state
.
showNewActivityDrawer
)
const
closeDrawer
=
()
=>
{
store
.
commit
(
'SET_NEW_ACTIVITY_DRAWER'
,
false
)
resetRecorder
()
basicData
.
value
=
{}
memberData
.
value
=
{}
detailData
.
value
=
{}
...
...
@@ -422,6 +430,14 @@ const basicData = ref<any>({})
const
memberData
=
ref
<
any
>
({})
const
detailData
=
ref
<
any
>
({})
watch
(
()
=>
detailData
.
value
,
(
data
)
=>
{
if
(
data
?.
describeType
!==
'text'
)
{
resetRecorder
()
}
},
)
watch
(
()
=>
props
.
data
,
(
data
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment