Commit b7ae7491 by 李伟康

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

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