|
@@ -1,41 +1,42 @@
|
|
|
<template>
|
|
|
- <view v-if="userType == '1'">
|
|
|
- <up-waterfall v-model="flowList">
|
|
|
- <template #left :listData="listData">
|
|
|
- <view class="demo-warter" v-for="(item, index) in listData" :key="index" @click="goToDetail(item)">
|
|
|
+ <view>
|
|
|
+ <up-waterfall>
|
|
|
+ <template #left>
|
|
|
+ <view class="demo-warter" v-for="(item, index) in props.listData" :key="index"
|
|
|
+ @click="goToDetail(item)">
|
|
|
<up-lazy-load threshold="-450" border-radius="10" :image="item.volunteerPicture"
|
|
|
:index="index"></up-lazy-load>
|
|
|
<view class="demo-title">
|
|
|
- {{item.businessTierName}}
|
|
|
+ {{ item.businessTierName }}
|
|
|
</view>
|
|
|
<view class="demo-skillDescribe">
|
|
|
- {{item.skillDescribe}}
|
|
|
+ {{ item.skillDescribe }}
|
|
|
</view>
|
|
|
<view class="demo-PriceDome">
|
|
|
<view class="demo-price">
|
|
|
<image :src="item.volunteerPicture" class="name-image"></image>
|
|
|
- {{item.name}}
|
|
|
+ {{ item.name }}
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
- <template #right :rightList="rightList">
|
|
|
- <view class="demo-warter" v-for="(item, index) in rightList" :key="index" @click="goToDetail(item)">
|
|
|
+
|
|
|
+ <template #right>
|
|
|
+ <view class="demo-warter" v-for="(item, index) in props.rightList" :key="index"
|
|
|
+ @click="goToDetail(item)">
|
|
|
<up-lazy-load threshold="-450" border-radius="10" :image="item.volunteerPicture"
|
|
|
:index="index"></up-lazy-load>
|
|
|
<view class="demo-title">
|
|
|
- {{item.businessTierName}}
|
|
|
+ {{ item.businessTierName }}
|
|
|
</view>
|
|
|
<view class="demo-skillDescribe">
|
|
|
- {{item.skillDescribe}}
|
|
|
+ {{ item.skillDescribe }}
|
|
|
</view>
|
|
|
<view class="demo-PriceDome">
|
|
|
<view class="demo-price">
|
|
|
<image :src="item.volunteerPicture" class="name-image"></image>
|
|
|
- {{item.name}}
|
|
|
+ {{ item.name }}
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -43,74 +44,28 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
-
|
|
|
<script setup>
|
|
|
- import {
|
|
|
- ref,
|
|
|
- onMounted,
|
|
|
- nextTick
|
|
|
- } from 'vue';
|
|
|
- import {
|
|
|
- onShow
|
|
|
- } from '@dcloudio/uni-app'
|
|
|
- import {
|
|
|
- volunteerinfolist,
|
|
|
- getDetailsvolunteerId
|
|
|
- } from "@/api/volunteerDetailsApi/details.js"
|
|
|
-
|
|
|
-
|
|
|
- const flowList = ref([]); //list数据
|
|
|
- const total = ref(0)
|
|
|
- const loadStatus = ref('loadmore');
|
|
|
- const userType = uni.getStorageSync('userType') //读取本地存储
|
|
|
-
|
|
|
- // 用户/志愿者 识别标识
|
|
|
- const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
|
|
|
-
|
|
|
-
|
|
|
- const listData = ref([])
|
|
|
- const rightList = ref([])
|
|
|
-
|
|
|
-
|
|
|
- const getList = async () => {
|
|
|
- try {
|
|
|
- const res = await volunteerinfolist();
|
|
|
- if (!res || !res.rows) {
|
|
|
- console.error('No data returned from API');
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- let leftArr = [];
|
|
|
- let rightArr = [];
|
|
|
-
|
|
|
- (res.rows || []).forEach((item, index) => {
|
|
|
- index % 2 !== 0 ? leftArr.push(item) : rightArr.push(item);
|
|
|
- });
|
|
|
-
|
|
|
- listData.value = leftArr;
|
|
|
- rightList.value = rightArr;
|
|
|
- total.value = res.rows;
|
|
|
- } catch (error) {
|
|
|
- console.error('Error fetching data:', error);
|
|
|
+ const props = defineProps({
|
|
|
+ listData: {
|
|
|
+ type: Array,
|
|
|
+ default: () => []
|
|
|
+ },
|
|
|
+ rightList: {
|
|
|
+ type: Array,
|
|
|
+ default: () => []
|
|
|
}
|
|
|
- };
|
|
|
-
|
|
|
+ });
|
|
|
+
|
|
|
const goToDetail = async (item) => {
|
|
|
const params = {
|
|
|
volunteerId: item.volunteerId, // 获取 volunteerId
|
|
|
serviceCategory: item.serviceCategory, // 获取 serviceCategory
|
|
|
businessManagementId: item.businessManagementId, //获取 businessManagementId
|
|
|
};
|
|
|
-
|
|
|
- // 使用 JSON.stringify 将对象传递给 URL 参数
|
|
|
uni.navigateTo({
|
|
|
- url: `/pages/goodsDetails/goodsDetails?params=${JSON.stringify(params)}`
|
|
|
+ url: `/pages_home/pages/Volunteerside/goodsDetails?params=${JSON.stringify(params)}`
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
- onShow(() => {
|
|
|
- getList()
|
|
|
- })
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
@@ -144,7 +99,8 @@
|
|
|
text-overflow: ellipsis;
|
|
|
word-break: break-all;
|
|
|
}
|
|
|
- .demo-skillDescribe{
|
|
|
+
|
|
|
+ .demo-skillDescribe {
|
|
|
font-size: 30rpx;
|
|
|
margin-top: 5px;
|
|
|
color: black;
|
|
@@ -156,6 +112,7 @@
|
|
|
text-overflow: ellipsis;
|
|
|
word-break: break-all;
|
|
|
}
|
|
|
+
|
|
|
.demo-img {
|
|
|
width: 40rpx;
|
|
|
height: 40rpx;
|