合并代码

This commit is contained in:
Teng 2025-12-02 16:58:09 +08:00
parent afea9432a1
commit 82b638b9a6
2 changed files with 52 additions and 9 deletions

View File

@ -5,8 +5,8 @@
请领物料
<view class="mhao" v-if="Material.length>0">{{Material.length}}</view>
</view>
<scroll-view scroll-x="true" class="kcscrol guodu"
scroll-with-animation :scroll-top="scrollleft" :style="qb?'width:calc(100% - 21.8vw)':'width:calc(100% - 10vw)' ">
<scroll-view scroll-x="true" class="kcscrol guodu" @scroll="onScroll"
scroll-with-animation :scroll-left="scrollleft" :style="qb?'width:calc(100% - 21.8vw)':'width:calc(100% - 10vw)' ">
<view class="yjbox" v-for="(v,i) in Material" :key="i" @click="clickaddcar(v,i)">
<image :src="v.materialInfo.materialImg?serverUrl+v.materialInfo.materialImg:'/static/index/procurement/k.png'"
mode="aspectFill"></image>
@ -15,8 +15,8 @@
</view>
<defaultr cont="暂无数据" v-if="Material.length==0&&timeout" style="position: absolute;width: 10vw;height: 10vw;"></defaultr>
</scroll-view>
<view class="kjlt more guodu" :style="qb?'width:15vw':'' ">
<view @click="qb=!qb;moredex=0" class="righ0">
<view class="kjlt more guodu" :style="qb?'width:15vw':'' " @touchstart="ts" @touchmove="canmove">
<view @click="qb=!qb;moredex=0;moveleft()" class="righ0">
{{!qb?'更多':'收起'}}
<image class="guodu" :style="qb?'transform: rotate(180deg);':''"
src="/static/index/procurement/zjt.png" mode="aspectFill"></image>
@ -45,7 +45,6 @@
}
});
const serverUrl = ref(uni.getStorageSync('serverUrl') + '/sys/common/static/')
const scrollleft = ref(0)
const qb = ref(false)
const moredex = ref(0)
// watch(()=>props.Material,
@ -55,6 +54,51 @@
// scrollleft.value = 100*props.Material.length
// }
// })
const startX = ref(0)
const ts = (e) => {
startX.value = e.touches[0].clientX
}
const savescrollleft = ref(0)
//
function onScroll(e : any) {
savescrollleft.value = e?.detail?.scrollLeft ?? 0
}
const scrollleft = ref(0)
const canmove = (e : any) => {
const moveX = e.touches[0].clientX
const diff = moveX - startX.value
// diff
if (diff < -60 && !qb.value) { // 👉 60px 便
qb.value = !qb.value;
moredex.value = 0;
// bug
scrollleft.value = savescrollleft.value + 125.99
setTimeout(() => {
scrollleft.value = savescrollleft.value + 126
}, 50)
}
if (diff > 60 && qb.value) { // 👉 60px 便
qb.value = !qb.value;
moredex.value = 0;
scrollleft.value = savescrollleft.value - 125.99
setTimeout(() => {
scrollleft.value = savescrollleft.value - 126
}, 50)
}
}
const moveleft = () => {
if (qb.value) {
scrollleft.value = savescrollleft.value + 125.99
setTimeout(() => {
scrollleft.value = savescrollleft.value + 126
}, 50)
} else {
scrollleft.value = savescrollleft.value - 125.99
setTimeout(() => {
scrollleft.value = savescrollleft.value - 126
}, 50)
}
}
const timeout = ref(false)
onMounted(()=>{
setTimeout(()=>{
@ -140,17 +184,17 @@
}
&:nth-child(2) {
right: 4.2vw;
right: 3.9vw;
z-index: 3;
}
&:nth-child(3) {
right: 8.5vw;
right: 7.7vw;
z-index: 2;
}
&:nth-child(4) {
right: 12.3vw;
right: 11.6vw;
z-index: 2;
}
}

View File

@ -246,7 +246,6 @@
}
const moveleft = () => {
console.log("qb", qb.value)
if (qb.value) {
scrollleft.value = savescrollleft.value + 95
setTimeout(() => {