Merge branch 'dev/1.0' of https://git.aigc-quickapp.com/Uniapp/lucky_shop into dev/1.0
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
</view>
|
||||
|
||||
<block v-if="value.template == 99">
|
||||
<view class="second-category-btns" :style="oneCategoryHeightStyle">
|
||||
<view class="second-category-btns">
|
||||
<view class="second-category-btn"
|
||||
v-for="(one, oneIndex) in category.child_list"
|
||||
:key="oneIndex"
|
||||
@@ -517,10 +517,6 @@ export default {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
oneCategoryHeight: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
mixins: [DiyMinx],
|
||||
data() {
|
||||
@@ -587,12 +583,6 @@ export default {
|
||||
isGroupedDisplay() {
|
||||
return this.value.template == 1 && this.value.level == 3;
|
||||
},
|
||||
oneCategoryHeightStyle() {
|
||||
if (this.oneCategoryHeight > 0) {
|
||||
return 'height:' + this.oneCategoryHeight + 'px';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.type = this.value.template == 1 || this.value.template == 99 ? 'category' : 'goods';
|
||||
@@ -646,9 +636,6 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
oneCategoryHeight: function () {
|
||||
this.$forceUpdate();
|
||||
},
|
||||
oneCategorySelect: function () {
|
||||
this.scrollTop = -1;
|
||||
this.goodsList = [];
|
||||
@@ -2404,6 +2391,7 @@ export default {
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
padding: 20rpx 20rpx 20rpx 24rpx;
|
||||
height: 100rpx;
|
||||
background: #fff;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
box-sizing: border-box;
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content-box" v-else-if="categoryTree">
|
||||
<view class="content-box" v-if="categoryTree">
|
||||
<block v-if="categoryTree.length">
|
||||
<scroll-view scroll-y="true" class="tree-wrap">
|
||||
<view class="category-item-wrap">
|
||||
@@ -119,7 +119,8 @@
|
||||
<view class="category-item" v-for="(item, index) in categoryTree" :key="index" :class="[
|
||||
{ select: select == index },
|
||||
{ 'border-bottom': value.template == 4 && select + 1 === index },
|
||||
{ 'border-top': value.template == 4 && select - 1 === index }
|
||||
{ 'border-top': value.template == 4 && select - 1 === index },
|
||||
{ 'first-category-item': index == 0 && value.template == 99 }
|
||||
]" @tap.stop="switchOneCategory(index)">
|
||||
<view class="">{{ item.category_name }}</view>
|
||||
</view>
|
||||
@@ -136,7 +137,6 @@
|
||||
:oneCategorySelect="oneCategorySelect" :isList="isList"
|
||||
:currentOneCategory="categoryTree && categoryTree[select] ? categoryTree[select] : null"
|
||||
:lastSecondCategoryName="lastSecondCategoryName"
|
||||
:oneCategoryHeight="oneCategoryItemHeight"
|
||||
@tologin="toLogin" @selectsku="selectSku($event, 0)" @addCart="addCartPoint"
|
||||
@saveSecondCategory="saveSecondCategoryName"></diy-category-item>
|
||||
</scroll-view>
|
||||
@@ -164,6 +164,7 @@
|
||||
<diy-category-item :category="item" :value="value" ref="categoryItem" :index="index"
|
||||
:select="select" :oneCategorySelect="oneCategorySelect" :isList="isList"
|
||||
:lastSecondCategoryName="value.template == 99 ? lastSecondCategoryName : ''"
|
||||
:currentOneCategory="categoryTree && categoryTree[select] ? categoryTree[select] : null"
|
||||
@tologin="toLogin" @selectsku="selectSku($event, index)" @addCart="addCartPoint"
|
||||
@loadfinish="getHeightArea" @saveSecondCategory="saveSecondCategoryName"></diy-category-item>
|
||||
</view>
|
||||
@@ -265,8 +266,7 @@ export default {
|
||||
// 用 categoryTreeLoading 区分"还在请求"和"真的没分类", 请求未完成时
|
||||
// 显示骨架占位而非空态文案
|
||||
categoryTreeLoading: true,
|
||||
// 模板99: 左侧一级分类选中项的高度,用于同步右侧二级分类按钮区域的高度
|
||||
oneCategoryItemHeight: 0
|
||||
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -299,12 +299,18 @@ export default {
|
||||
})
|
||||
.exec();
|
||||
if (this.value.template == 1) this.getHeightArea(-1);
|
||||
if (this.value.template == 99) this.getOneCategoryItemHeight(0);
|
||||
}, 500);
|
||||
},
|
||||
watch: {
|
||||
// 组件刷新监听
|
||||
componentRefresh: function (nval) { }
|
||||
componentRefresh: function (nval) { },
|
||||
categoryTreeLoading: function (nval, oval) {
|
||||
if (nval === false && oval === true) {
|
||||
this.$nextTick(() => {
|
||||
if (!this.heightArea.length) this.getHeightArea(-1);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
cartTotalMoney() {
|
||||
@@ -378,6 +384,7 @@ export default {
|
||||
this.$store.dispatch('getCartNumber');
|
||||
if (!this.heightArea.length) this.getHeightArea(-1);
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取高度区间
|
||||
*
|
||||
@@ -534,23 +541,6 @@ export default {
|
||||
this.select = index;
|
||||
this.categoryId = 'category-' + index;
|
||||
this.scrollLock = true;
|
||||
this.getOneCategoryItemHeight(index);
|
||||
},
|
||||
getOneCategoryItemHeight(index) {
|
||||
setTimeout(() => {
|
||||
const newQuery = uni.createSelectorQuery && uni.createSelectorQuery().in(this);
|
||||
if (!newQuery || typeof newQuery.selectAll !== 'function') {
|
||||
return;
|
||||
}
|
||||
newQuery
|
||||
.selectAll('.category-item-wrap .category-item')
|
||||
.boundingClientRect(data => {
|
||||
if (data && data.length > index && data[index].height) {
|
||||
this.oneCategoryItemHeight = data[index].height;
|
||||
}
|
||||
})
|
||||
.exec();
|
||||
}, 200);
|
||||
},
|
||||
saveSecondCategoryName(name) {
|
||||
this.lastSecondCategoryName = name;
|
||||
@@ -1071,6 +1061,8 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@keyframes category-skeleton-shimmer {
|
||||
0% {
|
||||
background-position: 100% 50%;
|
||||
@@ -1646,6 +1638,21 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
// 模板99: 第一个分类项固定高度,与右侧二级分类按钮区域对齐
|
||||
.tree-wrap .category-item.first-category-item {
|
||||
height: 100rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
||||
view {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
.content-wrap {
|
||||
background: #f5f5f5;
|
||||
padding: 0;
|
||||
|
||||
Reference in New Issue
Block a user