Commit 4979ebbe by 前端

记录

1 parent b3d647d1
......@@ -5,13 +5,13 @@
"configurations" : [
{
"app-plus" : {
"launchtype" : "remote"
"launchtype" : "local"
},
"default" : {
"launchtype" : "local"
},
"h5" : {
"launchtype" : "remote"
"launchtype" : "local"
},
"mp-weixin" : {
"launchtype" : "local"
......
......@@ -34,6 +34,14 @@ module.exports = {
...data
})
},
searchRecordingEndTime(data) {
return http.post({
method: 'dj.api.smartcarlife.recepiton.customer.searchRecordingEndTime',
projectName: 'boutique',
...data
})
},
getToken(data) {
return http.post({
method: 'dj.api.smartcarlife.recepiton.customer.oss.getToken',
......
<template>
<MessageBox
ref="employeeBoxVisible"
position="bottom"
:isFooter="false"
:title="`请选择${title}`"
:maxHeight="1000"
@close="$emit('close')"
>
<MessageBox ref="employeeBoxVisible" position="bottom" :isFooter="false" :title="`请选择${title}`" :maxHeight="1000" @close="$emit('close')">
<view class="select-box">
<view
class="select-item"
:class="{ checked: salesUuid == item.uuid }"
@click="handleSelect(item)"
v-for="(item, index) in employeeList"
:key="index"
>
<view class="select-item" :class="{ checked: salesUuid == item.uuid }" @click="handleSelect(item)" v-for="(item, index) in employeeList" :key="index">
{{ item.staffName }}
</view>
</view>
</MessageBox>
</template>
<script type='text/ecmascript-6'>
<script type="text/ecmascript-6">
export default {
name: 'Employee',
props: {
title: {
type: String,
default: '销售'
},
salesPropsUuid: {
type: String,
default: ''
}
},
data () {
......@@ -47,7 +38,7 @@ export default {
return this.$store.state.user.historyStatus
},
salesUuid () {
return this.$store.state.user.customerInfo.salesUuid
return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid
},
employeeList () {
return this.$store.state.user.employeeList
......@@ -81,7 +72,7 @@ export default {
}
</script>
<style scoped lang='scss'>
<style scoped lang="scss">
.select-box {
margin: 40rpx 0;
display: grid;
......@@ -104,4 +95,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
......@@ -4,50 +4,36 @@
<view class="user-avatar sprite-icon icon-avatar"></view>
<view class="user-name">{{ userInfo.name }}</view>
</view>
<view :class="['left-tabs', {'three':tabs.length == 3}]">
<view :class="['left-tabs', { three: tabs.length == 3 }]">
<template v-for="(i, index) in tabs">
<view
:class="['tab-item', { tabActive: tabIndex == index }]"
:key="index"
@click="changeIndex(index)"
>
<view :class="['tab-item', { tabActive: tabIndex == index }]" :key="index" @click="changeIndex(index)">
<view class="icon-box">
<view :class="[
'sprite-icon',
`icon-${i.icon}${tabIndex == index ? '-active' : ''}`,
]"></view>
<view :class="['sprite-icon', `icon-${i.icon}${tabIndex == index ? '-active' : ''}`]"></view>
</view>
{{ i.label }}
<view class="dot" v-if="i.icon == 'record' && perRecordNumber"></view>
</view>
</template>
</view>
<view class="left-footer">
<view
class="btn"
@click="$refs.kfRef.open()"
>
<view class="btn" @click="$refs.kfRef.open()">
<view class="sprite-icon icon-feedback"></view>
</view>
<view
class="btn"
@click="$refs.settingRef.open()"
>
<view class="btn" @click="$refs.settingRef.open()">
<view class="sprite-icon icon-setting"></view>
</view>
</view>
<!-- 客服弹框 -->
<!-- 客服弹框 -->
<kf-box ref="kfRef" />
<!-- 设置弹框 -->
<setting-box
ref="settingRef"
@stopAudio="$emit('stopAudio')"
/>
<setting-box ref="settingRef" @stopAudio="$emit('stopAudio')" />
</view>
</template>
<script type='text/ecmascript-6'>
<script type="text/ecmascript-6">
import KfBox from "./KfBox";
import SettingBox from "./SettingBox";
import { STORAGE_OBJECTkEY } from '@/utils/cache/constantData'
export default {
components: { KfBox, SettingBox },
props:{
......@@ -74,6 +60,11 @@ export default {
if(n.shopMerchantId) this.haveCustomerAccess(n.shopMerchantId)
}
},
computed: {
perRecordNumber() {
return this.$store.state.audio.perRecordNumber
}
},
mounted () {
},
methods: {
......@@ -96,7 +87,7 @@ export default {
}
</script>
<style scoped lang='scss'>
<style scoped lang="scss">
.left-side {
display: flex;
flex-direction: column;
......@@ -134,6 +125,16 @@ export default {
color: #8a98b5;
text-align: center;
padding-bottom: 96rpx;
position: relative;
.dot {
width: 16rpx;
height: 16rpx;
background: #f24724;
border-radius: 50%;
position: absolute;
right: 20rpx;
top: 20rpx;
}
.icon-box {
width: 112rpx;
height: 112rpx;
......@@ -213,5 +214,4 @@ export default {
padding-left: 60rpx;
}
}
</style>
\ No newline at end of file
</style>
......@@ -34,6 +34,7 @@
{{ i.tabName }}
<template v-if="index == 1 && i.num && recordFailList.length > 0">({{ recordFailList.length }})</template>
<template v-if="index == 2 && i.num && preRecordFailList.length > 0">({{ preRecordFailList.length }})</template>
<div class="dot" :style="{ right: '86rpx' }" v-if="index == 2 && i.num && preRecordFailList.length > 0"></div>
</view>
</view>
</view>
......@@ -69,7 +70,7 @@
<template v-for="(k, ind) in itemObject">
<view class="info flex" :key="ind">
<view class="label">{{ k.label }}</view>
<view class="value">{{ item[k.key] || '-' }}</view>
<view class="value">{{ formatValue(item[k.key], k.key) || '-' }}</view>
</view>
</template>
</view>
......@@ -98,7 +99,7 @@ import dayjs from 'dayjs'
const dayImgUrl = require('@/assets/images/common/day.webp')
const weekImgUrl = require('@/assets/images/common/week.webp')
const monthImgUrl = require('@/assets/images/common/month.webp')
import { STORAGE_OBJECTkEY ,DEFAULT_GET_STORAGEKEY} from '@/utils/cache/constantData'
import { STORAGE_OBJECTkEY } from '@/utils/cache/constantData'
import interruptRecord from '@/utils/recordManager/interruptRecord'
import saveRecord from './saveRecord.vue'
export default {
......@@ -141,7 +142,7 @@ export default {
{ text: '本月' },
],
itemObject: [
{ label: '客户电话', key: 'phoneNumberSplit' },
{ label: '客户电话', key: 'phoneNumber' },
{ label: '销售姓名', key: 'salesName' },
{ label: '接待时长', key: 'duration' },
{ label: '开始接待', key: 'startTime' },
......@@ -167,6 +168,13 @@ export default {
this.getPreRecordNum()
},
methods: {
formatValue(val,k) {
if(!val) return
if(k == 'phoneNumber') {
return val.slice(0, 3) + " " + val.slice(3, 7) + " " + val.slice(7)
}
return val
},
handleCancel() {
this.showRecord = true;
},
......@@ -227,13 +235,15 @@ export default {
this.list[0] = this.preRecordFailList.map(i => {
return Object.assign(i,{
duration: 0,
startTime: i.receptionStartTime.replace(/\//g, '.')
startTime:i.receptionStartTime && i.receptionStartTime.replace(/\//g, '.')
})
})
this.nothing = this.preRecordFailList.length ? true : false
},
getPreRecordNum() {
const preRecordList = uni.$storage.get(STORAGE_OBJECTkEY.preRecordList)||[]
console.log(preRecordList)
this.preRecordFailList = preRecordList
},
getRecordFail () {
......@@ -316,11 +326,9 @@ export default {
})
uni.hideLoading()
list?.length && list.map(e => {
let phoneNumber = e.phoneNumber
e.duration = this.formatSeconds(e.receptionEndTime - e.receptionStartTime)
e.startTime = dayjs(e.receptionStartTime).format("YYYY.MM.DD HH:mm:ss")
e.endTime = dayjs(e.receptionEndTime).format("YYYY.MM.DD HH:mm:ss")
e.phoneNumberSplit = phoneNumber.slice(0, 3) + " " + phoneNumber.slice(3, 7) + " " + phoneNumber.slice(7)
})
if (pageNum == 1) {
const record = {
......@@ -446,6 +454,14 @@ export default {
position: relative;
text-align: center;
width: 400rpx;
.dot {
width: 16rpx;
height: 16rpx;
background: #f24724;
position: absolute;
top: 40rpx;
border-radius: 50%;
}
}
.active {
position: absolute;
......
......@@ -29,7 +29,7 @@
<view class="submit-btn" @click="handleSave">提交</view>
</view>
<car-brands ref="carBrandListVisible" @select="handleSelect($event, 'carBrandListVisible')" />
<employee ref="employeeBoxVisible" @select="handleSelect($event, 'employeeBoxVisible')" />
<employee ref="employeeBoxVisible" :salesPropsUuid="customerInfo.salesUuid" @select="handleSelect($event, 'employeeBoxVisible')" />
<MessageBox ref="receptionStatusVisible" position="bottom" :isFooter="false" title="请选择接待结果" :maxHeight="1000">
<view class="select-box">
<view class="select-item" :class="{ checked: customerInfo.receptionStatus == item.label }" @click="selectReception(item.label)" v-for="(item, index) in receptionList" :key="index">
......@@ -110,6 +110,7 @@ export default {
}
},
mounted() {
console.log(this.customerInfo)
const i = this.receptionList.findIndex(e => e.value == this.customerInfo.receptionStatus)
this.customerInfo.receptionStatus = this.receptionList[i].label
},
......@@ -129,14 +130,14 @@ export default {
if (!result) return
const i = this.receptionList.findIndex(e => e.label == this.customerInfo.receptionStatus)
this.customerInfo.receptionStatus = this.receptionList[i].value
this.$emit('submit',this.customerInfo)
this.$emit('submit',this.customerInfo)
},
check(all = false) {
let flag = true
try {
this.formObject.map(e => {
if (!this.customerInfo[e.key]) throw false
if (!all && e.key == 'phoneNumber' && !phoneRex.test(this.formData[e.key])) {
if (!all && e.key == 'phoneNumber' && !phoneRex.test(this.customerInfo[e.key])) {
uni.showToast({
title: "请输入正确的车主电话",
icon: "none",
......@@ -151,9 +152,10 @@ export default {
},
handleSelect(item, popkey) {
this.$refs[popkey].close()
console.log(item, popkey)
if (popkey == 'employeeBoxVisible') {
this.customerInfo.salesUuid = item.uuid
this.customerInfo.staffName = item.staffName
this.customerInfo.salesName = item.staffName
} else {
this.$refs.carBrandListVisible.close()
this.customerInfo.carModel = item.name
......
const target = ["ip", "dev", "uat", "prod", "beta"];
const index = 1;
const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 1
/**
*
0本地
......@@ -12,110 +12,110 @@ const secretKey = {
ip: {},
dev: {
sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89",
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b",
},
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
},
uat: {
sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89",
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b",
},
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
},
prod: {
sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89",
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b",
},
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
},
beta: {
sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89",
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b",
},
},
}[target[index]];
appKey: '8b31ae1009ccb0f96130ca4bd90e3d89',
secret: '02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b'
}
}
}[target[index]]
const domain = {
// ip: 'http://192.168.2.94:8558',
// ip: 'http://192.168.2.3:8315',
ip: "http://192.168.1.170:8315",
ip: 'http://192.168.1.170:8315',
/**登录: 192.168.2.3:8315
商城: 192.168.2.3:8558 */
dev: "https://scrm.dev.glsx.com.cn",
uat: "https://scrm.test.glsx.com.cn",
beta: "https://scrm.beta.glsx.com.cn",
prod: "https://scrm.glsx.com.cn",
}[target[index]];
dev: 'https://scrm.dev.glsx.com.cn',
uat: 'https://scrm.test.glsx.com.cn',
beta: 'https://scrm.beta.glsx.com.cn',
prod: 'https://scrm.glsx.com.cn'
}[target[index]]
const djDomain = {
ip: "http://192.168.2.59:8292",
ip: 'http://192.168.2.59:8292',
// ip: 'http://192.168.2.80:8558',
dev: "http://dj.dev.glsx.com.cn",
beta: "https://dj.beta.glsx.com.cn", //预发布 appid: wx9f91c1ec493eb425
uat: "https://dj.test.glsx.com.cn", //测试 appid: wxe10067a63c1856ac
prod: "https://dj.glsx.com.cn",
pet: "https://cdptest.glsx.com.cn", //压测 appid: wx7ce755e425603084
}[target[index]];
dev: 'http://dj.dev.glsx.com.cn',
beta: 'https://dj.beta.glsx.com.cn', //预发布 appid: wx9f91c1ec493eb425
uat: 'https://dj.test.glsx.com.cn', //测试 appid: wxe10067a63c1856ac
prod: 'https://dj.glsx.com.cn',
pet: 'https://cdptest.glsx.com.cn' //压测 appid: wx7ce755e425603084
}[target[index]]
const merchantDomain = {
ip: "http://rop-merchant.dev.glsx.com.cn",
dev: "http://rop-merchant.dev.glsx.com.cn",
beta: "https://rop-merchant.beta.glsx.com.cn",
uat: "https://rop-merchant.test.glsx.com.cn",
prod: "https://commodity.glsx.com.cn",
pet: "",
}[target[index]];
ip: 'http://rop-merchant.dev.glsx.com.cn',
dev: 'http://rop-merchant.dev.glsx.com.cn',
beta: 'https://rop-merchant.beta.glsx.com.cn',
uat: 'https://rop-merchant.test.glsx.com.cn',
prod: 'https://commodity.glsx.com.cn',
pet: ''
}[target[index]]
const djSecretKey = {
ip: {},
dev: {
appKey: "48e5e13229b82c1b4e6e8c96151f0637",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
},
uat: {
appKey: "48e5e13229b82c1b4e6e8c96151f0637",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
},
beta: {
appKey: "48e5e13229b82c1b4e6e8c96151f0637",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
},
prod: {
appKey: "d7ffc3346fc9a45bccaaa35300d59022",
secret: "4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353",
appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
},
pet: {
appKey: "d7ffc3346fc9a45bccaaa35300d59022",
secret: "4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353",
},
}[target[index]];
appKey: 'd7ffc3346fc9a45bccaaa35300d59022',
secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
}
}[target[index]]
const pathEnum = {
sso: "/rop-scrm-sso/",
shopmall: "/rop-scrm-shopmall/",
coupon: "/rop-scrm-coupon/",
carlife: "/rop-scrm-carlife/",
live: "/rop-scrm-live/",
equity: "/rop-scrm-equity/",
entmicro: "/rop-scrm-entmicro/",
wechat: "/rop-scrm-wechat/",
boutiquecoupon: "/rop-scrm-boutiquecoupon/",
material: "/rop-scrm-marketing/", //素材
sop: "/rop-scrm-sop/",
customercollect: "/rop-scrm-bigdatautil/",
mindworkplate: "/rop-dj-smartcarlife/",
drac: "/rop-scrm-entmicro/",
busassistant: "/rop-scrm-busassistant/",
boutique: "/rop-dj-car-boutique/",
merchants: "/rop-merchants/",
};
sso: '/rop-scrm-sso/',
shopmall: '/rop-scrm-shopmall/',
coupon: '/rop-scrm-coupon/',
carlife: '/rop-scrm-carlife/',
live: '/rop-scrm-live/',
equity: '/rop-scrm-equity/',
entmicro: '/rop-scrm-entmicro/',
wechat: '/rop-scrm-wechat/',
boutiquecoupon: '/rop-scrm-boutiquecoupon/',
material: '/rop-scrm-marketing/', //素材
sop: '/rop-scrm-sop/',
customercollect: '/rop-scrm-bigdatautil/',
mindworkplate: '/rop-dj-smartcarlife/',
drac: '/rop-scrm-entmicro/',
busassistant: '/rop-scrm-busassistant/',
boutique: '/rop-dj-car-boutique/',
merchants: '/rop-merchants/'
}
const CONFIG_ENV_MAP = {
1: "develop",
2: "test",
3: "production",
4: "beta",
};
1: 'develop',
2: 'test',
3: 'production',
4: 'beta'
}
module.exports = {
index,
domain,
......@@ -124,5 +124,5 @@ module.exports = {
env: CONFIG_ENV_MAP[index],
djDomain,
merchantDomain,
djSecretKey,
};
djSecretKey
}
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-10-17 11:02:23
* @LastEditTime: 2024-10-18 16:26:28
* @FilePath: \gl_tape\mixin\click.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -26,7 +26,7 @@ export default {
reaction: 1
}
},
mounted() {
async mounted() {
this.handleSave(false)
// 获取当前页面栈数组
const pages = getCurrentPages()
......@@ -37,17 +37,26 @@ export default {
this.initTime()
},
watch: {
'$store.state.user.customerInfo'(val) {
const params = this.getParams(val)
interruptRecord.updatePreRecords(params)
changeData: {
handler(val) {
console.log(val, 'val', this.audioInfo.audioStatus)
if (this.audioInfo.audioStatus != 'start') return
const { customerInfo, booksList, receptionStatus } = val
const params = this.getParams(customerInfo, booksList, receptionStatus)
interruptRecord.updatePreRecords(params)
},
deep: true
}
},
computed: {
...mapState('audio', ['receptionStatus', 'booksList', 'audioInfo']),
...mapState(['user.customerInfo'])
},
created() {
console.log('created')
...mapState(['user.customerInfo']),
changeData() {
const customerInfo = this.$store.state.user.customerInfo
const booksList = this.booksList
const receptionStatus = this.receptionStatus
return { customerInfo, booksList, receptionStatus }
}
},
methods: {
...mapMutations('audio', ['setReceptionStatus', 'setBooks', 'setAudioInfo']),
......@@ -77,10 +86,10 @@ export default {
this.setReceptionStatus(0)
this.setAudioInfo({ endReasonType: 1 })
},
getParams(val) {
getParams(customerInfo, booksList, receptionStatus) {
const { shopMerchantId, phone, sceneType, uuid, name, merchantId, channelType, merchantName } = uni.$storage.get('userInfo'),
{ customerName, phoneNumber, salesUuid, carModel, staffName } = val || {},
receptionCustomerPaySourceList = this.booksList.map(item => {
{ customerName, phoneNumber, salesUuid, carModel, staffName } = customerInfo || {},
receptionCustomerPaySourceList = booksList.map(item => {
return {
id: item.id,
sourceType: item.id,
......@@ -112,7 +121,7 @@ export default {
loginPhone: phone,
salesName: staffName,
salesUuid,
receptionStatus: this.receptionStatus, //接待结果 1.成交 0.战败
receptionStatus, //接待结果 1.成交 0.战败
receptionStartTime,
receptionEndTime,
receptionCustomerPaySourceList, //1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径
......@@ -142,23 +151,25 @@ export default {
//开始录音
startAudio: utils.throttle(async function () {
if (this.audioInfo.audioStatus == 'start') return
this.setAudioInfo({ audioList: [], audioStatus: 'start' })
this.setBooks([])
this.$store.dispatch('clearCustomerInfo')
this.setReceptionStatus(1)
this.initTime()
this.setAudioInfo({ audioList: [], audioStatus: 'start' })
recorderManager.onStart(() => {
interruptRecord.addPreRecords()
setTimeout(() => {
interruptRecord.addPreRecords()
}, 1000)
})
recorderManager.start({
duration: 600000,
duration: 60000,
sampleRate: 16000,
numberOfChannels: 1
})
recorderManager.onStop(async res => {
if (this.audioInfo.audioStatus == 'start') {
uni.getRecorderManager().start({
duration: 600000,
duration: 60000,
sampleRate: 16000,
numberOfChannels: 1
})
......@@ -170,11 +181,12 @@ export default {
console.log(records, 'records')
if (!records) return
if (isNormal) {
Object.assign(records, this.getParams(this.$store.state.user.customerInfo))
Object.assign(records, this.getParams(this.$store.state.user.customerInfo, this.booksList, this.receptionStatus))
}
const audioPath = records.audioPath
const recordUrlList = []
for (let i = 0; i < audioPath.length; i++) {
console.log(audioPath[i], 'audioPath[i]')
const saveResult = await uni.saveFile({
tempFilePath: audioPath[i]
})
......@@ -198,7 +210,7 @@ export default {
},
removeRecords() {
const records = interruptRecord.getPreRecord()
interruptRecord.removePreRecord(record.id)
interruptRecord.removePreRecord(records.id)
},
/**保存记录*/
async saveRecord(record) {
......
......@@ -209,6 +209,11 @@ export default {
if (record.recordUrlList?.every(i => i.status == undefined)) {
const pathArr = record.recordUrlList.map(i => i.file)
const params = { ...record, recordUrlList: pathArr }
if (!params.receptionEndTime) {
const endTime = await uni.$api.commonApi.searchRecordingEndTime({ recordUrlList: pathArr, receptionStartTime: params.receptionStartTime.replace(/\//g, '-') })
params.receptionEndTime = endTime.replace(/\-/g, '/')
}
console.log(params, 'params')
const res = await uni.$api.commonApi.saveRecCustomer(params)
if (res) {
uni.$recordManager.removeRecord(record.id)
......
......@@ -3,13 +3,13 @@
* @Author: huyue
* @Date: 2024-04-07 18:15:11
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-04-11 21:22:55
* @LastEditTime: 2024-10-18 11:40:02
*/
// import { setToken, getToken, removeToken } from '@/utils/token';;
import utils from "@/utils/utils";
import utils from '@/utils/utils'
// const recorderManager = uni.getRecorderManager();
import upload from "@/utils/ossUploadFile/uploadFile.js";
import store from "../index";
import upload from '@/utils/ossUploadFile/uploadFile.js'
import store from '../index'
export default {
namespaced: true,
state() {
......@@ -18,35 +18,43 @@ export default {
audioList: [],
receptionStatus: 1,
endReasonType: 0,
perRecordNumber: 0,
audioInfo: {
audioStatus: "",
audioStatus: '',
endReasonType: 0,
receptionStartTime: "",
receptionEndTime: "",
},
};
receptionStartTime: '',
receptionEndTime: ''
}
}
},
mutations: {
setAudioInfo(state, data) {
if (data.audioStatus == "start") {
data.receptionStartTime = utils.convertDateTimeFormat(new Date(), "/");
if (data.audioStatus == 'start') {
data.receptionStartTime = utils.convertDateTimeFormat(new Date(), '/')
}
if (data.audioStatus == "end") {
data.receptionEndTime = utils.convertDateTimeFormat(new Date(), "/");
if (data.audioStatus == 'end') {
data.receptionEndTime = utils.convertDateTimeFormat(new Date(), '/')
}
state.audioInfo = Object.assign(state.audioInfo, data);
state.audioInfo = Object.assign(state.audioInfo, data)
},
setReceptionStatus(state, data) {
state.receptionStatus = data;
state.receptionStatus = data
},
setAudioList(state, data) {
state.audioList = data;
state.audioList = data
},
setBooks(state, data) {
state.booksList = data;
state.booksList = data
},
setPerRecordNumber(state, data) {
state.perRecordNumber = data
}
},
actions: {
setPerRecordNumber({ commit }, value) {
console.log(value)
commit('setPerRecordNumber', value)
}
// startAudio({ commit, state, dispatch }) {
// if (state.isStart) return;
// commit("setAudioStart", true);
......@@ -115,5 +123,5 @@ export default {
// commit("setReceptionStatus", 0);
// uni.$storage.set("storageFile", "");
// },
},
};
}
}
......@@ -2,18 +2,21 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-10-14 17:38:35
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-10-17 10:47:17
* @LastEditTime: 2024-10-18 16:29:34
* @FilePath: \gl-tape\utils\recordManager\interruptRecord.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import RecordManager from '../RecordManager.js'
import utils from '@/utils/utils.js'
import { storageApi } from '../cache'
// import store from '@/store'
class InterruptRecord extends RecordManager {
constructor() {
super()
// console.log(store)
// storageApi.removeRecords('preRecordList')
// storageApi.removeRecords('preRecordId')
// storageApi.removeRecords('recordList')
}
records = {}
pathName = null
......@@ -32,6 +35,9 @@ class InterruptRecord extends RecordManager {
*/
getPreRecord() {
const id = storageApi.getRecords('preRecordId')
if (!id) {
return
}
return this.getRecordById(id)
}
/**
......@@ -49,12 +55,16 @@ class InterruptRecord extends RecordManager {
* @returns {void} - 此函数不返回任何值
*/
async addPreRecords() {
console.log(storageApi.getRecords('preRecordId'), 6666)
if (storageApi.getRecords('preRecordId')) {
console.log(888)
this.addPreAudio()
return
}
this.pathName = await this.getAudioPathName()
const audioPath = await this.getAudioPath(this.pathName)
console.log('pathName')
const pathName = await this.getAudioPathName()
const audioPath = await this.getAudioPath(pathName)
const id = utils.uuid()
storageApi.setRecords(id, 'preRecordId')
const ids = storageApi.getRecords('preRecordId')
......@@ -73,9 +83,12 @@ class InterruptRecord extends RecordManager {
* @returns {void} - 此函数不返回任何值
*/
async addPreAudio() {
const audioPath = await this.getAudioPath(this.pathName)
const pathName = await this.getAudioPathName()
const audioPath = await this.getAudioPath(pathName)
this.records.audioPath.push(audioPath)
this.updateRecord(this.records)
const records = this.getPreRecord()
const params = { ...records, ...this.records }
this.updateRecord(params)
}
updatePreAudio(params) {
this.updateRecord(params)
......@@ -90,6 +103,7 @@ class InterruptRecord extends RecordManager {
storageApi.setRecords('', 'preRecordId')
}
const updateParams = { ...this.records, ...params }
console.log(updateParams, 'updateParams')
this.updateRecord(updateParams)
}
/**
......@@ -99,8 +113,10 @@ class InterruptRecord extends RecordManager {
* @returns {void} - 此函数不返回任何值
*/
async getAudioPath(name) {
console.log(name, 'name')
return new Promise(async (resolve, reject) => {
const path = await utils.getAudioFilePath(name + '/recorder')
console.log(path, 'path')
plus.io.resolveLocalFileSystemURL(
path,
e => {
......@@ -120,6 +136,7 @@ class InterruptRecord extends RecordManager {
})
})
).then(results => {
console.log(results, 'results')
// 找到修改时间最晚的文件
const latest = results.reduce(
(acc, current) => {
......@@ -184,7 +201,8 @@ class InterruptRecord extends RecordManager {
*/
setRecords(records) {
storageApi.setRecords(records, 'preRecordList')
console.log(storageApi.getRecords('preRecordList'))
console.log(records, 'records')
store.dispatch('audio/setPerRecordNumber', records.length)
}
}
export default new InterruptRecord()
......@@ -170,6 +170,10 @@ async function getFileSaveFolderOnClient() {
const rootPath = await getFilePath()
return `file://${rootPath}uniapp_save/`
}
async function getAudioFilePath(path = '') {
const rootPath = await getFilePath()
return `file://${rootPath}${path}`
}
export default {
compareVersions,
convertDateTimeFormat,
......@@ -180,5 +184,6 @@ export default {
isNetWork,
uuid,
getFilePath,
getFileSaveFolderOnClient
getFileSaveFolderOnClient,
getAudioFilePath
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!