Files
xl-mobile/src/pages/home/index.vue

187 lines
6.2 KiB
Vue
Raw Normal View History

2025-03-25 16:35:39 +08:00
<script setup>
2025-03-26 19:10:41 +08:00
import XNav from "../../components/XNav.vue";
import nav1 from '../../static/icons/icon-新手教学.png';
import nav2 from '../../static/icons/icon-收益榜单.png';
import nav3 from '../../static/icons/icon-邀请好友.png';
import nav4 from '../../static/icons/icon-添加客服.png';
import nav5 from '../../static/icons/icon-重要消息.png';
2025-03-27 15:38:21 +08:00
import XDropdownList from "../../components/XDropdownList.vue";
import XDropdownItem from "../../components/XDropdownItem.vue";
import TaskItem from "../../components/TaskItem.vue";
import useTableQuery from "../../hooks/useTableQuery.js";
import Api from "../../api/index.js";
import {reactive, ref} from "vue";
import {toPage} from "../../utils/uils.js";
import AddCustomerServiceModal from "../../components/AddCustomerServiceModal.vue";
2025-03-25 16:35:39 +08:00
2025-03-27 15:38:21 +08:00
const showAddCustomer = ref(false);
2025-03-26 19:10:41 +08:00
const nav = [
{
title: '新手教学',
icon: nav1,
2025-03-27 15:38:21 +08:00
path: '/pages/beginnerTutorial/index',
2025-03-26 19:10:41 +08:00
},
{
title: '收益榜单',
icon: nav2,
2025-03-27 15:38:21 +08:00
path: '/pages/comingSoon/index',
2025-03-26 19:10:41 +08:00
},
{
title: '邀请好友',
icon: nav3,
2025-03-27 15:38:21 +08:00
path: '/pages/InviteFriends/index',
2025-03-26 19:10:41 +08:00
},
{
title: '添加客服',
icon: nav4,
2025-03-27 15:38:21 +08:00
path: null,
onClick: () => {
showAddCustomer.value = true;
}
2025-03-26 19:10:41 +08:00
},
{
title: '重要消息',
icon: nav5,
2025-03-27 15:38:21 +08:00
path: '/pages/messageCenter/index',
2025-03-26 19:10:41 +08:00
},
];
2025-03-27 15:38:21 +08:00
const po = reactive({
});
const vo = reactive({
page: '',
rows: [],
total: 0,
});
const {loading, pagination, initFetchData} = useTableQuery({
api: Api.system.getData,
parameter: po,
callback: (data) => {
vo.page = data.page;
vo.total = data.total;
vo.rows =[...vo.rows, ... data.rows];
}
});
2025-03-25 16:35:39 +08:00
</script>
<template>
<!--首页-->
2025-03-26 19:10:41 +08:00
<XNav :show-back="false"></XNav>
2025-03-27 15:38:21 +08:00
<add-customer-service-modal v-model:show="showAddCustomer"></add-customer-service-modal>
<scroll-view
@refresherpulling="initFetchData()"
@scrolltolower="pagination.current++"
class="h-[calc(100vh-200rpx)]"
scroll-y>
<view class="relative overflow-hidden bg-b-r !pb-[34rpx]">
<image class="!w-full !absolute top-1/2 -translate-y-1/2" src="/static/icons/home-bg.png"
mode="widthFix"></image>
<view class="!w-full !h-full !absolute !top-0 !left-0 bg-w"></view>
<view class="box-border !p-[20rpx]">
<swiper class="!h-[240rpx] !w-full overflow-hidden rounded-[8rpx]">
<swiper-item class="!w-full !h-full" v-for="i in [1,2,3,4,5]">
<image class="!w-full !h-full" mode="widthFix" src="../../static/images/banner占位.png"></image>
</swiper-item>
</swiper>
</view>
<view class="mt-[44rpx] !flex !gap-[50rpx] !mx-[36rpx] relative z-10">
<view
v-for="item in nav"
:key="item.title"
@click="item.path ? toPage(item.path) : item.onClick()"
class="!flex flex-col items-center gap-[6rpx]">
<view class="!size-[96rpx] rounded-[20rpx] overflow-hidden">
<image class="!size-full" :src="item.icon"></image>
</view>
<view class="nav-desc">{{ item.title }}</view>
</view>
2025-03-26 19:10:41 +08:00
</view>
2025-03-27 15:38:21 +08:00
</view>
<view class="title">
任务列表
</view>
2025-03-26 19:10:41 +08:00
2025-03-27 15:38:21 +08:00
<view class="!grid !grid-cols-3 !px-[20rpx] gap-[20rpx]">
<x-dropdown-list>
<view class="bg-[#fff] !py-[14rpx] !px-[24rpx] rounded-[8rpx]">
全部任务
</view>
<template #menu>
<x-dropdown-item>全部任务</x-dropdown-item>
<x-dropdown-item>宣发任务</x-dropdown-item>
<x-dropdown-item>评论任务</x-dropdown-item>
<x-dropdown-item>点赞任务</x-dropdown-item>
<x-dropdown-item>助力任务</x-dropdown-item>
<x-dropdown-item>其他任务</x-dropdown-item>
</template>
</x-dropdown-list>
<x-dropdown-list>
<view class="bg-[#fff] !py-[14rpx] !px-[24rpx] rounded-[8rpx]">
全部平台
</view>
<template #menu>
<x-dropdown-item>全部平台</x-dropdown-item>
<x-dropdown-item>抖音</x-dropdown-item>
<x-dropdown-item>快手</x-dropdown-item>
<x-dropdown-item>小红书</x-dropdown-item>
<x-dropdown-item>今日头条</x-dropdown-item>
<x-dropdown-item>其他</x-dropdown-item>
</template>
</x-dropdown-list>
<x-dropdown-list>
<view class="bg-[#fff] !py-[14rpx] !px-[24rpx] rounded-[8rpx]">
默认排序
</view>
<template #menu>
<x-dropdown-item>默认排序</x-dropdown-item>
<x-dropdown-item>价格最高</x-dropdown-item>
<x-dropdown-item>极速打款</x-dropdown-item>
<x-dropdown-item>素材安全</x-dropdown-item>
<x-dropdown-item>简单上手</x-dropdown-item>
<x-dropdown-item>最新发布</x-dropdown-item>
</template>
</x-dropdown-list>
2025-03-26 19:10:41 +08:00
</view>
2025-03-27 15:38:21 +08:00
<view class="!flex flex-col gap-[20rpx] !mt-[20rpx] !px-[20rpx]">
<task-item v-for="i in vo.rows"></task-item>
<tui-loadmore v-if="loading" text="加载中..."></tui-loadmore>
</view>
</scroll-view>
2025-03-26 19:10:41 +08:00
</template>
2025-03-25 16:35:39 +08:00
2025-03-26 19:10:41 +08:00
<style lang="scss" scoped>
2025-03-27 15:38:21 +08:00
.bg-b-r {
border-bottom-right-radius: 20rpx;
border-bottom-left-radius: 20rpx;
}
.bg-w {
overflow: hidden;
background: linear-gradient(180.00deg, rgb(0, 0, 0, 0), rgb(255, 255, 255) 90%);
}
2025-03-26 19:10:41 +08:00
.nav-desc {
font-size: 20rpx;
}
2025-03-27 15:38:21 +08:00
.title {
color: rgb(29, 33, 41);
font-size: 16px;
font-weight: 700;
line-height: 140%;
letter-spacing: 0;
text-align: left;
margin: 28rpx 0;
padding: 0 20rpx;
}
2025-03-25 16:35:39 +08:00
</style>