feat: 金种子、邀请页、启动页API、银行卡
This commit is contained in:
+6
-10
@@ -1,6 +1,6 @@
|
||||
<!-- 首页,支持店铺装修 -->
|
||||
<template>
|
||||
<s-pages title="首页" :showLeftButton="false">
|
||||
<s-layout title="首页" :showLeftButton="false">
|
||||
<view class="pagesIndex">
|
||||
<s-custom-navbarIndex />
|
||||
<view class="pages">
|
||||
@@ -35,13 +35,11 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<su-sticky top="100rpx">
|
||||
<view class="goodsIndex">
|
||||
<goods :list="tagList" v-if="tagList?.length" />
|
||||
</view>
|
||||
</su-sticky>
|
||||
<view class="goodsIndex">
|
||||
<goods :list="tagList" v-if="tagList?.length" />
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</s-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -51,7 +49,6 @@ import {
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad,
|
||||
onPageScroll,
|
||||
onPullDownRefresh
|
||||
} from '@dcloudio/uni-app';
|
||||
import goods from '@/components/goods/goods.vue';
|
||||
@@ -237,7 +234,6 @@ onPullDownRefresh(() => {
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
onPageScroll(() => { });
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -301,4 +297,4 @@ onPageScroll(() => { });
|
||||
.pagesIndex {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,29 @@
|
||||
<template>
|
||||
<view class="start-page">
|
||||
<image class="bg" :src="$url + 'home/startPage_yg.png'" mode="aspectFill" />
|
||||
<video
|
||||
v-if="bgSrc && isVideo"
|
||||
class="bg"
|
||||
:src="bgSrc"
|
||||
autoplay
|
||||
loop
|
||||
muted
|
||||
:controls="false"
|
||||
:show-fullscreen-btn="false"
|
||||
:show-play-btn="false"
|
||||
:show-center-play-btn="false"
|
||||
:enable-progress-gesture="false"
|
||||
object-fit="cover"
|
||||
@error="onMediaError"
|
||||
@click="onMediaClick"
|
||||
/>
|
||||
<image
|
||||
v-else-if="bgSrc"
|
||||
class="bg"
|
||||
:src="bgSrc"
|
||||
mode="aspectFill"
|
||||
@error="onMediaError"
|
||||
@click="onMediaClick"
|
||||
/>
|
||||
<view class="count-down" :class="{ enabled: canEnter }" @click.stop="onEnterClick">
|
||||
{{ canEnter ? '进入' : `跳过 ${countDown}s` }}
|
||||
</view>
|
||||
@@ -8,12 +31,47 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import * as IndexApi from '@/sheep/api/index/index'
|
||||
|
||||
const bgSrc = ref('')
|
||||
const jumpUrl = ref('')
|
||||
const isVideo = ref(false)
|
||||
|
||||
const isVideoUrl = (url) => {
|
||||
const u = String(url || '')
|
||||
if (!u) return false
|
||||
const clean = u.split('?')[0].split('#')[0]
|
||||
return /\.(mp4|mov|m4v|webm|ogg)$/i.test(clean)
|
||||
}
|
||||
|
||||
const fetchStartPage = async () => {
|
||||
try {
|
||||
const res = await IndexApi.getstartpage({})
|
||||
if (res?.code !== 0) return false
|
||||
const data = res?.data || {}
|
||||
const media = String(data?.picUrl || '').trim()
|
||||
const url = String(data?.url || '').trim()
|
||||
if (!media) return false
|
||||
bgSrc.value = media
|
||||
jumpUrl.value = url
|
||||
isVideo.value = isVideoUrl(media)
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function onMediaError() {
|
||||
bgSrc.value = ''
|
||||
isVideo.value = false
|
||||
}
|
||||
|
||||
const countDown = ref(3)
|
||||
let timer = null
|
||||
const canEnter = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
fetchStartPage()
|
||||
timer = setInterval(() => {
|
||||
if (countDown.value <= 1) {
|
||||
//点击进入
|
||||
@@ -34,9 +92,25 @@ onUnmounted(() => {
|
||||
|
||||
function toHome() {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}
|
||||
|
||||
function onMediaClick() {
|
||||
const url = String(jumpUrl.value || '').trim()
|
||||
if (!url) return
|
||||
if (/^https?:\/\//i.test(url)) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/public/webview?url=${encodeURIComponent(url)}`,
|
||||
})
|
||||
return
|
||||
}
|
||||
if (url.startsWith('/pages/')) {
|
||||
uni.navigateTo({ url })
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
function onEnterClick() {
|
||||
if (!canEnter.value) return
|
||||
toHome()
|
||||
@@ -44,14 +118,18 @@ function onEnterClick() {
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.start-page {
|
||||
position: relative;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
}
|
||||
.bg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
.count-down {
|
||||
position: absolute;
|
||||
|
||||
Reference in New Issue
Block a user