This commit is contained in:
liuye
2022-06-22 10:25:07 +08:00
7 changed files with 34 additions and 39 deletions

View File

@@ -129,6 +129,7 @@
destroyed () { destroyed () {
document.body.removeEventListener('touchmove', this.bindEvent) document.body.removeEventListener('touchmove', this.bindEvent)
this.recorder.close()
}, },
onLoad () { onLoad () {
@@ -149,6 +150,19 @@
uni.$on('chooseEquipment', e => { uni.$on('chooseEquipment', e => {
this.equipmentList = e.equipmentList this.equipmentList = e.equipmentList
}) })
this.recorder = Recorder({
type: 'mp3',
sampleRate: 16000,
bitRate: 16,
onProcess(buffers, powerLevel, bufferDuration, bufferSampleRate, newBufferIdx, asyncEnd) {
//可利用extensions/waveview.js扩展实时绘制波形
}
})
this.recorder.open((e) => {
console.log(e)
}, e => {
console.log(e)
})
}, },
methods: { methods: {
@@ -157,6 +171,8 @@
}, },
onLongtap () { onLongtap () {
this.time = 60
if (!this.equipmentList.length) { if (!this.equipmentList.length) {
return this.$u.toast('请选择播发设备') return this.$u.toast('请选择播发设备')
} }
@@ -174,43 +190,23 @@
}, },
record () { record () {
this.duration = 0 this.recorder.start()
this.recorder = Recorder({ this.timing()
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 () { timing () {
this.time = this.time - 1
if (this.time === 0) { if (this.time === 0) {
this.stop() this.stop()
return false
} }
this.time = this.time - 1
this.timingTimeout = setTimeout(() => { this.timingTimeout = setTimeout(() => {
this.timing() this.timing()
}, 1000) }, 1000)
}, },
blobToDataURI(blob) {
return new Promise((resolve) => {
var reader = new FileReader()
reader.readAsDataURL(blob)
reader.onload = function (e) {
resolve(e.target.result)
}
})
},
play (url, index) { play (url, index) {
if (this.currIndex === index) { if (this.currIndex === index) {
this.innerAudioContext.destroy() this.innerAudioContext.destroy()
@@ -237,9 +233,6 @@
stop (isCancel) { stop (isCancel) {
clearTimeout(this.timingTimeout) clearTimeout(this.timingTimeout)
this.recorder.stop((blob, duration) => { this.recorder.stop((blob, duration) => {
this.recorder.close()
this.recorder = null
if (isCancel) { if (isCancel) {
this.time = 60 this.time = 60
return false return false
@@ -275,21 +268,20 @@
this.isShow = false this.isShow = false
}).catch(() => { }).catch(() => {
this.isShow = false this.isShow = false
uni.hideLoading()
}) })
} else { } else {
this.isShow = false this.isShow = false
} }
}).catch(() => { }).catch(() => {
uni.hideLoading()
this.isShow = false this.isShow = false
}) })
this.time = 60
console.log(blob, (window.URL || webkitURL).createObjectURL(blob), '时长:' + duration + 'ms') console.log(blob, (window.URL || webkitURL).createObjectURL(blob), '时长:' + duration + 'ms')
}, msg => { }, msg => {
console.log('录音失败:' + msg) console.log('录音失败:' + msg)
this.recorder.close()
this.isShow = false this.isShow = false
this.recorder = null
}) })
}, },

View File

