feat: 金种子、邀请页、启动页API、银行卡
This commit is contained in:
+15
-13
@@ -1,19 +1,21 @@
|
||||
<template>
|
||||
<view>
|
||||
<scroll-view scroll-x show-scrollbar="false" class="scroll-x-wrapper p-x-32">
|
||||
<view class="navs flex-center ju-flex-start nowrap" style="width: auto;">
|
||||
<view
|
||||
class="navItem flex-center flex-column flex1 shrink nowrap"
|
||||
:class="{ tabIndex: i == tabIndex, c34: i == tabIndex }"
|
||||
v-for="(v, i) in props.list"
|
||||
:key="i"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="navText"> {{ v.name }} </view>
|
||||
<image src="/static/index/active.png" mode="scaleToFill" />
|
||||
<su-sticky offsetTop="0" zIndex="20" bgColor="#F2F4F7">
|
||||
<scroll-view scroll-x show-scrollbar="false" class="scroll-x-wrapper p-x-32">
|
||||
<view class="navs flex-center ju-flex-start nowrap" style="width: auto;">
|
||||
<view
|
||||
class="navItem flex-center flex-column flex1 shrink nowrap"
|
||||
:class="{ tabIndex: i == tabIndex, c34: i == tabIndex }"
|
||||
v-for="(v, i) in props.list"
|
||||
:key="i"
|
||||
@click="navChange(i)"
|
||||
>
|
||||
<view class="navText"> {{ v.name }} </view>
|
||||
<image src="/static/index/active.png" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</scroll-view>
|
||||
</su-sticky>
|
||||
<view class="goodsPages">
|
||||
<goods-item
|
||||
v-for="(tab, i) in props.list"
|
||||
|
||||
@@ -1,37 +1,26 @@
|
||||
<template>
|
||||
<view class="goodsItem-container">
|
||||
<view v-show="i === props.index">
|
||||
<!-- top="120"下拉布局往下偏移,防止被悬浮菜单遮住 -->
|
||||
<mescroll-uni
|
||||
@init="mescrollInit"
|
||||
top="0"
|
||||
:down="downOption"
|
||||
@down="downCallback"
|
||||
:up="upOption"
|
||||
@up="upCallback"
|
||||
@emptyclick="emptyClick"
|
||||
v-if="i === props.index"
|
||||
:height="height + 'px'"
|
||||
>
|
||||
<!-- 数据列表 -->
|
||||
<!-- <good-list :list="goods"></good-list> -->
|
||||
<!-- <view v-for="(v,i) in goods" :key="i">
|
||||
{{ v.picUrl }}
|
||||
</view> -->
|
||||
|
||||
<view class="flex-row wrap w100" ref="cardRef">
|
||||
<view class="cardItem" v-for="(v, i) in goods" :key="i">
|
||||
<card_goods :data="v"></card_goods>
|
||||
</view>
|
||||
<view v-show="i === props.index">
|
||||
<mescroll-body
|
||||
@init="mescrollInit"
|
||||
top="0"
|
||||
:down="downOption"
|
||||
@down="downCallback"
|
||||
:up="upOption"
|
||||
@up="upCallback"
|
||||
@emptyclick="emptyClick"
|
||||
v-if="i === props.index"
|
||||
>
|
||||
<view class="flex-row wrap w100">
|
||||
<view class="cardItem" v-for="(v, i) in goods" :key="i">
|
||||
<card_goods :data="v"></card_goods>
|
||||
</view>
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
</view>
|
||||
</mescroll-body>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, getCurrentInstance } from 'vue';
|
||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app';
|
||||
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import card_goods from './card_goods.vue';
|
||||
@@ -39,7 +28,6 @@
|
||||
let goods = ref([]);
|
||||
const column = ref(2);
|
||||
const columnChange = ref(false);
|
||||
const height = ref(0);
|
||||
const props = defineProps({
|
||||
i: Number, // 每个tab页的专属下标
|
||||
index: {
|
||||
@@ -77,7 +65,7 @@
|
||||
},
|
||||
);
|
||||
|
||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom); // 调用mescroll的hook
|
||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(); // 调用mescroll的hook
|
||||
|
||||
defineExpose({ getMescroll }); // 使父组件可以通过ref调用到getMescroll方法 (必须)
|
||||
|
||||
@@ -121,9 +109,6 @@
|
||||
}
|
||||
}
|
||||
};
|
||||
let cardRef = ref(null);
|
||||
// 是否有下一页
|
||||
let hasMore = ref(true);
|
||||
const upCallback = (mescroll) => {
|
||||
SpuApi.getSpuPage({
|
||||
pageNo: mescroll.num,
|
||||
@@ -139,10 +124,6 @@
|
||||
// }
|
||||
if (mescroll.num == 1) goods.value = []; //如果是第一页需手动制空列表
|
||||
goods.value = goods.value.concat(list); //追加新数据
|
||||
hasMore.value = goods.value.length < res.data.total;
|
||||
// 计算容器高度
|
||||
getHeight(mescroll.num);
|
||||
|
||||
mescroll.endSuccess(list.length); // 请求成功, 结束加载
|
||||
})
|
||||
.catch(() => {
|
||||
@@ -156,40 +137,9 @@
|
||||
title: '点击了按钮,具体逻辑自行实现',
|
||||
});
|
||||
};
|
||||
const getHeight = (num) => {
|
||||
if (!goods.value.length) {
|
||||
// 541
|
||||
height.value = 10
|
||||
return
|
||||
}
|
||||
// 相除向上取整
|
||||
let cardHeight = Math.ceil(goods.value.length / 2) * (541)
|
||||
let sysInfo = uni.getSystemInfoSync()
|
||||
const windowHeight = sysInfo.windowHeight;
|
||||
const value1 = windowHeight - sysInfo.statusBarHeight - uni.upx2px(88) - uni.upx2px(120)
|
||||
let value2 = uni.upx2px(cardHeight) + 55 + uni.upx2px(12)
|
||||
// if(hasMore){
|
||||
// value2 = uni.upx2px(cardHeight) + uni.upx2px(12)
|
||||
// }
|
||||
const isGreater = value1 > value2;
|
||||
if(isGreater){
|
||||
height.value = value2
|
||||
}else{
|
||||
height.value = value1
|
||||
}
|
||||
// console.error(windowHeight)
|
||||
// console.log("最大高"+value1)
|
||||
// console.log("内容高"+value2)
|
||||
// console.error(height.value)
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.goodsItem-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.cardItem {
|
||||
width: calc(50% - 8rpx);
|
||||
margin-right: 16rpx;
|
||||
|
||||
Reference in New Issue
Block a user