This commit is contained in:
HongRun Liu
2026-05-26 15:52:30 +08:00
commit b0744c8ab6
849 changed files with 130587 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
<template>
<view class="cardTitle p-x-20 cardBg" :style="{ height: statusBarHeight + 44 + 'px' }">
<view :style="{ height: statusBarHeight + 'px' }"></view>
<view class="flex-center ju-between h_88">
<view class="cardLeft" v-if="props.showLeftButton">
<view @tap="onClickLeft">
<uni-icons type="left" :color="textColor" />
</view>
</view>
<view class="title size36 flex1 center" :style="[{ color: textColor }]">{{
props.title
}}</view>
<view> </view>
</view>
</view>
</template>
<script setup lang="ts">
import { getCurrentInstance, defineProps, defineEmits, ref } from 'vue';
import { onPageScroll } from '@dcloudio/uni-app';
import sheep from '@/sheep';
const { proxy } = getCurrentInstance() as any;
let props = defineProps({
title: {
type: String,
default: '',
},
bg: {
type: String,
default: '#ffffff',
},
scrollbg: {
type: String,
default: '#ffffff',
},
scrollTop: {
type: Number,
default: 20,
},
showLeftButton: {
type: Boolean,
default: true,
},
color: {
type: String,
default: '#333333',
},
scrollColor: {
type: String,
default: '#ffffff',
},
goLeft: {
type: Boolean,
default: true,
},
url: {
type: String,
default: '/pages/index/index',
},
back: {
type: Number,
default: 1,
},
});
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
const hasHistory = sheep.$router.hasHistory();
const emits = defineEmits(['navback', 'clickLeft']);
const onClickLeft = () => {
if (props.goLeft) {
if (hasHistory) {
uni.navigateBack({ delta: props.back });
} else {
sheep.$router.go(props.url);
}
} else {
emits('clickLeft');
}
};
// 监听滚动事件
let scrollTop = ref(0);
let backgroundColor = ref(props.bg);
let textColor = ref(props.color);
</script>
<style scoped lang="scss">
.cardTitle {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 1;
}
.cardBg {
// 背景图片顶部显示, 超出部分隐藏, 宽等于100%
background-color: #ffffff;
}
:deep(.uniui-left) {
font-size: 44rpx !important;
}
.cardLeft {
position: absolute;
bottom: 44rpx;
left: 20rpx;
transform: translateY(50%);
}
</style>
+114
View File
@@ -0,0 +1,114 @@
<template>
<view class="cardTitle p-x-20" :style="{ background: backgroundColor }">
<view :style="{height: statusBarHeight + 'px'}"></view>
<view class="flex-center ju-between h_88">
<view class="cardLeft" v-if="props.showLeftButton">
<view @tap="onClickLeft">
<uni-icons type="left" :color="textColor" />
</view>
</view>
<view class="title size36 flex1 center" :style="[{ color: textColor }]">{{ props.title }}</view>
</view>
</view>
</template>
<script setup lang="ts">
import { getCurrentInstance, defineProps, defineEmits, ref } from 'vue';
import {onPageScroll} from '@dcloudio/uni-app';
import sheep from '@/sheep';
const { proxy } = getCurrentInstance() as any;
let props = defineProps({
title: {
type: String,
default: '',
},
bg: {
type: String,
default: '',
},
scrollbg: {
type: String,
default: '#ffffff',
},
scrollTop: {
type: Number,
default: 20
},
showLeftButton: {
type: Boolean,
default: true,
},
color: {
type: String,
default: '#333333',
},
scrollColor:{
type: String,
default: '#333333'
},
goLeft: {
type: Boolean,
default: true,
},
url: {
type: String,
default: '/pages/index/index',
},
back:{
type: Number,
default: 1
},
index:{
type: Number,
default: 0
}
});
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
const hasHistory = sheep.$router.hasHistory();
const emits = defineEmits(['navback', 'clickLeft']);
const onClickLeft = () => {
if (props.goLeft && props.showLeftButton) {
if (hasHistory) {
uni.navigateBack({ delta: props.back })
} else {
sheep.$router.go(props.url);
}
} else {
emits('clickLeft');
}
};
// 监听滚动事件
let scrollTop = ref(0)
let backgroundColor = ref(props.bg)
let textColor = ref(props.color)
onPageScroll(e=>{
scrollTop.value = e.scrollTop
if(e.scrollTop > props.scrollTop){
backgroundColor.value = props.scrollbg
textColor.value = props.scrollColor
}else{
backgroundColor.value = props.bg
textColor.value = props.color
}
})
</script>
<style scoped lang="scss">
.cardTitle {
position: fixed;
top:0;
left:0;
width: 100%;
z-index: 98;
}
:deep(.uniui-left){
font-size: 44rpx !important;
}
.cardLeft{
position: absolute;
bottom: 44rpx;
left: 20rpx;
transform: translateY(50%);
}
</style>
@@ -0,0 +1,126 @@
<template>
<view class="cardTitle p-x-20">
<view :style="{height: statusBarHeight + 'px'}"></view>
<view class="flex-center ju-between h_88">
<view class="cardLeft" v-if="props.showLeftButton">
<view @tap="onClickLeft">
<uni-icons type="left" :color="textColor" />
</view>
</view>
<view class="title size36 flex1 center" :style="[{ color: textColor }]">{{ props.title }}</view>
</view>
</view>
</template>
<script setup lang="ts">
import { getCurrentInstance, defineProps, defineEmits, ref } from 'vue';
import { onPageScroll } from '@dcloudio/uni-app';
import sheep from '@/sheep';
const { proxy } = getCurrentInstance() as any;
let props = defineProps({
title: {
type: String,
default: '',
},
bg: {
type: String,
default: '',
},
scrollbg: {
type: String,
default: '#ffffff',
},
scrollTop: {
type: Number,
default: 20
},
showLeftButton: {
type: Boolean,
default: true,
},
color: {
type: String,
default: '#333333',
},
scrollColor: {
type: String,
default: '#333333'
},
goLeft: {
type: Boolean,
default: true,
},
url: {
type: String,
default: '/pages/index/index',
},
back: {
type: Number,
default: 1
},
index: {
type: Number,
default: 0
}
});
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
const hasHistory = sheep.$router.hasHistory();
const emits = defineEmits(['navback', 'clickLeft']);
const onClickLeft = () => {
if (props.goLeft && props.showLeftButton) {
if (hasHistory) {
uni.navigateBack({ delta: props.back })
} else {
sheep.$router.go(props.url);
}
} else {
emits('clickLeft');
}
};
// 监听滚动事件
let scrollTop = ref(0)
let backgroundColor = ref(props.bg)
let textColor = ref(props.color)
onPageScroll(e => {
scrollTop.value = e.scrollTop
if (e.scrollTop > props.scrollTop) {
backgroundColor.value = props.scrollbg
textColor.value = props.scrollColor
} else {
backgroundColor.value = props.bg
textColor.value = props.color
}
})
</script>
<style scoped lang="scss">
.one {
width: 100%;
height: 708rpx;
background-image: linear-gradient(to top, #F2F4F7 0%, rgba(251, 129, 55, 0.459) 36%);
position: fixed;
top: 0;
left: 0;
// z-index: -1;
}
.cardTitle {
position: fixed;
top: 0;
left: 0;
width: 100%;
// z-index: 98;
}
:deep(.uniui-left) {
font-size: 44rpx !important;
}
.cardLeft {
position: absolute;
bottom: 44rpx;
left: 20rpx;
transform: translateY(50%);
}
</style>