@@ -36,6 +36,8 @@
import { mapState } from 'vuex' import { mapState } from 'vuex'
export default { export default {
name: "selectEquipment", name: "selectEquipment",
appName: '选择设备',
data() { data() {
return { return {
areaId: '', areaId: '',

View File

@@ -23,8 +23,8 @@ instance.interceptors.request.use(config => {
}) })
instance.interceptors.response.use(res => { instance.interceptors.response.use(res => {
uni.hideLoading()
if (res.data) { if (res.data) {
uni.hideLoading()
if (res.data.access_token) { if (res.data.access_token) {
return res.data return res.data
} }

View File

@@ -55,7 +55,7 @@ export const config = {
} }
}, },
getCode({state, dispatch}, tryAgentSign = false) { getCode({state, dispatch}, tryAgentSign = false) {
let {corpid: corpId, suiteId} = state, url = location.href, REDIRECT_URI = encodeURIComponent(url), scope = "snsapi_base" let {corpid: corpId, suiteId, agentid: agentId} = state, url = location.href, REDIRECT_URI = encodeURIComponent(url), scope = "snsapi_privateinfo"
if (/\/AppForm\//.test(location.search)) { if (/\/AppForm\//.test(location.search)) {
scope = "snsapi_userinfo" scope = "snsapi_userinfo"
} else if (suiteId) { } else if (suiteId) {
@@ -64,10 +64,11 @@ export const config = {
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (corpId && scope) { if (corpId && scope) {
let oauthURL = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE#wechat_redirect' let oauthURL = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&agentid=AGENTID#wechat_redirect'
.replace(/APPID/g, corpId) .replace(/APPID/g, corpId)
.replace(/REDIRECT_URI/g, REDIRECT_URI) .replace(/REDIRECT_URI/g, REDIRECT_URI)
.replace(/SCOPE/g, scope) .replace(/SCOPE/g, scope)
.replace(/AGENTID/g, agentId)
location.replace(oauthURL) location.replace(oauthURL)
} else if (!tryAgentSign) { } else if (!tryAgentSign) {
dispatch("agentSign", {corpId, suiteId}).then(() => dispatch("getCode", true)).then(() => resolve()) dispatch("agentSign", {corpId, suiteId}).then(() => dispatch("getCode", true)).then(() => resolve())

View File

@@ -43,7 +43,7 @@
methods: { methods: {
getList (date) { getList (date) {
this.$http.post(`/api/appattendancerecord/userphotosort?queryTime=${date}`).then(res => { this.$http.post(`/api/appattendancerecord/alluserphotosort?queryTime=${date}`).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.list = Object.keys(res.data).map(v => { this.list = Object.keys(res.data).map(v => {
return { return {

View File

@@ -12,7 +12,7 @@
<div <div
class="watermark" class="watermark"
v-if="currIndex > -1 && currWatermarkConfig.length" v-if="currIndex > -1 && currWatermarkConfig.length"
:style="{left: x + 'px', top: y + 'px', transform: 'scale(' + watermarkScale + ')' }" :style="{left: x + 'px', top: y + 'px', transform: 'scale(' + watermarkScale + ')', transformOrigin: 'left' }"
@touchstart="onTouchstart" @touchstart="onTouchstart"
@touchmove="onTouchmove"> @touchmove="onTouchmove">
<component ref="WatermarkItem" :is="'Watermark' + (currIndex + 1)" :config="currWatermarkConfig"></component> <component ref="WatermarkItem" :is="'Watermark' + (currIndex + 1)" :config="currWatermarkConfig"></component>
@@ -141,7 +141,7 @@
data () { data () {
return { return {
img: '', img: '',
currIndex: -1, currIndex: 0,
isHide: true, isHide: true,
height: '100%', height: '100%',
waterSrc: '', waterSrc: '',

View File

@@ -102,7 +102,7 @@
if (v.length) { if (v.length) {
const title = v.filter(v => v.type === '17')[0] const title = v.filter(v => v.type === '17')[0]
const hoster = v.filter(v => v.type === '26')[0] const hoster = v.filter(v => v.type === '26')[0]
const date = v.filter(v => v.type === '0')[0] const date = v.filter(v => v.type === '1')[0]
const address = v.filter(v => v.type === '29')[0] const address = v.filter(v => v.type === '29')[0]
const remark = v.filter(v => v.type === '31')[0] const remark = v.filter(v => v.type === '31')[0]
const theme = v.filter(v => v.type === '30')[0] const theme = v.filter(v => v.type === '30')[0]