Commit 4f13ce6f by liimin

refactor(record): 重构录音模块及相关功能

- 删除无用的boutique模块
- 重构RecordDto和DBRecord数据结构,简化字段
- 修改上传逻辑,增加bucketName和region参数
- 调整日志级别,部分info改为warn
- 优化登录页面逻辑和错误处理
- 更新录音时长默认值为10分钟
- 修改用户信息存储结构,简化字段
- 修复序列化函数对undefined/null的处理
- 优化HTTP请求错误日志记录
1 parent 9d3401d8
...@@ -5,6 +5,7 @@ import boutiqueApi from './boutique' ...@@ -5,6 +5,7 @@ import boutiqueApi from './boutique'
import customerApi from './customerApi' import customerApi from './customerApi'
import sceneMarketApi from './sceneMarketApi' import sceneMarketApi from './sceneMarketApi'
import loginApi from './loginApi' import loginApi from './loginApi'
import record from './record'
module.exports = { module.exports = {
commonApi, commonApi,
...@@ -13,5 +14,6 @@ module.exports = { ...@@ -13,5 +14,6 @@ module.exports = {
boutiqueApi, boutiqueApi,
customerApi, customerApi,
sceneMarketApi, sceneMarketApi,
loginApi loginApi,
record
} }
import http from '../request/http'
import { env } from '../../env'
module.exports = {
getOSSToken (data) {
return http.shukeRequest('linkwe-gateway/file/get/config', data, 'GET', true)
},
}
\ No newline at end of file \ No newline at end of file
...@@ -64,6 +64,7 @@ class Request { ...@@ -64,6 +64,7 @@ class Request {
let errMsg = '' let errMsg = ''
if (!data) errMsg = '获取数据失败,请重试。' if (!data) errMsg = '获取数据失败,请重试。'
else errMsg = '服务器暂时不可用,请稍后再次尝试。' else errMsg = '服务器暂时不可用,请稍后再次尝试。'
uni.$logger.error(`Request Fail: ${JSON.stringify(params)}->${errMsg}`)
return reject(errMsg) return reject(errMsg)
} }
let { code, message } = data let { code, message } = data
...@@ -72,14 +73,15 @@ class Request { ...@@ -72,14 +73,15 @@ class Request {
return return
} }
if (code == 20 || code == 21) { if (code == 20 || code == 21) {
console.log(params.method)
const pages = getCurrentPages(), const pages = getCurrentPages(),
currentPage = pages[pages.length - 1] currentPage = pages[pages.length - 1]
uni.$logger.local.warn(`HTTP Triggered Logout: params:${JSON.stringify(params)} method: ${params.method}->code:${code} msg:${message} currentPage:${currentPage.route}`)
uni.hideLoading() uni.hideLoading()
if (currentPage.route != 'pages/common/login') if (currentPage.route != 'pages/common/login') {
uni.reLaunch({ uni.reLaunch({
url: '/pages/common/login' url: '/pages/common/login'
}) })
}
} else { } else {
if (code == '0') { if (code == '0') {
resolve(data.data) resolve(data.data)
...@@ -89,12 +91,14 @@ class Request { ...@@ -89,12 +91,14 @@ class Request {
title: message || '系统异常', title: message || '系统异常',
icon: 'none' icon: 'none'
}) })
uni.$logger.error(`HTTP Request Error: ${JSON.stringify(params)}->${message}`)
} }
} }
}, },
fail (error) { fail (error) {
uni.hideLoading() uni.hideLoading()
console.error(`${params.method}接口异常:`, error) uni.$logger.error(`HTTP Request Fail: ${JSON.stringify(params)}->${error.message}`)
// console.error(`${params.method}接口异常:`, error)
uni.showToast({ uni.showToast({
title: typeof error == 'string' ? error : error.errMsg ? error.errMsg : JSON.stringify(error) || '系统异常', title: typeof error == 'string' ? error : error.errMsg ? error.errMsg : JSON.stringify(error) || '系统异常',
icon: 'error' icon: 'error'
......
...@@ -151,7 +151,7 @@ export default { ...@@ -151,7 +151,7 @@ export default {
}, },
{ {
label: "客户电话", label: "客户电话",
key: "phoneNumber", key: "customerPhone",
type: "input", type: "input",
inputType: "tel", inputType: "tel",
maxlength: 11, maxlength: 11,
...@@ -160,7 +160,7 @@ export default { ...@@ -160,7 +160,7 @@ export default {
}, },
{ {
label: "品牌车型", label: "品牌车型",
key: "carModel", key: "carType",
type: "input", type: "input",
maxlength: 50, maxlength: 50,
placeholder: '请输入品牌车型', placeholder: '请输入品牌车型',
...@@ -169,8 +169,8 @@ export default { ...@@ -169,8 +169,8 @@ export default {
], ],
formData: { formData: {
customerName: "", customerName: "",
carModel: "", carType: "",
phoneNumber: "", customerPhone: "",
salesUuid: "", salesUuid: "",
}, },
resultList: [ resultList: [
...@@ -219,7 +219,7 @@ export default { ...@@ -219,7 +219,7 @@ export default {
...mapMutations("audio", ["setReceptionStatus"]), ...mapMutations("audio", ["setReceptionStatus"]),
showError (key) { showError (key) {
let flag = !this.formData[key] let flag = !this.formData[key]
if (key == 'phoneNumber' && this.formData[key]) flag = !phoneRex.test(this.formData[key]) if (key == 'customerPhone' && this.formData[key]) flag = !phoneRex.test(this.formData[key])
return this.errorTip && flag return this.errorTip && flag
}, },
showPopup ({ popKey, disabled }) { showPopup ({ popKey, disabled }) {
...@@ -243,7 +243,7 @@ export default { ...@@ -243,7 +243,7 @@ export default {
this.formObject.map(e => { this.formObject.map(e => {
if (e.required) { if (e.required) {
if (!this.formData[e.key]) throw false if (!this.formData[e.key]) throw false
if (!all && e.key == 'phoneNumber' && !phoneRex.test(this.formData[e.key])) { if (!all && e.key == 'customerPhone' && !phoneRex.test(this.formData[e.key])) {
uni.showToast({ uni.showToast({
title: "请输入正确的车主电话", title: "请输入正确的车主电话",
icon: "none", icon: "none",
......
...@@ -58,13 +58,13 @@ ...@@ -58,13 +58,13 @@
* @param {Object} options - (可选)包含上传器配置的对象,如 region * @param {Object} options - (可选)包含上传器配置的对象,如 region
* @throws {Error} 如果缺少必要的参数,将抛出错误 * @throws {Error} 如果缺少必要的参数,将抛出错误
*/ */
window.msgFromUniapp = function (accessKeyId, accessKeySecret, stsToken, fileName, filePath, recordId, options = {}) { window.msgFromUniapp = function (accessKeyId, accessKeySecret, stsToken, fileName, filePath, recordId,bucketName,region, options = {}) {
try { try {
if (!accessKeyId || !accessKeySecret || !stsToken || !fileName || !filePath) { if (!accessKeyId || !accessKeySecret || !fileName || !filePath || !bucketName ||!region) {
throw new Error('accessKeyId,accessKeySecret,stsToken,fileName,filePath is required') throw new Error('accessKeyId,accessKeySecret,stsToken,fileName,filePath is required')
} }
// 使用 Object.assign 合并默认配置参数和传入的 options 参数 // 使用 Object.assign 合并默认配置参数和传入的 options 参数
const opt = Object.assign({ accessKeyId, accessKeySecret, stsToken, filePath, recordId }, options) const opt = Object.assign({ accessKeyId, accessKeySecret, stsToken, filePath, recordId, bucket:bucketName,region }, options)
// 创建 OSSUpLoader 实例,传入配置对象 // 创建 OSSUpLoader 实例,传入配置对象
let uploader = new OSSUpLoader(opt) let uploader = new OSSUpLoader(opt)
// 调用 upload 方法上传文件,并在完成后处理结果 // 调用 upload 方法上传文件,并在完成后处理结果
......
...@@ -91,7 +91,7 @@ class OSSUpLoader { ...@@ -91,7 +91,7 @@ class OSSUpLoader {
bucket, bucket,
accessKeyId, accessKeyId,
accessKeySecret, accessKeySecret,
stsToken // stsToken
}) })
} }
_normalizeFileName(fileName) { _normalizeFileName(fileName) {
......
...@@ -20,7 +20,7 @@ class SQLite { ...@@ -20,7 +20,7 @@ class SQLite {
selectSql(sql) { selectSql(sql) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.$logger.local.info(`执行SQL语句: ${sql}`) uni.$logger.local.warn(`执行SQL语句: ${sql}`)
plus.sqlite.selectSql({ plus.sqlite.selectSql({
name: this.name, name: this.name,
sql, sql,
...@@ -48,7 +48,7 @@ class SQLite { ...@@ -48,7 +48,7 @@ class SQLite {
executeSql(sql) { executeSql(sql) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.$logger.local.info(`执行SQL语句: ${sql}`) uni.$logger.local.warn(`执行SQL语句: ${sql}`)
plus.sqlite.executeSql({ plus.sqlite.executeSql({
name: this.name, name: this.name,
sql, sql,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-12-26 10:03:54 * @Date: 2024-12-26 10:03:54
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-12-22 19:07:50 * @LastEditTime: 2025-12-23 16:48:13
* @FilePath: \simgle_app\mixin\record\recorder.js * @FilePath: \simgle_app\mixin\record\recorder.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -39,28 +39,28 @@ export default { ...@@ -39,28 +39,28 @@ export default {
}, },
deep: true deep: true
}, },
booksList: { // booksList: {
handler(val) { // handler(val) {
this.handler(val, this.updateBookList) // this.handler(val, this.updateBookList)
} // }
}, // },
receptionStatus: { // receptionStatus: {
handler(val) { // handler(val) {
this.handler(val, this.updateReceptionStatus) // this.handler(val, this.updateReceptionStatus)
} // }
}, // },
receptionKey: { // receptionKey: {
handler(val) { // handler(val) {
this.handler(this.receptionTrack, this.updateMaterialPointList) // this.handler(this.receptionTrack, this.updateMaterialPointList)
} // }
} // }
}, },
computed: { computed: {
...mapState(['user.customerInfo']), ...mapState(['user.customerInfo']),
...mapGetters(['customerInfo', 'receptionStatus', 'booksList', 'receptionTrack', 'receptionKey', 'customerKey']) ...mapGetters(['customerInfo', 'receptionStatus', 'receptionTrack', 'receptionKey', 'customerKey'])
}, },
methods: { methods: {
...mapMutations('audio', ['setReceptionStatus', 'setBooks', 'setPerRecordNumber']), ...mapMutations('audio', ['setReceptionStatus', 'setPerRecordNumber']),
...mapMutations(['clearCustomerInfo']), ...mapMutations(['clearCustomerInfo']),
//开始录音 //开始录音
async startAudio(isInitData = true) { async startAudio(isInitData = true) {
...@@ -81,9 +81,9 @@ export default { ...@@ -81,9 +81,9 @@ export default {
}, },
initReception() { initReception() {
this.setBooks([]) // this.setBooks([])
this.clearCustomerInfo() this.clearCustomerInfo()
this.setReceptionStatus('') // this.setReceptionStatus('')
}, },
async onAudioStart() { async onAudioStart() {
if (this.audioManager.counter === 0) { if (this.audioManager.counter === 0) {
...@@ -146,64 +146,55 @@ export default { ...@@ -146,64 +146,55 @@ export default {
this.tempRecord = null this.tempRecord = null
}, },
initDto() { initDto() {
const { shopMerchantId, phone, sceneType, uuid, name, merchantId, channelType, merchantName } = storageApi.getUserInfo() || {} const userInfo = storageApi.getUserInfo() || {}
const { deviceId: appCode } = uni.getDeviceInfo() console.log("🚀 ~ userInfo:", userInfo)
const { user:{userId,userName,deptId},sceneType='' } = userInfo
const { deviceId: machineCode } = uni.getDeviceInfo()
const dto = new RecordDto({ const dto = new RecordDto({
staffUuid: uuid, userId,
staffName: name, userName,
serviceMerchantId: merchantId, merchantId: deptId,
endReasonType: 0, //原因 1.异常 0.正常 machineCode
loginPhone: phone,
appCode,
merchantId: shopMerchantId,
merchantName,
bussinessType: sceneType == 0 ? 1 : 2, // sceneType 0延保 1精品。 bussinessType 1.延保 2.轻改
channelType: channelType || 1 //1问界 2 比亚迪 3 其他
}) })
this.sceneType = sceneType this.sceneType = sceneType
this.tempRecord = dto this.tempRecord = dto
}, },
updateCustomerInfo(customerInfo = {}) { updateCustomerInfo(customerInfo = {}) {
const { customerName, phoneNumber, salesUuid, carModel, staffName: salesName, carBrand, carBrandId, oneCarBrand, oneCarBrandId } = customerInfo const { customerName, customerPhone, customerType, carType} = customerInfo
this.record.updatePreRecords({ this.record.updatePreRecords({
customerName, customerName,
phoneNumber, customerPhone,
carModel, customerType,
salesUuid, carType
salesName,
carBrand,
carBrandId,
oneCarBrand,
oneCarBrandId
}) })
}, },
updateBookList(booksList) { // updateBookList(booksList) {
const receptionCustomerPaySourceList = booksList.map(item => { // const receptionCustomerPaySourceList = booksList.map(item => {
return { // return {
id: item.id, // id: item.id,
sourceType: item.id, // sourceType: item.id,
sourceUrl: item.imgUrl // sourceUrl: item.imgUrl
} // }
}) // })
this.record.updatePreRecords({ receptionCustomerPaySourceList }) // this.record.updatePreRecords({ receptionCustomerPaySourceList })
}, // },
updateMaterialPointList(receptionTrack) { // updateMaterialPointList(receptionTrack) {
const { merchantId, staffUuid, staffName } = this.tempRecord // const { merchantId, staffUuid, staffName } = this.tempRecord
let receptionCustomerMaterialPointList = [] // let receptionCustomerMaterialPointList = []
Object.keys(receptionTrack).map(key => { // Object.keys(receptionTrack).map(key => {
receptionCustomerMaterialPointList.push({ // receptionCustomerMaterialPointList.push({
...receptionTrack[key], // ...receptionTrack[key],
merchantId, // merchantId,
staffUuid, // staffUuid,
staffName, // staffName,
businessScene: this.sceneType // businessScene: this.sceneType
}) // })
}) // })
this.record.updatePreRecords({ receptionCustomerMaterialPointList }) // this.record.updatePreRecords({ receptionCustomerMaterialPointList })
}, // },
updateReceptionStatus(status) { // updateReceptionStatus(status) {
this.record.updatePreRecords({ receptionStatus: status }) // this.record.updatePreRecords({ receptionStatus: status })
}, // },
getRecorder() { getRecorder() {
return this.record return this.record
}, },
......
import { getOssToken } from '@/utils/ossUploadFile/uploadFile.js'
import Queue from '@/utils/Queue.js' import Queue from '@/utils/Queue.js'
import OperationQueue from '@/utils/OperationQueue.js' import OperationQueue from '@/utils/OperationQueue.js'
import { Command } from '../../ws/constants' import { Command } from '../../ws/constants'
...@@ -72,9 +71,8 @@ export default { ...@@ -72,9 +71,8 @@ export default {
uni.$logger.local.info(`【上传管理Uploader】 == 解析结果 -> ${JSON.stringify(fileInfo)}`) uni.$logger.local.info(`【上传管理Uploader】 == 解析结果 -> ${JSON.stringify(fileInfo)}`)
if (!fileInfo || !fileInfo.recordId) { if (!fileInfo || !fileInfo.recordId) {
uni.$logger.local.error(`【上传管理Uploader】 == 上传文件信息解析异常`) uni.$logger.local.error(`【上传管理Uploader】 == 上传文件信息解析异常`)
return throw new Error('上传文件信息解析异常,强制结束当前任务')
} }
// 竞态保护:判断回调是否属于当前任务 // 竞态保护:判断回调是否属于当前任务
const callbackKey = this._getTaskKey(fileInfo.recordId, fileInfo.fileName) const callbackKey = this._getTaskKey(fileInfo.recordId, fileInfo.fileName)
const isCurrentTask = this._currentKey && callbackKey === this._currentKey const isCurrentTask = this._currentKey && callbackKey === this._currentKey
...@@ -93,6 +91,8 @@ export default { ...@@ -93,6 +91,8 @@ export default {
} }
} catch (error) { } catch (error) {
this.reportError(`【上传管理Uploader】 == 保存记录(save)异常 error: ${error.message}`, error.message, data?.recordId, data?.filePath + data?.fileName) this.reportError(`【上传管理Uploader】 == 保存记录(save)异常 error: ${error.message}`, error.message, data?.recordId, data?.filePath + data?.fileName)
// 发生异常时也尝试结束任务,防止阻塞
this.endTask()
} }
// finally { // finally {
// uni.$logger.local.info('【上传管理Uploader】 == 本次任务完成,开启下一次上传任务!') // uni.$logger.local.info('【上传管理Uploader】 == 本次任务完成,开启下一次上传任务!')
...@@ -195,21 +195,21 @@ export default { ...@@ -195,21 +195,21 @@ export default {
_changeFilePathToServer(record, fileInfo) { _changeFilePathToServer(record, fileInfo) {
try { try {
const _record = deepClone(record) const _record = deepClone(record)
uni.$logger.local.info(`【上传管理Uploader】 == 开始更新文件路径: ${JSON.stringify(_record.recordUrlList)}`) uni.$logger.local.info(`【上传管理Uploader】 == 开始更新文件路径: ${JSON.stringify(_record.urlList)}`)
// 场景1: 无文件状态 (NoFile) // 场景1: 无文件状态 (NoFile)
if (fileInfo.status === FileStatus.NoFile) { if (fileInfo.status === FileStatus.NoFile) {
_record.status = FileStatus.NoFile _record.status = FileStatus.NoFile
_record.receptionEndTime = _record.receptionEndTime || record.receptionStartTime _record.endTime = _record.endTime || record.startTime
_record.recordUrlList = [] _record.urlList = []
uni.$logger.local.info(`【上传管理Uploader】 == 记录被标记为无文件状态`) uni.$logger.local.info(`【上传管理Uploader】 == 记录被标记为无文件状态`)
return _record return _record
} }
// 场景2: 正常更新文件状态 // 场景2: 正常更新文件状态
_record.recordUrlList = this.urlListFilter(_record.recordUrlList) _record.urlList = this.urlListFilter(_record.urlList)
const targetFile = _record.recordUrlList.find(item => { const targetFile = _record.urlList.find(item => {
// 匹配逻辑: 优先匹配绝对路径,其次匹配文件名后缀 // 匹配逻辑: 优先匹配绝对路径,其次匹配文件名后缀
if (!this.isLegalFile(fileInfo.fileName)) return !this.isLegalFile(item.file) if (!this.isLegalFile(fileInfo.fileName)) return !this.isLegalFile(item.file)
return item.file === fileInfo.clientPath || item.file.endsWith(fileInfo.fileName) return item.file === fileInfo.clientPath || item.file.endsWith(fileInfo.fileName)
...@@ -302,7 +302,7 @@ export default { ...@@ -302,7 +302,7 @@ export default {
try { try {
const _snapshot = await this.getRecordsSnapshotFlatten() const _snapshot = await this.getRecordsSnapshotFlatten()
this.snapshot = new Queue(_snapshot) this.snapshot = new Queue(_snapshot)
uni.$logger.local.info('【上传管理Uploader】 == 创建快照成功! 文件个数:' + this.snapshot.size) uni.$logger.local.info(`【上传管理Uploader】 == 创建快照成功! ${JSON.stringify(this.snapshot.items)} 快照数: ${this.snapshot.size} `)
} catch (error) { } catch (error) {
this.reportError(`【上传管理Uploader】 == 获取快照失败 error:${error.message}`, error.message) this.reportError(`【上传管理Uploader】 == 获取快照失败 error:${error.message}`, error.message)
if (!this.snapshot) { if (!this.snapshot) {
...@@ -339,20 +339,22 @@ export default { ...@@ -339,20 +339,22 @@ export default {
this.save(record) this.save(record)
} else { } else {
try { try {
const { lsaccessKeySecret, securityToken, lsaccessKeyId } = await getOssToken() const token = await uni.$api.record.getOSSToken({})
this._safeEvalUpload(lsaccessKeyId, lsaccessKeySecret, securityToken, record.fileName, record.filePath, record.recordId) const { secretKey:lsaccessKeySecret, securityToken='', secretId:lsaccessKeyId,bucketName,region } = token.data
console.log("🚀 ~ token:", token)
this._safeEvalUpload(lsaccessKeyId, lsaccessKeySecret, securityToken, record.fileName, record.filePath, record.recordId,bucketName,region)
} catch (error) { } catch (error) {
this.reportError(`上传文件时发生异常(uploadRecord): ${error.message}`, error.message) this.reportError(`上传文件时发生异常(uploadRecord): ${error.message}`)
this.endTask() this.endTask()
throw error throw error
} }
} }
}, },
_safeEvalUpload(lsaccessKeyId, lsaccessKeySecret, securityToken, fileName, filePath, recordId) { _safeEvalUpload(lsaccessKeyId, lsaccessKeySecret, securityToken, fileName, filePath, recordId,bucketName,region) {
if (!this.wv) { if (!this.wv) {
throw new Error('WebView is not initialized') throw new Error('WebView is not initialized')
} }
const args = [lsaccessKeyId, lsaccessKeySecret, securityToken, fileName, filePath, recordId].map(v => JSON.stringify(String(v || ''))) const args = [lsaccessKeyId, lsaccessKeySecret, securityToken, fileName, filePath, recordId,bucketName,region].map(v => JSON.stringify(String(v || '')))
const script = `msgFromUniapp(${args.join(',')})` const script = `msgFromUniapp(${args.join(',')})`
this.wv.evalJS(script) this.wv.evalJS(script)
}, },
...@@ -390,7 +392,7 @@ export default { ...@@ -390,7 +392,7 @@ export default {
uni.$logger.local.info(`【上传管理Uploader】 == 开始保存或更新接待记录!!`) uni.$logger.local.info(`【上传管理Uploader】 == 开始保存或更新接待记录!!`)
try { try {
const { status, ...record } = data const { status, ...record } = data
const fileList = Array.isArray(record.recordUrlList) ? record.recordUrlList : [] const fileList = Array.isArray(record.urlList) ? record.urlList : []
const isAllCompleted = status === FileStatus.NoFile || fileList.every(i => [FileStatus.Uploaded, FileStatus.Completed].includes(i.status)) const isAllCompleted = status === FileStatus.NoFile || fileList.every(i => [FileStatus.Uploaded, FileStatus.Completed].includes(i.status))
...@@ -417,10 +419,10 @@ export default { ...@@ -417,10 +419,10 @@ export default {
uni.$logger.local.info(`【上传管理Uploader】 == 已上传的文件: ${JSON.stringify(serverPaths)}`) uni.$logger.local.info(`【上传管理Uploader】 == 已上传的文件: ${JSON.stringify(serverPaths)}`)
// 2. 准备提交参数 // 2. 准备提交参数
const params = { ...record, recordUrlList: serverPaths } const params = { ...record, urlList: serverPaths }
if (!params.receptionEndTime) { if (!params.endTime) {
params.receptionEndTime = await this._requestReceptionEndTime(serverPaths, params.receptionStartTime) params.endTime = await this._requestendTime(serverPaths, params.startTime)
} }
// 3. 提交到服务器 // 3. 提交到服务器
...@@ -440,23 +442,23 @@ export default { ...@@ -440,23 +442,23 @@ export default {
*/ */
async _handleIncompleteRecord(record) { async _handleIncompleteRecord(record) {
uni.$logger.local.info(`【上传管理Uploader】 == 记录中有未上传文件,开始更新记录!!`) uni.$logger.local.info(`【上传管理Uploader】 == 记录中有未上传文件,开始更新记录!!`)
await uni.$dbManager.updateRecord({ recordUrlList: record.recordUrlList }, { id: record.id }) await uni.$dbManager.updateRecord({ urlList: record.urlList }, { id: record.id })
}, },
/** /**
* 向服务器请求接待结束时间 * 向服务器请求接待结束时间
* 这个函数用于向服务器请求接待结束时间 * 这个函数用于向服务器请求接待结束时间
* @param {Array} recordUrlList - 包含文件URL的数组 * @param {Array} urlList - 包含文件URL的数组
* @param {string} receptionStartTime - 接待开始时间 * @param {string} startTime - 接待开始时间
* @returns {Promise<string>} - 一个 Promise,成功时解析为接待结束时间 * @returns {Promise<string>} - 一个 Promise,成功时解析为接待结束时间
*/ */
async _requestReceptionEndTime(recordUrlList, receptionStartTime) { async _requestendTime(urlList, startTime) {
if (!recordUrlList || recordUrlList.length === 0) return receptionStartTime if (!urlList || urlList.length === 0) return startTime
try { try {
// 记录日志,显示正在向服务器请求结束接待时间,包括文件URL列表和接待开始时间 // 记录日志,显示正在向服务器请求结束接待时间,包括文件URL列表和接待开始时间
uni.$logger.local.info(`【上传管理Uploader】 == 向服务器获取结束接待时间: recordUrlList ->${serializeIfObject(recordUrlList)} receptionStartTime: -> ${receptionStartTime}`) uni.$logger.local.info(`【上传管理Uploader】 == 向服务器获取结束接待时间: urlList ->${serializeIfObject(urlList)} startTime: -> ${startTime}`)
// 调用 uni.$api.commonApi.searchRecordingEndTime 方法,向服务器发送请求,获取接待结束时间 // 调用 uni.$api.commonApi.searchRecordingEndTime 方法,向服务器发送请求,获取接待结束时间
const endTime = await uni.$api.commonApi.searchRecordingEndTime({ recordUrlList, receptionStartTime: receptionStartTime.replace(/\//g, '-') }) const endTime = await uni.$api.commonApi.searchRecordingEndTime({ urlList, startTime: startTime.replace(/\//g, '-') })
// 记录日志,显示服务器返回的接待结束时间 // 记录日志,显示服务器返回的接待结束时间
uni.$logger.local.info(`【上传管理Uploader】 == 服务器返回结束接待时间: endTime ->${endTime}`) uni.$logger.local.info(`【上传管理Uploader】 == 服务器返回结束接待时间: endTime ->${endTime}`)
// 返回接待结束时间,将日期格式中的连字符替换为斜杠,以保持一致性 // 返回接待结束时间,将日期格式中的连字符替换为斜杠,以保持一致性
...@@ -511,15 +513,15 @@ export default { ...@@ -511,15 +513,15 @@ export default {
const result = [] const result = []
try { try {
for (const cur of records) { for (const cur of records) {
const recordUrlList = this.urlListFilter(cur.recordUrlList) const urlList = this.urlListFilter(cur.urlList)
if (recordUrlList.length == 0) { if (urlList.length == 0) {
// 如果记录中没有文件,则将其状态设置为 NoFile,并添加到结果数组中 // 如果记录中没有文件,则将其状态设置为 NoFile,并添加到结果数组中
result.push({ status: FileStatus.NoFile, recordId: cur.id }) result.push({ status: FileStatus.NoFile, recordId: cur.id })
this.reportError('【上传管理Uploader】 == 记录中不存在接待语音文件', { record: cur }, cur.id) //记录中不存在接待语音文件 this.reportError('【上传管理Uploader】 == 记录中不存在接待语音文件', { record: cur }, cur.id) //记录中不存在接待语音文件
continue continue
} }
// 处理每个记录的文件列表 // 处理每个记录的文件列表
for (const file of recordUrlList) { for (const file of urlList) {
try { try {
// 如果文件状态为已上传或已完成,则跳过该文件 // 如果文件状态为已上传或已完成,则跳过该文件
if (file.status === FileStatus.Uploaded || file.status === FileStatus.Completed) continue if (file.status === FileStatus.Uploaded || file.status === FileStatus.Completed) continue
......
<template> <template>
<view class="layout"> <view class="layout">
<!-- <view class="bg"></view>
<view class="login">
<view class="title">登录</view>
<view class="sub-title">手机号码登录</view>
<view class="input">
<input
type="tel"
:value="mobile"
placeholder="请输入手机号"
maxlength="11"
@blur="input($event, 'mobile')"
:key="dateKey.mobile"
auto-blur
/>
<template v-if="mobile">
<view
class="icon"
@click="mobile = ''"
>
<icon
type="clear"
size="16"
color="#000"
></icon>
</view>
</template>
</view>
<view class="input">
<input
type="number"
:value="code"
placeholder="请输入验证码"
maxlength="4"
@blur="input($event, 'code')"
:key="dateKey.code"
auto-blur
/>
<template v-if="code">
<view
class="icon"
@click="code = ''"
>
<icon
type="clear"
size="16"
color="#000"
></icon>
</view>
</template>
<view
:class="['code-btn', `${count ? 'code-disabled' : ''}`]"
@click="getSmsCode"
>{{ count ? `重新发送(${count}s)` : '获取验证码' }}</view>
</view>
<button
class="btn"
@click="login"
>登录</button>
<view class="form-footer">
<view
class="autoLogin"
@click="readingStatus = !readingStatus"
>
<uni-icons
:type="`${readingStatus ? 'checkbox-filled' : 'circle'}`"
:size="18"
:color="`${readingStatus ? '#2C66F7' : '#858A94'}`"
></uni-icons>
我已阅读并同意
<text @click.stop="jumpUrl()">《用户隐私协议》</text>
</view>
<view
class="autoLogin"
@click="noSignIn = !noSignIn"
>
<uni-icons
:type="`${noSignIn ? 'checkbox-filled' : 'circle'}`"
:size="18"
:color="`${noSignIn ? '#2C66F7' : '#858A94'}`"
></uni-icons>
30天内免登录
</view>
</view>
</view>
<view class="app-code flex">
APP编码:{{ deviceId }}
<view
class="sprite-icon icon-clone"
@click="copyText"
></view>
</view> -->
<template v-if="loginUrl"> <template v-if="loginUrl">
<web-view <web-view :src="loginUrl" @message="login" />
:src="loginUrl"
@message="login"
/>
</template> </template>
<view v-else class="loading-placeholder">
<!-- 可在此处添加自定义加载或重试UI -->
</view>
</view> </view>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
const phoneRex = /^[1]([3-9])[0-9]{9}$/;
import { Request } from 'glsk-toolkit'
export default { export default {
data () { data () {
return { return {
mobile: '',
code: '',
count: '',
noSignIn: true,
readingStatus: true,
dateKey: {
mobile: 0,
code: 0
},
loginUrl: '', loginUrl: '',
}; };
}, },
watch: {
code: {
handler (val) {
this.autoLoginByMobile()
},
immediate: true,
deep: true
},
mobile: {
handler (val) {
this.autoLoginByMobile()
},
immediate: true,
deep: true
}
},
async onLoad (options) { async onLoad (options) {
this.init() // 设置 UserAgent 以适配特定环境(如企微)
plus.navigator.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0') plus.navigator.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0')
this.init()
}, },
methods: { methods: {
/**
* 处理登录回调
*/
async login ({ detail }) { async login ({ detail }) {
try { const authCode = detail.data?.[0]?.code
let { code: authCode } = detail.data[0] if (!authCode) {
uni.showToast({ title: '授权失败,未获取到AuthCode', icon: 'none' })
return
}
uni.showLoading({ uni.showLoading({
title: '登录中...', title: '登录中...',
mask: true mask: true
}) })
try {
const { data, msg } = await uni.$api.loginApi.login({ const { data, msg } = await uni.$api.loginApi.login({
authCode authCode
}) })
uni.hideLoading()
if (data) { if (data) {
uni.$storage.set('sessionId', data.access_token) uni.$storage.set('sessionId', data.access_token)
// 获取用户信息
const userInfo = await uni.$api.loginApi.getUserInfo() const userInfo = await uni.$api.loginApi.getUserInfo()
uni.$storage.set('userInfo',userInfo) uni.$storage.set('userInfo', userInfo)
uni.reLaunch({ uni.reLaunch({
url: '/pages/equity/index' url: '/pages/equity/index'
}) })
} else throw msg } else {
throw new Error(msg || '登录接口返回异常')
}
} catch (error) { } catch (error) {
if (error) uni.showToast({ console.error("Login Error:", error)
title: error, uni.showToast({
title: error.message || String(error) || '登录失败',
icon: 'none' icon: 'none'
}) })
// 登录失败后重置页面,重新尝试
this.loginUrl = '' this.loginUrl = ''
setTimeout(() => { setTimeout(() => {
this.init() this.init()
}, 1.5e3) }, 1500)
} finally {
uni.hideLoading()
} }
}, },
/**
* 初始化登录页面,获取配置和URL
*/
async init () { async init () {
uni.showLoading({ uni.showLoading({
title: '加载配置...',
mask: true mask: true
}) })
const { corpId, agentId } = await uni.$api.loginApi.getCorpInfo(), try {
{ loginUrl } = await uni.$api.loginApi.getLoginUrl() // 并行请求以提高速度
uni.hideLoading() const [{ corpId, agentId }, { loginUrl }] = await Promise.all([
uni.$api.loginApi.getCorpInfo(),
uni.$api.loginApi.getLoginUrl()
])
if (loginUrl && corpId && agentId) {
this.loginUrl = `${loginUrl}?corpId=${corpId}&agentId=${agentId}&customLogin=1` this.loginUrl = `${loginUrl}?corpId=${corpId}&agentId=${agentId}&customLogin=1`
} else {
throw new Error('获取登录配置失败')
}
} catch (error) {
console.error("Init Error:", error)
uni.showToast({
title: '初始化失败,请检查网络',
icon: 'none'
})
} finally {
uni.hideLoading()
}
}, },
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.bg { .layout {
position: fixed;
width: 100%; width: 100%;
height: 100%; height: 100vh;
left: 0; background-color: #fff;
top: 0;
background-image: url('../../assets/images/login/bg.webp');
background-size: 100% 100%;
} }
.login { .loading-placeholder {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
.title {
font-weight: 600;
font-size: toRpx(96);
color: #333333;
text-align: center;
}
.sub-title {
font-weight: 500;
font-size: toRpx(32);
color: #1a1a1a;
margin: toRpx(46) 0;
}
.input {
width: toRpx(800);
height: toRpx(112);
background: #f7f8fa;
border-radius: toRpx(56);
margin-bottom: toRpx(40);
box-sizing: border-box;
padding-left: toRpx(40);
display: flex;
align-items: center;
input {
height: 100%;
flex: 1;
font-size: toRpx(32) !important;
}
.icon {
margin-left: auto;
flex-shrink: 0;
display: flex;
align-items: center;
padding: 0 toRpx(40);
height: 100%;
}
.code-btn {
font-weight: 500;
font-size: toRpx(32);
color: #2c66f7;
flex-shrink: 0;
border: none;
margin-right: toRpx(40);
}
.code-disabled {
color: #9b9b9e;
}
}
.btn {
width: toRpx(800);
height: toRpx(112);
background-image: linear-gradient(90deg, #48a6ff 0%, #2c66f7 100%);
border-radius: toRpx(56);
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: toRpx(40);
color: #ffffff;
}
.btn[disabled]:not([type]),
.btn[disabled][type='default'] {
background: #c9c9c9 !important;
}
.form-footer {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: toRpx(40);
flex-direction: column;
gap: toRpx(38) 0;
padding-left: toRpx(142);
.autoLogin {
display: flex;
align-items: center; align-items: center;
margin-right: toRpx(20); height: 100%;
.uni-icons {
margin-right: toRpx(8);
// margin-left: toRpx(142);
}
text {
color: #2c66f7;
}
}
}
}
.app-code {
position: fixed;
bottom: toRpx(20);
left: 50%;
transform: translate(-50%);
font-size: toRpx(24);
color: #999999;
line-height: toRpx(40);
.icon-clone {
width: toRpx(24);
height: toRpx(24);
margin-left: toRpx(20);
}
} }
</style> </style>
...@@ -105,18 +105,18 @@ export default { ...@@ -105,18 +105,18 @@ export default {
}; };
}, },
watch: { watch: {
watchBooksList: { // watchBooksList: {
immediate: true, // immediate: true,
handler (newValue) { // handler (newValue) {
if (newValue.length) this.infoList = newValue // if (newValue.length) this.infoList = newValue
else this.infoList = JSON.parse(JSON.stringify(INFO_LIST)) // else this.infoList = JSON.parse(JSON.stringify(INFO_LIST))
}, // },
} // }
}, },
computed: { computed: {
watchBooksList () { // watchBooksList () {
return this.$store.state.audio.booksList // return this.$store.state.audio.booksList
} // }
}, },
methods: { methods: {
...mapMutations("audio", ["setBooks"]), ...mapMutations("audio", ["setBooks"]),
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* @Description: * @Description:
* @Author: huyue * @Author: huyue
* @Date: 2024-04-08 11:30:30 * @Date: 2024-04-08 11:30:30
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: limin
* @LastEditTime: 2024-12-25 18:52:46 * @LastEditTime: 2025-12-22 17:16:50
--> -->
<template> <template>
<view class="detail-box" :key="dateilKey"> <view class="detail-box" :key="dateilKey">
...@@ -284,7 +284,7 @@ export default { ...@@ -284,7 +284,7 @@ export default {
}, },
done(e) { done(e) {
this.showPayPage = false this.showPayPage = false
this.$refs.toolRef.hide() // this.$refs.toolRef.hide()
this.$refs.stepRef.close() this.$refs.stepRef.close()
this.$emit('done', e) this.$emit('done', e)
}, },
......
...@@ -58,6 +58,18 @@ export default { ...@@ -58,6 +58,18 @@ export default {
} }
}, },
computed: { computed: {
homeRef() {
return this.$refs.home
},
previewRef() {
return this.homeRef.previewRef
},
finishRef() {
return this.homeRef.finishRef
},
isRecording() {
return this.homeRef && this.homeRef.audioManager && this.homeRef.audioManager.isRecording
}
}, },
onBackPress (options) { onBackPress (options) {
if (options.from === 'backbutton') { if (options.from === 'backbutton') {
...@@ -176,9 +188,9 @@ export default { ...@@ -176,9 +188,9 @@ export default {
}) })
const isPermision = await this.$refs.home.isPermission() const isPermision = await this.$refs.home.isPermission()
if (this.recording || !isPermision) return if (this.recording || !isPermision) return
uni.showLoading({ // uni.showLoading({
mask: true // mask: true
}) // })
this.$refs.home.startAudio() this.$refs.home.startAudio()
this.clearHistory() this.clearHistory()
...@@ -186,9 +198,9 @@ export default { ...@@ -186,9 +198,9 @@ export default {
// this.id = 6 // this.id = 6
this.type = 'edit' this.type = 'edit'
this.recording = true this.recording = true
setTimeout(() => { // setTimeout(() => {
uni.hideLoading() // uni.hideLoading()
}, 1e3) // }, 1e3)
}, },
toDetail (index) { toDetail (index) {
let item = this.moduleList[index] let item = this.moduleList[index]
...@@ -243,7 +255,7 @@ export default { ...@@ -243,7 +255,7 @@ export default {
clearHistory () { clearHistory () {
this.$store.dispatch('clearCustomerInfo') this.$store.dispatch('clearCustomerInfo')
this.$store.dispatch('clearHistory') this.$store.dispatch('clearHistory')
this.$refs.home.setBooks([]) // this.$refs.home.setBooks([])
this.$store.dispatch('clearReceptionTrack') this.$store.dispatch('clearReceptionTrack')
}, },
openStep () { openStep () {
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-07 17:09:50 * @Date: 2024-04-07 17:09:50
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2024-12-27 21:11:57 * @LastEditTime: 2025-12-23 16:41:45
* @FilePath: \gl_tape\store\index.js * @FilePath: \simgle_app\store\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
import Vue from 'vue' import Vue from 'vue'
...@@ -14,7 +14,7 @@ import audio from './modules/audio' ...@@ -14,7 +14,7 @@ import audio from './modules/audio'
import update from './modules/update' import update from './modules/update'
import sys from './modules/sys' import sys from './modules/sys'
import point from './modules/point' import point from './modules/point'
import boutique from './modules/boutique' // import boutique from './modules/boutique'
Vue.use(Vuex) Vue.use(Vuex)
const store = new Vuex.Store({ const store = new Vuex.Store({
...@@ -24,7 +24,7 @@ const store = new Vuex.Store({ ...@@ -24,7 +24,7 @@ const store = new Vuex.Store({
update, update,
sys, sys,
point, point,
boutique // boutique
}, },
getters getters
}) })
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2024-04-07 18:15:11 * @Date: 2024-04-07 18:15:11
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-01-03 21:26:31 * @LastEditTime: 2025-12-23 13:43:53
*/ */
// import { setToken, getToken, removeToken } from '@/utils/token';; // import { setToken, getToken, removeToken } from '@/utils/token';;
import utils from '@/utils/utils' import utils from '@/utils/utils'
...@@ -13,35 +13,35 @@ export default { ...@@ -13,35 +13,35 @@ export default {
state() { state() {
return { return {
booksList: [], booksList: [],
audioList: [], // audioList: [],
receptionStatus: '', receptionStatus: '',
endReasonType: 0, endReasonType: 0,
perRecordNumber: 0, perRecordNumber: 0,
audioInfo: { // audioInfo: {
audioStatus: '', // audioStatus: '',
endReasonType: 0, // endReasonType: 0,
receptionStartTime: '', // receptionStartTime: '',
receptionEndTime: '' // receptionEndTime: ''
} // }
} }
}, },
mutations: { mutations: {
setAudioInfo(state, data) { // setAudioInfo(state, data) {
if (data.audioStatus == 'start') { // if (data.audioStatus == 'start') {
data.receptionStartTime = utils.convertDateTimeFormat(new Date(), '/') // data.receptionStartTime = utils.convertDateTimeFormat(new Date(), '/')
data.receptionEndTime = '' // data.receptionEndTime = ''
} // }
if (data.audioStatus == 'end') { // if (data.audioStatus == 'end') {
data.receptionEndTime = utils.convertDateTimeFormat(new Date(), '/') // data.receptionEndTime = utils.convertDateTimeFormat(new Date(), '/')
} // }
state.audioInfo = Object.assign(state.audioInfo, data) // state.audioInfo = Object.assign(state.audioInfo, data)
}, // },
setReceptionStatus(state, data) { setReceptionStatus(state, data) {
state.receptionStatus = data state.receptionStatus = data
}, },
setAudioList(state, data) { // setAudioList(state, data) {
state.audioList = data // state.audioList = data
}, // },
setBooks(state, data) { setBooks(state, data) {
state.booksList = data state.booksList = data
}, },
...@@ -53,73 +53,5 @@ export default { ...@@ -53,73 +53,5 @@ export default {
setPerRecordNumber({ commit }, value) { setPerRecordNumber({ commit }, value) {
commit('setPerRecordNumber', value) commit('setPerRecordNumber', value)
} }
// startAudio({ commit, state, dispatch }) {
// if (state.isStart) return;
// commit("setAudioStart", true);
// commit("setAudioList", []);
// commit("setAudioEnd", false);
// recorderManager.start({
// duration: 20000,
// });
// recorderManager.onStop(async (res) => {
// console.log("结束录音");
// console.log(state.isEnd, "this.isEnd");
// if (!state.isEnd) {
// uni.getRecorderManager().start({
// duration: 20000,
// });
// }
// const result = await upload(res.tempFilePath);
// const storageFile = [...state.audioList, result];
// uni.$storage.set("storageFile", storageFile);
// commit("setAudioList", storageFile);
// if (state.isEnd) {
// console.log("上传语音");
// dispatch("uploadVoice", storageFile);
// }
// return true;
// });
// },
// stopAudio({ commit, state }) {
// commit("setAudioStart", false);
// commit("setAudioEnd", true);
// recorderManager.stop();
// },
// async uploadVoice({ commit, state }, tempFilePath) {
// const { shopMerchantId, phone } = uni.$storage.get("userInfo"),
// { customerName, phoneNumber, salesUuid, carModel } =
// store.state.user.customerInfo,
// receptionCustomerPaySourceList = state.booksList.map((item) => {
// return {
// id: item.id,
// sourceType: item.id,
// sourceUrl: item.imgUrl,
// };
// }),
// params = {
// carModel,
// endReasonType: state.endReasonType, //原因 1.异常 0.正常
// customerName,
// phoneNumber,
// loginPhone: phone,
// salesUuid,
// receptionStatus: state.receptionStatus, //接待结果 1.成交 0.战败
// recordUrlList: tempFilePath,
// receptionStartTime: state.receptionStartTime,
// receptionEndTime: state.receptionEndTime,
// receptionCustomerPaySourceList, //1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径
// merchantId: shopMerchantId,
// };
// commit("setBooks", []);
// console.log(params);
// if (customerName && phoneNumber && salesUuid && carModel)
// uni.$api.commonApi.saveRecCustomer(params).then((res) => {
// console.log(res);
// });
// store.dispatch("clearCustomerInfo");
// commit("setReceptionStatus", 1);
// commit("setReceptionStatus", 0);
// uni.$storage.set("storageFile", "");
// },
} }
} }
export default {
state() {
return {
baseConfigData:{}
}
},
mutations: {
},
actions: {
}
}
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
}, },
actions: { actions: {
setBackgroundState({ commit }, value) { setBackgroundState({ commit }, value) {
uni.$logger.local.info(`【==== ${['切回', '切出'][+value]} ====】 APP`) uni.$logger.local.warn(`【==== ${['切回', '切出'][+value]} ====】 APP`)
commit('SET_BACKGROUND_STATE', value) commit('SET_BACKGROUND_STATE', value)
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2024-04-07 18:15:11 * @Date: 2024-04-07 18:15:11
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-01-03 20:52:28 * @LastEditTime: 2025-12-23 14:58:18
*/ */
// import { setToken, getToken, removeToken } from '@/utils/token';; // import { setToken, getToken, removeToken } from '@/utils/token';;
...@@ -13,17 +13,8 @@ export default { ...@@ -13,17 +13,8 @@ export default {
return { return {
customerInfo: { customerInfo: {
customerName: "", customerName: "",
carBrand: "", customerPhone: "",
carModel: "", carType: ""
phoneNumber: "",
salesUuid: "",
staffName: "",
newCarFare: '',
carModelId: '',
carBuyers: '',
carPurchaseMethod: '',
oneCarBrand: '',
oneCarBrandId: ''
}, },
historyStatus: Date.now(), historyStatus: Date.now(),
carBrands: [], carBrands: [],
...@@ -57,17 +48,8 @@ export default { ...@@ -57,17 +48,8 @@ export default {
clearCustomerInfo (state) { clearCustomerInfo (state) {
const info = { const info = {
customerName: "", customerName: "",
carBrand: "", customerPhone: "",
carModel: "", carType: ""
phoneNumber: "",
salesUuid: "",
staffName: "",
newCarFare: '',
carModelId: '',
carBuyers: '',
carPurchaseMethod: '',
oneCarBrand: '',
oneCarBrandId: ''
}; };
uni.$storage.set("customerInfo", JSON.stringify(info)); uni.$storage.set("customerInfo", JSON.stringify(info));
state.customerInfo = info state.customerInfo = info
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: limin * @Author: limin
* @Date: 2024-11-22 08:18:23 * @Date: 2024-11-22 08:18:23
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-12-22 11:05:15 * @LastEditTime: 2025-12-23 09:34:35
* @FilePath: \simgle_app\utils\DBManager.js * @FilePath: \simgle_app\utils\DBManager.js
*/ */
import { SQLite } from '../lib' import { SQLite } from '../lib'
...@@ -19,7 +19,21 @@ class DBManager { ...@@ -19,7 +19,21 @@ class DBManager {
db_table_name = 'records' db_table_name = 'records'
db_description = 'zyzs db' db_description = 'zyzs db'
db_size = 50 * 1024 * 1024 db_size = 50 * 1024 * 1024
table_columns = [`id TEXT PRIMARY KEY`, `staffUuid TEXT`, `staffName TEXT`, `serviceMerchantId INTEGER`, 'carModel TEXT', 'endReasonType INTEGER', 'customerName TEXT', 'phoneNumber TEXT', 'appCode TEXT', 'loginPhone TEXT', 'salesName TEXT', 'salesUuid TEXT', 'receptionStatus INTEGER', 'receptionStartTime TEXT', 'receptionEndTime TEXT', 'receptionCustomerPaySourceList TEXT', 'merchantId INTEGER', 'merchantName TEXT', 'bussinessType INTEGER', 'channelType INTEGER', 'receptionCustomerMaterialPointList TEXT', 'recordUrlList TEXT', 'carBrand TEXT', 'carBrandId INTEGER', 'oneCarBrand TEXT', 'oneCarBrandId INTEGER'] table_columns = [
`id TEXT PRIMARY KEY`,
'typeCode TEXT',
'carType TEXT',
'customerType TEXT',
'merchantId INTEGER',
'machineCode TEXT',
'customerName TEXT',
'customerPhone TEXT',
`userId INTEGER`,
`userName TEXT`,
'startTime TEXT',
'endTime TEXT',
'materialId INTEGER',
'urlList TEXT']
sqlite = null sqlite = null
isTableExists = false isTableExists = false
constructor(table_name, table_columns) { constructor(table_name, table_columns) {
...@@ -34,7 +48,7 @@ class DBManager { ...@@ -34,7 +48,7 @@ class DBManager {
await this.db.init() await this.db.init()
} }
const isTableExists = await this.db.isTableExists(this.table_name) const isTableExists = await this.db.isTableExists(this.table_name)
uni.$logger.info(`数据库是否存在isTableExists: ${isTableExists}`) uni.$logger.warn(`数据库是否存在isTableExists: ${isTableExists}`)
if (!isTableExists) { if (!isTableExists) {
await this.db.createTable(this.table_name, this.table_columns) await this.db.createTable(this.table_name, this.table_columns)
} }
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
* @Author: limin * @Author: limin
* @Date: 2024-12-04 18:17:23 * @Date: 2024-12-04 18:17:23
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-12-19 16:48:28 * @LastEditTime: 2025-12-23 13:55:42
* @FilePath: \simgle_app\utils\recordManager\AudioManager.js * @FilePath: \simgle_app\utils\recordManager\AudioManager.js
*/ */
class AudioManager { class AudioManager {
startOptions = { startOptions = {
duration: 1 * 60 * 1000, //默认10分钟 duration: 10 * 60 * 1000, //默认10分钟
sampleRate: 16000, sampleRate: 16000,
numberOfChannels: 1 numberOfChannels: 1
} }
......
...@@ -4,35 +4,23 @@ ...@@ -4,35 +4,23 @@
* @Author: limin * @Author: limin
* @Date: 2025-01-02 14:48:44 * @Date: 2025-01-02 14:48:44
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-01-06 09:35:40 * @LastEditTime: 2025-12-23 11:19:06
* @FilePath: \gl_tape\utils\recordManager\RecordDto.js * @FilePath: \simgle_app\utils\recordManager\RecordDto.js
*/ */
export default class RecordDto { export default class RecordDto {
staffUuid = '' typeCode = ''
staffName = '' carType = ''
serviceMerchantId = '' customerType = ''
carModel = ''
endReasonType = 1 //原因 1.异常 0.正常
customerName = ''
phoneNumber = ''
appCode = ''
loginPhone = ''
salesName = ''
salesUuid = ''
receptionStatus = '' //接待结果 1.成交 0.战败
receptionStartTime = ''
receptionEndTime = ''
receptionCustomerPaySourceList = [] //1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径
merchantId = '' merchantId = ''
merchantName = '' machineCode = ''
bussinessType = 0 // sceneType 0延保 1精品。 bussinessType 1.延保 2.轻改 customerName = ''
channelType = 1 //1问界 2 比亚迪 3 其他 customerPhone = ''
receptionCustomerMaterialPointList = [] userId = ''
carBrand = '' userName = ''
carBrandId = '' startTime = ''
oneCarBrand = '' endTime = ''
oneCarBrandId = '' materialId = ''
urlList = []
constructor(options) { constructor(options) {
Object.assign(this, options) Object.assign(this, options)
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: limin * @Author: limin
* @Date: 2025-01-02 18:49:17 * @Date: 2025-01-02 18:49:17
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-12-22 19:10:04 * @LastEditTime: 2025-12-23 11:45:35
* @FilePath: \simgle_app\utils\recordManager\TempRecord.js * @FilePath: \simgle_app\utils\recordManager\TempRecord.js
*/ */
import utils from '../utils' import utils from '../utils'
...@@ -107,8 +107,8 @@ class TempRecord { ...@@ -107,8 +107,8 @@ class TempRecord {
uni.$logger.local.info('〖接待记录Record〗 == 开始持久化记录 ==' + JSON.stringify(record)) uni.$logger.local.info('〖接待记录Record〗 == 开始持久化记录 ==' + JSON.stringify(record))
this.clearLoopTimer() this.clearLoopTimer()
await this.saveTempFile(record) await this.saveTempFile(record)
const { recordUrlList, tempFilePath, ...__record } = record const { urlList, tempFilePath, ...__record } = record
const recordLongList = await this.__analysisUrlList(recordUrlList) const recordLongList = await this.__analysisUrlList(urlList)
const { maxUploadNum = 10 } = uni.$storage.get('mock_data') const { maxUploadNum = 10 } = uni.$storage.get('mock_data')
if (recordLongList.length > maxUploadNum) { if (recordLongList.length > maxUploadNum) {
const userInfo = uni.$storage.get('userInfo') const userInfo = uni.$storage.get('userInfo')
...@@ -125,7 +125,7 @@ class TempRecord { ...@@ -125,7 +125,7 @@ class TempRecord {
} }
}) })
} }
__record.recordUrlList = recordLongList.slice(0, maxUploadNum) __record.urlList = recordLongList.slice(0, maxUploadNum)
uni.$logger.local.info('〖接待记录Record〗 == 更新文件,保存记录!') uni.$logger.local.info('〖接待记录Record〗 == 更新文件,保存记录!')
await this.dbManager.addRecord(__record) await this.dbManager.addRecord(__record)
await this.clearLocalRecord(record) await this.clearLocalRecord(record)
...@@ -147,26 +147,26 @@ class TempRecord { ...@@ -147,26 +147,26 @@ class TempRecord {
/** /**
* 清除已保存的录音文件 * 清除已保存的录音文件
* @param {Object} options - 配置参数 * @param {Object} options - 配置参数
* @param {Array} options.recordUrlList - 录音文件列表,默认为当前记录的recordUrlList * @param {Array} options.urlList - 录音文件列表,默认为当前记录的urlList
*/ */
clearSavedFiles({ recordUrlList = [] } = this.record) { clearSavedFiles({ urlList = [] } = this.record) {
// 遍历录音文件列表并删除每个文件 // 遍历录音文件列表并删除每个文件
recordUrlList.forEach(item => { urlList.forEach(item => {
uni.$logger.local.info('〖接待记录Record〗 == 清除已保存文件 -> ' + item.file) uni.$logger.local.info('〖接待记录Record〗 == 清除已保存文件 -> ' + item.file)
this.removeFile(item.file) this.removeFile(item.file)
}) })
} }
/** /**
* 将已保存的文件列表映射为上传列表(统一拼接基础保存路径) * 将已保存的文件列表映射为上传列表(统一拼接基础保存路径)
* @param {Array} recordUrlList - 已保存文件路径列表(形如 { file }) * @param {Array} urlList - 已保存文件路径列表(形如 { file })
* @returns {Promise<Array>} 规范化后的上传列表(形如 { status, file }) * @returns {Promise<Array>} 规范化后的上传列表(形如 { status, file })
*/ */
async __analysisUrlList(recordUrlList) { async __analysisUrlList(urlList) {
if (!recordUrlList?.length) return [] if (!urlList?.length) return []
try { try {
const basePath = await this.getFilePath() const basePath = await this.getFilePath()
const list = [] const list = []
for (const item of recordUrlList) { for (const item of urlList) {
const filePath = item?.file const filePath = item?.file
if (typeof filePath === 'string' && filePath.length > 0) { if (typeof filePath === 'string' && filePath.length > 0) {
const baseName = filePath.split('/').pop() const baseName = filePath.split('/').pop()
...@@ -207,9 +207,9 @@ class TempRecord { ...@@ -207,9 +207,9 @@ class TempRecord {
return { return {
id: utils.uuid(), id: utils.uuid(),
...this.newRecord, ...this.newRecord,
receptionStartTime: this.getTimeNow(), startTime: this.getTimeNow(),
receptionEndTime: '', endTime: '',
recordUrlList: [] urlList: []
} }
} }
...@@ -287,11 +287,11 @@ class TempRecord { ...@@ -287,11 +287,11 @@ class TempRecord {
const savedPath = await this.saveFilePath(lastAudio) const savedPath = await this.saveFilePath(lastAudio)
if (savedPath && this.record) { if (savedPath && this.record) {
this.record.tempFilePath = lastAudio this.record.tempFilePath = lastAudio
const last = this.record.recordUrlList[this.record.recordUrlList.length - 1] const last = this.record.urlList[this.record.urlList.length - 1]
if (last && last.file === savedPath) { if (last && last.file === savedPath) {
uni.$logger.local.warn('〖接待记录Record〗 == 录音未变化,跳过添加 -> ' + savedPath) uni.$logger.local.warn('〖接待记录Record〗 == 录音未变化,跳过添加 -> ' + savedPath)
} else { } else {
this.record.recordUrlList.push({ file: savedPath }) this.record.urlList.push({ file: savedPath })
uni.$logger.local.info('〖接待记录Record〗 == 添加新录音成功:' + savedPath) uni.$logger.local.info('〖接待记录Record〗 == 添加新录音成功:' + savedPath)
} }
} }
...@@ -333,8 +333,8 @@ class TempRecord { ...@@ -333,8 +333,8 @@ class TempRecord {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
updatePath() { updatePath() {
const { id, tempFilePath, recordUrlList } = this.record const { id, tempFilePath, urlList } = this.record
return this.updateRecord({ tempFilePath, recordUrlList }, { id }) return this.updateRecord({ tempFilePath, urlList }, { id })
} }
/** /**
* 保存文件 * 保存文件
...@@ -342,8 +342,8 @@ class TempRecord { ...@@ -342,8 +342,8 @@ class TempRecord {
* @returns - 返回保存后的文件路径 * @returns - 返回保存后的文件路径
*/ */
async saveTempFile(record = this.record) { async saveTempFile(record = this.record) {
let { tempFilePath, recordUrlList } = record let { tempFilePath, urlList } = record
if (!tempFilePath || recordUrlList.length === 0) { if (!tempFilePath || urlList.length === 0) {
if (!this.timer) { if (!this.timer) {
uni.$logger.local.info('〖接待记录Record〗 == 无可保存的临时录音,当前未在轮询中,跳过自动补录') uni.$logger.local.info('〖接待记录Record〗 == 无可保存的临时录音,当前未在轮询中,跳过自动补录')
return return
...@@ -352,14 +352,14 @@ class TempRecord { ...@@ -352,14 +352,14 @@ class TempRecord {
await this.addNewAudioAndUpdate() await this.addNewAudioAndUpdate()
return return
} }
const lastIndex = recordUrlList.length - 1 const lastIndex = urlList.length - 1
if (lastIndex < 0 || !tempFilePath) return if (lastIndex < 0 || !tempFilePath) return
const { file } = recordUrlList[lastIndex] const { file } = urlList[lastIndex]
const saveResultPath = await this.saveFilePath(tempFilePath) const saveResultPath = await this.saveFilePath(tempFilePath)
if (saveResultPath) { if (saveResultPath) {
uni.$logger.local.info('〖接待记录Record〗 == 删除上一次保存的文件 ' + file) uni.$logger.local.info('〖接待记录Record〗 == 删除上一次保存的文件 ' + file)
await this.removeFile(file) await this.removeFile(file)
record.recordUrlList[lastIndex].file = saveResultPath record.urlList[lastIndex].file = saveResultPath
} }
return saveResultPath return saveResultPath
} }
...@@ -422,12 +422,12 @@ class TempRecord { ...@@ -422,12 +422,12 @@ class TempRecord {
} }
/** /**
* 将当前内存的 `recordUrlList` 写回数据库 * 将当前内存的 `urlList` 写回数据库
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
updateUrlList() { updateUrlList() {
const { id, recordUrlList } = this.record const { id, urlList } = this.record
return this.updateRecord({ recordUrlList }, { id }) return this.updateRecord({ urlList }, { id })
} }
/** /**
* 启动保存临时录音的轮询 * 启动保存临时录音的轮询
...@@ -479,7 +479,7 @@ class TempRecord { ...@@ -479,7 +479,7 @@ class TempRecord {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
setReceptionEndTime() { setReceptionEndTime() {
return this.__update('receptionEndTime', this.getTimeNow()) return this.__update('endTime', this.getTimeNow())
} }
/** /**
* 获取当前时间字符串(格式化) * 获取当前时间字符串(格式化)
...@@ -493,7 +493,7 @@ class TempRecord { ...@@ -493,7 +493,7 @@ class TempRecord {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
withError() { withError() {
return this.__update('endReasonType', 1) // return this.__update('endReasonType', 1)
} }
/** /**
* 批量更新当前记录的多个预填字段 * 批量更新当前记录的多个预填字段
......
...@@ -4,39 +4,27 @@ ...@@ -4,39 +4,27 @@
* @Author: limin * @Author: limin
* @Date: 2025-01-02 18:34:39 * @Date: 2025-01-02 18:34:39
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-01-06 09:36:04 * @LastEditTime: 2025-12-23 11:11:04
* @FilePath: \gl_tape\utils\recordManager\dbRecord.js * @FilePath: \simgle_app\utils\recordManager\dbRecord.js
*/ */
import DBManager from '../DBManager.js' import DBManager from '../DBManager.js'
class DBRecord { class DBRecord {
table_columns = [ table_columns = [
`id TEXT PRIMARY KEY`, `id TEXT PRIMARY KEY`,
`staffUuid TEXT`, 'typeCode TEXT',
`staffName TEXT`, 'carType TEXT',
`serviceMerchantId INTEGER`, 'customerType TEXT',
'carModel TEXT',
'endReasonType INTEGER',
'customerName TEXT',
'phoneNumber TEXT',
'appCode TEXT',
'loginPhone TEXT',
'salesName TEXT',
'salesUuid TEXT',
'receptionStatus INTEGER',
'receptionStartTime TEXT',
'receptionEndTime TEXT',
'receptionCustomerPaySourceList TEXT',
'merchantId INTEGER', 'merchantId INTEGER',
'merchantName TEXT', 'machineCode TEXT',
'bussinessType INTEGER', 'customerName TEXT',
'channelType INTEGER', 'customerPhone TEXT',
'receptionCustomerMaterialPointList TEXT', `userId INTEGER`,
'recordUrlList TEXT', `userName TEXT`,
'startTime TEXT',
'endTime TEXT',
'materialId INTEGER',
'urlList TEXT',
'tempFilePath TEXT', 'tempFilePath TEXT',
'carBrand TEXT',
'carBrandId INTEGER',
'oneCarBrand TEXT',
'oneCarBrandId INTEGER'
] ]
table_name = 'temp_records' table_name = 'temp_records'
constructor() { constructor() {
......
/* /*
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 17:16:46 * @Date: 2024-04-08 17:16:46
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: limin
* @LastEditTime: 2025-01-17 09:37:32 * @LastEditTime: 2025-12-23 09:44:47
* @FilePath: \gl_tape\utils\utils.js * @FilePath: \simgle_app\utils\utils.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
function convertDateTimeFormat(dateTimeStr, separator = '-') { function convertDateTimeFormat(dateTimeStr, separator = '-') {
...@@ -188,7 +188,8 @@ async function getAudioFilePath(path = '') { ...@@ -188,7 +188,8 @@ async function getAudioFilePath(path = '') {
return `file://${rootPath}${path}` return `file://${rootPath}${path}`
} }
export function serializeIfObject(msg) { export function serializeIfObject(msg) {
return typeof msg === 'object' ? JSON.stringify(msg) : msg.toString() if (msg === undefined || msg === null) return String(msg)
return typeof msg === 'object' ? JSON.stringify(msg) : String(msg)
} }
export function isInteger(value) { export function isInteger(value) {
if (typeof value === 'number') { if (typeof value === 'number') {
......
...@@ -17,7 +17,7 @@ export default class AddRecordWorker { ...@@ -17,7 +17,7 @@ export default class AddRecordWorker {
} }
const keys = Object.keys(record) const keys = Object.keys(record)
const dto = new RecordDto({}) const dto = new RecordDto({})
const existKeys = ['id', 'recordUrlList'] const existKeys = ['id', 'urlList']
keys.forEach(key => { keys.forEach(key => {
if (!existKeys.includes(key) && !dto.hasOwnProperty(key)) { if (!existKeys.includes(key) && !dto.hasOwnProperty(key)) {
throw new Error(`数据格式错误,表中没有 ${key} 字段`) throw new Error(`数据格式错误,表中没有 ${key} 字段`)
......
...@@ -9,7 +9,7 @@ export default class AddTempRecordWorker { ...@@ -9,7 +9,7 @@ export default class AddTempRecordWorker {
} }
const keys = Object.keys(record) const keys = Object.keys(record)
const dto = new RecordDto({}) const dto = new RecordDto({})
const existKeys = ['id', 'recordUrlList','tempFilePath'] const existKeys = ['id', 'urlList','tempFilePath']
keys.forEach(key => { keys.forEach(key => {
if (!existKeys.includes(key) && !dto.hasOwnProperty(key)) { if (!existKeys.includes(key) && !dto.hasOwnProperty(key)) {
throw new Error(`数据格式错误,表中没有 ${key} 字段`) throw new Error(`数据格式错误,表中没有 ${key} 字段`)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!