Commit 457aa138 by 张立顺

Merge branch 'SAAS+V4.49' of http://192.168.3.233:8090/glsx/gl_tape into SAAS+V4.49

2 parents eddbbb4d 95db8d38
Showing 82 changed files with 1603 additions and 1282 deletions
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-07 17:09:53 * @Date: 2024-04-07 17:09:53
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-12-31 10:50:50 * @LastEditTime: 2025-01-14 11:27:04
* @FilePath: \gl_tape\App.vue * @FilePath: \gl_tape\App.vue
* @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
--> -->
...@@ -15,10 +15,8 @@ export default { ...@@ -15,10 +15,8 @@ export default {
computed: { computed: {
...mapState('audio', ['isEnd', 'isStart']) ...mapState('audio', ['isEnd', 'isStart'])
}, },
onLoad() {},
onLaunch: async function () { onLaunch: async function () {
this.onKeep() this.onKeep()
// this.init()
this.setAPPVersion() this.setAPPVersion()
setTimeout(() => { setTimeout(() => {
plus.screen.unlockOrientation() //解除锁定屏幕方向 plus.screen.unlockOrientation() //解除锁定屏幕方向
...@@ -31,6 +29,7 @@ export default { ...@@ -31,6 +29,7 @@ export default {
}, },
methods: { methods: {
onKeep() { onKeep() {
keepAlive &&
keepAlive.onKeep( keepAlive.onKeep(
{ {
title: '接待', title: '接待',
...@@ -41,50 +40,10 @@ export default { ...@@ -41,50 +40,10 @@ export default {
} }
) )
}, },
init() {
uni.addInterceptor('navigateTo', {
//监听跳转
invoke(e) {
console.log('******** invoke-navigateTo ********', e.url.split('?').shift())
if (PATH.includes(e.url.split('?').shift())) {
console.log(888)
}
}
})
//2
uni.addInterceptor('redirectTo', {
//监听关闭本页面跳转
invoke(e) {
console.log('******** redirectTo ********', e.url)
}
})
uni.addInterceptor('switchTab', {
//监听tabBar跳转
invoke(e) {
console.log('******** switchTab ********', e.url)
}
})
//4
uni.addInterceptor('navigateBack', {
//监听返回
invoke(e) {
console.log('******** navigateBack ********', e)
}
})
},
setAPPVersion() { setAPPVersion() {
let version = plus.runtime.version let version = plus.runtime.version
let storageVersion = uni.$storage.get('storageVersion') let storageVersion = uni.$storage.get('storageVersion')
console.log(storageVersion, version) uni.$logger.local.info(`storageVersion ->${storageVersion}, version ->${version}`)
if (storageVersion != version) { if (storageVersion != version) {
uni.$storage.rm('userInfo') uni.$storage.rm('userInfo')
uni.$storage.rm('noSignInUuid') uni.$storage.rm('noSignInUuid')
...@@ -94,7 +53,7 @@ export default { ...@@ -94,7 +53,7 @@ export default {
}, },
onShow: async function () { onShow: async function () {
uni.$logger.local.info('切回app') this.$store.dispatch('setBackgroundState', false)
// const systemInfo = await uni.$api.systemApi.getMockData(); // const systemInfo = await uni.$api.systemApi.getMockData();
// if (systemInfo.isCheckedUpdate) { // if (systemInfo.isCheckedUpdate) {
// checkUpdate(); // checkUpdate();
...@@ -106,7 +65,7 @@ export default { ...@@ -106,7 +65,7 @@ export default {
// }); // });
}, },
onHide: function () { onHide: function () {
uni.$logger.local.info('切出app') this.$store.dispatch('setBackgroundState', true)
}, },
onError: function (e) { onError: function (e) {
try { try {
...@@ -119,12 +78,8 @@ export default { ...@@ -119,12 +78,8 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
body {
// overflow: hidden;
}
page { page {
font-size: toRpx(28); font-size: 28rpx;
height: 100%; height: 100%;
min-height: 100%; min-height: 100%;
} }
...@@ -170,7 +125,7 @@ button { ...@@ -170,7 +125,7 @@ button {
margin: 0; margin: 0;
padding: 0; padding: 0;
line-height: 1.5; line-height: 1.5;
font-size: toRpx(28); font-size: 28rpx;
background-color: transparent; background-color: transparent;
border-radius: 0; border-radius: 0;
position: relative; position: relative;
...@@ -182,14 +137,14 @@ button::after { ...@@ -182,14 +137,14 @@ button::after {
// 指定按钮按下去的样式类 // 指定按钮按下去的样式类
.button-hover { .button-hover {
transform: translate(toRpx(1), toRpx(1)); transform: translate(1rpx, 1rpx);
} }
.webview-container { .webview-container {
position: absolute; position: absolute;
width: toRpx(100); width: 100rpx;
height: toRpx(100); height: 100rpx;
top: 0; top: 0rpx;
left: 0; left: 0rpx;
} }
</style> </style>
No preview for this file type
No preview for this file type

7.85 MB | W: | H:

2.3 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -195,6 +195,7 @@ export default { ...@@ -195,6 +195,7 @@ export default {
customerInfo.carBrand = selectItem.carChildsBrandName customerInfo.carBrand = selectItem.carChildsBrandName
this.$store.dispatch('setCustomerInfo', customerInfo) this.$store.dispatch('setCustomerInfo', customerInfo)
this.$refs.carBoxVisible?.close(); this.$refs.carBoxVisible?.close();
this.$store.dispatch('updateViewKey')
this.$emit('select', { this.$emit('select', {
...item, ...item,
...selectItem ...selectItem
......
...@@ -374,7 +374,6 @@ export default { ...@@ -374,7 +374,6 @@ export default {
this.total = total this.total = total
} catch (error) { } catch (error) {
uni.hideLoading() uni.hideLoading()
console.log(error)
this.flag = true this.flag = true
} }
}, },
...@@ -465,7 +464,6 @@ export default { ...@@ -465,7 +464,6 @@ export default {
title: error, title: error,
icon: 'none' icon: 'none'
}) })
console.log(error)
} }
}, },
jumpDetail (id) { jumpDetail (id) {
...@@ -513,7 +511,6 @@ export default { ...@@ -513,7 +511,6 @@ export default {
this.total = total this.total = total
this.$forceUpdate() this.$forceUpdate()
} catch (error) { } catch (error) {
console.log(error)
uni.hideLoading() uni.hideLoading()
this.flag = true this.flag = true
} }
......
...@@ -255,7 +255,6 @@ export default { ...@@ -255,7 +255,6 @@ export default {
res.customerTagName = res.customerTagName.replace(/,/g, '|') res.customerTagName = res.customerTagName.replace(/,/g, '|')
res.arrivalDate = dayjs(res.arrivalDate).format("YYYY-MM-DD") res.arrivalDate = dayjs(res.arrivalDate).format("YYYY-MM-DD")
this.customerInfo = res this.customerInfo = res
console.log(res)
}, },
back () { back () {
this.backClass = 'backClass' this.backClass = 'backClass'
......
...@@ -149,7 +149,7 @@ export default { ...@@ -149,7 +149,7 @@ export default {
} }
.calendar-weekdays { .calendar-weekdays {
display: flex; display: flex;
height: 80rpx; height: 56rpx;
margin-top: 30rpx; margin-top: 30rpx;
.calendar-weekday { .calendar-weekday {
flex: 1; flex: 1;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2025-01-08 10:31:49 * @Date: 2025-01-08 10:31:49
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2025-01-10 09:34:32 * @LastEditTime: 2025-01-15 15:38:27
* @FilePath: \gl-tape\components\HomeFrame\components\Income\Dailog.vue * @FilePath: \gl-tape\components\HomeFrame\components\Income\Dailog.vue
* @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
--> -->
...@@ -63,10 +63,10 @@ export default { ...@@ -63,10 +63,10 @@ export default {
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
background: #fff; background: #fff;
background-image: linear-gradient(179deg, #d6e9ff 12%, #ffffff 100%); /* 顶部渐变和底部白色 */ background-image: linear-gradient(179deg, #d1e5ff 12%, #ffffff00 100%);
background-size: background-size:
100% 110rpx, 100% 210rpx,
100% calc(100% - 110rpx); /* 分别设置渐变和白色的背景大小 */ 100% calc(100% - 210rpx); /* 分别设置渐变和白色的背景大小 */
background-repeat: no-repeat, no-repeat; /* 确保背景不重复 */ background-repeat: no-repeat, no-repeat; /* 确保背景不重复 */
background-position: top, bottom; /* 分别设置渐变和白色的位置 */ background-position: top, bottom; /* 分别设置渐变和白色的位置 */
border-radius: 48rpx; border-radius: 48rpx;
...@@ -78,6 +78,7 @@ export default { ...@@ -78,6 +78,7 @@ export default {
color: #1a1a1a; color: #1a1a1a;
font-weight: 600; font-weight: 600;
margin-top: -4rpx; margin-top: -4rpx;
margin-left: 16rpx;
} }
.enlarge { .enlarge {
transform: scale(1.5); transform: scale(1.5);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2025-01-07 13:49:15 * @Date: 2025-01-07 13:49:15
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2025-01-13 16:16:13 * @LastEditTime: 2025-01-16 14:57:39
* @FilePath: \gl-tape\components\HomeFrame\components\Income\History.vue * @FilePath: \gl-tape\components\HomeFrame\components\Income\History.vue
* @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
--> -->
...@@ -27,11 +27,19 @@ ...@@ -27,11 +27,19 @@
</view> </view>
<view class="income-box"> <view class="income-box">
<view class="income-header"> <view class="income-header">
<text>{{ year - 1 }}年8月收入</text> <view class="sprite-icon icon-income-icon"></view>
<text>{{ year - 1 }}年{{ monthStr || month }}月收入</text>
</view>
<template v-if="salaryDetail">
<view class="income-footer">
<view class="footer-up flex">
<view class="sprite-icon icon-income-card"></view>
<view class="footer-label">当月收入</view>
</view>
<view class="footer-price">
<text>¥</text>
{{ salaryDetail.correctSalary || 0 }}
</view> </view>
<view class="income-tips">
<view class="sprite-icon icon-tips-b"></view>
<text>以下未包括 个人所得税、社保等事项</text>
</view> </view>
<view class="income-list"> <view class="income-list">
<template v-for="(item, index) in IncomeList"> <template v-for="(item, index) in IncomeList">
...@@ -43,15 +51,21 @@ ...@@ -43,15 +51,21 @@
</view> </view>
</template> </template>
</view> </view>
<view class="income-footer">
<view class="footer-label">当月收入</view> <view class="income-tips">
<view class="footer-price"> <view class="sprite-icon icon-tips-b"></view>
<text>¥</text> <text>以下未包括 个人所得税、社保等事项</text>
{{ salaryDetail.correctSalary || 0 }}
</view> </view>
</template>
<view class="empty-body" v-else>
<view class="empty-box">
<image :src="require('@/assets/images/boutique/nothing.png')" mode="heightFix" />
<view class="empty-text">暂无记录</view>
</view> </view>
</view> </view>
</view> </view>
</view>
<Detail @close="show = false" :show="show" :detail="detail" :tabelTh="detail.tabelTh" :tabelTr="detail.tabelTr"></Detail> <Detail @close="show = false" :show="show" :detail="detail" :tabelTh="detail.tabelTh" :tabelTr="detail.tabelTr"></Detail>
<Question @close="tipsShow = false" :show="tipsShow" :detail="tipsDetail"></Question> <Question @close="tipsShow = false" :show="tipsShow" :detail="tipsDetail"></Question>
</view> </view>
...@@ -91,6 +105,7 @@ export default { ...@@ -91,6 +105,7 @@ export default {
], ],
width: 600, width: 600,
height: 420, height: 420,
monthStr: '',
canPersent: [], //百分比数组 canPersent: [], //百分比数组
listIndex: 0 listIndex: 0
...@@ -101,8 +116,8 @@ export default { ...@@ -101,8 +116,8 @@ export default {
query query
.select('.canvas-box') .select('.canvas-box')
.boundingClientRect(data => { .boundingClientRect(data => {
this.width = data.width this.width = data.width - 30
this.height = data.height - 60 this.height = data.height - 15
// this.showChart() // this.showChart()
}) })
.exec() .exec()
...@@ -147,7 +162,7 @@ export default { ...@@ -147,7 +162,7 @@ export default {
*/ */
monthSalaryDetail(salaryMonth) { monthSalaryDetail(salaryMonth) {
uni.$api.pointApi.monthSalaryDetail({ salaryMonth }).then(res => { uni.$api.pointApi.monthSalaryDetail({ salaryMonth }).then(res => {
this.salaryDetail = res || {} this.salaryDetail = res
}) })
}, },
...@@ -199,6 +214,7 @@ export default { ...@@ -199,6 +214,7 @@ export default {
if (this.canvasList[i].num) { if (this.canvasList[i].num) {
this.showChart(i) // 重新绘制图表,如果需要更新显示 this.showChart(i) // 重新绘制图表,如果需要更新显示
const month = this.canvasList[i].date.replace(/\D+/, '') const month = this.canvasList[i].date.replace(/\D+/, '')
this.monthStr = month
this.monthSalaryDetail(this.year - 1 + '-' + month) this.monthSalaryDetail(this.year - 1 + '-' + month)
} }
...@@ -232,7 +248,7 @@ export default { ...@@ -232,7 +248,7 @@ export default {
} }
} }
console.log('max---->', max) max = 100 * Math.ceil(max / 100)
// 计算百分比: 以数组中最大的为100%,来计算其他的百分比 // 计算百分比: 以数组中最大的为100%,来计算其他的百分比
for (var i = 0; i < this.canvasList.length; i++) { for (var i = 0; i < this.canvasList.length; i++) {
...@@ -240,7 +256,18 @@ export default { ...@@ -240,7 +256,18 @@ export default {
} }
console.log(this.canPersent) console.log(this.canPersent)
const step = Math.ceil(max / 5) // 假设我们想要5个刻度
const yStep = (this.height - 40) / 5
// 绘制纵坐标线和刻度标签
for (let i = 0; i <= 5; i++) {
const y = this.height - i * yStep
ctx.beginPath()
ctx.moveTo(20, y)
ctx.lineTo(30, y)
// ctx.stroke()
i != 0 && ctx.fillText('¥' + step * i, 0, y + 5)
}
// 柱状图之间的间隔 // 柱状图之间的间隔
// 绘制7个粗线条 (300-20)/7 = 40,所以 i 每次要加上40 20为左右间隔 // 绘制7个粗线条 (300-20)/7 = 40,所以 i 每次要加上40 20为左右间隔
var gap = this.width / this.canPersent.length var gap = this.width / this.canPersent.length
...@@ -254,7 +281,7 @@ export default { ...@@ -254,7 +281,7 @@ export default {
continue continue
} }
// 柱状图上的数据 // 柱状图上的数据
ctx.fillText(this.canvasList[i].num, 33 + gap * i, this.height - this.canPersent[i] - 15) ctx.fillText('¥' + this.canvasList[i].num, 30 + gap * i, this.height - this.canPersent[i] - 15)
// if (this.canPersent[i] == 0) { // if (this.canPersent[i] == 0) {
// i++ // i++
...@@ -264,7 +291,7 @@ export default { ...@@ -264,7 +291,7 @@ export default {
ctx.beginPath() ctx.beginPath()
ctx.setStrokeStyle(i == index ? 'rgba(44, 102, 247, 1)' : 'rgba(44, 102, 247, 0.2)') //设置柱状图颜色 ctx.setStrokeStyle(i == index ? 'rgba(44, 102, 247, 1)' : 'rgba(44, 102, 247, 0.2)') //设置柱状图颜色
ctx.moveTo(40 + gap * i, this.height - this.canPersent[i] - 6) ctx.moveTo(40 + gap * i, this.height - this.canPersent[i] - 6)
ctx.lineTo(40 + gap * i, this.height - 6) ctx.lineTo(40 + gap * i, this.height - 15)
ctx.lineWidth = 10 ctx.lineWidth = 10
ctx.lineCap = 'round' //设置线条样式 ctx.lineCap = 'round' //设置线条样式
ctx.stroke() ctx.stroke()
...@@ -335,6 +362,10 @@ export default { ...@@ -335,6 +362,10 @@ export default {
color: #808291; color: #808291;
display: flex; display: flex;
align-items: center; align-items: center;
.sprite-icon {
margin-left: auto;
transform: scale(0.7);
}
.year-text { .year-text {
font-weight: 600; font-weight: 600;
color: rgb(26, 26, 26); color: rgb(26, 26, 26);
...@@ -358,6 +389,9 @@ export default { ...@@ -358,6 +389,9 @@ export default {
font-weight: 600; font-weight: 600;
display: flex; display: flex;
align-items: center; align-items: center;
text {
margin-left: 24rpx;
}
} }
.income-tips { .income-tips {
font-size: 24rpx; font-size: 24rpx;
...@@ -367,9 +401,10 @@ export default { ...@@ -367,9 +401,10 @@ export default {
margin: 44rpx 0 74rpx; margin: 44rpx 0 74rpx;
} }
.income-list { .income-list {
height: calc(100% - 254rpx); margin-top: 28rpx;
height: calc(100% - 384rpx);
.income-item { .income-item {
height: 80rpx; height: 82rpx;
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0 20rpx 0rpx 32rpx; padding: 0 20rpx 0rpx 32rpx;
...@@ -394,16 +429,23 @@ export default { ...@@ -394,16 +429,23 @@ export default {
} }
} }
.income-footer { .income-footer {
display: flex; margin-top: 24rpx;
justify-content: space-between; justify-content: space-between;
padding: 0 20rpx; padding: 32rpx 48rpx;
background-image: linear-gradient(45deg, #edfaff 10%, #eff7fe 30%, #e5f2fe 50%, #d8f3fb 70%, #edfaff 80%, #c3e4fa 100%);
border: toRpx(2) solid #ffffff;
box-shadow: inset 0 toRpx(4) toRpx(8) 0 #ffffff80;
border-radius: 24rpx;
.footer-label { .footer-label {
font-size: 26rpx; font-size: 26rpx;
color: #181a1f; color: #181a1f;
margin-left: 16rpx;
} }
.footer-price { .footer-price {
font-size: 40rpx; font-size: 40rpx;
color: #181a1f; color: #181a1f;
margin-top: 16rpx;
font-weight: 600;
text { text {
font-size: 28rpx; font-size: 28rpx;
} }
...@@ -411,6 +453,72 @@ export default { ...@@ -411,6 +453,72 @@ export default {
} }
} }
} }
.empty-body {
height: calc(100vh - 540rpx);
overflow-y: auto;
overflow-x: hidden;
.empty-box {
text-align: center;
margin-top: 160rpx;
image {
height: 224rpx;
}
.empty-text {
font-size: 28rpx;
color: #808291;
line-height: 40rpx;
text-align: center;
}
}
.tips-item {
padding: 30rpx 32rpx;
width: 100%;
min-height: 384rpx;
background: #ffffffb3;
border-radius: 24rpx;
margin-top: 32rpx;
.item-header {
text {
font-size: 24rpx;
color: #808291;
}
}
.item-logo {
width: 100%;
height: 88rpx;
background-image: linear-gradient(81deg, #f0f6ff 0%, #f7faff 4%, #ecf4fe 9%, #f8f9ff 11%, #e8f2ff 43%, #f0f2ff 66%, #dbedff 100%);
font-size: 32rpx;
text-align: center;
line-height: 88rpx;
font-weight: 700;
margin: 10rpx 0;
text {
background: linear-gradient(129deg, #0eabf9 13%, #2f80ea 50%, #7d6ee6 91%);
color: transparent;
background-clip: text;
-webkit-background-clip: text;
}
}
.item-content {
font-size: 26rpx;
color: #181a1f;
line-height: 40rpx;
}
.item-footer {
margin-top: 16rpx;
text {
font-size: 24rpx;
color: #adb0b8;
}
}
}
}
.dailog-content { .dailog-content {
font-size: 32rpx; font-size: 32rpx;
color: #1a1a1a; color: #1a1a1a;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2025-01-08 10:31:49 * @Date: 2025-01-08 10:31:49
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2025-01-09 11:40:02 * @LastEditTime: 2025-01-13 20:36:45
* @FilePath: \gl-tape\components\HomeFrame\components\Income\Dailog.vue * @FilePath: \gl-tape\components\HomeFrame\components\Income\Dailog.vue
* @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
--> -->
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<view class="sprite-icon icon-locker-icon"></view> <view class="sprite-icon icon-locker-icon"></view>
</view> </view>
<view class="dailog-right"> <view class="dailog-right">
<view class="dailog-close" @click="close"><uni-icons type="closeempty" size="20"></uni-icons></view> <view class="dailog-close" @click="back"><uni-icons type="closeempty" size="20"></uni-icons></view>
<view class="password-title flex"> <view class="password-title flex">
<text>{{ passwordInfo.title }}</text> <text>{{ passwordInfo.title }}</text>
<view @click="changeIconShow" :class="`sprite-icon icon-${passwordInfo.icon}`"></view> <view @click="changeIconShow" :class="`sprite-icon icon-${passwordInfo.icon}`"></view>
...@@ -329,8 +329,9 @@ export default { ...@@ -329,8 +329,9 @@ export default {
} }
} }
}, },
close() { back() {
this.$emit('close') console.log('back')
this.$emit('close', 1)
} }
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2025-01-10 14:54:29 * @Date: 2025-01-10 14:54:29
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2025-01-13 17:45:47 * @LastEditTime: 2025-01-15 20:51:52
* @FilePath: \gl-tape\components\HomeFrame\components\Income\Promotion.vue * @FilePath: \gl-tape\components\HomeFrame\components\Income\Promotion.vue
* @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
--> -->
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<view class="sprite-icon icon-promotion"></view> <view class="sprite-icon icon-promotion"></view>
<text>{{ item.title }}</text> <text>{{ item.title }}</text>
</view> </view>
<view class="item-content" v-html="jobDetail[item.value]"></view> <view class="item-content" v-html="jobDetail[item.value]" v-if="jobDetail[item.value]"></view>
</view> </view>
</view> </view>
</view> </view>
...@@ -102,8 +102,13 @@ export default { ...@@ -102,8 +102,13 @@ export default {
this.getJobConfig(index) this.getJobConfig(index)
}, },
getJobConfig() { getJobConfig() {
uni.showLoading({
mask: true
})
uni.$api.pointApi.getJobConfig({ jobType: this.activeIndex }).then(res => { uni.$api.pointApi.getJobConfig({ jobType: this.activeIndex }).then(res => {
this.jobDetail = res || {} this.jobDetail = res || {}
console.log(this.jobDetail, 'jobDetail')
uni.hideLoading()
}) })
} }
} }
......
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2025-01-14 11:25:37
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2025-01-16 11:39:18
* @FilePath: \gl-tape\components\HomeFrame\components\Income\Question.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template> <template>
<Tips @close="close" v-if="show" width="1288rpx" :title="detail.label"> <Tips @close="close" v-if="show" width="1288rpx" :title="detail.label">
<view class="dailog-body" slot="content"> <view class="dailog-body" slot="content">
...@@ -9,23 +17,6 @@ ...@@ -9,23 +17,6 @@
<view v-for="(item, index) in detail.warnList" :key="index" :style="item.style">{{ item.message }}</view> <view v-for="(item, index) in detail.warnList" :key="index" :style="item.style">{{ item.message }}</view>
</view> </view>
</view> </view>
<template v-if="detail.base">
<view class="base-line">
<view class="base-label">职级工资</view>
<view class="base-times">(初级销售)</view>
<view class="base-value">3,500</view>
</view>
<view class="base-line">
<view class="base-label">应出勤天数</view>
<view class="base-times">(本月31-4)</view>
<view class="base-value">27天</view>
</view>
<view class="base-line">
<view class="base-label">实际出勤天数</view>
<view class="base-times">(截至2025-1-6)</view>
<view class="base-value">22天</view>
</view>
</template>
<view class="dailog-desc" v-if="detail.desc">{{ detail.desc }}</view> <view class="dailog-desc" v-if="detail.desc">{{ detail.desc }}</view>
</view> </view>
</Tips> </Tips>
...@@ -72,6 +63,17 @@ export default { ...@@ -72,6 +63,17 @@ export default {
.warn-label { .warn-label {
font-size: 28rpx; font-size: 28rpx;
color: #808291; color: #808291;
line-height: 44rpx;
}
}
.base-line {
font-size: 32rpx;
color: #1a1a1a;
line-height: 50rpx;
.base-times {
margin-left: auto;
color: #808291;
margin-right: 32rpx;
} }
} }
.dailog-desc { .dailog-desc {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2025-01-08 10:31:49 * @Date: 2025-01-08 10:31:49
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2025-01-10 17:47:07 * @LastEditTime: 2025-01-15 15:48:50
* @FilePath: \gl-tape\components\HomeFrame\components\Income\Dailog.vue * @FilePath: \gl-tape\components\HomeFrame\components\Income\Dailog.vue
* @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
--> -->
...@@ -68,6 +68,7 @@ export default { ...@@ -68,6 +68,7 @@ export default {
color: #1a1a1a; color: #1a1a1a;
font-weight: 600; font-weight: 600;
margin-top: -10rpx; margin-top: -10rpx;
margin-left: 16rpx;
} }
.enlarge { .enlarge {
transform: scale(1.5); transform: scale(1.5);
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</view> </view>
</view> </view>
<Password v-if="showPassword" @close="showPassword = false"></Password> <Password v-if="showPassword" @close="closePassword"></Password>
</template> </template>
<view class="dailog-panel" v-else> <view class="dailog-panel" v-else>
<view class="dailog-box"> <view class="dailog-box">
...@@ -83,21 +83,27 @@ export default { ...@@ -83,21 +83,27 @@ export default {
this.hideFooter(false) this.hideFooter(false)
const { phone } = uni.$storage.get('userInfo') const { phone } = uni.$storage.get('userInfo')
const res = await uni.$api.pointApi.incomeMeasurementConfig({ staffPhone: phone }) const res = await uni.$api.pointApi.incomeMeasurementConfig({ staffPhone: phone })
const phoneList = res.staffPhone || [] const phoneList = res.whiteConfig || {}
console.log(res.configFlag == 0, res.configFlag == 2 && phoneList.includes(phone)) if (res.configFlag == 0 || (res.configFlag == 2 && phoneList.staffPhone == phone)) {
if (res.configFlag == 0 || (res.configFlag == 2 && phoneList.includes(phone))) {
this.isShow = true this.isShow = true
} else { } else {
// return this.isShow = false
return
} }
this.incomeCalculation() this.incomeCalculation()
this.start() // this.start()
}, },
destroyed() { destroyed() {
this.hideFooter(true) this.hideFooter(true)
clearInterval(this.interval) clearInterval(this.interval)
}, },
methods: { methods: {
closePassword(val) {
if (val) {
this.close()
}
this.showPassword = false
},
/** /**
* 每1s执行一次,执行60次后,触发close方法 * 每1s执行一次,执行60次后,触发close方法
* @returns {undefined} * @returns {undefined}
...@@ -115,7 +121,7 @@ export default { ...@@ -115,7 +121,7 @@ export default {
* 点击页面时,清除定时器 * 点击页面时,清除定时器
*/ */
handleTouch() { handleTouch() {
clearInterval(this.interval) this.times = 0
}, },
close() { close() {
this.$emit('selectTab', 0) this.$emit('selectTab', 0)
...@@ -147,49 +153,49 @@ export default { ...@@ -147,49 +153,49 @@ export default {
position: relative; position: relative;
.income-header { .income-header {
position: absolute; position: absolute;
top: -120rpx; top: toRpx(-120);
right: 64rpx; right: toRpx(64);
display: flex; display: flex;
.level-box { .level-box {
width: 464rpx; width: toRpx(464);
height: 84rpx; height: toRpx(84);
background: #f0f6ff00; background: #f0f6ff00;
border: 2rpx solid #c0d8fb; border: 2rpx solid #c0d8fb;
border-radius: 42rpx; border-radius: toRpx(42);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 0 32rpx; padding: 0 toRpx(32);
.level-desc { .level-desc {
font-size: 28rpx; font-size: toRpx(28);
color: #181a1f; color: #181a1f;
margin-left: 38rpx; margin-left: toRpx(38);
} }
} }
.time-box { .time-box {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
width: 398rpx; width: toRpx(398);
height: 84rpx; height: toRpx(84);
background: #f0f6ff00; background: #f0f6ff00;
border: 2rpx solid #b0ccf5; border: 2rpx solid #b0ccf5;
border-radius: 42rpx; border-radius: toRpx(42);
margin-left: 32rpx; margin-left: toRpx(32);
padding: 0 32rpx; padding: 0 toRpx(32);
.level-label { .level-label {
font-size: 28rpx; font-size: toRpx(28);
color: #181a1f; color: #181a1f;
} }
.time-day { .time-day {
font-size: 36rpx; font-size: toRpx(36);
color: #2d66f7; color: #2d66f7;
margin-left: 48rpx; margin-left: toRpx(48);
} }
.time-go { .time-go {
border-bottom: 10rpx solid transparent; border-bottom: toRpx(10) solid transparent;
border-left: 14rpx solid #2d66f7; border-left: toRpx(14) solid #2d66f7;
border-top: 10rpx solid transparent; /* 箭头颜色 */ border-top: toRpx(10) solid transparent; /* 箭头颜色 */
} }
} }
} }
...@@ -199,7 +205,7 @@ export default { ...@@ -199,7 +205,7 @@ export default {
width: 100%; width: 100%;
font-weight: 600; font-weight: 600;
position: absolute; position: absolute;
bottom: -50rpx; bottom: -58rpx;
left: 0; left: 0;
text-align: center; text-align: center;
} }
...@@ -208,7 +214,7 @@ export default { ...@@ -208,7 +214,7 @@ export default {
display: grid; display: grid;
grid-template-columns: 68% 32%; grid-template-columns: 68% 32%;
column-gap: 48rpx; column-gap: 48rpx;
height: calc(100vh - 260rpx); height: calc(100vh - 268rpx);
width: calc(100% - 110rpx); width: calc(100% - 110rpx);
margin-top: 32rpx; margin-top: 32rpx;
.income-store { .income-store {
...@@ -240,7 +246,9 @@ export default { ...@@ -240,7 +246,9 @@ export default {
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
background: #fff; background: #fff;
background-image: linear-gradient(179deg, #d6e9ff 12%, #ffffff 100%); /* 顶部渐变和底部白色 */ background-image: linear-gradient(179deg, #d6e9ff 12%, #ffffff 100%); /* 顶部渐变和底部白色 */
background-size: 100% 110rpx, 100% calc(100% - 110rpx); /* 分别设置渐变和白色的背景大小 */ background-size:
100% 110rpx,
100% calc(100% - 110rpx); /* 分别设置渐变和白色的背景大小 */
background-repeat: no-repeat, no-repeat; /* 确保背景不重复 */ background-repeat: no-repeat, no-repeat; /* 确保背景不重复 */
background-position: top, bottom; /* 分别设置渐变和白色的位置 */ background-position: top, bottom; /* 分别设置渐变和白色的位置 */
width: 1040rpx; width: 1040rpx;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-12-31 16:53:31 * @Date: 2024-12-31 16:53:31
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2025-01-09 16:23:06 * @LastEditTime: 2025-01-15 13:36:10
* @FilePath: \gl-tape\components\HomeFrame\components\Point.vue * @FilePath: \gl-tape\components\HomeFrame\components\Point.vue
* @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
--> -->
...@@ -49,8 +49,8 @@ export default { ...@@ -49,8 +49,8 @@ export default {
margin-top: 68rpx; margin-top: 68rpx;
width: 550rpx; width: 550rpx;
height: 84rpx; height: 84rpx;
line-height: 72rpx; line-height: 74rpx;
background: rgba(101, 171, 250, 0.24); background: rgba(101, 171, 250, 0.12);
border-radius: 20rpx; border-radius: 20rpx;
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -66,6 +66,8 @@ export default { ...@@ -66,6 +66,8 @@ export default {
background: #ffffff; background: #ffffff;
border-radius: 16rpx; border-radius: 16rpx;
text-align: center; text-align: center;
font-weight: 600;
color: #4673ff;
} }
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2024-04-08 11:30:30 * @Date: 2024-04-08 11:30:30
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2025-01-10 15:54:24 * @LastEditTime: 2025-01-15 17:47:45
--> -->
<template> <template>
<view class="point-box"> <view class="point-box">
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
{ title: '平板接待精英', style: 'background: #FFFAED;', medalType: 3, logo: require('@/assets/images/point/elite_star.png'), logo_grey: require('@/assets/images/point/elite_grey.png'), content: '平板接待月度无扣分记录', couponName: '50元水果券', couponNum: '1张' } { title: '平板接待精英', style: 'background: #FFFAED;', medalType: 3, logo: require('@/assets/images/point/elite_star.png'), logo_grey: require('@/assets/images/point/elite_grey.png'), content: '平板接待月度无扣分记录', couponName: '50元水果券', couponNum: '1张' }
], ],
badgeList: [], badgeList: [],
tabelTh: [{ title: '积分区间', width: 7 }], tabelTh: [{ title: '积分区间', width: 8 }],
tabelTr: [{ content: '奖惩规则(每月)' }, { list: ['咖啡奶茶券 6 张', '生日当月专享哈根达斯券 1 张', '美团外卖直兑券 6 张', '闭门课分享活动参加资格', '定制公司公仔礼包'] }, { list: ['咖啡奶茶券 4 张', '生日当月专享哈根达斯券 1 张', '美团外卖直兑券 4 张', '定制公司公仔礼包'] }, { list: ['咖啡奶茶券 1 张', '美团外卖直兑券 1 张'] }, { list: ['咖啡奶茶券 1 张', '美团外卖直兑券 1 张'] }, { list: ['专项培训与辅导'] }] tabelTr: [{ content: '奖惩规则(每月)' }, { list: ['咖啡奶茶券 6 张', '生日当月专享哈根达斯券 1 张', '美团外卖直兑券 6 张', '闭门课分享活动参加资格', '定制公司公仔礼包'] }, { list: ['咖啡奶茶券 4 张', '生日当月专享哈根达斯券 1 张', '美团外卖直兑券 4 张', '定制公司公仔礼包'] }, { list: ['咖啡奶茶券 1 张', '美团外卖直兑券 1 张'] }, { list: ['咖啡奶茶券 1 张', '美团外卖直兑券 1 张'] }, { list: ['专项培训与辅导'] }]
} }
}, },
...@@ -354,13 +354,13 @@ export default { ...@@ -354,13 +354,13 @@ export default {
} }
.star-coupon { .star-coupon {
position: absolute; position: absolute;
bottom: toRpx(30); bottom: toRpx(38);
left: toRpx(0); left: toRpx(0);
display: flex; display: flex;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
.coupon-box { .coupon-box {
width: toRpx(390); width: toRpx(424);
height: toRpx(96); height: toRpx(96);
position: relative; position: relative;
display: flex; display: flex;
...@@ -372,7 +372,7 @@ export default { ...@@ -372,7 +372,7 @@ export default {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
width: toRpx(390); width: toRpx(424);
height: toRpx(96); height: toRpx(96);
z-index: -1; z-index: -1;
} }
......
...@@ -200,7 +200,7 @@ export default { ...@@ -200,7 +200,7 @@ export default {
height: toRpx(408); height: toRpx(408);
} }
&.medal-card { &.medal-card {
height: toRpx(782); height: toRpx(750);
margin-bottom: 0; margin-bottom: 0;
} }
&.rule-box { &.rule-box {
...@@ -218,7 +218,7 @@ export default { ...@@ -218,7 +218,7 @@ export default {
border: none; border: none;
background-color: transparent; background-color: transparent;
box-shadow: none; box-shadow: none;
height: calc(100vh - #{toRpx(1150)}); height: calc(100vh - #{toRpx(1118)});
.card-title { .card-title {
font-size: toRpx(36); font-size: toRpx(36);
color: #ffffff !important; color: #ffffff !important;
...@@ -383,7 +383,7 @@ export default { ...@@ -383,7 +383,7 @@ export default {
.month-up { .month-up {
display: flex; display: flex;
align-items: center; align-items: center;
margin-top: toRpx(150); margin-top: toRpx(126);
&:first-child { &:first-child {
margin-top: toRpx(60); margin-top: toRpx(60);
} }
......
...@@ -118,7 +118,6 @@ export default { ...@@ -118,7 +118,6 @@ export default {
message message
} = await uni.$api.userApi.logout(), } = await uni.$api.userApi.logout(),
userInfo = uni.$storage.get("userInfo") userInfo = uni.$storage.get("userInfo")
console.log(code)
if (code == 0) { if (code == 0) {
uni.$storage.rm("userInfo"); uni.$storage.rm("userInfo");
uni.$storage.rm("sessionId"); uni.$storage.rm("sessionId");
...@@ -131,7 +130,6 @@ export default { ...@@ -131,7 +130,6 @@ export default {
}, 500) }, 500)
} else throw message } else throw message
} catch (error) { } catch (error) {
console.log(error)
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
title: error, title: error,
......
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
data() { data() {
return { return {
errorTip:false, errorTip:false,
receptionList: [{ receptionList: Object.freeze([{
label: '成交', label: '成交',
value: 1 value: 1
}, },
...@@ -70,8 +70,8 @@ export default { ...@@ -70,8 +70,8 @@ export default {
label: '战败', label: '战败',
value: 0 value: 0
} }
], ]),
formObject: [{ formObject: Object.freeze([{
label: "车主姓名", label: "车主姓名",
placeholder: '车主姓名', placeholder: '车主姓名',
key: 'customerName', key: 'customerName',
...@@ -108,14 +108,13 @@ export default { ...@@ -108,14 +108,13 @@ export default {
popKey: "employeeBoxVisible", popKey: "employeeBoxVisible",
placeholder: '请选择', placeholder: '请选择',
}, },
], ]),
focusIndex: -1, focusIndex: -1,
customerInfo:{} customerInfo:{}
} }
}, },
mounted() { mounted() {
this.customerInfo = utils.deepClone(this.customerInfoVal) this.customerInfo = utils.deepClone(this.customerInfoVal)
console.log(this.customerInfo)
const i = this.receptionList.findIndex(e => e.value === this.customerInfo.receptionStatus) const i = this.receptionList.findIndex(e => e.value === this.customerInfo.receptionStatus)
this.$set(this.customerInfo, 'receptionStatus', i == -1?'':this.receptionList[i].label) this.$set(this.customerInfo, 'receptionStatus', i == -1?'':this.receptionList[i].label)
}, },
...@@ -157,7 +156,6 @@ export default { ...@@ -157,7 +156,6 @@ export default {
}, },
handleSelect(item, popkey) { handleSelect(item, popkey) {
this.$refs[popkey].close() this.$refs[popkey].close()
console.log(item, popkey)
if (popkey == 'employeeBoxVisible') { if (popkey == 'employeeBoxVisible') {
this.customerInfo.salesUuid = item.uuid this.customerInfo.salesUuid = item.uuid
this.customerInfo.salesName = item.staffName this.customerInfo.salesName = item.staffName
......
<template> <template>
<view class="container" @click="handleTouchStart"> <view
class="container"
@click="handleTouchStart"
>
<view :class="['home', { show: !id && showHome }]"> <view :class="['home', { show: !id && showHome }]">
<left-side :userInfo="userInfo" :tabIndex.sync="tabIndex" ref="leftBox" @changeTab="$emit('changeTab', $event)" @stopAudio="stopAudio" /> <left-side
:userInfo="userInfo"
:tabIndex.sync="tabIndex"
ref="leftBox"
@changeTab="$emit('changeTab', $event)"
@stopAudio="stopAudio"
/>
<view class="right-side"> <view class="right-side">
<template v-if="tabIndex == 0"> <template v-if="tabIndex == 0">
<view class="right-content"> <view class="right-content">
<view class="start" @click="$emit('start')"> <view
<image class="start-btn" src="../../assets/images/home/start.gif" alt="开始接待" /> class="start"
<image class="start-border" src="../../assets/images/home/start-border.png" /> @click="$emit('start')"
>
<image
class="start-btn"
src="../../assets/images/home/start.gif"
alt="开始接待"
/>
<image
class="start-border"
src="../../assets/images/home/start-border.png"
/>
</view> </view>
<view class="module-list"> <view class="module-list">
<slot name="module" /> <slot name="module" />
...@@ -15,9 +34,16 @@ ...@@ -15,9 +34,16 @@
</view> </view>
</template> </template>
<template v-else> <template v-else>
<component :is="componentName" :userInfo="userInfo" @showPage="handleShowPage" /> <component
:is="componentName"
:userInfo="userInfo"
@showPage="handleShowPage"
/>
</template> </template>
<view class="store-addr" v-if="footerBox"> <view
class="store-addr"
v-if="footerBox"
>
<view class="icon-addr sprite-icon icon-addr"></view> <view class="icon-addr sprite-icon icon-addr"></view>
<view class="addr-text">{{ userInfo.shopMerchantName }}</view> <view class="addr-text">{{ userInfo.shopMerchantName }}</view>
</view> </view>
...@@ -26,17 +52,41 @@ ...@@ -26,17 +52,41 @@
<view :class="['detail', { show: id }]"> <view :class="['detail', { show: id }]">
<slot name="detail" /> <slot name="detail" />
</view> </view>
<view class="point-page" v-if="!showHome"> <view
<component :is="pointComponentName" @backHome="backHome" @jump="jump" :transfer="transfer" /> class="point-page"
v-if="!showHome"
>
<component
:is="pointComponentName"
@backHome="backHome"
@jump="jump"
:transfer="transfer"
/>
</view> </view>
<!-- 未点击开始接待,弹窗 --> <!-- 未点击开始接待,弹窗 -->
<MessageBox ref="previewRef" @confirm="$emit('preview')" :popupW="704" content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」" confirmBtnText="预览素材" @cancel="$emit('previewCancel')" @close="$emit('previewClose')"></MessageBox> <MessageBox
ref="previewRef"
@confirm="$emit('preview')"
:popupW="704"
content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」"
confirmBtnText="预览素材"
@cancel="$emit('previewCancel')"
@close="$emit('previewClose')"
></MessageBox>
<!-- 停留弹框 --> <!-- 停留弹框 -->
<MessageBox ref="tipBox" @cancel="tipCancel" @confirm="tipConfirm" content="系统检测到您在当前页面停留较久,是否仍在客户接待中?" cancelBtnText="否" confirmBtnText="是"></MessageBox> <!-- <MessageBox ref="tipBox" @cancel="tipCancel" @confirm="tipConfirm" content="系统检测到您在当前页面停留较久,是否仍在客户接待中?" cancelBtnText="否" confirmBtnText="是"></MessageBox> -->
<!-- 退出弹框 --> <!-- 退出弹框 -->
<MessageBox :popupW="704" ref="finish" :content="finishContene" :isFooter="false"> <MessageBox
:popupW="704"
ref="finish"
:content="finishContene"
:isFooter="false"
>
<view class="footer"> <view class="footer">
<view class="footer-btn confirm flex" @click="$emit('openStep')"> <view
class="footer-btn confirm flex"
@click="$emit('openStep')"
>
<template v-if="finishDoneText"> <template v-if="finishDoneText">
{{ finishDoneText }} {{ finishDoneText }}
</template> </template>
...@@ -45,7 +95,10 @@ ...@@ -45,7 +95,10 @@
<text>(推荐)</text> <text>(推荐)</text>
</template> </template>
</view> </view>
<view class="footer-btn cancel flex" @click="$emit('backHome')"> <view
class="footer-btn cancel flex"
@click="$emit('backHome')"
>
仍要退出 仍要退出
<text>(不推荐)</text> <text>(不推荐)</text>
</view> </view>
...@@ -54,13 +107,20 @@ ...@@ -54,13 +107,20 @@
<!-- 升级弹框 --> <!-- 升级弹框 -->
<update-box /> <update-box />
<slot name="content" /> <slot name="content" />
<web-view @message="handlerMessage" ref="webview" src="/hybrid/html/index.html"></web-view> <web-view
@message="handlerMessage"
ref="webview"
src="/hybrid/html/index.html"
></web-view>
</view> </view>
</template> </template>
<script> <script>
import RecordList from './components/RecordList.vue' import RecordList from './components/RecordList.vue'
import myClick from '@/mixin/click' // import myClick from '@/mixin/click'
import uploader from '@/mixin/uploader.js' import timeout from '@/mixin/timeout'
import recorder from '@/mixin/record/recorder'
import uploader from '@/mixin/record/uploader.js'
import versionCheck from '@/mixin/versionCheck.js'
import CustomerFile from './components/CustomerFile.vue' import CustomerFile from './components/CustomerFile.vue'
import LeftSide from './components/LeftSide.vue' import LeftSide from './components/LeftSide.vue'
import Point from './components/Point.vue' import Point from './components/Point.vue'
...@@ -73,7 +133,7 @@ import Calendar from './components/Income/Calendar.vue' ...@@ -73,7 +133,7 @@ import Calendar from './components/Income/Calendar.vue'
import Promotion from './components/Income/Promotion.vue' import Promotion from './components/Income/Promotion.vue'
import History from './components/Income/History.vue' import History from './components/Income/History.vue'
export default { export default {
mixins: [myClick, uploader], mixins: [recorder, uploader, timeout, versionCheck],
components: { RecordList, CustomerFile, LeftSide, Point, dayPoint, rulePoint, Course, Ranking, LevelPoint, Calendar, Promotion, History }, components: { RecordList, CustomerFile, LeftSide, Point, dayPoint, rulePoint, Course, Ranking, LevelPoint, Calendar, Promotion, History },
props: { props: {
id: [String, Number], id: [String, Number],
...@@ -83,7 +143,7 @@ export default { ...@@ -83,7 +143,7 @@ export default {
default: '当前操作视为强制退出接待,若需正常流程完成接待请点击「完成接待」' default: '当前操作视为强制退出接待,若需正常流程完成接待请点击「完成接待」'
} }
}, },
data() { data () {
return { return {
transfer: '', transfer: '',
footerBox: true, footerBox: true,
...@@ -93,24 +153,25 @@ export default { ...@@ -93,24 +153,25 @@ export default {
tabIndex: 0 tabIndex: 0
} }
}, },
mounted() { mounted () {
const userInfo = uni.$storage.get('userInfo') || {} const userInfo = uni.$storage.get('userInfo') || {}
this.userInfo = userInfo this.userInfo = userInfo
this.checkVersion()
}, },
provide() { provide () {
return { return {
showPage: this.handleShowPage, showPage: this.handleShowPage,
hideFooter: this.handleFooter hideFooter: this.handleFooter
} }
}, },
computed: { computed: {
previewRef() { previewRef () {
return this.$refs.previewRef return this.$refs.previewRef
}, },
finishRef() { finishRef () {
return this.$refs.finish return this.$refs.finish
}, },
componentName() { componentName () {
const len = this.$refs.leftBox.tabs.length const len = this.$refs.leftBox.tabs.length
if (this.tabIndex == 0) return 'HomeSlot' if (this.tabIndex == 0) return 'HomeSlot'
else if (this.tabIndex == 1) return 'RecordList' else if (this.tabIndex == 1) return 'RecordList'
...@@ -119,20 +180,17 @@ export default { ...@@ -119,20 +180,17 @@ export default {
} }
}, },
methods: { methods: {
handleFooter(val) { handleFooter (val) {
console.log(val, 88)
this.footerBox = val this.footerBox = val
}, },
backHome() { backHome () {
this.showHome = true this.showHome = true
}, },
jump() { jump () {
console.log(888)
this.showHome = true this.showHome = true
this.$emit('start') this.$emit('start')
}, },
handleShowPage(name, transfer) { handleShowPage (name, transfer) {
console.log(transfer, 'transfer')
this.transfer = transfer this.transfer = transfer
this.showHome = false this.showHome = false
this.pointComponentName = name this.pointComponentName = name
......
...@@ -160,6 +160,7 @@ export default { ...@@ -160,6 +160,7 @@ export default {
} else { } else {
this.$refs.carBrandListVisible.close() this.$refs.carBrandListVisible.close()
this.customerInfo.carModel = item.name this.customerInfo.carModel = item.name
this.customerInfo.carModelId = item.id
} }
this.resetFocusIndex() this.resetFocusIndex()
this.$store.dispatch('setCustomerInfo', this.customerInfo) this.$store.dispatch('setCustomerInfo', this.customerInfo)
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<script src="js/OSSUpLoader.js"></script> <script src="js/OSSUpLoader.js"></script>
<script> <script>
// document.addEventListener('UniAppJSBridgeReady', function(){ // document.addEventListener('UniAppJSBridgeReady', function(){
/** /**
* 该函数用于接收来自 UniApp 的消息,它包含了文件上传所需的所有信息 * 该函数用于接收来自 UniApp 的消息,它包含了文件上传所需的所有信息
* @param {string} accessKeyId - OSS 访问密钥 ID * @param {string} accessKeyId - OSS 访问密钥 ID
* @param {string} accessKeySecret - OSS 访问密钥 secret * @param {string} accessKeySecret - OSS 访问密钥 secret
...@@ -58,12 +58,11 @@ ...@@ -58,12 +58,11 @@
* @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, options = {}) {
console.log(fileName, filePath) try {
if (!accessKeyId || !accessKeySecret || !stsToken || !fileName || !filePath) { if (!accessKeyId || !accessKeySecret || !stsToken || !fileName || !filePath) {
throw new Error('accessKeyId,accessKeySecret,stsToken,fileName,filePath is required') throw new Error('accessKeyId,accessKeySecret,stsToken,fileName,filePath is required')
} }
try {
// 使用 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 }, options)
// 创建 OSSUpLoader 实例,传入配置对象 // 创建 OSSUpLoader 实例,传入配置对象
...@@ -76,7 +75,8 @@ window.msgFromUniapp = function (accessKeyId, accessKeySecret, stsToken, fileNam ...@@ -76,7 +75,8 @@ window.msgFromUniapp = function (accessKeyId, accessKeySecret, stsToken, fileNam
...result, ...result,
fileName, fileName,
recordId, recordId,
filePath filePath,
accessKeyId
} }
}) })
// 调用 destroy 方法,这将重置上传器的状态,释放资源 // 调用 destroy 方法,这将重置上传器的状态,释放资源
...@@ -92,12 +92,12 @@ window.msgFromUniapp = function (accessKeyId, accessKeySecret, stsToken, fileNam ...@@ -92,12 +92,12 @@ window.msgFromUniapp = function (accessKeyId, accessKeySecret, stsToken, fileNam
fileName, fileName,
recordId, recordId,
filePath, filePath,
error: e.message message: e.message
} }
}) })
} }
} }
// }, false); // }, false);
</script> </script>
</body> </body>
......
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2025-01-03 18:53:43
* @LastEditors: limin
* @LastEditTime: 2025-01-07 15:34:10
* @FilePath: \gl_tape\init.js
*/
import { DBRecord } from './utils/recordManager/index'
// import RecordManager from '@/utils/RecordManager'
import DBManager from '@/utils/DBManager'
import utils from './utils/utils'
import logger from './utils/logger'
import { Storage } from './utils/cache/index'
import api from './api/index'
uni.$api = api
// uni.$lock = false
uni.$storage = new Storage()
uni.$throttle = utils.throttle
uni.$isNetWork = utils.isNetWork
uni.$logger = logger
// uni.$recordManager = RecordManager.getInstance()
uni.$dbTempRecord = new DBRecord()
uni.$dbManager = new DBManager()
!(async _ => {
await uni.$dbManager.init()
await uni.$dbTempRecord.init()
})()
...@@ -164,17 +164,17 @@ function requestAndroidPermission(permissionID) { ...@@ -164,17 +164,17 @@ function requestAndroidPermission(permissionID) {
var result = 0; var result = 0;
for (var i = 0; i < resultObj.granted.length; i++) { for (var i = 0; i < resultObj.granted.length; i++) {
var grantedPermission = resultObj.granted[i]; var grantedPermission = resultObj.granted[i];
console.log('已获取的权限:' + grantedPermission); uni.$logger.local.info('已获取的权限:' + grantedPermission);
result = 1 result = 1
} }
for (var i = 0; i < resultObj.deniedPresent.length; i++) { for (var i = 0; i < resultObj.deniedPresent.length; i++) {
var deniedPresentPermission = resultObj.deniedPresent[i]; var deniedPresentPermission = resultObj.deniedPresent[i];
console.log('拒绝本次申请的权限:' + deniedPresentPermission); uni.$logger.local.info('拒绝本次申请的权限:' + deniedPresentPermission);
result = 0 result = 0
} }
for (var i = 0; i < resultObj.deniedAlways.length; i++) { for (var i = 0; i < resultObj.deniedAlways.length; i++) {
var deniedAlwaysPermission = resultObj.deniedAlways[i]; var deniedAlwaysPermission = resultObj.deniedAlways[i];
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission); uni.$logger.local.info('永久拒绝申请的权限:' + deniedAlwaysPermission);
result = -1 result = -1
} }
resolve(result); resolve(result);
...@@ -184,7 +184,7 @@ function requestAndroidPermission(permissionID) { ...@@ -184,7 +184,7 @@ function requestAndroidPermission(permissionID) {
// } // }
}, },
function(error) { function(error) {
console.log('申请权限错误:' + error.code + " = " + error.message); uni.$logger.error('申请权限错误:' + error.code + " = " + error.message);
resolve({ resolve({
code: error.code, code: error.code,
message: error.message message: error.message
......
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-16 09:55:40
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-12-30 17:30:24
* @FilePath: \gl-tape\lib\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import sha1 from './sha1.js' import sha1 from './sha1.js'
import qs from './qs' import qs from './qs'
import SQLite from './sqlite.js' import SQLite from './sqlite.js'
module.exports = { sha1, qs, SQLite }
module.exports ={ sha1,qs,SQLite }
\ No newline at end of file \ No newline at end of file
...@@ -6,6 +6,7 @@ class SQLite { ...@@ -6,6 +6,7 @@ class SQLite {
this.size = size || 50 * 1024 * 1024 // 50MB this.size = size || 50 * 1024 * 1024 // 50MB
this.db = null this.db = null
} }
init() { init() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
plus.sqlite.openDatabase({ plus.sqlite.openDatabase({
...@@ -16,6 +17,7 @@ class SQLite { ...@@ -16,6 +17,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.info(`执行SQL语句: ${sql}`)
...@@ -43,6 +45,7 @@ class SQLite { ...@@ -43,6 +45,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.info(`执行SQL语句: ${sql}`)
...@@ -69,6 +72,7 @@ class SQLite { ...@@ -69,6 +72,7 @@ class SQLite {
const sql = `CREATE TABLE IF NOT EXISTS ${tableName} (${columns.join(', ')})` const sql = `CREATE TABLE IF NOT EXISTS ${tableName} (${columns.join(', ')})`
return this.executeSql(sql) return this.executeSql(sql)
} }
// 查询示例 // 查询示例
select(tabName, where, order) { select(tabName, where, order) {
let sql = `SELECT * FROM ${tabName}` let sql = `SELECT * FROM ${tabName}`
...@@ -84,6 +88,7 @@ class SQLite { ...@@ -84,6 +88,7 @@ class SQLite {
} }
return this.selectSql(sql) return this.selectSql(sql)
} }
// 插入示例 // 插入示例
insert(tabName, keyValues) { insert(tabName, keyValues) {
const keys = Object.keys(keyValues) const keys = Object.keys(keyValues)
...@@ -98,6 +103,7 @@ class SQLite { ...@@ -98,6 +103,7 @@ class SQLite {
const sql = `INSERT INTO ${tabName} (${keyStr}) VALUES (${valStr})` const sql = `INSERT INTO ${tabName} (${keyStr}) VALUES (${valStr})`
return this.executeSql(sql) return this.executeSql(sql)
} }
// 更新示例 // 更新示例
update(tabName, setData, where) { update(tabName, setData, where) {
const dataKeys = Object.keys(setData) const dataKeys = Object.keys(setData)
...@@ -107,6 +113,7 @@ class SQLite { ...@@ -107,6 +113,7 @@ class SQLite {
return `${key} = ${this.formatValue(value)}` return `${key} = ${this.formatValue(value)}`
}) })
.join(', ') .join(', ')
const whereKeys = Object.keys(where) const whereKeys = Object.keys(where)
const whereStr = whereKeys const whereStr = whereKeys
.map(key => { .map(key => {
...@@ -114,9 +121,11 @@ class SQLite { ...@@ -114,9 +121,11 @@ class SQLite {
return `${key} = ${this.formatValue(value)}` return `${key} = ${this.formatValue(value)}`
}) })
.join(' AND ') .join(' AND ')
const sql = `UPDATE ${tabName} SET ${setStr} WHERE ${whereStr}` const sql = `UPDATE ${tabName} SET ${setStr} WHERE ${whereStr}`
return this.executeSql(sql) return this.executeSql(sql)
} }
// 删除示例 // 删除示例
delete(tabName, where) { delete(tabName, where) {
const whereKeys = Object.keys(where) const whereKeys = Object.keys(where)
......
/* /*
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-07 17:09:53 * @Date: 2024-04-07 17:09:53
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: limin
* @LastEditTime: 2024-10-30 16:16:48 * @LastEditTime: 2025-01-07 16:10:32
* @FilePath: \gl_tape\main.js * @FilePath: \gl_tape\main.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'
import App from './App' import App from './App'
import config from '@/config.js' // import config from '@/config.js'
import store from '@/store' import store from '@/store'
import api from './api/index'
import { Storage } from './utils/cache/index'
import GlsxImage from './components/GlsxImage' import GlsxImage from './components/GlsxImage'
import MessageBox from './components/MessageBox/index' import MessageBox from './components/MessageBox/index'
import wnCanvas from './components/Canvas/wn-canvas' import wnCanvas from './components/Canvas/wn-canvas'
import UpdateBox from './components/UpdateBox' import UpdateBox from './components/UpdateBox'
import webView from './components/WebView' import webView from './components/WebView'
import utils from './utils/utils'
import logger from './utils/logger'
Vue.use(webView) Vue.use(webView)
Vue.component('GlsxImage', GlsxImage) Vue.component('GlsxImage', GlsxImage)
Vue.component('MessageBox', MessageBox) Vue.component('MessageBox', MessageBox)
Vue.component('wnCanvas', wnCanvas) Vue.component('wnCanvas', wnCanvas)
Vue.component('UpdateBox', UpdateBox) Vue.component('UpdateBox', UpdateBox)
import RecordManager from '@/utils/RecordManager'
import DBManager from '@/utils/DBManager'
const dbManager = new DBManager()
dbManager.init()
const recordManager = RecordManager.getInstance()
recordManager.compatible()
uni.$recordManager = recordManager
uni.$dbManager = dbManager
uni.$api = api
uni.$lock = false
uni.$storage = new Storage()
uni.$throttle = utils.throttle
uni.$isNetWork = utils.isNetWork
uni.$logger = logger
Vue.config.productionTip = false Vue.config.productionTip = false
App.mpType = 'app' App.mpType = 'app'
Vue.prototype.$ossDomain = config.OSS_DOMAIN // Vue.prototype.$ossDomain = config.OSS_DOMAIN
import permision from '@/js_sdk/wa-permission/permission.js' // import permision from '@/js_sdk/wa-permission/permission.js'
// import { index } from "./env"; // Vue.prototype.$permision = permision
// switch (uni.getSystemInfoSync().platform) { import './init'
// case "android": new Vue({
// permision.requestAndroidPermission("android.permission.RECORD_AUDIO");
// permision.requestAndroidPermission("android.permission.CAMERA");
// break;
// case "ios":
// permision.judgeIosPermission("record");
// permision.judgeIosPermission("camera");
// break;
// }
Vue.prototype.$permision = permision
// import sentryInit from "@/utils/sentryConfig/sentryInit";
// if (index == 3) {
// const sentry = sentryInit();
// Vue.prototype.$sendSentry = function (e) {
// sentry.captureException(e);
// };
// } else {
// Vue.prototype.$sendSentry = function () {};
// }
const app = new Vue({
store, store,
...App ...App
}) }).$mount()
app.$mount()
{ {
"name" : "展业助手", "name": "展业助手",
"appid" : "__UNI__D3BD3DF", "appid": "__UNI__D3BD3DF",
"description" : "", "description": "",
"versionName" : "2.3.0", "versionName": "2.4.0",
"versionCode" : "100", "versionCode": "100",
"transformPx" : false, "transformPx": false,
/* 5+App特有相关 */ /* 5+App特有相关 */
"app-plus" : { "app-plus": {
"bounce" : "none", "bounce": "none",
"usingComponents" : true, "usingComponents": true,
"nvueStyleCompiler" : "uni-app", "nvueStyleCompiler": "uni-app",
"compilerVersion" : 3, "compilerVersion": 3,
"screenOrientation" : "landscape", "compatible": {
"splashscreen" : { "ignoreVersion": true
"alwaysShowBeforeRender" : true, },
"waiting" : true, "screenOrientation": "landscape",
"autoclose" : true, "splashscreen": {
"delay" : 0 "alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
}, },
/* 模块配置 */ /* 模块配置 */
"modules" : { "modules": {
"Camera" : {}, "Camera": {},
"Record" : {}, "Record": {},
"VideoPlayer" : {}, "VideoPlayer": {},
"AudioPlayer" : {}, "AudioPlayer": {},
"SQLite" : {} "SQLite": {}
}, },
/* 应用发布信息 */ /* 应用发布信息 */
"distribute" : { "distribute": {
/* android打包配置 */ /* android打包配置 */
"android" : { "android": {
"permissions" : [ "permissions": [
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
...@@ -45,76 +48,83 @@ ...@@ -45,76 +48,83 @@
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
], ],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ], "abiFilters": [
"targetSdkVersion" : 30 "armeabi-v7a",
"arm64-v8a",
"x86"
],
"targetSdkVersion": 30
}, },
/* ios打包配置 */ /* ios打包配置 */
"ios" : { "ios": {
"dSYMs" : false, "dSYMs": false,
"UIBackgroundModes" : "audio" "UIBackgroundModes": "audio"
}, },
/* SDK配置 */ /* SDK配置 */
"sdkConfigs" : { "sdkConfigs": {
"ad" : {}, "ad": {},
"speech" : {}, "speech": {},
"geolocation" : { "geolocation": {
"system" : { "system": {
"__platform__" : [ "ios", "android" ] "__platform__": [
"ios",
"android"
]
} }
} }
}, },
"icons" : { "icons": {
"android" : { "android": {
"hdpi" : "static/72.png", "hdpi": "static/72.png",
"xhdpi" : "static/96.png", "xhdpi": "static/96.png",
"xxhdpi" : "static/144.png" "xxhdpi": "static/144.png"
} }
} }
}, },
"nativePlugins" : { "nativePlugins": {
"Ba-KeepAliveSuit" : { "Ba-KeepAliveSuit": {
"__plugin_info__" : { "__plugin_info__": {
"name" : "安卓保活套装(通用、常驻通知、电池优化、自启管理、后台运行等)", "name": "安卓保活套装(通用、常驻通知、电池优化、自启管理、后台运行等)",
"description" : "在Ba-KeepAlive的基础上,新增了忽略电池优化、自启管理、常驻通知。为定位、推送、websocket、定时任务、蓝牙、聊天等保驾护航(**注意:**不保证支持所有机型和场景,建议先试用再购买)", "description": "在Ba-KeepAlive的基础上,新增了忽略电池优化、自启管理、常驻通知。为定位、推送、websocket、定时任务、蓝牙、聊天等保驾护航(**注意:**不保证支持所有机型和场景,建议先试用再购买)",
"platforms" : "Android", "platforms": "Android",
"url" : "https://ext.dcloud.net.cn/plugin?id=11765", "url": "https://ext.dcloud.net.cn/plugin?id=11765",
"android_package_name" : "uni.gltap", "android_package_name": "uni.gltap",
"ios_bundle_id" : "", "ios_bundle_id": "",
"isCloud" : true, "isCloud": true,
"bought" : 1, "bought": 1,
"pid" : "11765", "pid": "11765",
"parameters" : {} "parameters": {}
} }
} }
} }
}, },
/* 快应用特有相关 */ /* 快应用特有相关 */
"quickapp" : {}, "quickapp": {},
/* 小程序特有相关 */ /* 小程序特有相关 */
"mp-weixin" : { "mp-weixin": {
"appid" : "wx79d1ff39bee3d047", "appid": "wx79d1ff39bee3d047",
"setting" : { "setting": {
"urlCheck" : false "urlCheck": false
}, },
"usingComponents" : true "usingComponents": true
}, },
"mp-alipay" : { "mp-alipay": {
"usingComponents" : true "usingComponents": true
}, },
"mp-baidu" : { "mp-baidu": {
"usingComponents" : true "usingComponents": true
}, },
"mp-toutiao" : { "mp-toutiao": {
"usingComponents" : true "usingComponents": true
}, },
"uniStatistics" : { "uniStatistics": {
"enable" : false "enable": false
}, },
"vueVersion" : "2", "vueVersion": "2",
"h5" : { "h5": {
"devServer" : { "devServer": {
"port" : 8080, "port": 8080,
"https" : false "https": false
} }
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -6,7 +6,8 @@ export default { ...@@ -6,7 +6,8 @@ export default {
label: '基本工资', label: '基本工资',
icon: 'jbgz-icon', icon: 'jbgz-icon',
content: '基本工资 = 职级工资÷应出勤天数×实际出勤天数', content: '基本工资 = 职级工资÷应出勤天数×实际出勤天数',
value: 'basicSalary' value: 'actualBasicSalary',
base: true
}, },
{ {
label: '退单冲减', label: '退单冲减',
...@@ -32,7 +33,7 @@ export default { ...@@ -32,7 +33,7 @@ export default {
label: '会员权益/升级', label: '会员权益/升级',
icon: 'qytc-icon', icon: 'qytc-icon',
content: '权益提成 = 权益产值 × 提成系数 × 提成比例', content: '权益提成 = 权益产值 × 提成系数 × 提成比例',
subContent: '延保提成 = 售前延保产值×提成系数×安心包max考核系数×提成比例 +售后延保产值×提成比例 +安心包Max产值×提成系数×提成比例', subContent: '延保提成 = 售前延保产值×提成系数×安心包Max考核系数×提成比例 +售后延保产值×提成比例 +安心包Max产值×提成系数×提成比例',
warnList: [ warnList: [
{ style: 'font-size: 28rpx;color: #808291;line-height: 48rpx;', message: '当安心包Max渗透率<15%,安心包Max考核系数为 0.8' }, { style: 'font-size: 28rpx;color: #808291;line-height: 48rpx;', message: '当安心包Max渗透率<15%,安心包Max考核系数为 0.8' },
{ {
......
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-12-26 10:03:54
* @LastEditors: limin
* @LastEditTime: 2025-01-15 21:23:38
* @FilePath: \gl_tape\mixin\record\recorder.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { AudioManager, TempRecord, RecordDto } from '../../utils/recordManager/index'
import { mapMutations, mapState, mapGetters } from 'vuex'
import utils from '@/utils/utils.js'
import { storageApi } from '@/utils/cache'
import permision from '@/js_sdk/wa-permission/permission.js'
export default {
provide() {
return {
getRecorder: () => this.record
}
},
async mounted() {
this.audioManager = new AudioManager(this.onAudioStart, this.onAudioStop, this.onError)
this.initDto()
this.record = new TempRecord(this.tempRecord, this.triggleTempNumber)
this.triggleTempNumber()
},
watch: {
/**
* 监听客户信息是否发生变化
* @param {object} val 监听客户信息
*/
customerInfo: {
handler(val) {
this.handler(val, this.updateCustomerInfo)
},
deep: true
},
booksList: {
handler(val) {
this.handler(val, this.updateBookList)
}
},
receptionStatus: {
handler(val) {
this.handler(val, this.updateReceptionStatus)
}
},
receptionTrack: {
handler(val) {
this.handler(val, this.updateMaterialPointList)
}
}
},
computed: {
...mapState(['user.customerInfo']),
...mapGetters(['customerInfo', 'receptionStatus', 'booksList', 'receptionTrack'])
},
methods: {
...mapMutations('audio', ['setReceptionStatus', 'setBooks', 'setPerRecordNumber']),
...mapMutations(['clearCustomerInfo']),
//开始录音
startAudio: utils.throttle(async function () {
const isPermission = await this.checkBeforeStart()
if (!isPermission) return
uni.$logger.local.info('〖接待管理Recorder〗 == 开始接待 ')
this.initReception()
this.audioManager.start()
}, 300),
initReception() {
this.setBooks([])
this.clearCustomerInfo()
this.setReceptionStatus('')
this.initTime()
},
async onAudioStart() {
if (this.audioManager.counter === 0) {
await this.record.add()
} else {
this.record.addAudio()
}
},
async onAudioStop() {
if (this.audioManager.isRecording) {
uni.$logger.local.info('〖接待管理Recorder〗 == 接待中,再次开启录音! ')
this.audioManager.start()
} else {
uni.$logger.local.info('〖接待管理Recorder〗 == 断开录音! ')
}
},
onAudioError(error) {
const message = error.message
this.reportError(`录音异常: error: ${message}`, message)
},
/**
* 结束接待
* @params {boolean} status true 不保存记录/AUDIO_STATUS.ABNORMAL 只要断开录音
* @returns {void}
*/
async stopAudio(isNotSave = false) {
uni.$logger.local.info('〖接待管理Recorder〗 == 结束接待! ')
this.stop()
await this.saveAndClearRecord(isNotSave)
},
async saveAndClearRecord(isNotSave = false) {
if (isNotSave) {
return this.record.clearLocalRecord()
}
this.record.setReceptionEndTime() //设置接待结束时间
//如果不需要保存记录
await this.record.save()
},
stop() {
this.endWatchClick()
this.record.clearLoopTimer()
if(this.audioManager.isRecording){
this.audioManager.stop()
}
},
handler(params, fn) {
if (!this.audioManager.isRecording) return
fn.call(this, params)
},
reset() {
this.audioManager = null
this.record = null
this.tempRecord = null
},
initDto() {
const { shopMerchantId, phone, sceneType, uuid, name, merchantId, channelType, merchantName } = storageApi.getUserInfo()
const { deviceId: appCode } = uni.getDeviceInfo()
const dto = new RecordDto({
staffUuid: uuid,
staffName: name,
serviceMerchantId: merchantId,
endReasonType: 0, //原因 1.异常 0.正常
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.tempRecord = dto
},
updateCustomerInfo(customerInfo = {}) {
const { customerName, phoneNumber, salesUuid, carModel, staffName: salesName } = customerInfo
this.record.updatePreRecords({
customerName,
phoneNumber,
carModel,
salesUuid,
salesName
})
},
updateBookList(booksList) {
const receptionCustomerPaySourceList = booksList.map(item => {
return {
id: item.id,
sourceType: item.id,
sourceUrl: item.imgUrl
}
})
this.record.updatePreRecords({ receptionCustomerPaySourceList })
},
updateMaterialPointList(receptionTrack) {
const { merchantId, staffUuid, staffName } = this.tempRecord
let receptionCustomerMaterialPointList = []
Object.keys(receptionTrack).map(key => {
receptionCustomerMaterialPointList.push({
...receptionTrack[key],
merchantId,
staffUuid,
staffName,
businessScene: this.sceneType
})
})
this.record.updatePreRecords({ receptionCustomerMaterialPointList })
},
updateReceptionStatus(status) {
this.record.updatePreRecords({ receptionStatus: status })
},
getRecorder() {
return this.record
},
async triggleTempNumber() {
const _records = await this.record.getRecords()
this.setPerRecordNumber(_records.length)
},
async isPermission() {
const result = await permision.requestAndroidPermission('android.permission.RECORD_AUDIO')
if (result !== 1) {
uni.showToast({
title: '为了记录语音通话,请打开录音权限',
icon: 'none'
})
}
return result === 1
},
async checkBeforeStart() {
const isPermission = await this.isPermission()
const isRecording = this.audioManager.isRecording
return isPermission && !isRecording
}
},
beforeDestroy() {
this.stop()
this.reset()
}
}
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48
* @LastEditors: limin
* @LastEditTime: 2025-01-08 16:04:45
* @FilePath: \gl_tape\mixin\timeout.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
const TIMER_DURATION = 40 * 60 * 1000 //40分钟
const TIMER_INTERVAL = 1 * 60 * 1000 //1分钟检一次
const TIMER_TIMEOUT = TIMER_DURATION / TIMER_INTERVAL
export default {
methods: {
//结束提示
stopRecorder() {
this.setReceptionStatus(0)
this.record.withError()
this.stop()
},
//监听点击事件
initTime() {
this.endWatchClick()
this.__timer = setInterval(() => {
if (this.__counter >= TIMER_TIMEOUT) {
//关闭录音
this.endWatchClick()
this.stopRecorder()
}
this.__counter++
}, TIMER_INTERVAL)
},
endWatchClick() {
if (this.__timer) clearInterval(this.__timer)
this.__timer = null
this.__counter = 0
},
handleTouchStart() {
this.__counter = 0
}
}
}
import { getOssToken } from '@/utils/ossUploadFile/uploadFile.js' import { getOssToken } from '@/utils/ossUploadFile/uploadFile.js'
import { storageApi } from '@/utils/cache'
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'
...@@ -82,14 +83,21 @@ export default { ...@@ -82,14 +83,21 @@ export default {
handlerMessage(data) { handlerMessage(data) {
this.save(data) this.save(data)
}, },
/**
* 缓存中待上传记录与待提交记录,插入数据库记录中
* @param {*} data
*/
async mergeRecord() { async mergeRecord() {
const unlock = await uni.$recordManager.lock() const records = uni.$recordManager.getRecords() || []
const records = uni.$recordManager.getRecords() const tempRecords = storageApi.getRecords('preRecordList') || []
for (let i = 0; i < records.length; i++) { for (let i = 0; i < records.length; i++) {
await uni.$dbManager.addRecord(records[i]) await uni.$dbManager.addRecord(records[i])
uni.$recordManager.removeRecord(records[i].id) uni.$recordManager.removeRecord(records[i].id)
} }
unlock() for (let i = 0; i < tempRecords.length; i++) {
await uni.$dbTempRecord.addRecord(tempRecords[i])
}
storageApi.setRecords('preRecordList', [])
}, },
async checkDB() { async checkDB() {
try { try {
......
import utils from '@/utils/utils.js'
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js'
export default {
methods: {
checkVersion(ver = plus?.runtime?.version) {
const { textList, tempFileURL, version } = uni.$storage.get('mock_data')
const res = utils.compareVersions(ver, version)
if (res > -1) {
return res
}
const e = {
result: {
is_silently: false,
is_mandatory: true,
name: '',
title: '',
contents: textList.join('\n'),
version: version,
url: tempFileURL,
stable_publish: true
}
}
checkUpdate(e)
return res
}
}
}
...@@ -345,16 +345,8 @@ export default { ...@@ -345,16 +345,8 @@ export default {
this.recording = false this.recording = false
}, },
async start (before = true) { async start (before = true) {
const result = await this.$permision.requestAndroidPermission( const isPermision = this.$refs.home.isPermission()
"android.permission.RECORD_AUDIO" if (!isPermision) return false
);
if (result !== 1) {
uni.showToast({
title: "为了记录语音通话,请打开录音权限",
icon: "none",
});
return false
}
if (before) this.clearHistory(); if (before) this.clearHistory();
this.$refs.home.startAudio(); this.$refs.home.startAudio();
this.recording = true this.recording = true
......
...@@ -180,12 +180,6 @@ export default { ...@@ -180,12 +180,6 @@ export default {
this.scrollTop = 0 this.scrollTop = 0
}, 100) }, 100)
}, },
watchCustomerInfo: {
immediate: true,
handler (newval) {
if (newval) this.customerInfo = newval
}
},
} }
}, },
computed: { computed: {
...@@ -202,6 +196,7 @@ export default { ...@@ -202,6 +196,7 @@ export default {
methods: { methods: {
init () { init () {
this.customerInfo = this.watchCustomerInfo
if (!this.customerInfo.carModel && !this.isByd) this.$refs.carBrandListVisible.autoSelect() if (!this.customerInfo.carModel && !this.isByd) this.$refs.carBrandListVisible.autoSelect()
else this.search() else this.search()
}, },
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
/> />
<template v-if="hasCarBrand"> <template v-if="hasCarBrand">
<image <image
:key="viewKey"
class="content" class="content"
:src="views[customerInfo.carModelId] || require('@/assets/images/media/nothing.webp')" :src="views[customerInfo.carModelId] || require('@/assets/images/media/nothing.webp')"
/> />
...@@ -63,6 +64,9 @@ export default { ...@@ -63,6 +64,9 @@ export default {
customerInfo () { customerInfo () {
return this.$store.state.user.customerInfo return this.$store.state.user.customerInfo
}, },
viewKey(){
return this.$store.state.user.viewKey
}
}, },
mounted () { mounted () {
}, },
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</view> </view>
<car-brands <car-brands
ref="carBrandListVisible" ref="carBrandListVisible"
@select="handleSelect($event,'carBrandListVisible')" @select="handleSelect($event)"
/> />
</view> </view>
</template> </template>
...@@ -61,8 +61,7 @@ export default { ...@@ -61,8 +61,7 @@ export default {
mounted () { mounted () {
}, },
methods: { methods: {
handleSelect (item, popkey) { handleSelect (item) {
this.$refs[popkey].close()
this.$refs.carBrandListVisible.close() this.$refs.carBrandListVisible.close()
this.customerInfo.carModel = item.name this.customerInfo.carModel = item.name
this.customerInfo.carModelId = item.id this.customerInfo.carModelId = item.id
......
...@@ -71,6 +71,10 @@ ...@@ -71,6 +71,10 @@
class="content-image" class="content-image"
:src="views[customerInfo.carModelId] || require('@/assets/images/media/nothing.webp')" :src="views[customerInfo.carModelId] || require('@/assets/images/media/nothing.webp')"
/> />
<image
class="content-bg"
:src="receptionBg(customerInfo.carModelId)"
/>
</template> </template>
</view> </view>
</view> </view>
...@@ -95,6 +99,7 @@ export default { ...@@ -95,6 +99,7 @@ export default {
title: String, title: String,
views: [Array, Object], views: [Array, Object],
isByd: Boolean, isByd: Boolean,
aitoCarModelIds: Array
}, },
name: 'Reception', name: 'Reception',
data () { data () {
...@@ -180,6 +185,12 @@ export default { ...@@ -180,6 +185,12 @@ export default {
carModel: e.brandModel carModel: e.brandModel
} }
this.inputCustomer() this.inputCustomer()
},
receptionBg (carModelId) {
const isAito = this.aitoCarModelIds.findIndex(e => e == carModelId)
let bgUrl = require('@/assets/images/common/aito-bg.webp')
if (isAito == -1) bgUrl = require('@/assets/images/common/zj-xj-bg.webp')
return bgUrl
} }
} }
} }
...@@ -284,7 +295,7 @@ export default { ...@@ -284,7 +295,7 @@ export default {
height: 100%; height: 100%;
z-index: 1; z-index: 1;
} }
.bg { &-bg {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
position: fixed; position: fixed;
...@@ -296,7 +307,4 @@ export default { ...@@ -296,7 +307,4 @@ export default {
.byd-layout { .byd-layout {
background-image: url('@/assets/images/media/byd-reception-bg.webp') !important; background-image: url('@/assets/images/media/byd-reception-bg.webp') !important;
} }
.aito-layout {
background-image: url('@/assets/images/media/reception-bg.webp');
}
</style> </style>
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
<script> <script>
import { uploadFile } from "@/utils/ossUploadFile/uploadFile.js"; import { uploadFile } from "@/utils/ossUploadFile/uploadFile.js";
import utils from "@/utils/utils"; import utils from "@/utils/utils";
import permision from '@/js_sdk/wa-permission/permission.js'
const INFO_LIST = [ const INFO_LIST = [
{ {
id: 1, id: 1,
...@@ -121,7 +122,7 @@ export default { ...@@ -121,7 +122,7 @@ export default {
...mapMutations("audio", ["setBooks"]), ...mapMutations("audio", ["setBooks"]),
// 上传图 // 上传图
async choose (index) { async choose (index) {
const result = await this.$permision.requestAndroidPermission( const result = await permision.requestAndroidPermission(
"android.permission.CAMERA" "android.permission.CAMERA"
); );
if (result !== 1) { if (result !== 1) {
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
:isPreview="isPreview" :isPreview="isPreview"
:isByd="isByd" :isByd="isByd"
:hasCarBrand="item.hasCarBrand" :hasCarBrand="item.hasCarBrand"
:aitoCarModelIds="aitoCarModelIds"
/> />
</view> </view>
</template> </template>
...@@ -170,9 +171,12 @@ export default { ...@@ -170,9 +171,12 @@ export default {
isPreview () { isPreview () {
return this.type == 'preview' return this.type == 'preview'
}, },
CarModelId () { customerInfo () {
return this.$store.state.user.customerInfo.carModelId return this.$store.state.user.customerInfo
}, },
viewKey(){
return this.$store.state.user.viewKey
}
}, },
watch: { watch: {
watchStatus: { watchStatus: {
...@@ -181,11 +185,12 @@ export default { ...@@ -181,11 +185,12 @@ export default {
if (newval) this.drawStatus = false if (newval) this.drawStatus = false
} }
}, },
CarModelId: { viewKey: {
immediate: true, immediate: true,
handler (newval) { handler (newval) {
if (this.channelType == 1) { if (this.channelType == 1) {
const isAito = this.aitoCarModelIds.findIndex(e => e == newval) let { carModelId } = this.customerInfo
const isAito = this.aitoCarModelIds.findIndex(e => e == carModelId)
if (isAito == -1) { if (isAito == -1) {
this.pageToolList = this.toolList.filter(e => !e.isAito) this.pageToolList = this.toolList.filter(e => !e.isAito)
} else this.pageToolList = this.toolList } else this.pageToolList = this.toolList
......
...@@ -240,7 +240,6 @@ export default { ...@@ -240,7 +240,6 @@ export default {
['moduleList', 'toolList'] ['moduleList', 'toolList']
) )
this.$store.state.user.boutiqueDefaultCarBrandId = boutiqueDefaultCarBrandId this.$store.state.user.boutiqueDefaultCarBrandId = boutiqueDefaultCarBrandId
console.log(moduleList, toolList, 999)
this.setViewInfo(moduleList, toolList) this.setViewInfo(moduleList, toolList)
} }
} }
...@@ -254,17 +253,9 @@ export default { ...@@ -254,17 +253,9 @@ export default {
uni.showLoading({ uni.showLoading({
mask: true mask: true
}) })
const result = await this.$permision.requestAndroidPermission('android.permission.RECORD_AUDIO') this.$refs.home.startAudio()
if (result !== 1) {
uni.showToast({
title: '为了记录语音通话,请打开录音权限',
icon: 'none'
})
return
}
this.getSoure() this.getSoure()
this.clearHistory() this.clearHistory()
this.$refs.home.startAudio()
this.id = this.moduleList[0].id this.id = this.moduleList[0].id
this.type = 'edit' this.type = 'edit'
this.recording = true this.recording = true
......
...@@ -3,4 +3,9 @@ export default { ...@@ -3,4 +3,9 @@ export default {
siteData: (state) => state.site.siteData, siteData: (state) => state.site.siteData,
userData: (state) => state.user.userData, userData: (state) => state.user.userData,
userId: (state) => state.user.userData.id, userId: (state) => state.user.userData.id,
isInBackgound: (state) => state.sys.isInBackgound,
customerInfo: (state) => state.user.customerInfo,
receptionTrack: (state) => state.user.receptionTrack,
receptionStatus: (state) => state.audio.receptionStatus,
booksList: (state) => state.audio.booksList,
}; };
/* /*
* @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: 前端 qianduan01@didihu.com.cn * @LastEditors: limin
* @LastEditTime: 2024-04-09 10:08:11 * @LastEditTime: 2024-12-27 21:11:57
* @FilePath: \gl_tape\store\index.js * @FilePath: \gl_tape\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
*/ */
...@@ -12,13 +12,15 @@ import getters from "./getters"; ...@@ -12,13 +12,15 @@ import getters from "./getters";
import user from "./modules/user"; import user from "./modules/user";
import audio from "./modules/audio"; import audio from "./modules/audio";
import update from "./modules/update"; import update from "./modules/update";
import sys from "./modules/sys";
Vue.use(Vuex); Vue.use(Vuex);
const store = new Vuex.Store({ const store = new Vuex.Store({
modules: { modules: {
user, user,
audio, audio,
update update,
sys
}, },
getters, getters,
}); });
......
...@@ -2,14 +2,12 @@ ...@@ -2,14 +2,12 @@
* @Description: * @Description:
* @Author: huyue * @Author: huyue
* @Date: 2024-04-07 18:15:11 * @Date: 2024-04-07 18:15:11
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: limin
* @LastEditTime: 2024-10-21 11:49:44 * @LastEditTime: 2025-01-03 21:26:31
*/ */
// import { setToken, getToken, removeToken } from '@/utils/token';; // import { setToken, getToken, removeToken } from '@/utils/token';;
import utils from '@/utils/utils' import utils from '@/utils/utils'
// const recorderManager = uni.getRecorderManager(); // const recorderManager = uni.getRecorderManager();
import upload from '@/utils/ossUploadFile/uploadFile.js'
import store from '../index'
export default { export default {
namespaced: true, namespaced: true,
state() { state() {
...@@ -53,7 +51,6 @@ export default { ...@@ -53,7 +51,6 @@ export default {
}, },
actions: { actions: {
setPerRecordNumber({ commit }, value) { setPerRecordNumber({ commit }, value) {
console.log(value)
commit('setPerRecordNumber', value) commit('setPerRecordNumber', value)
} }
// startAudio({ commit, state, dispatch }) { // startAudio({ commit, state, dispatch }) {
......
export default {
state() {
return {
isInBackgound: false
}
},
mutations: {
SET_BACKGROUND_STATE(state, value) {
state.isInBackgound = value
}
},
actions: {
setBackgroundState({ commit }, value) {
uni.$logger.local.info(`【==== ${['切回', '切出'][+value]} ====】 APP`)
commit('SET_BACKGROUND_STATE', value)
}
}
}
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
* @Description: * @Description:
* @Author: huyue * @Author: huyue
* @Date: 2024-04-07 18:15:11 * @Date: 2024-04-07 18:15:11
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: limin
* @LastEditTime: 2024-04-11 21:19:09 * @LastEditTime: 2025-01-03 20:52:28
*/ */
// import { setToken, getToken, removeToken } from '@/utils/token';; // import { setToken, getToken, removeToken } from '@/utils/token';;
export default { export default {
state () { state () {
return { return {
...@@ -17,27 +18,32 @@ export default { ...@@ -17,27 +18,32 @@ export default {
phoneNumber: "", phoneNumber: "",
salesUuid: "", salesUuid: "",
staffName: "", staffName: "",
newCarFare: '' newCarFare: '',
carModelId: ''
}, },
historyStatus: Date.now(), historyStatus: Date.now(),
carBrands: [], carBrands: [],
employeeList: [], employeeList: [],
paymentType: [], paymentType: [],
haveCustomerAccess: false, haveCustomerAccess: false,
boutiqueMediaConfig: {}, boutiqueMediaConfig: {
boutiqueCarList:[], M5: [],
M7: [],
M9: []
},
receptionTrack: {}, //接待记录埋点 receptionTrack: {}, //接待记录埋点
boutiqueDefaultCarBrandId: '' boutiqueDefaultCarBrandId: '',
viewKey: Date.now()
}; };
}, },
mutations: { mutations: {
getCustomerInfo (state) { getCustomerInfo (state) {
return state.customerInfo; return state.customerInfo;
}, },
setCustomerInfo (state, data) { setCustomerInfo (state, data = {}) {
// state.customerInfo = data; // state.customerInfo = data;
uni.$storage.set("customerInfo", JSON.stringify(data)); uni.$storage.set("customerInfo", JSON.stringify(data));
state.customerInfo = JSON.parse(uni.$storage.get("customerInfo") || "{}"); state.customerInfo = data
}, },
clearCustomerInfo (state) { clearCustomerInfo (state) {
const info = { const info = {
...@@ -50,7 +56,7 @@ export default { ...@@ -50,7 +56,7 @@ export default {
newCarFare: '' newCarFare: ''
}; };
uni.$storage.set("customerInfo", JSON.stringify(info)); uni.$storage.set("customerInfo", JSON.stringify(info));
state.customerInfo = JSON.parse(uni.$storage.get("customerInfo") || "{}"); state.customerInfo = info
}, },
}, },
actions: { actions: {
...@@ -78,10 +84,13 @@ export default { ...@@ -78,10 +84,13 @@ export default {
}, },
setReceptionTrack ({ state }, { key, value }) { setReceptionTrack ({ state }, { key, value }) {
state.receptionTrack[key] = value state.receptionTrack[key] = value
// console.log(JSON.parse(JSON.stringify(state.receptionTrack)))
}, },
clearReceptionTrack ({ state }) { clearReceptionTrack ({ state }) {
state.receptionTrack = {} state.receptionTrack = {}
}, },
updateViewKey({ state }){
state.viewKey = Date.now();
}
}, },
}; };
import { unix } from 'dayjs' /*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2024-11-22 08:18:23
* @LastEditors: limin
* @LastEditTime: 2025-01-06 09:36:39
* @FilePath: \gl_tape\utils\DBManager.js
*/
import { SQLite } from '../lib' import { SQLite } from '../lib'
/** /**
* 记录管理器类 * 记录管理器类
...@@ -27,7 +35,7 @@ class DBManager { ...@@ -27,7 +35,7 @@ class DBManager {
} }
const isTableExists = await this.db.isTableExists(this.table_name) const isTableExists = await this.db.isTableExists(this.table_name)
if (!isTableExists) { if (!isTableExists) {
await this.db.createTable(this.db_table_name, this.table_columns) await this.db.createTable(this.table_name, this.table_columns)
} }
return true return true
} catch (error) { } catch (error) {
...@@ -35,6 +43,9 @@ class DBManager { ...@@ -35,6 +43,9 @@ class DBManager {
throw new Error(error.message) throw new Error(error.message)
} }
} }
async openDB(){
}
/** /**
* 将一条新记录添加到当前对象的记录列表中 * 将一条新记录添加到当前对象的记录列表中
* *
...@@ -42,7 +53,7 @@ class DBManager { ...@@ -42,7 +53,7 @@ class DBManager {
* @returns {Array} - 包含新记录的更新后的记录列表 * @returns {Array} - 包含新记录的更新后的记录列表
*/ */
async addRecord(record) { async addRecord(record) {
await this.db.insert(this.db_table_name, record) await this.db.insert(this.table_name, record)
} }
/** /**
* 移除一个ID对应的记录 * 移除一个ID对应的记录
...@@ -51,7 +62,7 @@ class DBManager { ...@@ -51,7 +62,7 @@ class DBManager {
* @returns {Array} - 移除记录后的更新后的记录列表 * @returns {Array} - 移除记录后的更新后的记录列表
*/ */
async removeRecord(id) { async removeRecord(id) {
return this.db.delete(this.db_table_name, { id }) return this.db.delete(this.table_name, { id })
} }
/** /**
* 根据给定的 ID 获取一条记录 * 根据给定的 ID 获取一条记录
...@@ -61,7 +72,7 @@ class DBManager { ...@@ -61,7 +72,7 @@ class DBManager {
* *
*/ */
async getRecordById(id) { async getRecordById(id) {
const records = await this.db.select(this.db_table_name, { id }) const records = await this.db.select(this.table_name, { id })
return Array.isArray(records) ? records[0] : records // sqlite 返回数组 return Array.isArray(records) ? records[0] : records // sqlite 返回数组
} }
/** /**
...@@ -70,7 +81,7 @@ class DBManager { ...@@ -70,7 +81,7 @@ class DBManager {
* @returns {Array} - 从 storageApi 获取的记录列表 * @returns {Array} - 从 storageApi 获取的记录列表
*/ */
async getRecords() { async getRecords() {
return this.db.select(this.db_table_name) return this.db.select(this.table_name)
} }
/** /**
* 设置记录列表 * 设置记录列表
...@@ -96,13 +107,13 @@ class DBManager { ...@@ -96,13 +107,13 @@ class DBManager {
if (!where) { if (!where) {
where = { id } where = { id }
} }
return this.db.update(this.db_table_name, record, where) return this.db.update(this.table_name, record, where)
} }
async isOpen() { async isOpen() {
return this.db.isOpen() return this.db.isOpen()
} }
async isTableExists() { async isTableExists() {
return this.db.isTableExists(this.db_table_name) return this.db.isTableExists(this.table_name)
} }
/** /**
* 清除所有记录 * 清除所有记录
...@@ -110,10 +121,10 @@ class DBManager { ...@@ -110,10 +121,10 @@ class DBManager {
* @returns {void} - 此函数不返回任何值 * @returns {void} - 此函数不返回任何值
*/ */
async clearRecords() { async clearRecords() {
this.db.delete(this.db_table_name) this.db.delete(this.table_name)
} }
async drop() { async drop() {
this.db.drop(this.db_table_name) this.db.drop(this.table_name)
} }
} }
export default DBManager export default DBManager
/* /*
* @Author: 前端 qianduan01@didihu.com.cn * @Descripttion:
* @Date: 2024-12-30 11:27:18 * @version: 1.0.0
* @LastEditors: 前端 qianduan01@didihu.com.cn * @Author: limin
* @LastEditTime: 2024-12-30 20:10:04 * @Date: 2024-11-20 15:05:41
* @FilePath: \gl-tape\utils\OperationQueue.js * @LastEditors: limin
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @LastEditTime: 2025-01-06 09:36:48
* @FilePath: \gl_tape\utils\OperationQueue.js
*/ */
class OperationQueue { class OperationQueue {
constructor(options = {}) { constructor(options = {}) {
...@@ -13,6 +14,7 @@ class OperationQueue { ...@@ -13,6 +14,7 @@ class OperationQueue {
this.maxQueueSize = options.maxQueueSize || 1000 this.maxQueueSize = options.maxQueueSize || 1000
this.operationTimeout = options.operationTimeout || 5 * 60 * 1000 // 5分钟超时 this.operationTimeout = options.operationTimeout || 5 * 60 * 1000 // 5分钟超时
} }
async enqueue(operation, context = '') { async enqueue(operation, context = '') {
if (this.queue.length >= this.maxQueueSize) { if (this.queue.length >= this.maxQueueSize) {
throw new Error('Queue capacity exceeded') throw new Error('Queue capacity exceeded')
...@@ -31,6 +33,7 @@ class OperationQueue { ...@@ -31,6 +33,7 @@ class OperationQueue {
}) })
}) })
} }
async processQueue() { async processQueue() {
if (this.processing) return if (this.processing) return
this.processing = true this.processing = true
...@@ -40,7 +43,10 @@ class OperationQueue { ...@@ -40,7 +43,10 @@ class OperationQueue {
uni.$logger.local.info(`【操作队列】 开始处理操作 [${context}], 等待时间: ${Date.now() - timestamp}ms`) uni.$logger.local.info(`【操作队列】 开始处理操作 [${context}], 等待时间: ${Date.now() - timestamp}ms`)
try { try {
// 添加超时处理 // 添加超时处理
const result = await Promise.race([operation(), new Promise(resolve => setTimeout(() => resolve('Operation timeout'), this.operationTimeout))]) const result = await Promise.race([
operation(),
new Promise(resolve => setTimeout(() => resolve('Operation timeout'), this.operationTimeout))
])
resolve(result) resolve(result)
uni.$logger.local.info(`【操作完成】 [${context}],耗时: ${Date.now() - timestamp}ms`) uni.$logger.local.info(`【操作完成】 [${context}],耗时: ${Date.now() - timestamp}ms`)
} catch (error) { } catch (error) {
...@@ -57,6 +63,7 @@ class OperationQueue { ...@@ -57,6 +63,7 @@ class OperationQueue {
this.processing = false this.processing = false
} }
} }
// 新增:清空队列方法 // 新增:清空队列方法
clear() { clear() {
const rejectedItems = this.queue.splice(0, this.queue.length) const rejectedItems = this.queue.splice(0, this.queue.length)
...@@ -65,6 +72,7 @@ class OperationQueue { ...@@ -65,6 +72,7 @@ class OperationQueue {
}) })
uni.$logger.local.warn(`【操作队列】 队列已清空,丢弃了 ${rejectedItems.length} 个任务`) uni.$logger.local.warn(`【操作队列】 队列已清空,丢弃了 ${rejectedItems.length} 个任务`)
} }
// 新增:获取队列状态 // 新增:获取队列状态
getStatus() { getStatus() {
return { return {
......
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2024-07-01 09:41:43
* @LastEditors: limin
* @LastEditTime: 2025-01-06 09:36:58
* @FilePath: \gl_tape\utils\Queue.js
*/
class Queue { class Queue {
_items = []; _items = [];
constructor(items = []) { constructor(items = []) {
......
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2024-07-01 09:40:48
* @LastEditors: limin
* @LastEditTime: 2025-01-06 09:37:09
* @FilePath: \gl_tape\utils\RecordManager.js
*/
import { storageApi } from './cache' import { storageApi } from './cache'
import fileManager from "@/utils/file/FileManager.js";
import utils from './utils' import utils from './utils'
/** /**
* 记录管理器类 * 记录管理器类
...@@ -11,6 +19,7 @@ class RecordManager { ...@@ -11,6 +19,7 @@ class RecordManager {
* 用于初始化 RecordManager 实例 * 用于初始化 RecordManager 实例
*/ */
constructor() { constructor() {
// storageApi.removeRecords('preRecord')
// this.fileSaveFolderOnClient = utils.getFileSaveFolderOnClient(); // this.fileSaveFolderOnClient = utils.getFileSaveFolderOnClient();
} }
// 单例模式 // 单例模式
...@@ -59,10 +68,10 @@ class RecordManager { ...@@ -59,10 +68,10 @@ class RecordManager {
* @param {Object} record - 要添加的新记录对象 * @param {Object} record - 要添加的新记录对象
* @returns {Array} - 包含新记录的更新后的记录列表 * @returns {Array} - 包含新记录的更新后的记录列表
*/ */
async addRecord(record,key) { async addRecord(record, key) {
const records = this.getRecords(key) || [] const records = this.getRecords(key) || []
records.push(record) records.push(record)
this.setRecords(records,key) this.setRecords(records, key)
return records return records
} }
/** /**
...@@ -71,10 +80,10 @@ class RecordManager { ...@@ -71,10 +80,10 @@ class RecordManager {
* @param {number} id - 要移除的记录的ID * @param {number} id - 要移除的记录的ID
* @returns {Array} - 移除记录后的更新后的记录列表 * @returns {Array} - 移除记录后的更新后的记录列表
*/ */
async removeRecord(id,key) { async removeRecord(id, key) {
let records = this.getRecords(key) let records = this.getRecords(key)
records = records.filter(i => i.id !== id) records = records.filter(i => i.id !== id)
this.setRecords(records) this.setRecords(records, key)
return records return records
} }
/** /**
...@@ -93,7 +102,7 @@ class RecordManager { ...@@ -93,7 +102,7 @@ class RecordManager {
* @returns {Object} - 具有给定 ID 的记录对象,如果没有找到符合条件的记录,则返回 undefined * @returns {Object} - 具有给定 ID 的记录对象,如果没有找到符合条件的记录,则返回 undefined
* *
*/ */
getRecordById(id,key) { getRecordById(id, key) {
const records = this.getRecords(key) const records = this.getRecords(key)
return records.find(i => i.id === id) return records.find(i => i.id === id)
} }
...@@ -103,9 +112,7 @@ class RecordManager { ...@@ -103,9 +112,7 @@ class RecordManager {
* @returns {Array} - 从 storageApi 获取的记录列表 * @returns {Array} - 从 storageApi 获取的记录列表
*/ */
getRecords(key) { getRecords(key) {
// console.log(888) return storageApi.getRecords(key) || []
// fileManager.writeFile("123.txt", storageApi.getRecords());
return storageApi.getRecords(key)
} }
/** /**
* 设置记录列表 * 设置记录列表
...@@ -113,8 +120,8 @@ class RecordManager { ...@@ -113,8 +120,8 @@ class RecordManager {
* @param {Array} records - 要设置的记录列表 * @param {Array} records - 要设置的记录列表
* @returns {void} - 此函数不返回任何值 * @returns {void} - 此函数不返回任何值
*/ */
setRecords(records,key) { setRecords(records, key) {
storageApi.setRecords(records,key) storageApi.setRecords(records, key)
} }
/** /**
* 更新记录数组中的记录 * 更新记录数组中的记录
...@@ -124,12 +131,12 @@ class RecordManager { ...@@ -124,12 +131,12 @@ class RecordManager {
* @param {Object} record - 要更新的记录对象,必须包含一个唯一的 id 属性 * @param {Object} record - 要更新的记录对象,必须包含一个唯一的 id 属性
* @throws {Error} 如果记录数组中找不到具有给定 id 的记录,将抛出错误 * @throws {Error} 如果记录数组中找不到具有给定 id 的记录,将抛出错误
*/ */
updateRecord(record,key) { updateRecord(record, key) {
const records = this.getRecords(key) const records = this.getRecords(key)
const index = records.findIndex(i => i.id === record.id) const index = records.findIndex(i => i.id === record.id)
if (index !== -1) { if (index !== -1) {
records[index] = record records[index] = record
this.setRecords(records) this.setRecords(records, key)
} }
} }
/** /**
...@@ -153,7 +160,7 @@ class RecordManager { ...@@ -153,7 +160,7 @@ class RecordManager {
let path = await utils.getFileSaveFolderOnClient() let path = await utils.getFileSaveFolderOnClient()
try { try {
let records = this.getRecords() let records = this.getRecords()
if(typeof records === 'string') { if (typeof records === 'string') {
records = JSON.parse(records) records = JSON.parse(records)
} }
records.forEach(i => { records.forEach(i => {
......
/*
* @Descripttion: 轮询管理器
* @version: 1.0.0
* @Author: limin
* @Date: 2024-12-06 10:13:02
* @LastEditors: limin
* @LastEditTime: 2025-01-08 10:27:45
* @FilePath: \gl_tape\utils\TimeoutManager.js
*/
class TimeoutManager { class TimeoutManager {
waitTime = 5 * 60 * 1000
outTime = 15 * 60 * 1000
constructor() { constructor() {
this.tasks = [] this.tasks = []
} }
addTimeout(waitTime, outTime = 15 * 60 * 1000) { addTimeout(waitTime, outTime = this.outTime) {
this.tasks = [] this.tasks = []
const timeout = new Promise(resolve => { const timeout = new Promise(resolve => {
this.tasks.push(resolve) this.tasks.push(resolve)
...@@ -24,11 +35,11 @@ class TimeoutManager { ...@@ -24,11 +35,11 @@ class TimeoutManager {
return this.tasks.length > 0 return this.tasks.length > 0
} }
delay(interval = 60 * 10) { delay(interval = this.waitTime) {
return new Promise(resolve => { return new Promise(resolve => {
this.tasks.push(resolve) this.tasks.push(resolve)
setTimeout(resolve, interval * 1000) setTimeout(resolve, interval)
console.log(interval + 's后开始下一轮上传!') uni.$logger.local.info(interval + 'ms后开始下一轮上传!')
}) })
} }
} }
......
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-16 09:55:40
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2025-01-02 17:49:34
* @FilePath: \gl-tape\utils\cache\constantData.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
// export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/store-assistant/' // export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/store-assistant/'
// import util from '~/utils/util' // import util from '~/utils/util'
...@@ -28,6 +20,7 @@ export const STORAGE_OBJECTKEY = { ...@@ -28,6 +20,7 @@ export const STORAGE_OBJECTKEY = {
recordList: 'recordList', recordList: 'recordList',
preRecordList: 'preRecordList', preRecordList: 'preRecordList',
preRecordId: 'preRecordId', preRecordId: 'preRecordId',
preRecord: 'preRecord',
preAudioList: 'preAudioList', preAudioList: 'preAudioList',
recordSuccessList: 'recordSuccessList', recordSuccessList: 'recordSuccessList',
historyList: 'historyList', historyList: 'historyList',
......
import Record from "./Record"; /*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2024-12-04 18:17:23
* @LastEditors: limin
* @LastEditTime: 2025-01-06 18:50:33
* @FilePath: \gl_tape\utils\recordManager\AudioManager.js
*/
class AudioManager { class AudioManager {
startOptions = { startOptions = {
duration: 600000, //默认10分钟 duration: 10 * 60 * 1000, //默认10分钟
sampleRate: 16000, sampleRate: 16000,
numberOfChannels: 1 numberOfChannels: 1
} }
__isRecording = false __isRecording = false
__counter = 0 __counter = 0
static instance = null; events = {}
/**
* AudioManager类的构造函数
* 负责初始化音频管理器实例,包括音频录制的开始、停止和错误处理
* @param {Function} onStart - 音频录制开始时的回调函数
* @param {Function} onStop - 音频录制停止时的回调函数
* @param {Function} onError - 音频录制遇到错误时的回调函数
*/
constructor(onStart, onStop, onError) { constructor(onStart, onStop, onError) {
if (AudioManager.instance) { this.on()
return AudioManager.instance; this.events = {
onStart,
onStop,
onError
} }
}
on() {
this.recorderManager = uni.getRecorderManager() this.recorderManager = uni.getRecorderManager()
this.recorderManager.onStart(onStart) this.recorderManager.onStart(this.onStart.bind(this))
this.recorderManager.onStop(onStop) this.recorderManager.onStop(this.onStop.bind(this))
this.recorderManager.onError(onError) this.recorderManager.onError(this.onError.bind(this))
this.__record = new Record()
AudioManager.instance = this;
} }
/**
* 启动录音管理器开始录音
* 此方法用于初始化录音过程,它将配置参数应用到录音管理器,并开始录音
*/
start() { start() {
this.__counter++ uni.$logger.local.info('〖录音管理Audio〗 == 开启录音 ')
this.recorderManager.start(this.startOptions) this.recorderManager.start(this.startOptions)
} }
/**
* 异步处理录音开始时的回调函数
*
* 此函数在录音开始时被调用,主要用于执行一些初始化操作和状态更新
* 它首先记录了一条信息到日志,然后执行事件的onStart方法,
* 并且更新内部计数器和录音状态标志
*/
async onStart() {
// 记录录音开始的信息到日志
uni.$logger.local.info('〖录音管理Audio〗 == 开启录音回调 ')
// 等待事件的onStart方法执行完成
await this.events.onStart()
// 内部计数器增加,用于跟踪录音开始的次数
this.__counter++
// 设置录音状态标志为true,表示当前正在录音
this.__isRecording = true
}
/**
* 停止录音功能
*
* 此方法用于停止当前正在进行的录音操作它首先记录了停止录音的信息,
* 然后重置了当前的录音状态,最后通过调用RecorderManager的stop方法来停止录音
*/
stop() { stop() {
this.__counter = 0 // 记录停止录音的信息
this.__isRecording = false uni.$logger.local.info('〖录音管理Audio〗 == 停止录音 ')
// 重置录音状态
this.reset()
// 调用RecorderManager的stop方法来停止录音
this.recorderManager.stop() this.recorderManager.stop()
} }
onStop(res) {} /**
* 异步处理停止录音的回调函数
* @param {Object} res - 停止录音的回调结果对象
*
* 此函数用于在录音停止时执行相应的逻辑它接收一个回调结果对象作为参数,
* 该对象包含有关停止录音的信息它首先记录了一条信息表示录音已停止,
* 然后调用events对象上的onStop方法处理具体的停止录音逻辑
*/
async onStop(res) {
uni.$logger.local.info('〖录音管理Audio〗 == 停止录音回调 ')
await this.events.onStop(res)
}
/**
* 异步处理错误的方法
*
* 当遇到错误时,此方法会被调用,它将等待错误事件处理完成
* 主要作用是将错误传递给注册在this.events上的错误事件处理器
*
* @param {Error} err - 发生的错误对象
*/
async onError(err) {
await this.events.onError(err)
}
/**
* 获取当前是否正在录音的状态
*
* 此方法用于获取实例当前的录音状态它返回一个布尔值,表示是否正在录音
* 该方法没有参数
*
* @returns {boolean} 当前是否正在录音true表示正在录音,false表示未在录音
*/
get isRecording() { get isRecording() {
return this.__isRecording return this.__isRecording
} }
set isRecording(val) { /**
this.__isRecording = val * 获取当前计数器的值
} *
* 此方法作为属性访问器,用于获取内部私有属性 __counter 的值
* 它没有参数
* 返回值为当前计数器的值
*/
get counter() { get counter() {
return this.__counter return this.__counter
} }
get record() {
return this.__record
}
onError(err) {} onError(err) {}
}
AudioManager.getInstance = () => { /**
if (!AudioManager.instance) { * 重置录音状态
AudioManager.instance = new AudioManager(); *
* 此方法用于将录音管理器的状态重置为初始状态,即不是正在录音,且计数器清零
* 它主要用于准备开始新的录音过程或取消当前录音过程时,清理所有录音相关状态
*/
reset() {
// 记录重置录音状态的日志信息
uni.$logger.local.info('〖录音管理Audio〗 == 重置录音状态 ')
// 设置__isRecording属性为false,表示当前不处于录音状态
this.__isRecording = false
// 将__counter计数器重置为0,此计数器可能用于记录录音过程中的某些度量,如录音时间
this.__counter = 0
} }
return AudioManager.instance; }
};
export default AudioManager export default AudioManager
import { getRecords } from "../cache/storageApi"
class Record {
key = 'preRecord'
timer = null
timer_interval
constructor() {
this.recordManager = uni.$recordManager
this.dbManager = uni.$dbManager
}
getRecords(){
return this.recordManager.getRecords(this.key)
}
getRecord() {
return this.recordManager.getRecord(this.key)
}
addRecord(record) {
this.recordManager.addRecord(record, this.key)
}
updateRecord(record) {
this.recordManager.updateRecord(record, this.key)
}
removeRecord(id) {
this.recordManager.removeRecord(id,this.key)
}
async save(record) {
const __record = await this.saveTempFile(record)
await this.dbManager.addRecord(__record)
this.removeRecord(record.id)
}
addOrUpdate(record) {
const record = this.recordManager.getRecordById(record.id, this.key)
if (record) {
this.updateRecord(record)
} else {
this.addRecord(record)
}
}
async add(customerInfo, booksList, receptionStatus) {
const params = this.getParams(customerInfo, booksList, receptionStatus)
const id = utils.uuid()
this.record = {
id,
...params,
recordUrlList: []
}
return this.addAudio()
}
async saveTempFile(record) {
const lastIndex = record.recordUrlList.length - 1
if (lastIndex < 0) return
const filePath = record.recordUrlList[lastIndex]
const saveResult = await uni.saveFile({
tempFilePath: filePath
})
if (filePath) {
uni.removeSavedFile({
filePath,
complete: () => console.log('complete')
})
}
record.recordUrlList[lastIndex] = saveResult[1].savedFilePath
return record
}
async saveLastVideo() {
const record = this.preRecord
const __record = await this.saveTempFile(record)
this.updateRecord(__record)
}
setLoopAudio() {
this.timer = setInterval(() => {
this.saveLastVideo()
}, 1000 * 30)
}
get preRecord() {
return this.record
}
async addAudio() {
clearInterval(this.timer)
await this.saveTempFile()
const lastAudio = await this.getAudioFilePath()
this.record.recordUrlList.push(lastAudio)
this.addOrUpdate(this.record)
this.setLoopAudio()
}
async getAudioPathName() {
return new Promise(async (resolve, reject) => {
const path = await utils.getAudioFilePath()
plus.io.resolveLocalFileSystemURL(
path,
e => {
var dirR = e.createReader()
dirR.readEntries(
function (er) {
Promise.all(
er.map((item, index) => {
console.log(item, 'item')
return new Promise(resolve => {
item.getMetadata(metadata => {
resolve({
index: index,
name: item.name,
modificationTime: new Date(metadata.modificationTime).getTime()
})
})
})
})
).then(results => {
console.log(results, 'results')
results = results.filter(i => i.name.startsWith('uniapp_temp'))
// 找到修改时间最晚的文件
const latest = results.reduce(
(acc, current) => {
if (current.modificationTime > acc.modificationTime) {
return current
}
return acc
},
{ modificationTime: 0 }
)
// 修改时间最晚的文件名
resolve(latest.name)
})
},
err => {
reject(err)
}
)
},
err => {}
)
})
}
async getAudioFilePath() {
const pathName = await this.getAudioPathName()
return this.getAudioFilePath(pathName)
}
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 => {
var dirR = e.createReader()
dirR.readEntries(
function (er) {
Promise.all(
er.map((item, index) => {
return new Promise(resolve => {
item.getMetadata(metadata => {
resolve({
index: index,
name: item.name,
modificationTime: new Date(metadata.modificationTime).getTime()
})
})
})
})
).then(results => {
console.log(results, 'results')
// 找到修改时间最晚的文件
const latest = results.reduce(
(acc, current) => {
if (current.modificationTime > acc.modificationTime) {
return current
}
return acc
},
{ modificationTime: 0 }
)
// 修改时间最晚的文件名
resolve(path + '/' + latest.name)
})
},
err => {
reject(err)
}
)
},
err => {}
)
})
}
updatePreRecords(customerInfo, booksList, receptionStatus) {
const params = this.getParams(customerInfo, booksList, receptionStatus)
const updateParams = { ...this.record, ...params }
console.log(updateParams, 'updateParams')
this.updateRecord(updateParams)
}
setRecords(records) {
this.recordManager.setRecords(records, 'preRecordList')
console.log(records, 'records')
store.dispatch('audio/setPerRecordNumber', records.length)
}
getParams(customerInfo = {}, booksList, receptionStatus) {
const { shopMerchantId, phone, sceneType, uuid, name, merchantId, channelType, merchantName } = uni.$storage.get('userInfo'),
{ customerName, phoneNumber, salesUuid, carModel, staffName } = customerInfo,
receptionCustomerPaySourceList = booksList.map(item => {
return {
id: item.id,
sourceType: item.id,
sourceUrl: item.imgUrl
}
}),
{ receptionStartTime, receptionEndTime, endReasonType } = this.audioInfo,
{ deviceId: appCode } = uni.getDeviceInfo(),
receptionTrack = this.$store.state.user.receptionTrack,
receptionCustomerMaterialPointList = []
Object.keys(receptionTrack).map(key => {
receptionCustomerMaterialPointList.push({
...receptionTrack[key],
merchantId: shopMerchantId,
businessScene: sceneType,
staffUuid: uuid,
staffName: name
})
})
let params = {
staffUuid: uuid,
staffName: name,
serviceMerchantId: merchantId,
carModel,
endReasonType, //原因 1.异常 0.正常
customerName,
phoneNumber,
appCode,
loginPhone: phone,
salesName: staffName,
salesUuid,
receptionStatus, //接待结果 1.成交 0.战败
receptionStartTime,
receptionEndTime,
receptionCustomerPaySourceList, //1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径
merchantId: shopMerchantId,
merchantName,
bussinessType: sceneType == 0 ? 1 : 2, // sceneType 0延保 1精品。 bussinessType 1.延保 2.轻改
channelType: channelType || 1, //1问界 2 比亚迪 3 其他
receptionCustomerMaterialPointList
}
return params
}
}
export default Record
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2025-01-02 14:48:44
* @LastEditors: limin
* @LastEditTime: 2025-01-06 09:35:40
* @FilePath: \gl_tape\utils\recordManager\RecordDto.js
*/
export default class RecordDto {
staffUuid = ''
staffName = ''
serviceMerchantId = ''
carModel = ''
endReasonType = 1 //原因 1.异常 0.正常
customerName = ''
phoneNumber = ''
appCode = ''
loginPhone = ''
salesName = ''
salesUuid = ''
receptionStatus = '' //接待结果 1.成交 0.战败
receptionStartTime = ''
receptionEndTime = ''
receptionCustomerPaySourceList = [] //1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径
merchantId = ''
merchantName = ''
bussinessType = 0 // sceneType 0延保 1精品。 bussinessType 1.延保 2.轻改
channelType = 1 //1问界 2 比亚迪 3 其他
receptionCustomerMaterialPointList = []
constructor(options) {
Object.assign(this, options)
}
}
class RecorderManager {
startOptions = {
duration: 600000, //默认10分钟
sampleRate: 16000,
numberOfChannels: 1
}
constructor({ onStart, onStop, onError }) {
this.recorderManager = uni.getRecorderManager()
this.onStart = onStart
this.onStop = onStop
this.onError = onError
}
init() {
this.recorderManager.onStart(() => {
this.onStart()
})
this.recorderManager.onError(err => {
this.onError(err)
})
this.recorderManager.onStop(res => {
this.onStop(res)
})
}
start(options) {
const opt = Object.assign({}, this.startOptions, options)
this.recorderManager.start(opt)
}
stop() {
this.recorderManager.stop()
}
}
export default RecorderManager
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2025-01-02 18:49:17
* @LastEditors: limin
* @LastEditTime: 2025-01-15 22:01:56
* @FilePath: \gl_tape\utils\recordManager\TempRecord.js
*/
import utils from '../utils'
import helpler from './helpler'
import { FileStatus } from '../common/constants'
class TempRecord {
timer = null
timer_interval = 30 * 1000
record = null
path = ''
newRecord = null
onTempRecordNumberChanged = null
constructor(record, onTempRecordNumberChanged) {
this.newRecord = record
this.recordManager = uni.$dbTempRecord
this.dbManager = uni.$dbManager
this.onTempRecordNumberChanged = onTempRecordNumberChanged
}
getRecords() {
return this.recordManager.getRecords()
}
getRecord(id) {
return this.recordManager.getRecordById(id)
}
async addRecord(record = this.record) {
await this.recordManager.addRecord(record)
this.triggleRecordNumChanged()
}
updateRecord(item, where) {
return this.recordManager.updateRecord(item, where)
}
async removeRecord(id) {
await this.recordManager.removeRecord(id)
this.triggleRecordNumChanged()
}
async __update(key, value) {
if (this.record[key] === value) return
this.record[key] = value
return this.updateRecord({ [key]: value }, { id: this.record.id })
}
async getFilePath() {
if (!this.path) {
this.path = await utils.getFileSaveFolderOnClient()
}
return this.path
}
async save(record = this.record) {
try {
if(!record) throw new Error('记录对象为空')
uni.$logger.local.info('〖接待记录Record〗 == 开始持久化记录 ==' + JSON.stringify(record))
this.clearLoopTimer()
await this.saveTempFile(record)
const { recordUrlList, tempFilePath, ...__record } = record
__record.recordUrlList = await this.__analysisUrlList(recordUrlList)
uni.$logger.local.info('〖接待记录Record〗 == 更新文件,保存记录!')
await this.dbManager.addRecord(__record)
await this.clearLocalRecord(record)
} catch (error) {
uni.$logger.local.info('〖接待记录Record〗 == 保存记录异常' + error.message)
}
}
async clearLocalRecord(record = this.record) {
const { id, tempFilePath } = record
uni.$logger.local.info('〖接待记录Record〗 == 删除临时文件' + tempFilePath)
await this.removeFile(tempFilePath)
await this.removeRecord(id)
record = null
uni.$logger.local.info('〖接待记录Record〗 == 置空接待记录')
}
async __analysisUrlList(recordUrlList) {
if (!recordUrlList?.length) return []
try {
const __path = await this.getFilePath()
const __list = recordUrlList.reduce((arr, item) => {
if (item?.file) {
arr.push({
status: FileStatus.Waiting,
file: __path + item.file.replace(/.+\/(\d+\.mp3)/, '$1')
})
} else {
uni.$logger.local.warn('〖接待记录Record〗 == 有文件为空路径,舍弃!! ==')
}
return arr
}, [])
return __list
} catch (error) {
uni.$logger.local.info('〖接待记录Record〗 == 解析接待文件列表异常' + error.message)
throw new Error(error.message)
}
}
/**
* 添加新的接待记录
*/
async add() {
// 创建一个新的记录对象
this.record = this.__createNewRecord()
// 异步添加新创建的记录对象
await this.addRecord(this.record)
// 添加音频资源
this.addAudio()
}
__createNewRecord() {
return {
id: utils.uuid(),
...this.newRecord,
receptionStartTime: this.getTimeNow(),
receptionEndTime: '',
recordUrlList: []
}
}
/**
* 添加音频
* @param {Object} isUpdate - 是否更新音频
* @returns {void}
*/
// Update the record with the new information
async addAudio() {
this.clearLoopTimer()
uni.$logger.local.info('〖接待记录Record〗 == 保存上一个临时文件!')
//保存上一个临时文件
await this.saveLastAudio()
//新增一个录音
await this.addNewAudio()
//更新临时录音文件
await this.updatePath()
//开启轮询保存临时录音文件
this.startSaveAudioLoop()
}
async addNewAudio() {
const lastAudio = await helpler.getLatestAudioFilePath()
uni.$logger.local.info('〖接待记录Record〗 == 添加一个新的录音' + lastAudio)
this.record.tempFilePath = lastAudio
const __path = await this.saveFilePath(lastAudio)
this.record.recordUrlList.push({ file: __path })
}
updatePath() {
const { id, tempFilePath, recordUrlList } = this.record
return this.updateRecord({ tempFilePath, recordUrlList }, { id })
}
/**
* 保存文件
* @param {Object} record - 接待记录对象
* @returns - 返回保存后的文件路径
*/
async saveTempFile(record = this.record) {
const { tempFilePath, recordUrlList } = record
const lastIndex = recordUrlList.length - 1
if (lastIndex < 0 || !tempFilePath) return
const { file } = recordUrlList[lastIndex]
const saveResultPath = await this.saveFilePath(tempFilePath)
if (saveResultPath) {
uni.$logger.local.info('〖接待记录Record〗 == 删除上一次保存的文件 ' + file)
await this.removeFile(file)
record.recordUrlList[lastIndex].file = saveResultPath
}
return saveResultPath
}
async saveFilePath(tempFilePath) {
uni.$logger.local.info('〖接待记录Record〗 == 开始保存临时录音 tempFilePath-> ' + tempFilePath)
if (!tempFilePath) return
const saveResult = await uni.saveFile({
tempFilePath
})
let saveResultPath = saveResult[1]?.savedFilePath
uni.$logger.local.info('〖接待记录Record〗 == 保存后的文件路径 saveResultPath ->' + saveResultPath)
return saveResultPath
}
removeFile(filePath) {
if (!filePath) return
return new Promise(resolve => {
uni.removeSavedFile({
filePath,
complete: resolve
})
})
}
async saveLastAudio() {
const __path = await this.saveTempFile()
__path && this.updateUrlList()
}
updateUrlList() {
const { id, recordUrlList } = this.record
return this.updateRecord({ recordUrlList }, { id })
}
startSaveAudioLoop() {
this.clearLoopTimer()
this.timer = setInterval(this.saveLastAudio.bind(this), this.timer_interval)
}
clearLoopTimer() {
if (this.timer) {
clearInterval(this.timer)
this.timer = null
}
}
get currentRecord() {
return this.record
}
setReceptionEndTime() {
return this.__update('receptionEndTime', this.getTimeNow())
}
getTimeNow() {
return utils.convertDateTimeFormat(new Date(), '/')
}
withError() {
return this.__update('endReasonType', 1)
}
async updatePreRecords(items) {
if (items) {
Object.keys(items).forEach(async key => await this.__update(key, items[key]))
}
return this.record
}
async triggleRecordNumChanged() {
if (this.onTempRecordNumberChanged) {
this.onTempRecordNumberChanged()
}
}
}
export default TempRecord
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48
* @LastEditors: limin
* @LastEditTime: 2024-12-06 14:46:47
* @FilePath: \gl_tape\utils\recordManager\click.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import utils from '@/utils/utils.js'
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js'
const timer = Object.freeze({
duration: 40 * 60 * 1000,
interval: 30 * 1000,
timeout: duration / interval
})
let counter = 0
let timer_interval = null
export default {
data() {
return {
reaction: 1
}
},
async mounted() {
this.versionCheck() // 检查更新
},
methods: {
versionCheck() {
const { textList, tempFileURL, version } = uni.$storage.get('mock_data')
const res = utils.compareVersions(plus?.runtime?.version, version)
if (res > -1) {
return
}
const e = {
result: {
is_silently: false,
is_mandatory: true,
name: '',
title: '',
contents: textList.join('\n'),
version: version,
url: tempFileURL,
stable_publish: true
}
}
checkUpdate(e)
},
// //关闭提示
tipCancel() {
this.audioManager.stop()
this.saveRecord()
this.setReceptionStatus(0)
this.setAudioInfo({ endReasonType: 1 })
if (this.$refs.tipBox) {
this.$refs.tipBox.close()
let { sceneType } = uni.$storage.get('userInfo')
uni.reLaunch({
url: sceneType == 0 ? '/pages/equity/index' : '/pages/boutique/index'
})
}
},
async saveRecord() {
const preRecord = this.record.preRecord
return this.record.save(preRecord)
},
//结束提示
tipConfirm() {
counter = 0
this.$refs.tipBox?.close()
},
closeAudio() {
this.endWatchClick()
this.audioManager.stop()
this.setReceptionStatus(0)
this.setAudioInfo({ endReasonType: 1 })
},
//监听点击事件
initTime() {
this.endWatchClick()
timer_interval = setInterval(() => {
if (counter >= timer.timeout) {
//关闭录音
this.closeAudio()
}
counter++
}, timer.interval)
},
endWatchClick() {
if (timer_interval) clearInterval(timer_interval)
timer_interval = null
counter = 0
},
handleTouchStart() {
counter = 0
}
}
}
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2025-01-02 18:34:39
* @LastEditors: limin
* @LastEditTime: 2025-01-06 09:36:04
* @FilePath: \gl_tape\utils\recordManager\dbRecord.js
*/
import DBManager from '../DBManager.js'
class DBRecord {
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', 'tempFilePath TEXT']
table_name = 'temp_records'
constructor() {
this.db = new DBManager(this.table_name, this.table_columns)
return this.db
}
}
export default DBRecord
import utils from '../utils'
/**
* 内部方法,用于获取完整的音频文件路径
*
* 此函数调用 `getAudioPathName` 获取文件名,并通过 `getAudioPath` 获取完整路径。
*/
async function getLatestAudioFilePath() {
const pathName = await __getAudioPathName()
return __getAudioPath(pathName)
}
/**
* 异步获取音频文件路径名称
*
* 此函数用于查找特定目录中所有以 'uniapp_temp' 开头的文件,并返回修改时间最晚的文件名。
* 如果没有找到符合条件的文件,则返回一个空字符串或抛出错误。
*/
async function __getAudioPathName() {
const path = await utils.getAudioFilePath()
return __getLatestFileName(path, 'uniapp_temp')
}
/**
* 异步获取指定名称的音频文件路径
*
* 此函数用于根据给定的文件名查找其完整路径,并返回修改时间最晚的文件路径。
* 如果没有找到符合条件的文件,则返回一个空字符串或抛出错误。
* @param {string} name - 文件名(不包含扩展名)
*/
async function __getAudioPath(name) {
const path = await utils.getAudioFilePath(name + '/recorder')
return __getLatestFilePath(path)
}
/**
* 获取指定目录中修改时间最晚的文件名
*
* @param {string} directoryPath - 目录路径
* @param {string} prefix - 文件名前缀(可选)
* @returns {Promise<string>} - 修改时间最晚的文件名
*/
async function __getLatestFileName(directoryPath, prefix = '') {
const latestFile = await __getLatestFile(directoryPath, prefix)
return latestFile ? latestFile.name : ''
}
/**
* 获取指定目录中修改时间最晚的文件路径
*
* @param {string} directoryPath - 目录路径
* @returns {Promise<string>} - 修改时间最晚的文件路径
*/
async function __getLatestFilePath(directoryPath) {
const latestFile = await __getLatestFile(directoryPath)
return latestFile ? directoryPath + '/' + latestFile.name : ''
}
/**
* 获取指定目录中修改时间最晚的文件
*
* @param {string} directoryPath - 目录路径
* @param {string} prefix - 文件名前缀(可选)
* @returns {Promise<object|null>} - 修改时间最晚的文件对象或 null
*/
async function __getLatestFile(directoryPath, prefix = '') {
return new Promise((resolve, reject) => {
plus.io.resolveLocalFileSystemURL(
directoryPath,
e => {
const dirR = e.createReader()
dirR.readEntries(
async entries => {
const files = entries.filter(item => (prefix ? item.name.startsWith(prefix) : true))
const filePromises = files.map(item => __getFileMetadata(item))
const results = await Promise.all(filePromises)
const latest = results.reduce((acc, current) => (current.modificationTime > acc.modificationTime ? current : acc), { modificationTime: 0 })
resolve(latest.name ? latest : null)
},
err => reject(err)
)
},
err => reject(err)
)
})
}
/**
* 获取文件的元数据
*
* @param {object} fileEntry - 文件条目
* @returns {Promise<object>} - 文件元数据
*/
async function __getFileMetadata(fileEntry) {
return new Promise((resolve, reject) => {
fileEntry.getMetadata(
metadata => {
resolve({
name: fileEntry.name,
modificationTime: new Date(metadata.modificationTime).getTime()
})
},
err => reject(err)
)
})
}
export default {
getLatestAudioFilePath
}
import { storageApi } from "@/utils/cache"; /*
* @Descripttion:
/** * @version: 1.0.0
* 记录管理器类 * @Author: limin
* 用于管理记录列表 * @Date: 2024-06-28 17:12:39
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2025-01-14 16:56:37
* @FilePath: \gl_tape\utils\recordManager\index.js
*/ */
class recorder { // import { singleton } from '../utils.js'
/** import AudioManager from './AudioManager.js'
* RecordManager 类的构造函数 import DBRecord from './dbRecord.js'
* 用于初始化 RecordManager 实例 // import Record from './Record.js'
*/ import RecordDto from './RecordDto.js'
constructor() {} import TempRecord from './TempRecord.js'
// const SingleDBTempRecord = singleton(TempRecord)
module.exports = { AudioManager, DBRecord, RecordDto, TempRecord }
}
export default recorder
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-10-14 17:38:35
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-11-20 17:27:29
* @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'
let Interval = null
class InterruptRecord extends RecordManager {
constructor() {
super()
const records = this.getRecords()
store.dispatch('audio/setPerRecordNumber', records.length)
// console.log(store)
// storageApi.removeRecords('preRecordList')
// storageApi.removeRecords('preRecordId')
// storageApi.removeRecords('recordList')
}
records = {}
pathName = null
audioPath = null
/**
* 获取记录列表
*
* @returns {Array} - 从 storageApi 获取的记录列表
*/
getRecords() {
console.log(storageApi.getRecords('preRecordList'), 'ddd')
return storageApi.getRecords('preRecordList') || []
}
/**
* 获取待提交的记录id
*
*/
getPreRecord() {
const id = storageApi.getRecords('preRecordId')
if (!id) {
return
}
return this.getRecordById(id)
}
/**
* 删除待提交的记录
*
*/
removePreRecord(id) {
uni.$logger.local.info(`删除待提交的记录${id}`)
this.removeRecord(id)
storageApi.setRecords('', 'preRecordId')
clearInterval(Interval)
}
/**
* 初始化保存记录
*
* @param {string} name - 录音文件目录名
* @returns {void} - 此函数不返回任何值
*/
async addPreRecords(params) {
if (storageApi.getRecords('preRecordId')) {
uni.$logger.local.info(`添加录音${storageApi.getRecords('preRecordId')}`)
this.addPreAudio()
return
}
const pathName = await this.getAudioPathName()
const audioPath = await this.getAudioPath(pathName)
this.audioPath = audioPath
const id = utils.uuid()
storageApi.setRecords(id, 'preRecordId')
const ids = storageApi.getRecords('preRecordId')
console.log(ids, 'id')
this.records = {
id,
...params,
audioPath: [audioPath]
}
uni.$logger.local.info(`开始保存记录${id}`)
const records = this.getRecords() || []
records.push(this.records)
this.setRecords(records)
this.setLoopAudio()
storageApi.setRecords('', 'preAudioList')
}
/**
* 30s保存录音文件
*
*/
setLoopAudio() {
Interval = setInterval(() => {
this.updateAudio()
}, 1000 * 30)
}
async updateAudio() {
const len = this.records.audioPath.length - 1
const saveResult = await uni.saveFile({
tempFilePath: this.audioPath
})
const preAudioList = storageApi.getRecords('preAudioList') || []
const filePath = preAudioList[len]
const savedFilePath = saveResult[1].savedFilePath
if (filePath) {
uni.removeSavedFile({
filePath: filePath,
complete: () => {
console.log('complete')
}
})
}
preAudioList[len] = savedFilePath
console.log(preAudioList, 'preAudioList')
storageApi.setRecords(preAudioList, 'preAudioList')
}
get getPreAudioList() {
return storageApi.getRecords('preAudioList')
}
/**
* 添加录音文件
*
* @returns {void} - 此函数不返回任何值
*/
async addPreAudio() {
clearInterval(Interval)
this.updateAudio()
const pathName = await this.getAudioPathName()
const audioPath = await this.getAudioPath(pathName)
this.audioPath = audioPath
const addAudioPath = [...this.records.audioPath, audioPath]
this.records.audioPath.push(audioPath)
const records = this.getPreRecord()
const params = { ...records, audioPath: addAudioPath }
this.updateRecord(params)
this.setLoopAudio()
}
/**
* 更新参数
*
* @returns {void} - 此函数不返回任何值
*/
updatePreRecords(params, isRemoveId) {
if (isRemoveId) {
uni.$logger.local.info(`清除正在接待记录的id`)
storageApi.setRecords('', 'preRecordId')
clearInterval(Interval)
}
const updateParams = { ...this.records, ...params }
console.log(updateParams, 'updateParams')
this.updateRecord(updateParams)
}
/**
* 获取录音文件全路径
*
* @param {string} name - 录音文件目录名
* @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 => {
var dirR = e.createReader()
dirR.readEntries(
function (er) {
Promise.all(
er.map((item, index) => {
return new Promise(resolve => {
item.getMetadata(metadata => {
resolve({
index: index,
name: item.name,
modificationTime: new Date(metadata.modificationTime).getTime()
})
})
})
})
).then(results => {
console.log(results, 'results')
// 找到修改时间最晚的文件
const latest = results.reduce(
(acc, current) => {
if (current.modificationTime > acc.modificationTime) {
return current
}
return acc
},
{ modificationTime: 0 }
)
// 修改时间最晚的文件名
resolve(path + '/' + latest.name)
})
},
err => {
reject(err)
}
)
},
err => {}
)
})
}
/**
* 获取录音文件名
*
* @returns {void} - 此函数不返回任何值
*/
async getAudioPathName() {
return new Promise(async (resolve, reject) => {
const path = await utils.getAudioFilePath()
plus.io.resolveLocalFileSystemURL(
path,
e => {
var dirR = e.createReader()
dirR.readEntries(
function (er) {
Promise.all(
er.map((item, index) => {
console.log(item, 'item')
return new Promise(resolve => {
item.getMetadata(metadata => {
resolve({
index: index,
name: item.name,
modificationTime: new Date(metadata.modificationTime).getTime()
})
})
})
})
).then(results => {
console.log(results, 'results')
results = results.filter(i => i.name.startsWith('uniapp_temp'))
// 找到修改时间最晚的文件
const latest = results.reduce(
(acc, current) => {
if (current.modificationTime > acc.modificationTime) {
return current
}
return acc
},
{ modificationTime: 0 }
)
// 修改时间最晚的文件名
resolve(latest.name)
})
},
err => {
reject(err)
}
)
},
err => {}
)
})
}
/**
* 设置记录列表
*
* @param {Array} records - 要设置的记录列表
* @returns {void} - 此函数不返回任何值
*/
setRecords(records) {
storageApi.setRecords(records, 'preRecordList')
console.log(records, 'records')
store.dispatch('audio/setPerRecordNumber', records.length)
}
}
export default new InterruptRecord()
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48
* @LastEditors: limin
* @LastEditTime: 2024-12-06 14:44:19
* @FilePath: \gl_tape\utils\recordManager\recorder.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import AudioManager from './AudioManager'
import Record from './Record'
const UPLOAD_STATUS = {
// 上传状态
success: 1,
fail: 2
}
const AUDIO_STATUS = {
START: 'start', //录音中
END: 'end', //录音结束
ABNORMAL: 'abnormal' //40分钟未触碰平板,断开录音,不提交记录
}
import { mapMutations, mapState } from 'vuex'
import utils from '@/utils/utils.js'
export default {
data() {
return {
voicePath: '',
times: 0,
timeout: 240,
reaction: 1,
audioManager: null,
record: null
}
},
async mounted() {
this.audioManager = AudioManager.getInstance()
this.record = this.audioManager.record
this.recovery()
},
watch: {
/**
* 监听客户信息是否发生变化
* @param {object} val 监听客户信息
*/
changeData: {
handler(val) {
console.log(val, 'val', this.audioInfo.audioStatus)
if (!this.audioManager.isRecording) return
const { customerInfo, booksList, receptionStatus } = val
this.record.updatePreRecords(customerInfo, booksList, receptionStatus)
},
deep: true
}
},
computed: {
...mapState('audio', ['receptionStatus', 'booksList', 'audioInfo']),
...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']),
//开始录音
startAudio: utils.throttle(async function () {
if (this.audioManager.isRecording) return
uni.$logger.local.info('开始接待')
this.setBooks([])
this.$store.dispatch('clearCustomerInfo')
this.setReceptionStatus('')
this.initTime()
// this.setAudioInfo({ audioList: [], audioStatus: AUDIO_STATUS.START })
this.audioManager.start()
}, 300),
onAudioStart() {
if (this.audioManager.counter === 0) {
this.record.add(this.customerInfo, this.booksList, this.receptionStatus)
} else {
this.record.addAudio()
}
},
onAudioStop() {
if (this.audioManager.isRecording) {
uni.$logger.local.info('接待中,再次开启录音!')
this.audioManager.start()
} else {
uni.$logger.local.info('断开录音!')
}
},
onAudioError(error) {
const message = error.message
this.reportError(`录音异常: error: ${message}`, message)
},
async recovery() {
const records = this.record.getRecords()
if (!records.length) return
while (records.length) {
const record = records.shift()
await this.record.save(record)
}
},
/**
* 结束接待
* @params {boolean} status true 不保存记录/AUDIO_STATUS.ABNORMAL 只要断开录音
* @returns {void}
*/
stopAudio(status) {
this.endWatchClick()
this.audioManager.stop()
const preRecord = this.record.preRecord
//直接退出
if (status) {
uni.$logger.local.info('退出接待,不保存记录!')
this.record.removeRecord(preRecord.id)
return
}
this.record.save(preRecord)
}
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @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: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-12-31 14:28:35 * @LastEditTime: 2025-01-15 21:03:19
* @FilePath: \gl_tape\utils\utils.js * @FilePath: \gl_tape\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
*/ */
...@@ -111,11 +111,7 @@ var isNetWork = function () { ...@@ -111,11 +111,7 @@ var isNetWork = function () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.getNetworkType({ uni.getNetworkType({
complete: function (res) { complete: function (res) {
if (res.networkType == 'none') { resolve(res.networkType !== 'none')
reject('网络异常,请检查网络连接')
} else {
resolve('网络正常')
}
} }
}) })
}) })
...@@ -202,6 +198,20 @@ export function isInteger(value) { ...@@ -202,6 +198,20 @@ export function isInteger(value) {
} }
return false return false
} }
export function singleton(className) {
let ins = null
const proxy = new Proxy(className, {
construct(target, args) {
if (!ins) {
ins = Reflect.construct(target, args)
}
return ins
}
})
proxy.prototype.constructor = proxy
return proxy
}
export default { export default {
compareVersions, compareVersions,
convertDateTimeFormat, convertDateTimeFormat,
......
...@@ -9,6 +9,10 @@ import StopPollingWorker from './workers/StopPollingWorker' ...@@ -9,6 +9,10 @@ import StopPollingWorker from './workers/StopPollingWorker'
import RemoveRecordWorker from './workers/RemoveRecordWorker' import RemoveRecordWorker from './workers/RemoveRecordWorker'
import StartPollingWorker from './workers/StartPollingWorker' import StartPollingWorker from './workers/StartPollingWorker'
import SetPollingIntervalWorker from './workers/SetPollingIntervalWorker' import SetPollingIntervalWorker from './workers/SetPollingIntervalWorker'
import TempRecordsWorker from './workers/TempRecordsWorker'
import RemoveTempRecordWorker from './workers/RemoveTempRecordWorker'
import AddTempRecordWorker from './workers/AddTempRecordWorker'
import AddRecordWorker from './workers/AddRecordWorker'
import { Command } from './constants' import { Command } from './constants'
const Workers = { const Workers = {
[Command.GetLog]: LogsWorker, [Command.GetLog]: LogsWorker,
...@@ -20,7 +24,11 @@ const Workers = { ...@@ -20,7 +24,11 @@ const Workers = {
[Command.StopPolling]: StopPollingWorker, [Command.StopPolling]: StopPollingWorker,
[Command.RemoveRecord]: RemoveRecordWorker, [Command.RemoveRecord]: RemoveRecordWorker,
[Command.StartPolling]: StartPollingWorker, [Command.StartPolling]: StartPollingWorker,
[Command.SetPollingInterval]: SetPollingIntervalWorker [Command.SetPollingInterval]: SetPollingIntervalWorker,
[Command.TempRecords]: TempRecordsWorker,
[Command.RemoveTempRecord]: RemoveTempRecordWorker,
[Command.AddTempRecord]: AddTempRecordWorker,
[Command.AddRecord]: AddRecordWorker
} }
export default { export default {
create: cmd => Workers[cmd] || CommonWorker create: cmd => Workers[cmd] || CommonWorker
......
...@@ -17,7 +17,7 @@ export class Ws { ...@@ -17,7 +17,7 @@ export class Ws {
this.loginAddress =`${config.HTTP_SERVER}/login` this.loginAddress =`${config.HTTP_SERVER}/login`
} }
async connect() { async connect() {
const { code, data, ...o } = await this.login() const { code, data, o } = await this.login()
if (code == 200) { if (code == 200) {
this.deviceId = data.id this.deviceId = data.id
this.token = data.token this.token = data.token
......
...@@ -3,11 +3,15 @@ const Command = { ...@@ -3,11 +3,15 @@ const Command = {
GetStorage: 'getStorage', GetStorage: 'getStorage',
Message: 'message', Message: 'message',
GetLogList: 'getLogList', GetLogList: 'getLogList',
RemoveLog:'removeLog', RemoveLog: 'removeLog',
RemoveRecord:'removeRecord', RemoveRecord: 'removeRecord',
StopPolling:'stopPolling', StopPolling: 'stopPolling',
StartPolling:'startPolling', StartPolling: 'startPolling',
SetPollingInterval:'setPollingInterval', SetPollingInterval: 'setPollingInterval',
Records:'records', Records: 'records',
TempRecords: 'tempRecords',
RemoveTempRecord: 'removeTempRecord',
AddTempRecord: 'addTempRecord',
AddRecord: 'addRecord'
} }
export { Command } export { Command }
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2025-01-14 16:49:00
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2025-01-14 18:14:20
* @FilePath: \gl-tape\ws\workers\AddRecordWorker.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { RecordDto } from '@/utils/recordManager/index'
export default class AddRecordWorker {
constructor() {}
async work(deviceId, data, ws) {
try {
const record = data.data
if (!record) {
throw new Error(`数据格式错误,请提供 record 数据`)
}
const keys = Object.keys(record)
const dto = new RecordDto({})
const existKeys = ['id', 'recordUrlList']
keys.forEach(key => {
if (!existKeys.includes(key) && !dto.hasOwnProperty(key)) {
throw new Error(`数据格式错误,表中没有 ${key} 字段`)
}
})
await uni.$dbManager.addRecord(record)
const msg = `写入待上传记录成功 temp record -> ${JSON.stringify(record)}`
uni.$logger.local.info(msg)
ws.send({ code: 200, msg })
} catch (error) {
const msg = `写入待上传记录失败 error -> ${error.message}`
uni.$logger.local.error(msg)
ws.send({ error: msg })
}
}
}
import { RecordDto } from '@/utils/recordManager/index'
export default class AddTempRecordWorker {
constructor() {}
async work(deviceId, data, ws) {
try {
const record = data.data
if (!record) {
throw new Error(`数据格式错误,请提供 record 数据`)
}
const keys = Object.keys(record)
const dto = new RecordDto({})
const existKeys = ['id', 'recordUrlList','tempFilePath']
keys.forEach(key => {
if (!existKeys.includes(key) && !dto.hasOwnProperty(key)) {
throw new Error(`数据格式错误,表中没有 ${key} 字段`)
}
})
await uni.$dbTempRecord.addRecord(record)
const msg = `写入待提交记录成功 temp record -> ${JSON.stringify(record)}`
uni.$logger.local.info(msg)
ws.send({ code: 200, msg })
} catch (error) {
const msg = `写入待提交记录失败 error -> ${error.message}`
uni.$logger.local.error(msg)
ws.send({ error: msg })
}
}
}
...@@ -19,7 +19,6 @@ export default class RemoveRecordWorker { ...@@ -19,7 +19,6 @@ export default class RemoveRecordWorker {
} }
try { try {
const record = await uni.$dbManager.getRecordById(recordId) const record = await uni.$dbManager.getRecordById(recordId)
console.log(record, 'record')
if (!record) { if (!record) {
const msg = `记录不存在 id -> ${recordId}` const msg = `记录不存在 id -> ${recordId}`
uni.$logger.local.info(msg) uni.$logger.local.info(msg)
......
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-11-22 20:45:05
* @LastEditors: limin
* @LastEditTime: 2025-01-13 20:24:34
* @FilePath: \gl_tape\ws\workers\RemoveTempRecordWorker.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { serializeIfObject } from '@/utils/utils.js'
export default class RemoveTempRecordWorker {
constructor() {}
async work(deviceId, data, ws) {
const recordId = data.id
if (!recordId) {
const msg = `删除接待待提交记录,缺少记录id`
uni.$logger.local.info(msg)
ws.send({ error: msg })
return
}
try {
const record = await uni.$dbTempRecord.getRecordById(recordId)
if (!record) {
const msg = `待提交记录不存在 id -> ${recordId}`
uni.$logger.local.info(msg)
ws.send({ error: msg })
return
}
await uni.$dbTempRecord.removeRecord(recordId)
const msg = `待提交记录删除成功 id -> ${recordId}`
uni.$logger.local.info(msg)
ws.send({ code: 200, msg })
} catch (error) {
const msg = `待提交记录删除异常 id -> ${recordId} error -> ${serializeIfObject(error.message)}`
uni.$logger.local.error(msg)
ws.send({ error: error, recordId })
}
}
}
/* /*
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-11-22 20:45:05 * @Date: 2024-11-22 20:45:05
* @LastEditors: 前端 qianduan01@didihu.com.cn * @LastEditors: limin
* @LastEditTime: 2024-12-06 09:31:10 * @LastEditTime: 2025-01-03 20:42:08
* @FilePath: \gl-tape\ws\workers\StorageWorker.js * @FilePath: \gl_tape\ws\workers\StorageWorker.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 { constData } from '../../utils/cache' import { constData } from '../../utils/cache'
...@@ -14,7 +14,6 @@ export default class StorageWorker { ...@@ -14,7 +14,6 @@ export default class StorageWorker {
let key = data.key let key = data.key
if (!constData.STORAGE_OBJECTKEY[key]) { if (!constData.STORAGE_OBJECTKEY[key]) {
uni.$logger.local.error(`不存在的 Storage Key->${key}. data->${serializeIfObject(data)}`) uni.$logger.local.error(`不存在的 Storage Key->${key}. data->${serializeIfObject(data)}`)
console.log(`不存在的 Storage Key->${key}.`)
return return
} }
let value = uni.$storage.get(key) let value = uni.$storage.get(key)
......
export default class TempRecordsWorker {
constructor() {}
async work(deviceId, data, ws) {
try {
const records = await uni.$dbTempRecord.getRecords()
const msg = `记录获取待提交记录成功 temp records -> ${records}`
uni.$logger.local.info(msg)
ws.send({ code: 200, msg })
} catch (error) {
const msg = `获取待提交记录失败 error -> ${error.message}`
uni.$logger.local.error(msg)
ws.send({ error: msg })
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!