| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <template>
- <view class="center">
- <scroll-view scroll-y="true" class="list">
- <view v-for="(item,index) in courseList" :key="index" class="listBox" >
- <view class="type">已完成</view>
- <view class="top flex">
- <image src="../../static/img/indexMycourse.png"></image>
- <view class="font">
- <view class="title">奥数能力提升班</view>
- <view class="time">{{item.start_time}}</view>
- </view>
- </view>
- <view class="main">
- <view class="left">
- <view class="font">授课科目: <text style=" display: inline-block;padding-left: 20rpx;">{{item.subject}}</text></view>
- <view class="font">班主任: <text style=" display: inline-block;padding-left: 20rpx;">{{ bzr }}</text></view>
- </view>
- <view class="right">
- <view class="font">授课老师: <text style=" display: inline-block;padding-left: 20rpx;">{{item.teacher}}</text></view>
- <view class="font">电话:<text style=" display: inline-block;padding-left: 20rpx;">{{ phone }}</text></view>
- </view>
- </view>
- <view class="btnBox flex">
- <view class="button" @click="nav(index)">课程评价</view>
- </view>
- </view>
- <uni-load-more :status="loadingType"></uni-load-more>
- </scroll-view>
-
- </view>
- </template>
- <script>
- import { getCourse } from '@/api/course.js';
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import { mapState, mapMutations } from 'vuex';
- import { my } from '@/api/user.js';
- import { saveUrl, interceptor } from '@/utils/loginUtils.js';
- export default {
- computed: {
- ...mapState(['hasLogin', 'userInfo', 'baseURL', 'urlFile'])
- },
- components: {
- uniLoadMore
- },
- data() {
- return {
- page: 1,
- limit: 10,
- loadingType: 'more',
- courseList: [
-
- ],
- bzr: '',
- phone:'',
- }
- },
- onLoad() {
- if (this.hasLogin) {
- console.log(this.userInfo)
- this.loadData();
- this.data();
- }else{
- uni.showModal({
- title: '登录',
- content: '您未登录,是否马上登陆?',
- success: e => {
- console.log(e)
- if (e.confirm) {
- console.log("1111")
- interceptor();
- }
- },
- fail: e => {
- console.log(e);
- }
- });
- return;
- }
- },
- //下拉刷新
- onPullDownRefresh() {
- this.loadData('refresh');
- },
- //监听页面是否滚动到底部加载更多
- onReachBottom() {
- this.loadData();
- },
- methods: {
- async loadData(type = 'add', loading) {
- let obj = this;
- if (type === 'add') {
- if (obj.loadingType === 'nomore') {
- return;
- }
- obj.loadingType = 'loading';
- } else {
- obj.loadingType = 'more';
- }
- if (type === 'refresh') {
- // 清空数组
- obj.courseList = [];
- obj.page = 1
- }
- //获取课程
- getCourse({
- page: obj.page,
- limit: obj.limit,
- type: 2,
- }).then(e => {
-
- obj.courseList = obj.courseList.concat(e.data.data);
- console.log(obj.courseList);
- obj.page++
- //判断是否还有下一页,有是more 没有是nomore
- if (obj.limit==e.data.data.length) {
- obj.loadingType='more'
- } else{
- obj.loadingType='nomore'
- }
- if (type === 'refresh') {
- if (loading == 1) {
- uni.hideLoading();
- } else {
- uni.stopPullDownRefresh();
- }
- }
- })
- },
- data(){
- my({}).then(({data}) => {
- this.bzr = data.manage.real_name;
- this.phone = data.manage.phone;
- })
- },
- nav(index){
- index = + index;
- let id = '';
- console.log(this.courseList[index]);
- if(this.courseList[+index]){
- id = this.courseList[index].id;
- }
- uni.navigateTo({
- url: '/pages/course/evaluate?id=' + id
- })
- },
- // navzy(index){
- // index = + index;
- // let id = '';
- // console.log(this.courseList[index]);
- // if(this.courseList[+index]){
- // id = this.courseList[index].id;
- // }
- // uni.navigateTo({
- // url: '/pages/homework/setHomework?id=' + id
- // })
- // },
- }
- }
- </script>
- <style lang="scss">
- page,
- .center {
- width: 100%;
- height: 100%;
- background-color: #f8f8f8;
- }
- .listBox {
- position: relative;
- padding: 42rpx 32rpx 20rpx 30rpx;
- margin: 0 auto;
- margin: 20rpx;
- background: #FFFFFF;
- box-shadow: 0px 5rpx 24rpx 0px rgba(4, 0, 0, 0.06);
- border-radius: 15rpx;
- .type {
- position: absolute;
- top: 38rpx;
- right: 32rpx;
- width: 97rpx;
- height: 38rpx;
- text-align: center;
- background: #DFFFFA;
- border-radius: 5rpx;
- font-size: 22rpx;
- font-weight: 500;
- color: #1CC7C6;
- line-height: 38rpx;
- }
- .top {
- justify-content: start;
- margin-bottom: 34rpx;
- image {
- width: 76rpx;
- height: 60rpx;
- }
- .font {
- margin-left: 10rpx;
- .title {
- font-size: 32rpx;
- font-weight: bold;
- color: #333333;
- }
- .time {
- margin-top: 14rpx;
- font-size: 24rpx;
- font-weight: 400;
- color: #808080;
- }
- }
- }
- .main {
- padding-left: 8rpx;
- display: flex;
- justify-content: start;
- .left {
- padding-left: 10rpx;
- width: 50%;
- .font{
- margin-top: 20rpx;
- font-size: 28rpx;
- font-weight: 500;
- color: #808080;
- }
- }
- .right {
- padding-left: 10rpx;
- .font{
- margin-top: 20rpx;
- font-size: 28rpx;
- font-weight: 500;
- color: #808080;
- }
- }
- }
- .btnBox{
- width: 100%;
- margin-top: 40rpx;
- justify-content: flex-end;
- .button {
- margin-right: 20rpx;
- width: 145rpx;
- height: 48rpx;
- border: 1rpx solid #FF5850;
- border-radius: 24rpx;
- font-size: 26rpx;
- font-weight: 500;
- color: #FF5850;
- text-align: center;
- line-height: 48rpx;
- }
- }
- }
- </style>
|