Files
medicine_app/pages/trainingCourse/index.vue
liuyuan c470a4b125 提交
2025-04-16 16:09:55 +08:00

192 lines
4.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="page" style=" height:100vh; background: #f6f6f8;">
<z-nav-bar title="培训班管理">
<view slot="right">
<picker mode="date" fields="year" @change="handleYearChange">
<view class="picker">
<uni-icons type="info" size="16"></uni-icons>{{ year || '请选择年份' }}
</view>
</picker>
</view>
</z-nav-bar>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<view class="list_block" v-if="!nullStatus">
<view class="list_item" v-for="(item,index) in list" :key="index">
<view class="list_item_right">
<text class="list_item_title">{{item.title}}</text>
<text class="list_item_text">活动类型<span v-if="item.type==1">线上</span><span v-else>线下</span></text>
<text class="list_item_text">活动年份{{item.year}}</text>
<text class="list_item_text">培训日期{{item.trainingDate}}{{item.endDate}}</text>
<text class="list_item_text">培训价格<span style="color: red;">{{item.finalFee}}</span></text>
<view style=" display: flex; align-items: center;">
<uni-button class="list_item_btn" @click="goToDetail(item)">了解详情</uni-button>
<uni-button class="list_item_btn list_item_btn_bm" @click="goToBuy(item)" v-if="item.isJoin!=1&&item.singupFlag!=0">立即报名</uni-button>
</view>
</view>
<view class="statusBg" v-if="item.isJoin==1">已报名</view>
<view class="statusBg statusBg2" :class="item.isJoin==1?'statusBg_top':''" v-if="item.singupFlag==0">已关闭</view>
</view>
</view>
<view class="zanwu" v-if="nullStatus">暂无数据</view>
<z-navigation></z-navigation>
</view>
</template>
<script>
import $http from '@/config/requestConfig.js';
export default {
data() {
return {
list: [],
nullStatus: false,
year: '',
}
},
onLoad(e) {
},
onShow() {
this.getData();
},
methods: {
//获取数据
getData(){
uni.showLoading({
title: '加载中'
})
$http.request({
url: "common/trainingClass/trainingClassList",
method: "POST",
data: {
year: this.year
},
header: {
'Content-Type': 'application/json'
},
})
.then(res => {
uni.hideLoading();
if (res.code == 0) {
if(res.trainingClassList&&res.trainingClassList.length>0){
this.list = res.trainingClassList;
}else{
this.list = [];
this.nullStatus = true;
}
}
}).catch(e => {
});
},
//选择年份
handleYearChange(event){
this.year = event.detail.value;
this.list = [];
this.nullStatus = false;
this.getData();
},
//了解详情
goToDetail(item){
uni.navigateTo({
url: `/pages/trainingCourse/detail?image=${item.icon}`,
});
},
//立即报名
goToBuy(item){
var data = {
id: item.id,
title: item.title,
price: item.finalFee,
identity: item.identity
}
uni.navigateTo({
url: '/pages/order/index?data='+JSON.stringify(data),
});
},
},
}
</script>
<style>
.zanwu{
font-style: 26rpx;
line-height: 30rpx;
padding-top: 100rpx;
text-align: center;
color: #999;
}
.list_block{
padding: 20rpx;
}
.list_item{
margin-bottom: 20rpx;
background-color: #fff;
border-radius: 15rpx;
padding: 20rpx;
box-shadow: 0px 0px 6px 0px #a7bbe4;
position: relative;
}
.list_item_right{
margin-left: 20rpx;
}
.list_item_right text{
display: block;
}
.list_item_title{
font-size: 32rpx;
font-weight: bold;
color: #333;
line-height: 40rpx;
padding-bottom: 10rpx;
}
.list_item_text{
font-size: 26rpx;
color: #666;
line-height: 40rpx;
}
.list_item_btn{
margin-top: 10rpx;
width: 150rpx;
height: 50rpx;
text-align: center;
line-height: 50rpx;
border-radius: 15rpx;
background-image: linear-gradient(90deg, #258feb 0%, #00e1ec 100%);
font-size: 24rpx;
color: #fff;
}
.list_item_btn_bm{
margin-left: 10rpx;
background-image: linear-gradient(90deg, #ff1f00 0%, #fa9f93 100%);
}
.statusBg{
position: absolute;
right: 0;
top: 20rpx;
width: 100rpx;
height: 44rpx;
line-height: 44rpx;
background: #ff1f00;
opacity: 0.8;
border-radius: 50rpx 0 0 50rpx;
font-size: 22rpx;
color: #fff;
padding-left: 20rpx;
}
.statusBg2{
background: #999;
}
.statusBg_top{
top: 70rpx;
}
.picker{
display: flex;
align-items: center;
font-size: 26rpx;
padding-right: 20rpx;
}
</style>