Browse Source

新增加载下一页

master
liutong 1 year ago
parent
commit
e790d04f6d
  1. 299
      pages/student/timetable/index.vue

299
pages/student/timetable/index.vue

@ -9,47 +9,19 @@
<view class="main_section"> <view class="main_section">
<view class="section_1"> <view class="section_1">
<view class="ul"> <view class="ul">
<view class="li"> <view class="li" v-for="(v,k) in dateList" :key="k" @click="selectDate(v.date)">
<text>周日</text> <text>{{v.name}}</text>
<text>14</text>
<text></text> <text :class="[filteredData.schedule_date == v.date ? 'today':'']">{{today == v.date ? '今':v.today}}</text>
</view>
<view class="li"> <text :class="[today == v.date ?'select_plan':'']"></text>
<text>周一</text>
<text>14</text>
<text></text>
</view>
<view class="li">
<text>周二</text>
<text>14</text>
<text></text>
</view>
<view class="li">
<text>周日</text>
<text class="today"></text>
<text class=""></text>
</view>
<view class="li">
<text>周一</text>
<text>14</text>
<text class="select_plan"></text>
</view>
<view class="li">
<text>周二</text>
<text>14</text>
<text></text>
</view>
<view class="li">
<text>周二</text>
<text>14</text>
<text></text>
</view> </view>
</view> </view>
</view> </view>
<view class="section_2"> <view class="section_2">
<view class="item_box"> <view class="item_box">
XXX体育场馆 {{venuesInfo.name}}
</view> </view>
<view class="item_box" style="text-align: right;color: #F59A23;" @click="more"> <view class="item_box" style="text-align: right;color: #F59A23;" @click="more">
更多 更多
@ -57,49 +29,15 @@
</view> </view>
<view class="section_3"> <scroll-view
class="section_3"
scroll-y="true"
:lower-threshold="lowerThreshold"
@scrolltolower="loadMoreData"
style="height: 100vh;"
>
<view class="ul"> <view class="ul">
<view class="li" @click="openViewCourseInfo({id:1})"> <view v-for="(v,k) in tableList" :key="k" class="li" @click="openViewCourseInfo({id:v.id})">
<view class="top_box">
<view class="center_box">
<view>班级少年班</view>
<view>时间2020-05-25 15:30 - 17:30</view>
<view>课室302
</view>
<view>课程篮球少儿课
</view>
</view>
<view class="right_box">
<view class="tag" style="background:#fad24e;">上课中</view>
<!-- <view class="tag" style="background:#1cd188;">待上课</view>-->
</view>
</view>
<view class="bottom_box">
<view class="hint">
已签到学生 (15/34)
</view>
<view class="list_box">
<view class="list">
<view class="itme">
<image src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
</view>
<view class="itme">
<image src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
</view>
<view class="itme">
<image src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
</view>
<view class="itme">
<image src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
</view>
</view>
<view class="btn">
详情
</view>
</view>
</view>
</view>
<view class="li" @click="openViewCourseInfo({id:2})">
<view class="top_box"> <view class="top_box">
<view class="center_box"> <view class="center_box">
<view>班级少年班</view> <view>班级少年班</view>
@ -140,7 +78,10 @@
</view> </view>
</view> </view>
</view> </view>
</view> </scroll-view>
<!-- 加载状态-->
<!-- <fui-loading :isFixed="true" srcCol="/static/icon-img/loading_white.png" text="正在加载..." v-if="loading"></fui-loading>-->
</view> </view>
<!-- 底部导航--> <!-- 底部导航-->
@ -149,7 +90,7 @@
</template> </template>
<script> <script>
// import user from '@/api/user.js'; import memberApi from '@/api/member.js';
import AQTabber from "@/components/AQ/AQTabber.vue" import AQTabber from "@/components/AQ/AQTabber.vue"
@ -159,75 +100,161 @@ export default {
}, },
data() { data() {
return { return {
formData:{}, loading:false,//
lowerThreshold: 100,//
// isReachedBottom: false,//|true=|false=
show_course:false,//
// //
course_name:'课程',// filteredData:{
options_course: [ page:1,//
{ limit:10,//
text: '请选择课程', total:10,//
value: '', schedule_date:'',//
checked: true venue_id:'',//id
}, { },
text: '羽毛球课程1', tableList:[],//
value: '1'
}, { venuesInfo:{},//
text: '篮球课程2',
value: '2' //
} today: '',
], dateList:[]//
//
show_classroom:false,//
//
classroom_name:'课室',//
options_classroom: [
{
text: '请选择课室',
value: '',
checked: true
}, {
text: '羽毛球201',
value: '1'
}, {
text: '篮球室101',
value: '2'
}
],
} }
}, },
onLoad() { onLoad() {
}, },
onShow() {
this.init()//
},
//
async onPullDownRefresh() {
//
let schedule_date = this.filteredData.schedule_date
console.log('eee',schedule_date)
await this.loadData()
this.filteredData.schedule_date = schedule_date
await this.getList()
},
methods: { methods: {
// //
clickCourse(e){ async init(){
console.log(e) await this.getDate()
this.course_name = e.text await this.getList()
this.show_course = true await this.getDateList(); //
console.log(1111,this.dateList)
}, },
//
filterTapCourse() { //
// async getDate() {
this.$refs.ref_course.show() let date = new Date();
this.show_course = true; let year = date.getFullYear();
let month = String(date.getMonth() + 1).padStart(2, '0'); //
let day = String(date.getDate()).padStart(2, '0'); //
let hour = date.getHours();
let minute = date.getMinutes();
let second = date.getSeconds();
let res = `${year}-${month}-${day}`; //
this.today = res;
this.filteredData.schedule_date = res;
}, },
//
async getDateList() {
const days = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
const dateList = [];
const today = new Date(); //
// 24
for (let i = -2; i <= 4; i++) {
const date = new Date(today);
date.setDate(today.getDate() + i); //
let dayOfWeek = days[date.getDay()]; //
let formattedDateArr = this.formatDate(date); //
let formattedDate = `${formattedDateArr[0]}-${formattedDateArr[1]}-${formattedDateArr[2]}`; //
dateList.push({
name: dayOfWeek,
date: formattedDate,
today: formattedDateArr[2],//
});
}
this.dateList = dateList
},
// YYYY-MM-DD
formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return [
year, month, day
]
},
// //()
clickClassroom(e){ loadMoreData() {
console.log(e) //
this.classroom_name = e.text if (!this.isReachedBottom) {
this.show_classroom = true this.isReachedBottom = true;//
this.getList();
}
}, },
// //
filterTapClassroom() { async loadData() {
// this.isReachedBottom = false; // 便
this.$refs.ref_classroom.show() this.filteredData = {
this.show_classroom = true; page:1,//
limit:10,//
total:10,//
schedule_date:'',//
venue_id:'',//id
}
}, },
//
async getList(){
this.loading = true
let data = {...this.filteredData}
//
if(this.filteredData.page * this.filteredData.limit > this.filteredData.total || this.filteredData.limit > this.filteredData.total ){
this.loading = false
uni.showToast({
title: '暂无更多',
icon: 'none'
})
return
}
let res = await memberApi.courseList(data)
this.loading = false
this.isReachedBottom = false;
if (res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.tableList = res.data.list.data
//
this.venuesInfo = res.data.venues_info
this.total = res.data.list.total
this.page++
},
//
async selectDate(date){
this.loadData()
this.filteredData.schedule_date = date
this.getList()
},
// //
openViewCourseInfo(item){ openViewCourseInfo(item){

Loading…
Cancel
Save