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

210 lines
5.9 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 TaskItem from "../../components/TaskItem.vue";
import useTableQuery from "../../hooks/useTableQuery.js";
import Api from "../../api/index.js";
2025-05-12 19:45:27 +08:00
import {reactive, ref, onMounted} from "vue";
2025-03-27 15:38:21 +08:00
import {toPage} from "../../utils/uils.js";
import AddCustomerServiceModal from "../../components/AddCustomerServiceModal.vue";
2025-05-12 19:45:27 +08:00
import OpenTypeFun from "../../components/OpenTypeFun.js";
2025-06-13 14:27:16 +08:00
import XNoticeBar from "../../components/XNoticeBar.vue";
2025-06-20 21:21:58 +08:00
import {onShow} from "@dcloudio/uni-app";
2025-03-25 16:35:39 +08:00
2025-03-27 15:38:21 +08:00
const showAddCustomer = ref(false);
2025-07-07 15:23:10 +08:00
const textContent = reactive([]);
2025-05-12 19:45:27 +08:00
const advList = reactive([]);
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
2025-05-12 19:45:27 +08:00
const taskType = reactive([]);
const platformType = reactive([]);
const sortType = reactive([
{id: 0, name: '默认排序'},
{id: 1, name: '价格最高'},
{id: 2, name: '极速打款'},
{id: 3, name: '素材安全'},
{id: 4, name: '简单上手'},
{id: 5, name: '最新发布'},
]);
Api.system.getTaskType().then(({data}) => {
taskType.length = 0;
taskType.push(...data);
});
Api.system.getPlatform().then(({data}) => {
platformType.length = 0;
platformType.push(...data);
});
2025-03-27 15:38:21 +08:00
const po = reactive({
2025-05-12 19:45:27 +08:00
type: 0,
pid: 0,
order: 0,
2025-03-27 15:38:21 +08:00
});
const vo = reactive({
page: '',
rows: [],
total: 0,
});
const {loading, pagination, initFetchData} = useTableQuery({
2025-05-12 19:45:27 +08:00
api: Api.system.getTask,
2025-07-14 16:58:46 +08:00
uuid: true,
2025-06-20 21:21:58 +08:00
immediate: false,
2025-03-27 15:38:21 +08:00
parameter: po,
callback: (data) => {
2025-05-12 19:45:27 +08:00
Object.assign(vo, data);
2025-03-27 15:38:21 +08:00
}
});
2025-05-12 19:45:27 +08:00
2025-06-20 21:21:58 +08:00
onShow(() => {
initFetchData();
});
2025-05-12 19:45:27 +08:00
onMounted(() => {
Api.system.getAdvList({
position: 1,
}).then(({data}) => {
advList.length = 0;
advList.push(...data);
});
2025-06-13 21:01:33 +08:00
Api.system.getBarrageList().then(({data}) => {
2025-07-07 15:23:10 +08:00
textContent.length = 0;
textContent.push(...data);
2025-06-13 21:01:33 +08:00
});
2025-05-12 19:45:27 +08:00
})
2025-03-25 16:35:39 +08:00
</script>
<template>
<!--首页-->
2025-03-26 19:10:41 +08:00
<XNav :show-back="false"></XNav>
2025-07-07 15:23:10 +08:00
<x-notice-bar :text="textContent" v-if="textContent.length"></x-notice-bar>
2025-03-26 19:10:41 +08:00
2025-03-27 15:38:21 +08:00
<add-customer-service-modal v-model:show="showAddCustomer"></add-customer-service-modal>
<scroll-view
@refresherpulling="initFetchData()"
2025-05-13 10:45:51 +08:00
@scrolltolower="() => {
2025-05-27 19:01:45 +08:00
pagination.page++;
2025-05-13 10:45:51 +08:00
}"
2025-03-27 15:38:21 +08:00
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]">
2025-05-12 19:45:27 +08:00
<swiper-item class="!w-full !h-full" v-for="i in advList">
<image @click="OpenTypeFun(i)" class="!w-full !h-full" mode="aspectFill" :src="i.file"></image>
2025-03-27 15:38:21 +08:00
</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]">
2025-05-12 19:45:27 +08:00
<x-dropdown-list
@change="initFetchData"
v-model:model-value="po.type"
:option="taskType">
2025-03-27 15:38:21 +08:00
</x-dropdown-list>
2025-05-12 19:45:27 +08:00
<x-dropdown-list
@change="initFetchData"
v-model:model-value="po.pid"
:option="platformType">
2025-03-27 15:38:21 +08:00
</x-dropdown-list>
2025-05-12 19:45:27 +08:00
<x-dropdown-list
@change="initFetchData"
v-model:model-value="po.order"
:option="sortType">
2025-03-27 15:38:21 +08:00
</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]">
2025-05-12 19:45:27 +08:00
<task-item v-for="i in vo.rows" :key="i.id" :data="i"></task-item>
2025-03-27 15:38:21 +08:00
2025-05-13 10:45:51 +08:00
<tui-loadmore v-if="loading" text="加载中..." :index="2"></tui-loadmore>
2025-03-27 15:38:21 +08:00
</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>