184 lines
3.7 KiB
Vue
184 lines
3.7 KiB
Vue
<template>
|
|
<s-layout
|
|
:navbar="props.navbar"
|
|
color="#333333"
|
|
:title="props.title"
|
|
:bgStyle="{ color: props.color }"
|
|
:showLeftButton="props.showLeftButton"
|
|
:goLeft="props.goLeft"
|
|
:tabbar="props.tabbar"
|
|
:navPreset="props.navPreset"
|
|
@onClickLeft="onClickLeft"
|
|
>
|
|
<template #navLeft>
|
|
<slot name="navLeft" />
|
|
</template>
|
|
<template #navRight>
|
|
<slot name="navRight" />
|
|
</template>
|
|
<!-- <Agreement /> -->
|
|
<view class="theme-ai pages">
|
|
<view v-if="purple_bg" class="full-bg">
|
|
<image class="full-bg__img" src="/static/bg.jpg" mode="aspectFill" />
|
|
</view>
|
|
<view class="card1 w100">
|
|
<image v-if="pink_bg" class="w100" :src="$ygUrl + 'transparent_bg.png'" mode="" />
|
|
</view>
|
|
<view class="card1 w100">
|
|
<image v-if="blue_bg" class="w100" src="/static/index/login_bg.png" mode="" />
|
|
</view>
|
|
<view class="scon" :style="{ height: height + 'px' }">
|
|
<slot />
|
|
</view>
|
|
|
|
<!-- pages内容 -->
|
|
<!-- <view class="s-con" :style="{ top: height + 'px', height: windowHeight - height + 'px',zIndex:1 }">
|
|
<slot />
|
|
</view> -->
|
|
</view>
|
|
</s-layout>
|
|
</template>
|
|
<script setup>
|
|
// import Agreement from '@/components/agreement.vue';
|
|
import {
|
|
ref,
|
|
reactive,
|
|
onMounted,
|
|
onUnmounted,
|
|
getCurrentInstance,
|
|
watch,
|
|
nextTick,
|
|
defineProps,
|
|
} from 'vue';
|
|
let { proxy } = getCurrentInstance();
|
|
const props = defineProps({
|
|
title: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
showLeftButton: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
goLeft: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
height: {
|
|
type: Number,
|
|
default: 0,
|
|
},
|
|
heightShow: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
color: {
|
|
type: String,
|
|
default: '#F2F4F7',
|
|
},
|
|
leftUrl: {
|
|
//返回上一页地址
|
|
type: String,
|
|
default: '',
|
|
},
|
|
navbar: {
|
|
type: String,
|
|
default: 'inner',
|
|
},
|
|
tabbar: {
|
|
type: [String, Boolean],
|
|
default: '',
|
|
},
|
|
navPreset: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
pink_bg: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
purple_bg: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
blue_bg: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
});
|
|
let height = ref(0);
|
|
let sysInfo = uni.getSystemInfoSync();
|
|
const windowHeight = sysInfo.windowHeight;
|
|
const safeBottom = sysInfo.safeAreaInsets?.bottom || 0;
|
|
watch(
|
|
() => [props.height, props.heightShow],
|
|
(val) => {
|
|
if (!props.height) {
|
|
if (!props.heightShow) {
|
|
const tabbarHeight = props.tabbar ? uni.upx2px(100) + safeBottom : 0;
|
|
height.value = windowHeight - sysInfo.statusBarHeight - uni.upx2px(88) - tabbarHeight;
|
|
}
|
|
} else {
|
|
height.value = props.height;
|
|
}
|
|
},
|
|
{
|
|
deep: true,
|
|
immediate: true,
|
|
},
|
|
);
|
|
const onClickLeft = () => {
|
|
if (props.leftUrl) {
|
|
proxy.utils.go(props.leftUrl);
|
|
} else {
|
|
proxy.$emit('onClickLeft');
|
|
}
|
|
};
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.pages {
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.full-bg {
|
|
position: fixed;
|
|
inset: 0;
|
|
width: 100vw;
|
|
height: 100vh;
|
|
z-index: 0;
|
|
}
|
|
|
|
.full-bg__img {
|
|
position: absolute;
|
|
inset: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.card1 {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
z-index: 1;
|
|
height: 300rpx;
|
|
overflow: hidden;
|
|
image {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
|
|
.scon {
|
|
position: relative;
|
|
overflow-y: auto;
|
|
z-index: 2;
|
|
}
|
|
|
|
.s-con {
|
|
position: sticky;
|
|
overflow: auto;
|
|
box-sizing: border-box;
|
|
}
|
|
</style>
|