This commit is contained in:
liuye
2022-06-08 14:33:09 +08:00
7 changed files with 84 additions and 19 deletions

View File

@@ -54,13 +54,16 @@
<span class="line19 animation"></span>
<span class="line20 animation"></span>
</div>
<h2>00:00:13</h2>
<h2>{{ time }}</h2>
</div>
</div>
</template>
<script>
import { mapState } from 'vuex'
import Recorder from 'recorder-core'
import 'recorder-core/src/engine/mp3'
import 'recorder-core/src/engine/mp3-engine'
export default {
name: 'LiveBroadcast',
@@ -77,7 +80,13 @@
closeW: require('./img/close-w.png'),
isShow: false,
isImpact: false,
startTime: 0
startTime: 0,
isRecording: false,
recorder: null,
blobFile: null,
counterDownTime: 0,
time: '00:00:00',
timingTimeout: null
}
},
@@ -99,24 +108,76 @@
this.isImpact = false
this.startTime = new Date().getTime()
this.isShow = true
this.record()
},
record () {
this.duration = 0
this.recorder = Recorder({
type: 'mp3',
sampleRate: 16000,
bitRate: 16,
onProcess(buffers, powerLevel, bufferDuration, bufferSampleRate, newBufferIdx, asyncEnd) {
//可利用extensions/waveview.js扩展实时绘制波形
}
})
this.recorder.open(() => {
this.recorder.start()
this.timing()
})
},
timing () {
var durationObj = this.$dayjs.duration(this.counterDownTime * 1000)
var hours = durationObj.hours() > 9 ? durationObj.hours() : '0' + durationObj.hours()
var min = durationObj.minutes() > 9 ? durationObj.minutes() : '0' + durationObj.minutes()
var seconds = durationObj.seconds() > 9 ? durationObj.seconds() : '0' + durationObj.seconds()
this.time = hours + ':' + min + ':' + seconds
this.counterDownTime++
this.timingTimeout = setTimeout(() => {
this.timing()
}, 1000)
},
stop (isCancel) {
this.counterDownTime = 0
clearTimeout(this.timingTimeout)
this.recorder.stop((blob, duration) => {
this.recorder.close()
this.recorder = null
if (!isCancel) {
this.blobFile = blob
}
this.time = '00:00:00'
console.log(blob, (window.URL || webkitURL).createObjectURL(blob), '时长:' + duration + 'ms')
}, msg => {
console.log('录音失败:' + msg)
this.recorder.close()
this.recorder = null
})
},
onTouchend () {
if (this.isShow && new Date().getTime() - this.startTime < 1500) {
this.isImpact = false
this.isShow = false
this.stop(true)
return this.$u.toast('说话时间太短')
}
if (this.isImpact) {
this.isShow = false
this.isImpact = false
this.stop(true)
return false
}
this.isImpact = false
this.submit()
this.stop()
},
onTouchmove (e) {

View File

@@ -20,7 +20,7 @@
</AiPagePicker>
</AiItem>
</AiGroup>
<div class="footer" @click="confirm">{{ fromType == 'add' ? '确认添加' : '确认修改' }}</div>
<div class="footer" @click="$u.debounce(confirm)">{{ fromType == 'add' ? '确认添加' : '确认修改' }}</div>
</div>
</template>
@@ -86,7 +86,6 @@ export default {
name: item.name
}
})
uni.showLoading({mask: true})
this.$http.post(`/app/appgirdinfo/addOrUpdateByEw`, {...this.form, girdMemberManageList, girdMemberList}).then((res) => {
if (res?.code == 0) {
this.$u.toast('提交成功')
@@ -97,8 +96,7 @@ export default {
}
}).catch((err) => {
this.$u.toast(err)
}).finally(() => uni.hideLoading())
})
},
getArrayLabel(arr, key = 'name', separation = '') {
return arr?.map(e => e[key])?.join(separation)

View File

@@ -21,7 +21,6 @@
<span class="tips">*</span>所属网格
</div>
<div class="value" @click="linkTo('./SelectGird?formType=2')">
<span v-if="selectGird.girdName">{{selectGird.girdName}}</span>
<span style="color:#999;" v-else>请选择</span>
<img src="./components/img/right-icon.png" alt="" /></div>

View File

@@ -10,7 +10,7 @@
<AiMore v-model="params.girdName" icon="arrow-down"/>
</div>
</AiPagePicker>
<span @click="linkTo('./SetGird?id='+params.id)" v-if="isGridAdmin">网格配置</span>
<span @click="linkTo('./SetGird?id='+params.id)" v-if="isGridAdmin&&!!params.id">网格配置</span>
</div>
<component v-if="refresh" :is="component" @change="onChange" :params="params"/>
<div class="tabs" v-if="isTab">

View File

@@ -53,13 +53,15 @@ export default {
},
isGridMember() {
return this.user.girdCheckType > 0
}
},
//是否是网格员申报
isApply: v => v.$route.query.formType == 2
},
onLoad(option) {
if (option.isFormMap) {
this.isFormMap = option.isFormMap
}
this.isGridMember ? this.getAllGrids() : this.$u.toast('当前人员不是网格员或网格长')
this.isGridMember || this.isApply ? this.getAllGrids() : this.$u.toast('当前人员不是网格员或网格长')
},
methods: {
getAllGrids() {
@@ -67,6 +69,10 @@ export default {
let {girdMemberId} = this.user,
url = `/app/appgirdinfo/queryAppGirdInfoByGirdLevel`,
params = {girdMemberId}
if (this.isApply) {
url = `/app/appgirdinfo/listByInfo`
params = {}
}
if (this.isMyGirds) {
url = `/app/appgirdmemberinfo/queryMyGirdListByLevel2AndUser`
params = {}
@@ -81,7 +87,7 @@ export default {
},
treeInit(isClick) {
let last = uni.getStorageSync("lastSelectedGrid")
if (!isClick && last) {
if (!isClick && last && !this.isApply) {
this.$http.post("/app/appgirdinfo/listFatherGirdInfo", null, {
params: {girdId: last}
}).then(res => {

View File

@@ -21,8 +21,8 @@
</AiGroup>
<div class="subBtn" v-if="detail.girdRight==1">
<div @click="toAddGird">添加下级网格</div>
<div @click="handleDelete">编辑网格</div>
<div class="delete" @click="toAddGird">删除网格</div>
<div @click="edit">编辑网格</div>
<div class="delete" @click="handleDelete">删除网格</div>
</div>
</div>
</template>
@@ -74,11 +74,11 @@ export default {
uni.navigateTo({url: `./AddGird?id=${this.detail.id}&fromType=edit`})
},
handleDelete() {
this.$confirm('删除网格后,会清除网格内网格员责任家庭信息,如有下级网格,会同步删除下级网格所有数据', `您确认要删除该网格?`).then(() => {
this.$confirm('删除网格后,会清除网格内网格员责任家庭信息,如有下级网格,会同步删除下级网格所有数据', `您确认要删除该网格?`).then(() => {
this.$http.post(`/app/appgirdinfo/delete?ids=${this.detail.id}`).then((res) => {
if (res?.code == 0) {
this.$u.toast('删除成功!')
this.getDetail()
uni.navigateBack({})
}
})
})

View File

@@ -2,7 +2,7 @@
<section class="gridMembers">
<div class="title">{{ detail.girdName }}</div>
<div flex v-for="(item, index) in list" :key="index" class="listItem">
<!-- <img class="avatar" :src="item.photo"/>-->
<!-- <img class="avatar" :src="item.photo"/>-->
<div class="fill">
<div class="memberName" v-text="item.name"/>
<div flex>
@@ -12,9 +12,10 @@
</div>
<div class="btns">
<div @click="gotoFamilyList(item)">责任家庭</div>
<!-- <div @click="handleTag(item)">标签设置</div>-->
<!-- <div @click="handleTag(item)">标签设置</div>-->
</div>
</div>
<AiEmpty v-if="!list.length"/>
<div class="btn" v-if="detail.girdRight == 1">
<span class="del" @click="del" v-if="!!detail.parentGirdId">删除网格</span>
<span class="edit" @click="edit">编辑网格</span>