Commit 8f6588b5 by 李伟康

refactor(boutique): 重构案例视频页面

- 移除了不必要的控制台日志输出
- 优化了页面结构和布局
- 改进了分类筛选功能,支持按车型和类别筛选
- 优化了数据加载逻辑,提高了页面响应速度
- 修复了一些小bug,提升了用户体验
1 parent 30defc06
......@@ -24,7 +24,6 @@ export default {
})
},
mounted() {
console.log('消息')
this.getMessageSummary()
},
methods: {
......
......@@ -45,7 +45,6 @@ export default {
},
inject: ['showPage'],
mounted() {
console.log(this.messageData)
},
methods: {
open() {
......@@ -55,7 +54,6 @@ export default {
this.$refs.popup.close()
},
toMessage() {
console.log(this.messageData)
const {messageData} = this
this.showPage('MessageDetail', {...messageData, type: 'read'})
this.close()
......
......@@ -223,7 +223,6 @@ export default {
mounted () {
const userInfo = uni.$storage.get('userInfo') || {}
this.userInfo = userInfo
this.checkVersion()
permision.requestAndroidPermission('android.permission.RECORD_AUDIO') // 进入界面时检查权限
},
provide () {
......@@ -393,6 +392,10 @@ export default {
eventCode: 'app_reception_begins'
})
this.$emit('start')
},
async updateApp (requested = false) {
if (!requested) await uni.$api.systemApi.getMockData(true)
this.checkVersion()
}
}
}
......
......@@ -258,6 +258,7 @@ export default {
let { blockX, ismove } = this
let pageX = e.changedTouches[0].pageX
let nums = ismove - pageX
if(nums == 0) return
if (!(nums > 50 || blockX < -30) || !(nums < -50 || blockX > 30)) {
this.viewX = -10
setTimeout(() => {
......
<template>
<view
class="layout"
@click="hideSelect"
>
<view class="layout">
<view class="bg"></view>
<wnCanvas
:canvasId="`c-${madiaId}`"
......@@ -15,31 +12,6 @@
<view class="layout-content">
<view class="box">
<view class="select-box">
<view
class="select"
@click.stop="selectType"
>
{{selectIndex}}
<view class="sprite-icon icon-arrow-bottom"></view>
</view>
<view
class="pop-box"
v-show="isSelect"
>
<view
v-for="i in selectList"
:key="i.label"
class="type-item"
:class="i.value == selectIndex ? 'active' : ''"
@click="chooseType(i)"
>{{i.label}}</view>
<!-- <view class="type-item active">全部</view>
<view class="type-item">视频</view>
<view class="type-item">图片</view>
<view class="type-item">PDF</view> -->
</view>
</view>
<view class="input-box">
<input
type="text"
......@@ -51,7 +23,7 @@
/>
<view
class="input-tips"
v-if="!isSearch"
v-if="!isSearch && !name"
>搜索图片/视频名称<uni-icons
type="search"
class="icon"
......@@ -59,7 +31,7 @@
size="20"
></uni-icons></view>
<uni-icons
v-if="isSearch"
v-if="name"
type="closeempty"
class="close"
color="#999"
......@@ -67,48 +39,83 @@
size="20"
></uni-icons>
</view>
<scroll-view
class="record-box"
scroll-y
:scroll-top="scrollTop"
>
<view class="list">
<template v-if="list.length">
<template v-for="item in list">
<view class="content-box">
<scroll-view
class="scroll-box"
scroll-x
enable-flex
>
<view class="classif-box flex">
<template v-for="(i,index) in caseMaterials">
<view
:class="['first-item classif-item flex',{'classif-active':carModelName == i.label}]"
:key="index"
@click="carModelName = i.label"
>
{{i.label}}
</view>
</template>
</view>
</scroll-view>
<scroll-view
class="scroll-box"
enable-flex
scroll-x
>
<view class="classif-box flex">
<template v-for="(i,index) in secondClassifList">
<view
class="item"
:key="item.id"
:class="['second-item classif-item flex',{'classif-active second-ative':category == i}]"
:key="index"
@click="category = i"
>
{{i}}
</view>
</template>
</view>
</scroll-view>
<scroll-view
class="record-box"
scroll-y
>
<view class="list">
<template v-if="list.length">
<template v-for="item in list">
<view
class="item-autio"
@click="playVideo(item)"
class="item"
:key="item.id"
>
<image
:src="item.thumbnailUrl"
class="cover-box"
></image>
<image
v-if="item.materialFormat == 1"
src="../../assets/images/boutique/play.png"
class="play-box"
></image>
<view
class="item-autio"
@click="playVideo(item)"
>
<image
:src="item.thumbnailUrl"
class="cover-box"
></image>
<image
v-if="item.materialFormat == 1"
src="../../assets/images/boutique/play.png"
class="play-box"
></image>
</view>
<view class="item-desc">{{ item.name }}</view>
</view>
<view class="item-desc">{{ item.name }}</view>
</template>
</template>
<template v-else>
<view class="nothing flex">
<image
class="icon"
src="../../assets/images/home/nothing.webp"
/>
暂无数据
</view>
</template>
</template>
<template v-else>
<view class="nothing flex">
<image
class="icon"
src="../../assets/images/home/nothing.webp"
/>
暂无数据
</view>
</template>
</view>
</scroll-view>
</view>
<view class="list-bottom-mask"></view>
</scroll-view>
</view>
</view>
</view>
</template>
......@@ -149,67 +156,78 @@ export default {
return {
name: '',
list: [],
searchList: [],
popupShow: false,
isSearch: false,
videoSrc: '',
isSelect: false,
selectIndex: '全部',
selectList: [
{
label: '全部',
value: '全部'
},
],
scrollTop: 0,
startDate: '',
endDate: '',
userInfo: {}
userInfo: {},
carModelName: '',
category: '',
caseMaterials: []
}
},
props: {
show: Boolean,
madiaId: Number,
penSwitch: Boolean,
// caseMaterials: Array
},
computed: {
watchStatus () {
return this.$store.state.user.historyStatus
},
secondClassifList () {
let { caseMaterials, carModelName } = this,
item = {}
if (caseMaterials.length) item = caseMaterials.find(e => e.label == (!carModelName ? caseMaterials[0].label : carModelName))
return item?.cases || []
}
},
watch: {
watchStatus: {
show: {
handler (newValue) {
if (newValue) {
this.init()
this.getCaseTags()
}
if (!newValue) this.handleLeavePage()
},
immediate: true
},
carModelName: {
handler (val) {
this.selectIndex = '全部'
// this.name = '';
// this.isSearch = false
// this.list = this.views
// this.init()
let { caseMaterials } = this
if (caseMaterials.length && val) {
this.category = this.secondClassifList[0]
}
},
immediate: true
},
show: {
handler (newValue) {
console.log('案例视频', newValue)
if (newValue) this.init()
if (!newValue) this.handleLeavePage()
category: {
handler (val) {
if (val) this.getCaseList()
},
immediate: true
}
},
// caseMaterials: {
// handler (val) {
// if (val.length) {
// this.carModelName = val[0].label
// }
// },
// immediate: true
// }
},
mounted () {
mounted () {
const userInfo = uni.$storage.get("userInfo")
this.userInfo = userInfo
this.init()
console.log('案例视频')
this.getCategory()
},
methods: {
// 离开页面时上传埋点并清空缓存
async handleLeavePage() {
async handleLeavePage () {
try {
const caseInfo = uni.$storage.get("caseInfo")
console.log(caseInfo, 'caseInfo')
if (caseInfo && caseInfo.length > 0) {
await this.uploadData(caseInfo)
uni.$storage.rm("caseInfo")
......@@ -223,7 +241,6 @@ export default {
// 埋点
async sendData (params) {
const { shopMerchantId, sceneType, uuid, name } = this.userInfo
const { startDate, endDate } = this
const default_params = {
merchantId: shopMerchantId,
businessScene: sceneType,
......@@ -241,7 +258,6 @@ export default {
// 查找是否有相同素材(id相同)
const idx = caseInfo.findIndex(item => item.materialId === params.materialId)
console.log(idx, 'idx')
if (idx !== -1) {
// 已存在,openCount+1
caseInfo[idx].openCount = (caseInfo[idx].openCount || 1) + 1
......@@ -257,15 +273,12 @@ export default {
},
// 上传埋点
async uploadData (caseInfo) {
console.log(caseInfo, 'caseInfo')
// const caseInfo = uni.$storage.get("caseInfo")
if (caseInfo && caseInfo.length > 0) {
await uni.$api.boutiqueApi.caseVideoCenter({receptionCustomerMaterialPointList:caseInfo})
await uni.$api.boutiqueApi.caseVideoCenter({ receptionCustomerMaterialPointList: caseInfo })
}
},
playVideo (item) {
console.log(item, 'item')
this.$emit('preview', item)
const params = {
materialId: item.id,
......@@ -276,67 +289,81 @@ export default {
},
focus () {
this.isSearch = true
},
init () {
this.name = '';
this.searchValue = ''
this.isSelect = false
setTimeout(() => {
this.isSearch = false
// this.list = this.views
this.getCaseList(this.selectIndex == '全部' ? '' : this.selectIndex)
}, 300);
},
handleClear () {
this.name = ''
this.searchValue = ''
this.isSearch = false
this.getCaseList(this.selectIndex == '全部' ? '' : this.selectIndex)
this.getCaseTags()
this.clearCanvas()
},
input (e) {
this.name = e.detail.value
if (this.name == '')
this.isSearch = false
// this.list = this.searchList.filter(i => i.name.includes(this.name))
this.getCaseList(this.selectIndex == '全部' ? '' : this.selectIndex, this.name)
let { value } = e.detail
this.isSearch = false
if (this.searchValue == value) return
this.searchValue = value
this.getCaseTags()
this.clearCanvas()
},
selectType () {
this.isSelect = !this.isSelect
},
hideSelect () {
this.isSelect = false
},
chooseType (val) {
this.selectIndex = val.value
this.isSelect = false
this.getCaseList(this.selectIndex == '全部' ? '' : this.selectIndex, this.name)
this.clearCanvas()
async getCaseList () {
try {
uni.showLoading({
mask: true
})
this.list = []
let { searchValue, carModelName, category } = this
const userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId } = userInfo; // 44217687
const params = {
merchantId: shopMerchantId,
carModelName: carModelName,
category: category
}
if (searchValue) params.materialName = searchValue
const { list } = await uni.$api.boutiqueApi.getCaseList(params)
uni.hideLoading()
if (list && list.length) this.list = list
} catch (error) {
uni.hideLoading()
}
},
async getCaseList (category = '', name = '') {
async getCaseTags () {
this.carModelName = ''
this.category = ''
let { searchValue } = this
const userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId } = userInfo; // 44217687
const params = { merchantId: shopMerchantId, category }
if (name) params.materialName = name
const res = await uni.$api.boutiqueApi.getCaseList(params)
this.list = res.list
this.searchList = res.list
this.scrollTop = 1
setTimeout(() => {
this.scrollTop = 0
}, 100);
},
async getCategory () {
const userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId } = userInfo;
const res = await uni.$api.boutiqueApi.getCategory({ merchantId: shopMerchantId })
const _list = res.map(item => {
return {
label: item,
value: item
}
})
this.selectList = [...this.selectList, ..._list]
const params = { merchantId: shopMerchantId }
if (searchValue) params.materialName = searchValue
const { list } = await uni.$api.boutiqueApi.getCaseList(params)
if (list && list.length) {
let arr = Array.from(new Set([...list.map((e) => e.carModelName)])),
caseMaterials = []
arr.map((e, index) => {
caseMaterials.push({
label: e,
cases: []
})
let secondClassifList = new Array(arr.length).fill([])
list.map(i => {
if (e == i.carModelName) secondClassifList[index].push(i.category)
})
caseMaterials[index].cases = Array.from(new Set([...secondClassifList[index]]))
})
this.caseMaterials = caseMaterials
let [item] = list
this.carModelName = item.carModelName
this.category = item.category
} else {
this.caseMaterials = []
this.list = []
}
},
clearCanvas () {
this.$refs.caseCanvas.clearBoard()
......@@ -368,7 +395,7 @@ export default {
top: 0;
}
.box {
padding-top: toRpx(160);
padding-top: toRpx(168);
position: relative;
.select-box {
position: absolute;
......@@ -446,15 +473,57 @@ export default {
justify-content: center;
}
}
.content-box {
height: calc(100vh - #{toRpx(272)});
margin: toRpx(24) 44rpx 0;
border-radius: 48rpx 48rpx 0 0;
background: #ffffff;
backdrop-filter: blur(16rpx);
box-shadow: inset 0 0 16rpx 0 #ffffff;
padding-top: 24rpx;
box-sizing: border-box;
.scroll-box {
width: calc(100% - 88rpx);
margin: 16rpx 44rpx 0;
height: 80rpx;
.classif-box {
width: 100%;
gap: toRpx(24);
flex-wrap: nowrap;
}
}
.classif-item {
height: 80rpx;
padding: 0 32rpx;
color: #666666;
width: fit-content;
flex-shrink: 0;
}
.first-item {
font-size: 32rpx;
}
.classif-active {
color: #2d66f7;
font-weight: 500;
}
.second-item {
font-size: 28rpx;
border-radius: 16rpx;
background: #f2f2f2;
}
.second-ative {
background: #2d66f71a;
}
}
.record-box {
height: calc(100vh - #{toRpx(224)});
padding-top: toRpx(48);
margin-top: 40rpx;
height: calc(100% - #{toRpx(232)});
}
.list {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: toRpx(48) toRpx(50);
margin: 0 toRpx(64);
gap: toRpx(48) toRpx(38);
margin: 0 toRpx(44);
.item {
height: toRpx(536);
background: #ffffff;
......@@ -494,6 +563,10 @@ export default {
}
}
}
.list-bottom-mask {
height: 100rpx;
width: 100%;
}
}
}
.popup-box {
......
......@@ -101,7 +101,8 @@ export default {
icon: 'icon-customer-2'
}
]),
loadComplete:false
loadComplete: false,
requested: false
}
},
onBackPress (options) {
......@@ -114,11 +115,13 @@ export default {
// 其他情况允许正常返回
return false;
},
onLoad () {
async onLoad () {
await uni.$api.systemApi.getMockData(true) //获取APP配置信息
this.init();
uni.$api.systemApi.getMockData(true)
this.requested = true
this.$refs.home.updateApp(true)
},
onShow () {
async onShow () {
const userInfo = uni.$storage.get("userInfo")
if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) {
uni.$storage.rm("userInfo");
......@@ -128,6 +131,7 @@ export default {
});
return;
}
if (this.requested && !this.id) this.$refs.home.updateApp()
},
computed: {
},
......@@ -207,7 +211,6 @@ export default {
this.$store.state.user.boutiqueMediaConfig = boutiqueMediaConfig
this.$store.state.user.boutiqueCarList = boutiqueCarList
}).catch(error => {
console.log(error)
uni.hideLoading()
uni.showToast({
title: error,
......@@ -238,8 +241,6 @@ export default {
this.id = id;
this.tabId = tabId
this.currentCarId = this.carBannerList[this.currentIndex].carModelId
console.log(id)
},
back () {
if (!this.id) return uni.navigateBack();
......@@ -265,6 +266,7 @@ export default {
this.clearHistory();
this.recording = false
this.$refs.home.$refs.leftBox.getMessageInfo()
if (this.requested) this.$refs.home.updateApp()
},
async start (before = true) {
const isPermision = await this.$refs.home.isPermission()
......
......@@ -53,7 +53,8 @@ export default {
recording: false,
aitoCarModelIds: [],
mediaId: '',
loadComplete: false
loadComplete: false,
requested: false
}
},
computed: {
......@@ -82,14 +83,15 @@ export default {
},
async onLoad () {
const mockdata = await uni.$api.systemApi.getMockData(true) //获取APP配置信息
if(this.channelType == 1 && mockdata.boutiqueDefaultCarBrandId) {
if (this.channelType == 1 && mockdata.boutiqueDefaultCarBrandId) {
this.$store.state.user.boutiqueDefaultCarBrandId = mockdata.boutiqueDefaultCarBrandId //默认车辆品牌
if(mockdata.defaultCarId) this.$store.state.user.defaultCarId = mockdata.defaultCarId //默认车系
if (mockdata.defaultCarId) this.$store.state.user.defaultCarId = mockdata.defaultCarId //默认车系
}
this.get_Vehicle_Sales_Data()
this.requested = true
this.$refs.home.updateApp(true)
},
onShow () {
async onShow () {
const userInfo = uni.$storage.get('userInfo')
if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) {
uni.$storage.rm('userInfo')
......@@ -105,6 +107,7 @@ export default {
...mapMutations('audio', ['setReceptionStatus']),
init () {
this.findPayInfo()
if (this.requested && !this.id) this.$refs.home.updateApp()
},
/**获取车型&销售数据 */
get_Vehicle_Sales_Data () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!