第一版
This commit is contained in:
@@ -97,7 +97,7 @@
|
||||
<!-- 项目列表 -->
|
||||
<view class="project-list">
|
||||
<text class="list-title" v-if="projects.length > 0">项目列表</text>
|
||||
<view v-if="projects.length > 0" class="list-container">
|
||||
<scroll-view v-if="projects.length > 0" scroll-y="true" @scrolltolower='getList()' class="list-container">
|
||||
<view v-for="project in projects" :key="project.planId" class="project-item"
|
||||
@click="handleProjectClick(project)">
|
||||
<view class="item-icon">
|
||||
@@ -110,7 +110,7 @@
|
||||
<text v-if="currentIndex!==3" class="item-count">{{ project.users.length }}人</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view v-else class="empty-project">
|
||||
<text class="empty-text">暂无项目</text>
|
||||
</view>
|
||||
@@ -125,18 +125,18 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import { Service } from '@/Service/Service'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { loginService } from '@/Service/swimming/loginService'
|
||||
import { PlanService } from '@/Service/swimming/PlanService'
|
||||
|
||||
|
||||
|
||||
let currentIndex = ref(0)
|
||||
|
||||
|
||||
// 分页相关
|
||||
let page = ref(1)
|
||||
let status = ref('loadmore')
|
||||
|
||||
|
||||
// 模拟项目数据
|
||||
const projects = ref<Array<any>>([])
|
||||
|
||||
@@ -148,7 +148,11 @@
|
||||
login()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
onShow(()=>{
|
||||
uni.showTabBar()
|
||||
})
|
||||
|
||||
const login = () => {
|
||||
uni.getProvider({
|
||||
service: 'oauth',
|
||||
@@ -174,7 +178,7 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 获取项目列表数据
|
||||
const getData = () => {
|
||||
projects.value = []
|
||||
@@ -182,14 +186,15 @@
|
||||
status.value = 'loadmore'
|
||||
getList()
|
||||
}
|
||||
|
||||
|
||||
// 获取项目列表
|
||||
const getList = () => {
|
||||
|
||||
if (status.value == 'loading' || status.value == 'nomore') {
|
||||
return
|
||||
}
|
||||
status.value = 'loading'
|
||||
PlanService.GetPlanList(currentIndex.value==1?'计时项目':(currentIndex.value==2?'分段项目':'混氧项目'), page.value.toString()).then(res => {
|
||||
PlanService.GetPlanList(currentIndex.value == 1 ? '计时项目' : (currentIndex.value == 2 ? '分段项目' : '混氧项目'), page.value.toString()).then(res => {
|
||||
if (res.code == 0) {
|
||||
projects.value = [...projects.value, ...res.data]
|
||||
status.value = res.data.length == 10 ? 'loadmore' : 'nomore'
|
||||
@@ -199,7 +204,7 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 显示计时项目列表弹窗
|
||||
const showTimingProjectModal = (index : any) => {
|
||||
@@ -228,19 +233,19 @@
|
||||
}
|
||||
|
||||
// 处理项目点击事件
|
||||
const handleProjectClick = (project:any) => {
|
||||
const handleProjectClick = (project : any) => {
|
||||
if (currentIndex.value === 1) {
|
||||
showTimingModal.value = false
|
||||
Service.GoPage('/pages/userFunc/swiming?id='+project.planId)
|
||||
|
||||
Service.GoPage('/pages/userFunc/swiming?id=' + project.planId)
|
||||
|
||||
}
|
||||
else if (currentIndex.value === 2) {
|
||||
showTimingModal.value = false
|
||||
Service.GoPage('/pages/userFunc/segmentation?id='+project.planId)
|
||||
Service.GoPage('/pages/userFunc/segmentation?id=' + project.planId)
|
||||
}
|
||||
else {
|
||||
showTimingModal.value = false
|
||||
Service.GoPage('/pages/userFunc/hunyang?id='+project.planId)
|
||||
Service.GoPage('/pages/userFunc/hunyang?id=' + project.planId)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -652,6 +657,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16rpx;
|
||||
max-height: 240rpx;
|
||||
}
|
||||
|
||||
.project-item {
|
||||
@@ -660,7 +666,7 @@
|
||||
gap: 20rpx;
|
||||
padding: 28rpx 24rpx;
|
||||
background: linear-gradient(135deg, #fff 0%, #fafbfc 100%);
|
||||
border-radius: 20rpx;
|
||||
// border-radius: 20rpx;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06), 0 0 0 1rpx rgba(0, 0, 0, 0.04) inset;
|
||||
position: relative;
|
||||
|
||||
Reference in New Issue
Block a user