|
@@ -54,238 +54,255 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import {
|
|
|
- ref,
|
|
|
- reactive,
|
|
|
- onMounted
|
|
|
-} from 'vue';
|
|
|
-import {
|
|
|
- onLoad,
|
|
|
- onShow,
|
|
|
- onReachBottom
|
|
|
-} from "@dcloudio/uni-app";
|
|
|
-import RankingList from '@/pages/common/rankingList/index.vue';
|
|
|
-import ServIces from "@/components/Services/services.vue"
|
|
|
-import {
|
|
|
- Client
|
|
|
-} from "@/components/Client/new_file.vue"
|
|
|
-import {
|
|
|
- volunteerinfolist,
|
|
|
-} from "@/api/volunteerDetailsApi/details.js"
|
|
|
-import {
|
|
|
- slideshow
|
|
|
-} from '@/api/home.js'
|
|
|
-
|
|
|
-const total = ref(0)
|
|
|
-const listData = ref([])
|
|
|
-const rightList = ref([])
|
|
|
-const leftList = ref([])
|
|
|
-const userType = uni.getStorageSync('userType') //读取本地存储
|
|
|
-const globalData = ref({
|
|
|
- statusBarHeight: 47,
|
|
|
- navBarHeight: 91
|
|
|
-});
|
|
|
-const data = reactive({
|
|
|
- address: '重庆市',
|
|
|
- queryValue: ''
|
|
|
-})
|
|
|
-const list3 = ref([]);
|
|
|
-const ValueZone = ref([]);
|
|
|
-const hotList = ref([])
|
|
|
-
|
|
|
-// 分页
|
|
|
-const pages = ref({
|
|
|
- current: 1,
|
|
|
- pageSize: 10,
|
|
|
- total: 0
|
|
|
-})
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-const loadmoreInfo = ref({
|
|
|
- status: 'loadmore',
|
|
|
- loadingText: '努力加载中...',
|
|
|
- loadmoreText: '点击加载更多~',
|
|
|
- nomoreText: '已经到底啦~'
|
|
|
-})
|
|
|
-
|
|
|
-// 加载更多
|
|
|
-async function handleLoadmore(e) {
|
|
|
- if (pages.value.current < Math.ceil(pages.value.total / pages.value.pageSize)) {
|
|
|
- pages.value.current += 1;
|
|
|
- loadmoreInfo.value.status = 'loading';
|
|
|
- await getList();
|
|
|
- } else {
|
|
|
- loadmoreInfo.value.status = 'nomore';
|
|
|
+ import {
|
|
|
+ ref,
|
|
|
+ reactive,
|
|
|
+ onMounted
|
|
|
+ } from 'vue';
|
|
|
+ import {
|
|
|
+ provide
|
|
|
+ } from 'vue';
|
|
|
+ import {
|
|
|
+ onLoad,
|
|
|
+ onShow,
|
|
|
+ onReachBottom
|
|
|
+ } from "@dcloudio/uni-app";
|
|
|
+ import RankingList from '@/pages/common/rankingList/index.vue';
|
|
|
+ import ServIces from "@/components/Services/services.vue"
|
|
|
+ import {
|
|
|
+ Client
|
|
|
+ } from "@/components/Client/new_file.vue"
|
|
|
+ import {
|
|
|
+ volunteerinfolist,
|
|
|
+ } from "@/api/volunteerDetailsApi/details.js"
|
|
|
+ import {
|
|
|
+ slideshow
|
|
|
+ } from '@/api/home.js'
|
|
|
+ import {
|
|
|
+ useDict
|
|
|
+ } from '@/utils/dict.js';
|
|
|
+
|
|
|
+
|
|
|
+ const total = ref(0)
|
|
|
+ const listData = ref([])
|
|
|
+ const rightList = ref([])
|
|
|
+ const leftList = ref([])
|
|
|
+ const list3 = ref([]);
|
|
|
+ const ValueZone = ref([]);
|
|
|
+ const hotList = ref([])
|
|
|
+ const userType = uni.getStorageSync('userType') //读取本地存储
|
|
|
+
|
|
|
+ const {
|
|
|
+ lrr_service_category
|
|
|
+ } = useDict('lrr_service_category');
|
|
|
+
|
|
|
+ const globalData = ref({
|
|
|
+ statusBarHeight: 47,
|
|
|
+ navBarHeight: 91
|
|
|
+ });
|
|
|
+ const data = reactive({
|
|
|
+ address: '重庆市',
|
|
|
+ queryValue: ''
|
|
|
+ })
|
|
|
+
|
|
|
+ // 分页
|
|
|
+ const pages = ref({
|
|
|
+ current: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ total: 0,
|
|
|
+ serviceCategory: '',
|
|
|
+ appStatus:"2",
|
|
|
+ })
|
|
|
+
|
|
|
+ const loadmoreInfo = ref({
|
|
|
+ status: 'loadmore',
|
|
|
+ loadingText: '努力加载中...',
|
|
|
+ loadmoreText: '点击加载更多~',
|
|
|
+ nomoreText: '已经到底啦~'
|
|
|
+ })
|
|
|
+
|
|
|
+ // 加载更多
|
|
|
+ async function handleLoadmore(e) {
|
|
|
+ if (pages.value.current < Math.ceil(pages.value.total / pages.value.pageSize)) {
|
|
|
+ pages.value.current += 1;
|
|
|
+ loadmoreInfo.value.status = 'loading';
|
|
|
+ await getList();
|
|
|
+ } else {
|
|
|
+ loadmoreInfo.value.status = 'nomore';
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
-const getList = async () => {
|
|
|
- try {
|
|
|
- loadmoreInfo.value.status = 'loading';
|
|
|
|
|
|
- // 请求时传递分页参数
|
|
|
- const res = await volunteerinfolist({
|
|
|
- pageNum: pages.value.current, // 当前页码
|
|
|
- pageSize: pages.value.pageSize // 每页大小
|
|
|
- });
|
|
|
+ const getList = async () => {
|
|
|
+ try {
|
|
|
+ loadmoreInfo.value.status = 'loading';
|
|
|
+
|
|
|
+ const params = {
|
|
|
+ pageNum: pages.value.current,
|
|
|
+ pageSize: pages.value.pageSize,
|
|
|
+ serviceCategory: pages.value.serviceCategory || '',
|
|
|
+ appStatus:pages.value.appStatus,
|
|
|
+ };
|
|
|
+ console.log('请求参数:', params); // 调试输出
|
|
|
+
|
|
|
+ const res = await volunteerinfolist(params);
|
|
|
+
|
|
|
+ if (!res || !res.rows) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断是否已经到了最后一页
|
|
|
+ if (pages.value.current >= Math.ceil(res.total / pages.value.pageSize)) {
|
|
|
+ loadmoreInfo.value.status = 'nomore';
|
|
|
+ } else {
|
|
|
+ loadmoreInfo.value.status = 'loadmore';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 将数据分成左右两列
|
|
|
+ res.rows.forEach((item, index) => {
|
|
|
+ index % 2 !== 0 ? leftList.value.push(item) : rightList.value.push(item);
|
|
|
+ });
|
|
|
+
|
|
|
+ pages.value.total = res.total;
|
|
|
+ } catch (error) {
|
|
|
+ leftList.value = [];
|
|
|
+ rightList.value = [];
|
|
|
+ loadmoreInfo.value.status = 'loadmore';
|
|
|
+ pages.value.total = 0;
|
|
|
+ console.error('Error fetching data:', error);
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
- console.log(res, '>>>>>>>res');
|
|
|
|
|
|
- if (!res || !res.rows) {
|
|
|
- return;
|
|
|
+ onReachBottom(() => {
|
|
|
+ if (pages.value.current < Math.ceil(pages.value.total / pages.value.pageSize)) {
|
|
|
+ pages.value.current = pages.value.current + 1
|
|
|
+ loadmoreInfo.value.status = 'nomore'
|
|
|
+ getList()
|
|
|
}
|
|
|
+ })
|
|
|
|
|
|
- // 判断是否已经到了最后一页
|
|
|
- if (pages.value.current >= Math.ceil(res.total / pages.value.pageSize)) {
|
|
|
- loadmoreInfo.value.status = 'nomore';
|
|
|
- } else {
|
|
|
- loadmoreInfo.value.status = 'loadmore';
|
|
|
- }
|
|
|
|
|
|
- // 将数据分成左右两列
|
|
|
- res.rows.forEach((item, index) => {
|
|
|
- index % 2 !== 0 ? leftList.value.push(item) : rightList.value.push(item);
|
|
|
- });
|
|
|
|
|
|
- pages.value.total = res.total;
|
|
|
- } catch (error) {
|
|
|
- leftList.value = [];
|
|
|
- rightList.value = [];
|
|
|
- loadmoreInfo.value.status = 'loadmore';
|
|
|
- pages.value.total = 0;
|
|
|
- console.error('Error fetching data:', error);
|
|
|
- }
|
|
|
-};
|
|
|
+ const getBanners = async () => {
|
|
|
+ try {
|
|
|
+ const res = await slideshow(7);
|
|
|
+ if (res.code === 200 && res.data.picture) {
|
|
|
+ list3.value = res.data.picture.split(',');
|
|
|
+ }
|
|
|
|
|
|
+ const value_res = await slideshow(8);
|
|
|
+ if (value_res.code === 200 && value_res.data.picture) {
|
|
|
+ ValueZone.value = value_res.data.picture.split(',');
|
|
|
+ }
|
|
|
|
|
|
-onReachBottom(() => {
|
|
|
- if (pages.value.current < Math.ceil(pages.value.total / pages.value.pageSize)) {
|
|
|
- pages.value.current = pages.value.current + 1
|
|
|
- loadmoreInfo.value.status = 'nomore'
|
|
|
- getList()
|
|
|
- }
|
|
|
-})
|
|
|
+ const hot_res = await slideshow(11);
|
|
|
+ if (hot_res.code === 200 && hot_res.data.picture) {
|
|
|
+ hotList.value = hot_res.data.picture.split(',');
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log('error', error);
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ onShow(() => {
|
|
|
+ getList()
|
|
|
+ getBanners();
|
|
|
+ // getListData()
|
|
|
+ // 在 App.vue 中初始化
|
|
|
+ uni.getSystemInfo({
|
|
|
+ success: (res) => {
|
|
|
+ const statusBarHeight = res.statusBarHeight;
|
|
|
+ const navBarHeight = res.platform === 'android' ? 48 : 44 + res.statusBarHeight;
|
|
|
+ globalData.value = {
|
|
|
+ statusBarHeight,
|
|
|
+ navBarHeight
|
|
|
+ };
|
|
|
+ console.log('statusBarHeight', statusBarHeight, navBarHeight);
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+</script>
|
|
|
|
|
|
-const getBanners = async () => {
|
|
|
- try {
|
|
|
- const res = await slideshow(7);
|
|
|
- if (res.code === 200 && res.data.picture) {
|
|
|
- list3.value = res.data.picture.split(',');
|
|
|
+<style scoped lang="scss">
|
|
|
+ .main-content {
|
|
|
+ background: rgba(255, 255, 255, 1);
|
|
|
+
|
|
|
+ .home-banner {
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-end;
|
|
|
+ justify-content: space-between;
|
|
|
+ // background: rgba(255, 255, 255, 1);
|
|
|
+ // background-color: #ED806A;
|
|
|
+ background-color: rgba(221, 60, 62, 1);
|
|
|
+ box-shadow: 0rpx 0rpx 0rpx rgba(0, 0, 0, 0), 0rpx 0rpx 0rpx rgba(0, 0, 0, 0), 0rpx 2.08rpx 4.17rpx rgba(0, 0, 0, 0.05);
|
|
|
+ padding: 20rpx 16rpx;
|
|
|
+ color: #fff;
|
|
|
+ position: fixed;
|
|
|
+ top: 0px;
|
|
|
+ left: 0px;
|
|
|
+ right: 0;
|
|
|
+ z-index: 99;
|
|
|
}
|
|
|
|
|
|
- const value_res = await slideshow(8);
|
|
|
- if (value_res.code === 200 && value_res.data.picture) {
|
|
|
- ValueZone.value = value_res.data.picture.split(',');
|
|
|
+ .home-banner-left {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ width: 30%;
|
|
|
}
|
|
|
|
|
|
- const hot_res = await slideshow(11);
|
|
|
- if (hot_res.code === 200 && hot_res.data.picture) {
|
|
|
- hotList.value = hot_res.data.picture.split(',');
|
|
|
+ .home-banner-center {
|
|
|
+ flex: 1;
|
|
|
+ font-size: 38rpx;
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
- console.log('error', error);
|
|
|
|
|
|
- }
|
|
|
-}
|
|
|
+ .home-banner-rigth {
|
|
|
+ width: 30%;
|
|
|
+ }
|
|
|
|
|
|
-onShow(() => {
|
|
|
- getList()
|
|
|
- getBanners();
|
|
|
+ .home-main {
|
|
|
+ padding: 12px 16px 0;
|
|
|
|
|
|
- // 在 App.vue 中初始化
|
|
|
- uni.getSystemInfo({
|
|
|
- success: (res) => {
|
|
|
- const statusBarHeight = res.statusBarHeight;
|
|
|
- const navBarHeight = res.platform === 'android' ? 48 : 44 + res.statusBarHeight;
|
|
|
- globalData.value = { statusBarHeight, navBarHeight };
|
|
|
- console.log('statusBarHeight', statusBarHeight, navBarHeight);
|
|
|
|
|
|
}
|
|
|
- });
|
|
|
-})
|
|
|
-</script>
|
|
|
|
|
|
-<style scoped lang="scss">
|
|
|
-.main-content {
|
|
|
- background: rgba(255, 255, 255, 1);
|
|
|
-
|
|
|
- .home-banner {
|
|
|
- display: flex;
|
|
|
- align-items: flex-end;
|
|
|
- justify-content: space-between;
|
|
|
- // background: rgba(255, 255, 255, 1);
|
|
|
- // background-color: #ED806A;
|
|
|
- background-color: rgba(221, 60, 62, 1);
|
|
|
- box-shadow: 0rpx 0rpx 0rpx rgba(0, 0, 0, 0), 0rpx 0rpx 0rpx rgba(0, 0, 0, 0), 0rpx 2.08rpx 4.17rpx rgba(0, 0, 0, 0.05);
|
|
|
- padding: 20rpx 16rpx;
|
|
|
- color: #fff;
|
|
|
- position: fixed;
|
|
|
- top: 0px;
|
|
|
- left: 0px;
|
|
|
- right: 0;
|
|
|
- z-index: 99;
|
|
|
- }
|
|
|
-
|
|
|
- .home-banner-left {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- width: 30%;
|
|
|
+ .home-ranking {
|
|
|
+ padding: 24rpx 16px;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- .home-banner-center {
|
|
|
- flex: 1;
|
|
|
- font-size: 38rpx;
|
|
|
+ .hot-box-title {
|
|
|
+ padding: 0 32rpx;
|
|
|
}
|
|
|
|
|
|
- .home-banner-rigth {
|
|
|
- width: 30%;
|
|
|
+ .hot-swiper {
|
|
|
+ padding: 24rpx 32rpx 0;
|
|
|
}
|
|
|
|
|
|
- .home-main {
|
|
|
- padding: 12px 16px 0;
|
|
|
+ .hot-box {
|
|
|
+ padding: 24rpx 32rpx;
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: repeat(2, 1fr);
|
|
|
+ gap: 8rpx;
|
|
|
|
|
|
|
|
|
+ .hot-item {
|
|
|
+ // padding: 32rpx 16rpx;
|
|
|
+ // border-radius: 10rpx;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- .home-ranking {
|
|
|
- padding: 24rpx 16px;
|
|
|
+ .home-grid2 {
|
|
|
+ margin-bottom: 32rpx;
|
|
|
+ background: #fff;
|
|
|
+ padding: 12px 0;
|
|
|
+ border-radius: 8px;
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-.hot-box-title {
|
|
|
- padding: 0 32rpx;
|
|
|
-}
|
|
|
-
|
|
|
-.hot-swiper {
|
|
|
- padding: 24rpx 32rpx 0;
|
|
|
-}
|
|
|
-
|
|
|
-.hot-box {
|
|
|
- padding: 24rpx 32rpx;
|
|
|
- display: grid;
|
|
|
- grid-template-columns: repeat(2, 1fr);
|
|
|
- gap: 8rpx;
|
|
|
-
|
|
|
|
|
|
- .hot-item {
|
|
|
- // padding: 32rpx 16rpx;
|
|
|
- // border-radius: 10rpx;
|
|
|
+ .home-g-bgc {
|
|
|
+ background: #f7f7f7;
|
|
|
+ padding: 24rpx;
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-.home-grid2 {
|
|
|
- margin-bottom: 32rpx;
|
|
|
- background: #fff;
|
|
|
- padding: 12px 0;
|
|
|
- border-radius: 8px;
|
|
|
-}
|
|
|
-
|
|
|
-.home-g-bgc {
|
|
|
- background: #f7f7f7;
|
|
|
- padding: 24rpx;
|
|
|
-}
|
|
|
</style>
|