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="line19 animation"></span>
<span class="line20 animation"></span> <span class="line20 animation"></span>
</div> </div>
<h2>00:00:13</h2> <h2>{{ time }}</h2>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import Recorder from 'recorder-core'
import 'recorder-core/src/engine/mp3'
import 'recorder-core/src/engine/mp3-engine'
export default { export default {
name: 'LiveBroadcast', name: 'LiveBroadcast',
@@ -77,7 +80,13 @@
closeW: require('./img/close-w.png'), closeW: require('./img/close-w.png'),
isShow: false, isShow: false,
isImpact: 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.isImpact = false
this.startTime = new Date().getTime() this.startTime = new Date().getTime()
this.isShow = true 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 () { onTouchend () {
if (this.isShow && new Date().getTime() - this.startTime < 1500) { if (this.isShow && new Date().getTime() - this.startTime < 1500) {
this.isImpact = false this.isImpact = false
this.isShow = false this.isShow = false
this.stop(true)
return this.$u.toast('说话时间太短') return this.$u.toast('说话时间太短')
} }
if (this.isImpact) { if (this.isImpact) {
this.isShow = false this.isShow = false
this.isImpact = false this.isImpact = false
this.stop(true)
return false return false
} }
this.isImpact = false this.isImpact = false
this.submit() this.stop()
}, },
onTouchmove (e) { onTouchmove (e) {

View File

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

View File

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

View File

@@ -10,7 +10,7 @@
<AiMore v-model="params.girdName" icon="arrow-down"/> <AiMore v-model="params.girdName" icon="arrow-down"/>
</div> </div>
</AiPagePicker> </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> </div>
<component v-if="refresh" :is="component" @change="onChange" :params="params"/> <component v-if="refresh" :is="component" @change="onChange" :params="params"/>
<div class="tabs" v-if="isTab"> <div class="tabs" v-if="isTab">

View File

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

View File

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

View File

@@ -15,6 +15,7 @@
<!-- <div @click="handleTag(item)">标签设置</div>--> <!-- <div @click="handleTag(item)">标签设置</div>-->
</div> </div>
</div> </div>
<AiEmpty v-if="!list.length"/>
<div class="btn" v-if="detail.girdRight == 1"> <div class="btn" v-if="detail.girdRight == 1">
<span class="del" @click="del" v-if="!!detail.parentGirdId">删除网格</span> <span class="del" @click="del" v-if="!!detail.parentGirdId">删除网格</span>
<span class="edit" @click="edit">编辑网格</span> <span class="edit" @click="edit">编辑网格</span>