2022-08-26 09:52:43 +00:00
|
|
|
|
<template>
|
2024-10-10 06:10:49 +00:00
|
|
|
|
<page-meta :page-style="$theme.pageStyle">
|
|
|
|
|
|
<!-- #ifndef H5 -->
|
|
|
|
|
|
<navigation-bar
|
|
|
|
|
|
:front-color="$theme.navColor"
|
|
|
|
|
|
:background-color="$theme.navBgColor"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<!-- #endif -->
|
|
|
|
|
|
</page-meta>
|
|
|
|
|
|
<view class="index" :style="pageStyle">
|
|
|
|
|
|
<!-- 组件 -->
|
|
|
|
|
|
<template
|
|
|
|
|
|
v-for="(item, index) in state.pages"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
>
|
2022-09-08 08:28:56 +00:00
|
|
|
|
<template v-if="item.name == 'search'">
|
2024-10-10 06:10:49 +00:00
|
|
|
|
<w-search
|
|
|
|
|
|
:pageMeta="state.meta"
|
|
|
|
|
|
:content="item.content"
|
|
|
|
|
|
:styles="item.styles"
|
|
|
|
|
|
:percent="percent"
|
|
|
|
|
|
:isLargeScreen="isLargeScreen"
|
|
|
|
|
|
/>
|
2022-09-08 08:28:56 +00:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-if="item.name == 'banner'">
|
2024-10-10 06:10:49 +00:00
|
|
|
|
<w-banner
|
|
|
|
|
|
:content="item.content"
|
|
|
|
|
|
:styles="item.styles"
|
|
|
|
|
|
:isLargeScreen="isLargeScreen"
|
|
|
|
|
|
@change="handleBanner"
|
|
|
|
|
|
/>
|
2022-09-08 08:28:56 +00:00
|
|
|
|
</template>
|
|
|
|
|
|
<template v-if="item.name == 'nav'">
|
2024-10-10 06:10:49 +00:00
|
|
|
|
<w-nav :content="item.content" :styles="item.styles"/>
|
2022-09-08 08:28:56 +00:00
|
|
|
|
</template>
|
2024-10-10 06:10:49 +00:00
|
|
|
|
<template v-if="item.name == 'middle-banner'">
|
|
|
|
|
|
<w-middle-banner :content="item.content" :styles="item.styles" />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2022-09-09 03:06:58 +00:00
|
|
|
|
<view class="article" v-if="state.article.length">
|
|
|
|
|
|
<view
|
2024-10-10 06:10:49 +00:00
|
|
|
|
class="flex items-center article-title mx-[20rpx] my-[30rpx] text-lg font-medium"
|
2022-09-09 03:06:58 +00:00
|
|
|
|
>
|
|
|
|
|
|
最新资讯
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<news-card
|
|
|
|
|
|
v-for="item in state.article"
|
|
|
|
|
|
:key="item.id"
|
|
|
|
|
|
:news-id="item.id"
|
|
|
|
|
|
:item="item"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</view>
|
2024-10-10 06:10:49 +00:00
|
|
|
|
|
2026-02-06 07:42:05 +00:00
|
|
|
|
<view class="px-[20rpx] mb-[30rpx]">
|
|
|
|
|
|
<view
|
|
|
|
|
|
class="bg-gradient-to-r from-blue-500 to-blue-600 rounded-[16rpx] p-[30rpx] flex items-center justify-between"
|
|
|
|
|
|
@click="goToPreRegistration"
|
|
|
|
|
|
>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<view class="text-white text-lg font-medium mb-[10rpx]">学校预报名</view>
|
|
|
|
|
|
<view class="text-white/80 text-sm">填写信息,提前锁定名额</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="bg-white/20 rounded-full w-[80rpx] h-[80rpx] flex items-center justify-center">
|
|
|
|
|
|
<text class="text-white text-2xl">→</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
2024-10-10 06:10:49 +00:00
|
|
|
|
<!-- #ifdef H5 -->
|
|
|
|
|
|
<view class="text-center py-4 mb-12">
|
|
|
|
|
|
<router-navigate
|
|
|
|
|
|
class="mx-1 text-xs text-[#495770]"
|
|
|
|
|
|
:to="{
|
|
|
|
|
|
path: '/pages/webview/webview',
|
|
|
|
|
|
query: {
|
|
|
|
|
|
url: item.value
|
|
|
|
|
|
}
|
|
|
|
|
|
}"
|
|
|
|
|
|
v-for="item in appStore.getCopyrightConfig"
|
|
|
|
|
|
:key="item.key"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ item.key }}
|
|
|
|
|
|
</router-navigate>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<!-- #endif -->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 返回顶部按钮 -->
|
|
|
|
|
|
<u-back-top
|
|
|
|
|
|
:scroll-top="scrollTop"
|
|
|
|
|
|
:top="100"
|
|
|
|
|
|
:customStyle="{
|
|
|
|
|
|
backgroundColor: '#FFF',
|
|
|
|
|
|
color: '#000',
|
|
|
|
|
|
boxShadow: '0px 3px 6px rgba(0, 0, 0, 0.1)'
|
|
|
|
|
|
}"
|
|
|
|
|
|
>
|
|
|
|
|
|
</u-back-top>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- #ifdef MP -->
|
|
|
|
|
|
<!-- 微信小程序隐私弹窗 -->
|
|
|
|
|
|
<MpPrivacyPopup></MpPrivacyPopup>
|
|
|
|
|
|
<!-- #endif -->
|
|
|
|
|
|
|
|
|
|
|
|
<tabbar/>
|
2022-08-26 09:52:43 +00:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2022-09-07 13:00:03 +00:00
|
|
|
|
<script setup lang="ts">
|
2024-10-10 06:10:49 +00:00
|
|
|
|
import {getIndex} from '@/api/shop'
|
|
|
|
|
|
import {onLoad, onPageScroll} from "@dcloudio/uni-app";
|
|
|
|
|
|
import {computed, reactive, ref} from 'vue'
|
|
|
|
|
|
import {useAppStore} from '@/stores/app'
|
|
|
|
|
|
|
|
|
|
|
|
// #ifdef MP
|
|
|
|
|
|
import MpPrivacyPopup from './component/mp-privacy-popup.vue'
|
|
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
|
|
const appStore = useAppStore()
|
2022-09-08 08:28:56 +00:00
|
|
|
|
const state = reactive<{
|
|
|
|
|
|
pages: any[]
|
2024-10-10 06:10:49 +00:00
|
|
|
|
meta: any[]
|
2022-09-09 03:06:58 +00:00
|
|
|
|
article: any[]
|
2024-10-10 06:10:49 +00:00
|
|
|
|
bannerImage: string
|
2022-09-08 08:28:56 +00:00
|
|
|
|
}>({
|
2022-09-09 03:06:58 +00:00
|
|
|
|
pages: [],
|
2024-10-10 06:10:49 +00:00
|
|
|
|
meta: [],
|
|
|
|
|
|
article: [],
|
|
|
|
|
|
bannerImage: ''
|
|
|
|
|
|
})
|
|
|
|
|
|
const scrollTop = ref<number>(0)
|
|
|
|
|
|
const percent = ref<number>(0)
|
|
|
|
|
|
|
|
|
|
|
|
// 是否联动背景图
|
|
|
|
|
|
const isLinkage = computed(() => {
|
|
|
|
|
|
return state.pages.find((item: any) => item.name === 'banner')?.content.bg_style === 1
|
|
|
|
|
|
})
|
|
|
|
|
|
// 是否大屏banner
|
|
|
|
|
|
const isLargeScreen = computed(() => {
|
|
|
|
|
|
return state.pages.find((item: any) => item.name === 'banner')?.content.style === 2
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 根页面样式
|
|
|
|
|
|
const pageStyle = computed(() => {
|
|
|
|
|
|
const {bg_type, bg_color, bg_image} = state.meta[0]?.content ?? {}
|
|
|
|
|
|
if (!isLinkage.value) {
|
|
|
|
|
|
return bg_type == 1 ?
|
|
|
|
|
|
{'background-color': bg_color} :
|
|
|
|
|
|
{'background-image': `url(${bg_image})`}
|
|
|
|
|
|
}
|
|
|
|
|
|
else return {'background-image': `url(${state.bannerImage})`}
|
2022-09-07 13:00:03 +00:00
|
|
|
|
})
|
2024-10-10 06:10:49 +00:00
|
|
|
|
|
|
|
|
|
|
const handleBanner = (url: string) => {
|
|
|
|
|
|
state.bannerImage = url
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-07 13:00:03 +00:00
|
|
|
|
const getData = async () => {
|
|
|
|
|
|
const data = await getIndex()
|
2024-10-10 06:10:49 +00:00
|
|
|
|
state.pages = JSON.parse(data?.page?.data)
|
|
|
|
|
|
state.meta = JSON.parse(data?.page?.meta)
|
2022-09-09 03:06:58 +00:00
|
|
|
|
state.article = data.article
|
2024-10-10 06:10:49 +00:00
|
|
|
|
uni.setNavigationBarTitle({
|
|
|
|
|
|
title: state.meta[0].content.title
|
|
|
|
|
|
})
|
2022-09-07 13:00:03 +00:00
|
|
|
|
}
|
2022-09-09 09:58:18 +00:00
|
|
|
|
|
2026-02-06 07:42:05 +00:00
|
|
|
|
const goToPreRegistration = () => {
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: '/pages/pre_registration/pre_registration'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-10 06:10:49 +00:00
|
|
|
|
onPageScroll((event: any) => {
|
|
|
|
|
|
scrollTop.value = event.scrollTop
|
|
|
|
|
|
const top = uni.upx2px(100)
|
|
|
|
|
|
percent.value = event.scrollTop / top > 1 ? 1 : event.scrollTop / top
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
onLoad(() => { getData() })
|
2022-09-07 13:00:03 +00:00
|
|
|
|
</script>
|
2022-08-26 09:52:43 +00:00
|
|
|
|
|
2024-10-10 06:10:49 +00:00
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.index {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
|
background-size: 100% auto;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
transition: all 1s;
|
|
|
|
|
|
min-height: calc(100vh - env(safe-area-inset-bottom));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-09 03:06:58 +00:00
|
|
|
|
.article-title {
|
|
|
|
|
|
&::before {
|
2022-09-09 08:22:08 +00:00
|
|
|
|
content: '';
|
2022-09-09 03:06:58 +00:00
|
|
|
|
width: 8rpx;
|
|
|
|
|
|
height: 34rpx;
|
|
|
|
|
|
display: block;
|
2022-09-09 08:22:08 +00:00
|
|
|
|
margin-right: 10rpx;
|
2024-10-10 06:10:49 +00:00
|
|
|
|
@apply bg-primary;
|
2022-09-09 03:06:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|