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 () {
document.body.removeEventListener('touchmove', this.bindEvent)
this.recorder.close()
},
onLoad () {
@@ -149,6 +150,19 @@
uni.$on('chooseEquipment', e => {
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: {
@@ -157,6 +171,8 @@
},
onLongtap () {
this.time = 60
if (!this.equipmentList.length) {
return this.$u.toast('请选择播发设备')
}
@@ -174,43 +190,23 @@
},
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()
})
this.recorder.start()
this.timing()
},
timing () {
this.time = this.time - 1
if (this.time === 0) {
this.stop()
return false
}
this.time = this.time - 1
this.timingTimeout = setTimeout(() => {
this.timing()
}, 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) {
if (this.currIndex === index) {
this.innerAudioContext.destroy()
@@ -237,9 +233,6 @@
stop (isCancel) {
clearTimeout(this.timingTimeout)
this.recorder.stop((blob, duration) => {
this.recorder.close()
this.recorder = null
if (isCancel) {
this.time = 60
return false
@@ -275,21 +268,20 @@
this.isShow = false
}).catch(() => {
this.isShow = false
uni.hideLoading()
})
} else {
this.isShow = false
}
}).catch(() => {
uni.hideLoading()
this.isShow = false
})
this.time = 60
console.log(blob, (window.URL || webkitURL).createObjectURL(blob), '时长:' + duration + 'ms')
}, msg => {
console.log('录音失败:' + msg)
this.recorder.close()
this.isShow = false
this.recorder = null
})
},

View File

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

View File

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

View File

@@ -55,7 +55,7 @@ export const config = {
}
},
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)) {
scope = "snsapi_userinfo"
} else if (suiteId) {
@@ -64,10 +64,11 @@ export const config = {
}
return new Promise((resolve, reject) => {
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(/REDIRECT_URI/g, REDIRECT_URI)
.replace(/SCOPE/g, scope)
.replace(/AGENTID/g, agentId)
location.replace(oauthURL)
} else if (!tryAgentSign) {
dispatch("agentSign", {corpId, suiteId}).then(() => dispatch("getCode", true)).then(() => resolve())

View File

@@ -43,7 +43,7 @@
methods: {
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) {
this.list = Object.keys(res.data).map(v => {
return {

View File

@@ -12,7 +12,7 @@
<div
class="watermark"
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"
@touchmove="onTouchmove">
<component ref="WatermarkItem" :is="'Watermark' + (currIndex + 1)" :config="currWatermarkConfig"></component>
@@ -141,7 +141,7 @@
data () {
return {
img: '',
currIndex: -1,
currIndex: 0,
isHide: true,
height: '100%',
waterSrc: '',

View File

@@ -102,7 +102,7 @@
if (v.length) {
const title = v.filter(v => v.type === '17')[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 remark = v.filter(v => v.type === '31')[0]
const theme = v.filter(v => v.type === '30')[0]