Commit d02c6104 by liimin

feat: 新增组件并优化现有功能

refactor(HomeFrame): 重构布局和动画性能
feat(ResultSelect): 新增接待结果选择组件
feat(CustomerTypeRadio): 新增客户类型单选组件
feat(ResultList): 新增结果列表组件
style(ButtonGroup): 优化按钮组样式和交互
perf(RecordList): 优化记录列表性能和数据格式化
refactor(FinishStep): 使用新组件重构完成步骤
perf(equity/detail): 优化滑动切换和渲染性能
refactor(equity/index): 优化数据获取和状态管理
refactor(saveRecord): 重构表单布局和验证逻辑
1 parent e01037b1
<template>
<view class="button-group">
<template v-for="(item, index) in selectList">
<view
v-for="(item, index) in selectList"
:key="index"
class="button-item"
:class="{ active: index === selectIndex }"
@click="chooseType(index, item)"
:style="{ width: itemWidth + 'rpx', marginRight: index === selectList.length - 1 ? 0 : gap + 'rpx' }"
:style="{ width: itemWidth + 'rpx' }"
>
<text class="label">{{ item[labelKey] }}</text>
<template v-if="item.dot && item.dot()">
<view class="dot"></view>
</template>
<!-- 选中时的背景动画元素 -->
<view class="active-bg" v-if="index === selectIndex"></view>
</view>
<view class="divider" v-if="index < selectList.length - 1" :key="'divider-' + index"></view>
</template>
</view>
</template>
......@@ -30,8 +35,7 @@ export default {
data() {
return {
selectIndex: 0,
itemWidth: 104, // 按钮固定宽度
gap: 16 // 按钮间距
itemWidth: 140, // 按钮固定宽度
}
},
methods: {
......@@ -76,6 +80,17 @@ export default {
z-index: 2; /* 文字在最上层 */
}
.dot {
position: absolute;
top: toRpx(8);
right: toRpx(16);
width: toRpx(12);
height: toRpx(12);
border-radius: 100%;
background: #f24724;
z-index: 3;
}
/* 激活状态的背景层 */
.active-bg {
position: absolute;
......@@ -95,6 +110,13 @@ export default {
box-shadow: 0 toRpx(2) toRpx(8) rgba(55, 115, 248, 0.15);
}
}
.divider {
width: 1px;
height: toRpx(32);
background: #ebedf0;
margin: 0 toRpx(12);
}
}
@keyframes pulse-fade {
......
<template>
<radio-group @change="handleChange" class="radio-group">
<template v-for="(item, index) in items">
<label class="radio" :key="index">
<radio :value="item.value" :checked="value == item.value" />
{{ item.label }}
</label>
</template>
</radio-group>
</template>
<script>
export default {
name: "CustomerTypeRadio",
props: {
value: {
type: [String, Number],
default: ''
},
items: {
type: Array,
default: () => [
{
label: "VIP",
value: 'VIP'
},
{
label: "潜客",
value: '潜客'
},
{
label: "普通",
value: '普通'
}
]
}
},
methods: {
handleChange(e) {
this.$emit('input', e.detail.value);
this.$emit('change', e);
}
}
}
</script>
<style scoped lang="scss">
.radio-group {
display: flex;
align-items: center;
height: 100%;
.radio {
display: flex;
align-items: center;
margin-right: toRpx(30);
}
}
</style>
......@@ -16,14 +16,7 @@
<input :type="i.inputType" :maxlength="i.maxlength" v-model="formData[i.key]" class="input" :placeholder="i.placeholder" :disabled="customerType == 0" @input="inputCustomer" placeholder-style="color:#c9c9c9;" />
</template>
<template v-else-if="i.type == 'radio'">
<radio-group @change="radioChange">
<template v-for="(item, index) in i.items">
<label class="radio" :key="index">
<radio :value="item.value" :checked="formData[i.key] == item.value" />
{{ item.label }}
</label>
</template>
</radio-group>
<CustomerTypeRadio :value="formData[i.key]" @change="radioChange" />
</template>
<!-- <template v-else>
<view
......@@ -46,14 +39,7 @@
</template>
<template v-else>
<view class="pop-tips">请完善本次接待结果</view>
<view class="choose-box">
<template v-for="(i, index) in resultList">
<view :class="['choose-item', `${i.status == receptionStatus ? (i.status == 1 ? 'success' : 'error') : ''}`]" :key="index" @click="chooseResult(i.status)">
<view :class="['sprite-icon', `icon-face-${i.status == receptionStatus ? `${i.icon}-active` : i.icon}`]"></view>
{{ i.text }}
</view>
</template>
</view>
<ResultList :list="resultList" :value="receptionStatus" @change="chooseResult" />
</template>
</view>
</MessageBox>
......@@ -65,9 +51,15 @@
<script type="text/ecmascript-6">
import { mapMutations } from "vuex";
import ResultList from '@/components/ResultList.vue'
import CustomerTypeRadio from '@/components/CustomerTypeRadio.vue'
const phoneRex = /^[1]([2-9])[0-9]{9}$/;
export default {
name: 'FinishStep',
components: {
ResultList,
CustomerTypeRadio
},
props: {
sceneType: {
type: Number,
......@@ -105,20 +97,6 @@ export default {
label: "客户类型",
key: "customerType",
type: "radio",
items: [
{
label: "VIP",
value: 'VIP'
},
{
label: "潜客",
value: '潜客'
},
{
label: "普通",
value: '普通'
}
],
placeholder: '请输入客户类型',
required: true
},
......@@ -407,30 +385,4 @@ export default {
}
}
}
.choose-box {
display: flex;
flex-direction: column;
align-items: center;
.choose-item {
width: 100%;
height: toRpx(128);
border: toRpx(2) solid #e8e8e8;
border-radius: toRpx(16);
display: flex;
align-items: center;
justify-content: center;
margin-top: toRpx(24);
.sprite-icon {
margin-right: toRpx(16);
}
}
.success {
background: #14cc681a;
border-color: #14cc681a;
}
.error {
background: #f247241a;
border-color: #f247241a;
}
}
</style>
......@@ -8,7 +8,7 @@
<view class="module-box box-class">
<view class="common-title">
<text class="title-text">
<text class="highlight-type">{{ currentType.typeName }}</text>
<text class="highlight-type" @click="changeType">{{ currentType.typeName }}</text>
产品介绍
</text>
<view class="switch-btn flex" @click="changeType">
......
......@@ -122,7 +122,7 @@ export default {
]),
uploadTypeList: Object.freeze([
{ label: '待上传' },
{ label: '待提交' },
{ label: '待提交', dot: () => this.preRecordFailList.length },
]),
itemObject: Object.freeze([
// { label: '接待结果', key: 'result' },
......@@ -194,6 +194,7 @@ export default {
item = {
"id": null,
"merchantId": "44210895",
customerType: 'VIP',
"customerName": "1211第五",
"phoneNumber": "13512110555",
"salesUuid": "77936e318e9844e4af0b099c7ccc98e4",
......@@ -287,11 +288,18 @@ export default {
},
async getPreRecordNum () {
const preRecordList = await this.recorder.getRecords()
this.preRecordFailList = preRecordList
this.preRecordFailList =this.formatRecordList(preRecordList)
//[{
// result: '',
// customerPhone: '',
// customerType: 'VIP',
// customerName: '',
// carType: '',
// startTime: '',
// endTime: '' }]
},
getRecordFail () {
this.getRecordNum()
this.list[0] = this.recordFailList.map(record => {
formatRecordList(list) {
return list.map(record => {
return {
result: record.result,
customerPhone: record.customerPhone,
......@@ -303,6 +311,10 @@ export default {
endTime: record.endTime
}
})
},
getRecordFail () {
this.getRecordNum()
this.list[0] = this.formatRecordList(this.recordFailList)
this.flag = true
this.isPrePage = false
this.nothing = !!this.recordFailList.length
......@@ -396,24 +408,7 @@ export default {
async submitRecord (val) {
this.flag = false
delete val.duration
delete val.startTime
const { maxUploadNum = 10 } = uni.$storage.get('mock_data')
if (val.recordUrlList.length > maxUploadNum) {
const userInfo = uni.$storage.get('userInfo')
const { customerName, phoneNumber, carModel, salesName } = val || {}
const { name } = userInfo || {}
uni.$logger.error({
msg: `员工: ${name}, 客户: ${customerName}`,
extra: {
'手机号: ': phoneNumber,
'姓名: ': customerName,
'销售: ': salesName,
'车型: ': carModel,
'原因: ': '录音文件过长,数量' + val.recordUrlList.length
}
})
}
val.recordUrlList = val.recordUrlList.slice(0, maxUploadNum)
// delete val.startTime
await this.recorder.save(val)
this.getRecordNum()
await this.getPreRecordFail()
......
<template>
<view class="container" @click="handleTouchStart">
<view :class="['home', { show: !id && showHome }]">
<view :class="['home', { show: !activeDetailId && showHome }]">
<left-side :userInfo="userInfo" :tabIndex.sync="tabIndex" ref="leftBox" @changeTab="changeTab" @stopAudio="stopAudio" @showReadCountTips="showReadCountTips" @closeTips="closeTips" />
<view class="tips-box" :style="tipsObject.style" @click.stop="closeTips">{{ tipsObject.text }}</view>
<view class="right-side">
......@@ -11,9 +11,12 @@
</view>
<store-address v-if="footerBox" />
</view>
<view :class="['detail', { show: id }]">
<view :class="['detail', { show: activeDetailId }]">
<slot name="detail" />
</view>
<view class="point-page" v-if="!showHome && !activeDetailId">
<component :is="pointComponentName" :transfer="transfer" @close="showHome = true" />
</view>
<!-- 未点击开始接待,弹窗 -->
<MessageBox ref="previewRef" @confirm="previewHandler('preview', true)" :popupW="704" content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」" confirmBtnText="预览素材" @cancel="previewHandler('previewCancel')" @close="previewHandler('previewClose')"></MessageBox>
<finish-reception-dialog ref="finish" @confirm="$emit('openStep')" @cancel="$emit('backHome')" />
......@@ -37,14 +40,19 @@ import recorder from '@/mixin/record/recorder'
import uploader from '@/mixin/record/uploader.js'
import versionCheck from '@/mixin/versionCheck.js'
import LeftSide from './components/LeftSide.vue'
import Material from '@/components/MaterialIndex.vue'
import HomeSlot from './components/HomeSlot.vue'
import Order from './components/Order/index.vue'
const TAB_COMPONENTS = {
1: 'ReceptionCenter',
2: 'Order'
}
export default {
mixins: [recorder, uploader, timeout, versionCheck],
components: { LeftSide, Material, ReceptionCenter, FinishReceptionDialog, StoreAddress, HomeSlot, Order },
components: { LeftSide, ReceptionCenter, FinishReceptionDialog, StoreAddress, HomeSlot, Order },
props: {
id: [String, Number],
activeDetailId: [String, Number],
finishDoneText: String,
finishContene: {
type: String,
......@@ -97,8 +105,7 @@ export default {
return this.$refs.finish
},
componentName() {
let tabs = this.$refs.leftBox?.tabs
return tabs ? tabs[this.tabIndex].name : ''
return TAB_COMPONENTS[this.tabIndex] || ''
}
},
methods: {
......@@ -161,6 +168,7 @@ export default {
text-align: left;
display: none;
opacity: 0;
will-change: opacity, display; // 优化动画性能
}
&::after {
......@@ -173,10 +181,10 @@ export default {
background-image: url('@/assets/images/common/home-bg-1.webp');
background-size: 100% 100%;
z-index: 1;
pointer-events: none; // 避免背景图阻挡交互
}
.home,
.detail {
.home {
position: fixed;
width: 100%;
height: 100%;
......@@ -185,6 +193,29 @@ export default {
left: 0;
visibility: hidden;
opacity: 0;
will-change: opacity, visibility; // 提示浏览器提前优化
// 使用3D加速,避免重绘
transform: translateZ(0);
}
.detail {
position: fixed;
width: 100vw;
height: 100vh;
left: 0;
top: 0;
z-index: -1;
visibility: hidden;
transform: translateX(100%);
transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1), visibility 0.5s;
will-change: transform, visibility; // 提示浏览器提前优化
&.show {
z-index: 2;
visibility: visible;
transform: translateX(0);
}
}
.point-page {
......@@ -250,16 +281,17 @@ export default {
z-index: 2;
visibility: visible;
animation: show-content-left 0.15s forwards;
will-change: transform;
}
}
@keyframes show-content-left {
0% {
left: 100%;
transform: translateX(100%);
}
100% {
left: 0;
transform: translateX(0);
}
}
......@@ -267,6 +299,7 @@ export default {
flex: 1;
position: relative;
width: calc(100vw - #{toRpx(240)});
contain: layout style; // 限制样式和布局计算范围
.right-content {
height: 100vh;
......@@ -274,15 +307,16 @@ export default {
position: relative;
animation: show-box 0.15s forwards;
overflow: hidden;
will-change: transform; // 优化动画
}
@keyframes show-box {
0% {
left: 100%;
transform: translateX(100%);
}
100% {
left: 0;
transform: translateX(0);
}
}
......
......@@ -4,6 +4,7 @@
:type="position"
:is-mask-click="false"
:animation="animation"
:mask-background-color="maskBackgroundColor"
>
<view
class="tips-wrapper"
......@@ -111,6 +112,10 @@ export default {
showCancelBtn: {
type: Boolean,
default: true,
},
maskBackgroundColor: {
type: String,
default: 'rgba(0, 0, 0, 0.4)'
}
},
methods: {
......@@ -135,8 +140,10 @@ export default {
<style scoped lang="scss">
.tips-wrapper {
background: #ffffff;
border-radius: toRpx(20);
border-radius: toRpx(24);
height: 100%;
box-shadow: 0 toRpx(12) toRpx(48) rgba(0, 0, 0, 0.16), 0 toRpx(4) toRpx(16) rgba(0, 0, 0, 0.08);
border: 1px solid rgba(0, 0, 0, 0.06);
.tips-content {
padding: toRpx(48);
box-sizing: border-box;
......
<template>
<view class="choose-box">
<template v-for="(i, index) in list">
<view :class="['choose-item', `${i.status == value ? (i.status == '完成' || i.status == 1 ? 'success' : 'error') : ''}`]" :key="index" @click="chooseResult(i.status)">
<view :class="['sprite-icon', `icon-face-${i.status == value ? `${i.icon}-active` : i.icon}`]"></view>
{{ i.text }}
</view>
</template>
</view>
</template>
<script>
export default {
name: "ResultList",
props: {
list: {
type: Array,
default: () => []
},
value: {
type: [String, Number],
default: -1
}
},
methods: {
chooseResult(val) {
this.$emit('input', val);
this.$emit('change', val);
}
}
}
</script>
<style scoped lang="scss">
.choose-box {
display: flex;
flex-direction: column;
align-items: center;
.choose-item {
width: 100%;
height: toRpx(128);
border: toRpx(2) solid #e8e8e8;
border-radius: toRpx(16);
display: flex;
align-items: center;
justify-content: center;
margin-top: toRpx(24);
.sprite-icon {
margin-right: toRpx(16);
}
}
.success {
background: #14cc681a;
border-color: #14cc681a;
}
.error {
background: #f247241a;
border-color: #f247241a;
}
}
</style>
<template>
<MessageBox ref="popup" title="接待结果" :popupW="704" :isFooter="false" :maskBackgroundColor="maskBackgroundColor">
<ResultList :list="list" :value="value" @change="handleChange" />
</MessageBox>
</template>
<script>
import ResultList from './ResultList.vue'
export default {
name: "ResultSelect",
components: {
ResultList
},
props: {
list: {
type: Array,
default: () => [
{
icon: 'success',
text: '结果完美,成交了',
status: "完成"
},
{
icon: 'error',
text: '仍需努力,战败了',
status: "未完成"
}
]
},
value: {
type: [String, Number],
default: -1
},
maskBackgroundColor: {
type: String,
default: 'rgba(0, 0, 0, 0.4)'
}
},
methods: {
open() {
this.$refs.popup.open()
},
close() {
this.$refs.popup.close()
},
handleChange(val) {
this.$emit('input', val);
this.$emit('change', val);
}
}
}
</script>
......@@ -377,7 +377,12 @@ export default {
try {
if (str && (str.includes('=') || str.length > 50)) {
const decrypted = decryptAES(str)
if (decrypted) return decrypted
if (decrypted) {
if (label == 'Region' && decrypted.includes('.')) {
decrypted = decrypted.split('.')[0]
}
}
return decrypted
}
} catch (e) {
console.error(`${label} decryption error`, e)
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2024-04-08 11:30:30
* @LastEditors: limin
* @LastEditTime: 2025-12-29 08:46:10
* @LastEditTime: 2025-12-29 11:40:42
-->
<template>
<view class="detail-box" :key="dateilKey">
......@@ -13,9 +13,12 @@
</view>
</view>
<template v-for="(item, index) in moduleList">
<view :class="['view', getViewClass(item)]" :key="index" @touchstart.stop="touchStart"
<view :class="['view', getViewClass(item)]" :style="{ 'animation-duration': swipeConfig.animDuration + 'ms' }" :key="index" @touchstart.stop="touchStart"
@touchend.stop="touchEnd">
<component @full="handleFull" :detail="item" :is="item.componentName"
<!-- 优化:仅渲染当前页、上一页、下一页,减少DOM节点 -->
<component
v-if="shouldRender(item)"
@full="handleFull" :detail="item" :is="item.componentName"
:views="item.receptionSourceDetailList || []" :penSwitch="penSwitch" :show="id == item.id"
:ref="'media' + item.id" :title="item.materialName || ''" :madiaId="item.id" @scale="scale"
:ulList="item.ulList" :screenList="item.screenList" @onProductModel="productModelStatus = $event"
......@@ -412,22 +415,27 @@ export default {
},
touchEnd(e) {
if (this.modeName || this.isAnimating) return
try {
let { pageToolList, drawStatus, startX, screenWidth, id, scaleValueObject, productModelStatus } = this
if (!e || !e.changedTouches || drawStatus || pageToolList.length == 0 || e.changedTouches.length === 0) return
let touch = e.changedTouches[0]
let diffX = touch.pageX - startX
const { pageToolList, drawStatus, startX, screenWidth, id, scaleValueObject, productModelStatus } = this
// 快速前置检查
if (!e?.changedTouches?.length || drawStatus || !pageToolList.length) return
let isDistanceSignificant = Math.abs(diffX) > screenWidth / this.swipeConfig.sensitivity
let index = pageToolList.findIndex(item => item.id == id)
const touch = e.changedTouches[0]
const diffX = touch.pageX - startX
// 垂直滑动过大则忽略水平滑动,避免误触
if (Math.abs(this.startY - touch.pageY) > this.swipeConfig.verticalLimit) return
if (!scaleValueObject[id]) scaleValueObject[id] = 1
if (isDistanceSignificant && index != -1 && scaleValueObject[id] == 1 && !productModelStatus) {
const isNext = diffX < 0
// 距离检查
if (Math.abs(diffX) <= screenWidth / this.swipeConfig.sensitivity) return
const index = pageToolList.findIndex(item => item.id == id)
if (index === -1) return
// 缩放状态或打开产品弹窗时不切换
if ((scaleValueObject[id] && scaleValueObject[id] !== 1) || productModelStatus) return
const isNext = diffX < 0
let nextIndex
if (isNext) {
nextIndex = index === pageToolList.length - 1 ? 0 : index + 1
......@@ -438,12 +446,11 @@ export default {
}
const nextItem = pageToolList[nextIndex]
// 使用 nextTick 确保状态更新
this.$nextTick(() => {
this.$emit('update:id', nextItem.id)
})
uni.$logger.local.info(`预览${nextItem.title}`)
}
} catch (error) {
console.log(error)
}
},
getViewClass(item) {
const isCurrent = item.id == this.id
......@@ -502,6 +509,29 @@ export default {
this.$emit('update:id', jumpItem ? jumpItem.id : moduleList[0].id)
}
this.currentMediaId = id
},
// 判断是否应该渲染该组件(性能优化)
shouldRender(item) {
// 如果列表很短,直接全部渲染
if (this.moduleList.length <= 3) return true
const currentIndex = this.moduleList.findIndex(i => i.id == this.id)
if (currentIndex === -1) return false
const targetIndex = this.moduleList.findIndex(i => i.id == item.id)
// 渲染当前页
if (currentIndex === targetIndex) return true
// 渲染上一页(考虑循环)
const prevIndex = currentIndex === 0 ? this.moduleList.length - 1 : currentIndex - 1
if (prevIndex === targetIndex) return true
// 渲染下一页(考虑循环)
const nextIndex = currentIndex === this.moduleList.length - 1 ? 0 : currentIndex + 1
if (nextIndex === targetIndex) return true
return false
}
}
}
......
......@@ -5,7 +5,7 @@
@start="start"
@changeType="changeType"
ref="home"
:id="id"
:activeDetailId="id"
@openStep="openStep"
@backHome="backHome"
@changeTab="changeTab"
......@@ -34,8 +34,9 @@
</template>
<script>
import detail from './detail/detail'
import { mapMutations } from 'vuex'
import { mapMutations, mapActions } from 'vuex'
import HomeFrame from '@/components/HomeFrame/index.vue'
export default {
components: { HomeFrame, detail },
data () {
......@@ -59,41 +60,33 @@ export default {
return this.$refs.home
},
previewRef() {
return this.homeRef.previewRef
return this.homeRef?.previewRef
},
finishRef() {
return this.homeRef.finishRef
return this.homeRef?.finishRef
}
},
onBackPress (options) {
if (options.from === 'backbutton') {
// 物理返回按钮触发
// 阻止默认行为,即不执行页面返回
this.back()
return true
}
// 其他情况允许正常返回
return false
},
async onLoad () {
// uni.hideLoading()
const mockdata = await uni.$api.systemApi.getMockData(true) //获取APP配置信息
const mockdata = await uni.$api.systemApi.getMockData(true)
uni.$storage.set('typeItem', {
typeCode: mockdata?.typeCode || '',
typeName: mockdata?.typeName || ''
})
// if (this.channelType == 1 && mockdata.boutiqueDefaultCarBrandId) {
// this.$store.state.user.boutiqueDefaultCarBrandId = mockdata.boutiqueDefaultCarBrandId //默认车辆品牌
// if (mockdata.defaultCarId) this.$store.state.user.defaultCarId = mockdata.defaultCarId //默认车系
// }
// this.get_Vehicle_Sales_Data()
// this.requested = true
// this.$refs.home.updateApp(true)
this.getHomeSource(mockdata?.typeCode)
await Promise.all([
this.getHomeSource(mockdata?.typeCode),
this.getSource(mockdata?.typeCode)
// setTimeout(() => {
// this.start()
// }, 1e3)
])
// 确保初始化时清空id,保证显示首页
this.id = ''
},
async onShow () {
this.init()
......@@ -101,43 +94,45 @@ export default {
methods: {
...mapMutations('audio', ['setReceptionStatus']),
...mapMutations('material', ['setMaterial']),
...mapActions(['clearCustomerInfo', 'clearHistory', 'clearReceptionTrack']),
init () {
// this.findPayInfo()
if (this.requested && !this.id) this.homeRef.updateApp()
if (this.requested && !this.id) this.homeRef?.updateApp()
},
// 查询素材
// 查询素材(优化版:减少循环中的await)
async getSource (typeCode) {
const first_res = await uni.$api.commonApi.getPadFolderList({
typeCode,
status: 0
})
this.folderList = Array.isArray(first_res?.data) ? first_res.data : []
if (!this.folderList.length) {
this.moduleList = []
this.toolList = []
return
}
let materials = []
for (let i = 0; i < this.folderList.length; i++) {
const folder = this.folderList[i]
const res = await uni.$api.commonApi.getPadMaterialList({
if (!this.folderList.length) return this.resetLists()
// 并行请求所有文件夹内容
const folderPromises = this.folderList.map(folder =>
uni.$api.commonApi.getPadMaterialList({
folderCode: folder.folderCode,
typeCode: folder.typeCode,
status: 0
})
const list = Array.isArray(res?.data) ? res.data : []
if (list.length) {
materials = list
break
}
}
)
const results = await Promise.all(folderPromises)
// 找到第一个有数据的文件夹
const validResult = results.find(res => Array.isArray(res?.data) && res.data.length > 0)
if (!validResult) return this.resetLists()
this.processMaterials(validResult.data)
},
if (!materials.length) {
resetLists() {
this.moduleList = []
this.toolList = []
return
}
},
processMaterials(materials) {
this.moduleList = materials.map(item => ({
...item,
thumbnail: item.materialUrl,
......@@ -159,6 +154,7 @@ export default {
shortTitleUrl: item.materialUrl
}))
},
// 获取首页素材
async getHomeSource(typeCode) {
const res = await uni.$api.commonApi.getPadMaterialList({
......@@ -168,42 +164,43 @@ export default {
})
this.homeList = Array.isArray(res?.data) ? res.data : []
},
changeType () {
const typeItem = uni.$storage.get('typeItem')
const typeCode = typeItem?.typeCode || ''
this.getHomeSource(typeCode)
this.getSource(typeCode)
},
async start (item) {
if (!this.moduleList.length) return uni.showToast({
title: '该场景尚未配置素材,请联系总部人员',
icon: 'none'
})
const isPermision = await this.homeRef.isPermission()
if (this.recording || !isPermision) return
const material = this.moduleList[0]
this.setMaterial(material)
// uni.showLoading({
// mask: true
// })
await this.homeRef.startAudio()
this.clearHistory()
this.clearAllHistory()
this.id = +material.id
// this.id = 6
this.type = 'edit'
this.recording = true
// setTimeout(() => {
// uni.hideLoading()
// }, 1e3)
},
toDetail (index) {
let item = this.moduleList[index]
this.chooseItem = item
this.previewRef.open()
this.chooseItem = this.moduleList[index]
this.previewRef?.open()
},
cancel () {
this.previewRef.close()
this.previewRef?.close()
},
preview () {
let { id, title } = this.chooseItem
this.type = 'preview'
......@@ -211,109 +208,60 @@ export default {
uni.$logger.local.info(`预览${title}`)
this.cancel()
},
// 完成接待
done (e) {
this.finishRef.close()
if (this.recording) this.homeRef.stopAudio()
this.finishRef?.close()
if (this.recording) this.homeRef?.stopAudio()
this.recording = false
setTimeout(() => {
this.id = ''
this.type = ''
this.setReceptionStatus(e)
this.$store.dispatch('clearHistory')
this.$store.dispatch('clearReceptionTrack')
this.clearAllHistory()
}, 1500)
},
back () {
const detailRef = this.$refs.detail
if (detailRef.showPayPage) return (detailRef.showPayPage = false)
if (detailRef?.showPayPage) return (detailRef.showPayPage = false)
if (!this.id) return uni.navigateBack()
if (this.type != 'preview') return this.finishRef.open()
if (this.type != 'preview') return this.finishRef?.open()
this.backHome()
},
backHome () {
if (this.recording) this.homeRef.stopAudio(true)
this.finishRef.close()
if (this.recording) this.homeRef?.stopAudio(true)
this.finishRef?.close()
this.id = ''
this.type = ''
this.clearHistory()
// this.init()
this.clearAllHistory()
this.recording = false
// this.$refs.home.$refs.leftBox.getMessageInfo()
},
nextStep () {
let { id } = this.moduleList[0]
this.type = 'preview'
this.id = id
},
clearHistory () {
this.$store.dispatch('clearCustomerInfo')
this.$store.dispatch('clearHistory')
// this.$refs.home.setBooks([])
this.$store.dispatch('clearReceptionTrack')
clearAllHistory () {
this.clearCustomerInfo()
this.clearHistory()
this.clearReceptionTrack()
},
openStep () {
this.finishRef.close()
this.$refs.detail.open()
this.finishRef?.close()
this.$refs.detail?.open()
},
// 查询门店支付配置
// async findPayInfo () {
// const { shopMerchantId } = uni.$storage.get('userInfo')
// const data = await uni.$api.commonApi.findPayInfo({
// merchantId: shopMerchantId
// })
// let paymentType = []
// data.find(item => {
// if (item.paymentType == 1)
// paymentType.push({
// name: '扫码支付',
// type: 1,
// title: '付款二维码',
// ...item
// })
// if (item.paymentType == 2)
// paymentType.push({
// name: '对公账户',
// type: 2,
// title: '付款方式',
// ...item
// })
// })
// this.$store.dispatch('setPaymentType', paymentType)
// },
changeTab (index) {
// if (index == 0) this.init()
}
},
/**按序加载车型 */
// async getCarBrandsList (carBrandList, index) {
// const item = carBrandList[index]
// if (!item) return
// const carList = uni.getStorageSync(`${item.id}_${item.brandId}_carlist`)
// if (index < carBrandList.length - 1) {
// index += 1
// if (!carList) {
// const list = await uni.$api.commonApi.getCarBrandsList({
// brandId: item.brandId,
// childBrandId: item.id
// })
// if (list) uni.setStorageSync(`${item.id}_${item.brandId}_carlist`, list)
// this.getCarBrandsList(carBrandList, ++index)
// } else this.getCarBrandsList(carBrandList, ++index)
// }
// },
/**素材内容 */
// setViewInfo (data) {
// let { moduleList, toolList, id } = data
// this.moduleList = moduleList
// this.toolList = toolList
// this.mediaId = id
// this.loadComplete = true
// this.$store.state.user = {
// ...this.$store.state.user,
// ...data
// }
// }
beforeDestroy () {
this.backHome()
}
}
</script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!