Commit b7ae7491 by 李伟康

feat(carBrand): 添加车品牌选择弹窗状态管理功能

- 在CarBrands组件中添加carBrandOpenStatus状态控制
- 实现车品牌选择弹窗打开和关闭的状态同步
- 在Canvas组件中根据车品牌弹窗状态禁用缩放平移功能
- 在equity页面中根据车品牌弹窗状态控制触摸事件响应
- 添加flex-shrink样式防止文字溢出
- 注释掉权限检查相关代码
- 在store中添加carBrandOpenStatus状态管理和mutation方法
1 parent 17254b3c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="wn-canvas"> <view class="wn-canvas">
<zoom-pan <zoom-pan
:class="['canvas-box',{fill:custom}]" :class="['canvas-box',{fill:custom}]"
:disabled="drawStatus || !scaleSwitch" :disabled="carBrandOpenStatus || drawStatus || !scaleSwitch"
:scale-max="3" :scale-max="3"
:scale-min="1" :scale-min="1"
@scale="scale" @scale="scale"
...@@ -178,6 +178,9 @@ export default { ...@@ -178,6 +178,9 @@ export default {
watchStatus () { watchStatus () {
return this.$store.state.user.historyStatus return this.$store.state.user.historyStatus
}, },
carBrandOpenStatus () {
return this.$store.state.user.carBrandOpenStatus
},
}, },
mounted (opt) { mounted (opt) {
this.drawContext = uni.createCanvasContext(this.canvasId, this); this.drawContext = uni.createCanvasContext(this.canvasId, this);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
position="bottom" position="bottom"
:isFooter="false" :isFooter="false"
title="请选择车品牌" title="请选择车品牌"
@close="$emit('close')" @close="clickClose"
> >
<view class="select-box"> <view class="select-box">
<view <view
...@@ -113,6 +113,7 @@ export default { ...@@ -113,6 +113,7 @@ export default {
if (carBrandList.length) this.selectCar(carBrandList[carIndex], true, defaultCarId) if (carBrandList.length) this.selectCar(carBrandList[carIndex], true, defaultCarId)
}, },
open () { open () {
this.$store.dispatch('setCarBrandOpenStatus', true)
const userInfo = uni.$storage.get("userInfo"), const userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId } = userInfo; { shopMerchantId } = userInfo;
/**获取品牌车型 */ /**获取品牌车型 */
...@@ -219,6 +220,7 @@ export default { ...@@ -219,6 +220,7 @@ export default {
this.$store.dispatch('setCurrentCarInfo', selectItem) this.$store.dispatch('setCurrentCarInfo', selectItem)
} }
this.$refs.carBoxVisible?.close(); this.$refs.carBoxVisible?.close();
this.$store.dispatch('setCarBrandOpenStatus', false)
this.$emit('select', { this.$emit('select', {
...item, ...item,
...selectItem ...selectItem
...@@ -228,11 +230,17 @@ export default { ...@@ -228,11 +230,17 @@ export default {
this.$refs?.carBoxVisible?.close(); this.$refs?.carBoxVisible?.close();
this.$refs?.carBrandListVisible?.close() this.$refs?.carBrandListVisible?.close()
this.carBrandListOff = false this.carBrandListOff = false
this.$store.dispatch('setCarBrandOpenStatus', false)
}, },
closeCarBoxVisible () { closeCarBoxVisible () {
if (this.carBrandListOff) return if (this.carBrandListOff) return
else this.$emit('close') else this.$emit('close')
} },
clickClose () {
this.$store.dispatch('setCarBrandOpenStatus', false)
this.$emit('close')
},
} }
} }
</script> </script>
......
...@@ -276,6 +276,7 @@ export default { ...@@ -276,6 +276,7 @@ export default {
.text { .text {
position: relative; position: relative;
padding: 0 24rpx; padding: 0 24rpx;
flex-shrink: 0;
} }
&::before, &::before,
&:after { &:after {
......
...@@ -215,7 +215,10 @@ export default { ...@@ -215,7 +215,10 @@ export default {
// 为了极致性能,可以考虑维护一个 map 或直接缓存 index // 为了极致性能,可以考虑维护一个 map 或直接缓存 index
if (!this.renderList || !this.renderList.length) return -1 if (!this.renderList || !this.renderList.length) return -1
return this.renderList.findIndex(i => i.id == this.id) return this.renderList.findIndex(i => i.id == this.id)
} },
carBrandOpenStatus () {
return this.$store.state.user.carBrandOpenStatus
},
}, },
watch: { watch: {
// 监听 currentIndex 变化,处理预加载逻辑 // 监听 currentIndex 变化,处理预加载逻辑
...@@ -370,6 +373,7 @@ export default { ...@@ -370,6 +373,7 @@ export default {
return {} return {}
}, },
touchStart (e) { touchStart (e) {
if(this.carBrandOpenStatus) return
if (!this.drawStatus && e.changedTouches?.length) { if (!this.drawStatus && e.changedTouches?.length) {
this.startX = e.changedTouches[0].pageX this.startX = e.changedTouches[0].pageX
this.startY = e.changedTouches[0].pageY this.startY = e.changedTouches[0].pageY
...@@ -379,6 +383,7 @@ export default { ...@@ -379,6 +383,7 @@ export default {
} }
}, },
touchMove (e) { touchMove (e) {
if(this.carBrandOpenStatus) return
if (!this.isTouching || this.drawStatus) return if (!this.isTouching || this.drawStatus) return
// 使用 requestAnimationFrame 优化滑动性能 // 使用 requestAnimationFrame 优化滑动性能
...@@ -398,7 +403,7 @@ export default { ...@@ -398,7 +403,7 @@ export default {
}, },
touchEnd (e) { touchEnd (e) {
this.isTouching = false this.isTouching = false
if(this.carBrandOpenStatus) return
if (this.modeName) return if (this.modeName) return
try { try {
let { pageToolList, drawStatus, startX, screenWidth, id, scaleValueObject, productModelStatus } = this let { pageToolList, drawStatus, startX, screenWidth, id, scaleValueObject, productModelStatus } = this
......
...@@ -166,8 +166,8 @@ export default { ...@@ -166,8 +166,8 @@ export default {
title: '该场景尚未配置素材,请联系总部人员', title: '该场景尚未配置素材,请联系总部人员',
icon: 'none' icon: 'none'
}) })
const isPermision = await this.$refs.home.isPermission() // const isPermision = await this.$refs.home.isPermission()
if (this.recording || !isPermision) return // if (this.recording || !isPermision) return
uni.showLoading({ uni.showLoading({
mask: true mask: true
}) })
......
...@@ -39,6 +39,7 @@ export default { ...@@ -39,6 +39,7 @@ export default {
defaultCarId: '', defaultCarId: '',
customerKey: Date.now(), //客户信息KEY customerKey: Date.now(), //客户信息KEY
currentCarInfo: {},//当前选中的车品牌车系 currentCarInfo: {},//当前选中的车品牌车系
carBrandOpenStatus: false, // 车品牌选择弹窗是否打开
}; };
}, },
mutations: { mutations: {
...@@ -93,6 +94,10 @@ export default { ...@@ -93,6 +94,10 @@ export default {
state.customerInfo = info state.customerInfo = info
state.customerKey = Date.now() state.customerKey = Date.now()
}, },
setCarBrandOpenStatus (state, value) {
state.carBrandOpenStatus = value;
},
}, },
actions: { actions: {
// 获取用户详情 // 获取用户详情
...@@ -130,5 +135,8 @@ export default { ...@@ -130,5 +135,8 @@ export default {
setCurrentCarInfo ({ commit }, value) { setCurrentCarInfo ({ commit }, value) {
commit("setCurrentCarInfo", value); commit("setCurrentCarInfo", value);
}, },
setCarBrandOpenStatus ({ commit }, value) {
commit('setCarBrandOpenStatus', value)
},
}, },
}; };
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!