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
+309
View File
@@ -0,0 +1,309 @@
<template>
<view
class="page-app theme-ai"
:class="['theme-' + sys?.mode, 'main-' + sys?.theme, 'font-' + sys?.fontSize]"
>
<view class="page-main" :style="[bgMain]">
<!-- 顶部导航栏-情况1:默认通用顶部导航栏 -->
<!-- <su-navbar
v-if="navbar === 'normal'"
:title="title"
statusBar
:color="color"
:tools="tools"
:opacityBgUi="opacityBgUi"
@search="(e) => emits('search', e)"
:defaultSearch="defaultSearch"
:showLeftButton="showLeftButton"
:goLeft="props.goLeft"
@onClickLeft="onClickLeft"
/> -->
<!-- 顶部导航栏-情况2:装修组件导航栏-标准 -->
<s-custom-navbar
v-if="navbar === 'custom' && navbarMode === 'normal'"
:data="navbarStyle"
:showLeftButton="showLeftButton"
:goLeft="props.goLeft"
@onClickLeft="onClickLeft"
/>
<cardNavbar
v-if="navbar === 'normal'"
:title="title"
:showLeftButton="showLeftButton"
@onClickLeft="onClickLeft"
/>
<innerNavbar
v-if="navbar === 'inner'"
:title="title"
:showLeftButton="showLeftButton"
@onClickLeft="onClickLeft"
/>
<!-- <view v-else-if="navbar === 'customIndex'">123</view> -->
<!-- <s-custom-navbarIndex v-if="navbar === 'customIndex'"></s-custom-navbarIndex> -->
<view class="page-body" :style="[bgBody]">
<!-- 顶部导航栏-情况3:沉浸式头部 -->
<!-- <su-inner-navbar
v-if="navbar === 'inner'"
:title="title"
:showLeftButton="showLeftButton"
:color="color"
:goLeft="props.goLeft"
@onClickLeft="onClickLeft"
:theme="props.theme"
/> -->
<!-- 顶部导航栏-情况4:装修组件导航栏-沉浸式 -->
<s-custom-navbar
v-if="navbar === 'custom' && navbarMode === 'inner'"
:data="navbarStyle"
:showLeftButton="showLeftButton"
:goLeft="props.goLeft"
@onClickLeft="onClickLeft"
/>
<!-- 页面内容插槽 -->
<view class="page_con">
<slot />
</view>
</view>
</view>
<view class="page-modal">
<!-- 全局授权弹窗 -->
<s-auth-modal />
<!-- 全局分享弹窗 -->
<s-share-modal :shareInfo="shareInfo" />
<!-- 全局快捷入口 -->
<s-menu-tools />
</view>
</view>
</template>
<script setup>
/**
* 模板组件 - 提供页面公共组件,属性,方法
*/
import { computed, onMounted, getCurrentInstance } from 'vue';
import sheep from '@/sheep';
import { isEmpty } from 'lodash-es';
import { onPageScroll } from '@dcloudio/uni-app';
// #ifdef MP-WEIXIN
import { onShareAppMessage, onShareTimeline, onPageScroll } from '@dcloudio/uni-app';
// #endif
const { proxy } = getCurrentInstance();
import innerNavbar from '@/components/card_navbar/inner-navbar';
import cardNavbar from '@/components/card_navbar/card_navbar';
const props = defineProps({
title: {
type: String,
default: '',
},
navbar: {
type: String,
default: 'normal',
},
opacityBgUi: {
type: String,
default: 'bg-white',
},
color: {
type: String,
default: '#ffffff',
},
tools: {
type: String,
default: 'title',
},
keyword: {
type: String,
default: '',
},
navbarStyle: {
type: Object,
default: () => ({
styleType: '',
type: '',
color: '',
src: '',
list: [],
alwaysShow: 0,
}),
},
bgStyle: {
type: Object,
default: () => ({
src: '',
color: '#F2F4F7',
}),
},
tabbar: {
type: [String, Boolean],
default: '',
},
onShareAppMessage: {
type: [Boolean, Object],
default: true,
},
leftWidth: {
type: [Number, String],
default: 100,
},
rightWidth: {
type: [Number, String],
default: 100,
},
defaultSearch: {
type: String,
default: '',
},
//展示返回按钮
showLeftButton: {
type: Boolean,
default: true,
},
goLeft: {
type: Boolean,
default: true,
},
theme: {
type: String,
default: '2',
},
});
const emits = defineEmits(['search']);
const sysStore = sheep.$store('sys');
const userStore = sheep.$store('user');
const appStore = sheep.$store('app');
const modalStore = sheep.$store('modal');
const sys = computed(() => sysStore);
// 导航栏模式(因为有自定义导航栏 需要计算)
const navbarMode = computed(() => {
if (props.navbar === 'normal' || props.navbarStyle.styleType === 'normal') {
return 'normal';
}
return 'inner';
});
// 背景1
const bgMain = computed(() => {
if (navbarMode.value === 'inner') {
return {
background: `${props.bgStyle.backgroundColor || props.bgStyle.color} url(${sheep.$url.cdn(
props.bgStyle.backgroundImage,
)}) no-repeat top center / 100% auto`,
};
}
return {};
});
// 背景2
const bgBody = computed(() => {
if (navbarMode.value === 'normal') {
return {
background: `${props.bgStyle.backgroundColor || props.bgStyle.color} url(${sheep.$url.cdn(
props.bgStyle.backgroundImage,
)}) no-repeat top center / 100% auto`,
};
}
return {};
});
// 分享信息
const shareInfo = computed(() => {
if (props.onShareAppMessage === true) {
return sheep.$platform.share.getShareInfo();
} else {
if (!isEmpty(props.onShareAppMessage)) {
sheep.$platform.share.updateShareInfo(props.onShareAppMessage);
return props.onShareAppMessage;
}
}
return {};
});
// #ifdef MP-WEIXIN
uni.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline'],
});
// 微信小程序分享好友
onShareAppMessage(() => {
return {
title: shareInfo.value.title,
path: shareInfo.value.forward.path,
imageUrl: shareInfo.value.image,
};
});
// 微信小程序分享朋友圈
onShareTimeline(() => {
return {
title: shareInfo.value.title,
query: shareInfo.value.forward.path,
imageUrl: shareInfo.value.image,
};
});
// #endif
// 组件中使用 onMounted 监听页面加载,不是页面组件不使用 onShow
onMounted(() => {
if (!isEmpty(shareInfo.value)) {
sheep.$platform.share.updateShareInfo(shareInfo.value);
}
});
const onClickLeft = () => {
proxy.$emit('onClickLeft');
};
onPageScroll((e) => {
console.log(e.scrollTop);
});
</script>
<style lang="scss" scoped>
.page-app {
position: relative;
color: var(--ui-TC);
background-color: var(--ui-BG-1) !important;
z-index: 2;
display: flex;
width: 100%;
height: 100vh;
overflow: scroll;
.page-main {
position: absolute;
z-index: 1;
width: 100%;
min-height: 100%;
display: flex;
flex-direction: column;
.page-body {
width: 100%;
position: relative;
z-index: 1;
flex: 1;
display: flex;
flex-direction: column;
.page_con {
flex: 1;
display: flex;
flex-direction: column;
}
}
.page-img {
width: 100vw;
height: 100vh;
position: absolute;
top: 0;
left: 0;
z-index: 0;
}
}
}
</style>
+187
View File
@@ -0,0 +1,187 @@
<template>
<!-- :class="['theme-' + sys?.mode, 'main-' + sys?.theme, 'font-' + sys?.fontSize]" -->
<view class="page-app theme-ai" :style="[bgMain]">
<!-- :style="[bgMain]" -->
<view class="page-main">
<cardNavbar
v-if="navbar === 'normal'"
:title="title"
:showLeftButton="showLeftButton"
@clickLeft="onClickLeft"
:index="props.index"
/>
<innerNavbar
v-if="navbar === 'inner'"
:title="title"
:showLeftButton="showLeftButton"
@clickLeft="onClickLeft"
:index="props.index"
/>
<transparentNavbar
v-if="navbar === 'transparent'"
:title="title"
:showLeftButton="showLeftButton"
@clickLeft="onClickLeft"
:index="props.index"
/>
<!-- 页面内容插槽 -->
<!-- :style="{ paddingTop: paddingTop + 'px' }" -->
<view class="pageCon" :style="{ paddingTop: paddingTop + 'px' }">
<!-- <view class="transparent_bg" style="z-index: 100;">
<image src="/static/transparent_bg.png" />
</view> -->
<slot />
</view>
</view>
<view class="">
<!-- 全局授权弹窗 -->
<s-auth-modal />
<!-- 全局快捷入口 -->
<s-menu-tools />
</view>
</view>
</template>
<script setup lang="ts">
import { getCurrentInstance, ref, computed } from 'vue';
import innerNavbar from '@/components/card_navbar/inner-navbar';
import cardNavbar from '@/components/card_navbar/card_navbar';
import transparentNavbar from '@/components/card_navbar/transparent_navbar';
import sheep from '@/sheep';
const { proxy } = getCurrentInstance() as any;
const props = defineProps({
title: {
type: String,
default: '',
},
navbar: {
type: String,
default: 'normal',
},
opacityBgUi: {
type: String,
default: 'bg-white',
},
color: {
type: String,
default: '#ffffff',
},
tools: {
type: String,
default: 'title',
},
keyword: {
type: String,
default: '',
},
navbarStyle: {
type: Object,
default: () => ({
styleType: '',
type: '',
color: '',
src: '',
list: [],
alwaysShow: 0,
}),
},
bgStyle: {
type: Object,
default: () => ({
src: '',
color: '#F2F4F7',
}),
},
tabbar: {
type: [String, Boolean],
default: '',
},
onShareAppMessage: {
type: [Boolean, Object],
default: true,
},
leftWidth: {
type: [Number, String],
default: 100,
},
rightWidth: {
type: [Number, String],
default: 100,
},
defaultSearch: {
type: String,
default: '',
},
//展示返回按钮
showLeftButton: {
type: Boolean,
default: true,
},
goLeft: {
type: Boolean,
default: true,
},
theme: {
type: String,
default: '2',
},
index: {
type: Number,
default: 0,
},
});
const sys = computed(() => sysStore);
const sysStore = sheep.$store('sys');
const userStore = sheep.$store('user');
const appStore = sheep.$store('app');
const modalStore = sheep.$store('modal');
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
let paddingTop = ref();
paddingTop.value = statusBarHeight + 44;
const bgMain = computed(() => {
return {
background: `${props.bgStyle.backgroundColor || props.bgStyle.color} url(${sheep.$url.cdn(
props.bgStyle.backgroundImage,
)}) no-repeat top center / 100% auto`,
};
});
const onClickLeft = () => {
console.log('返回2');
proxy.$emit('onClickLeft');
};
</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%);
}
.transparent_bg {
width: 100%;
height: 708rpx;
// position: fixed;
// top: 0;
// left: 0;
image {
width: 100%;
height: 100%;
}
}
.page-app {
.page-main {
.pageCon {
// min-height: 100vh;
box-sizing: border-box;
}
}
}
.pageCon {
box-sizing: border-box;
}
</style>