超v课程 添加购买
This commit is contained in:
237
pages/course/vipCourse.vue
Normal file
237
pages/course/vipCourse.vue
Normal file
@@ -0,0 +1,237 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<z-nav-bar :title="pageTitle"></z-nav-bar>
|
||||
<view class="learnBox box" >
|
||||
<view class="newBox">
|
||||
<view class="item flexbox" v-for="(item, index) in courseList" :key="index" @click="onPageJump('/pages/course/courseDetail',item.id, item.title)">
|
||||
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
|
||||
<view class="imgcontainer">
|
||||
<image :src="item.image" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="buyItems">
|
||||
<view class="txt555">
|
||||
{{item.title}}
|
||||
</view>
|
||||
<view class="jianjie" v-html="item.content">
|
||||
|
||||
</view>
|
||||
<!-- <view class="tag-view">
|
||||
<uni-tag style="margin-right: 10rpx;" text="高级" type="primary" size="small" />
|
||||
<uni-tag style="margin-right: 10rpx;" text="选修" size="small" type="success" />
|
||||
</view> -->
|
||||
<view class="btn_box">
|
||||
<text>课程详情</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<u-divider v-show="status == 2" text="已加载全部"></u-divider>
|
||||
<u-divider v-show="status == 3" text="暂无数据"></u-divider>
|
||||
<u-divider v-show="status == 1" text="加载中..."></u-divider>
|
||||
</view>
|
||||
|
||||
<public-module></public-module>
|
||||
<z-navigation></z-navigation>
|
||||
<music-play :playData="playData"></music-play>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import musicPlay from '@/components/music.vue'
|
||||
import $http from '@/config/requestConfig.js';
|
||||
var clear;
|
||||
import {
|
||||
mapState
|
||||
} from 'vuex';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
playData: {},
|
||||
tagId: null,
|
||||
pageTitle: '',
|
||||
courseList: [],
|
||||
status:0, // 0 不显示, 1 加载中,2 加载全部完成,3 暂无数据
|
||||
page:1,
|
||||
flag:true, // 函数是否执行完
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
onLoad(e) {
|
||||
// 隐藏原生的tabbar
|
||||
uni.hideTabBar();
|
||||
this.tagId = e.id
|
||||
this.pageTitle = e.title
|
||||
console.log(e, '传入分类id')
|
||||
this.getData();
|
||||
},
|
||||
onReachBottom() {
|
||||
if(this.status != 2){
|
||||
this.page ++
|
||||
this.getData() }
|
||||
console.log('触底加载',this.page)
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo'])
|
||||
},
|
||||
//页面显示
|
||||
onShow() {
|
||||
// 隐藏原生的tabbar
|
||||
uni.hideTabBar();
|
||||
|
||||
|
||||
},
|
||||
components: {
|
||||
musicPlay
|
||||
},
|
||||
//方法
|
||||
methods: {
|
||||
// 跳转
|
||||
onPageJump(url,thatId,title) {
|
||||
uni.navigateTo({
|
||||
url: `${url}?id=${thatId}&title=${title}`
|
||||
});
|
||||
},
|
||||
getData() {
|
||||
if(!this.flag){
|
||||
console.log('正在执行,未完成')
|
||||
return
|
||||
}
|
||||
this.status = 1
|
||||
this.flag = false
|
||||
$http.request({
|
||||
url: "medical/home/getMarketCourseList",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: {
|
||||
"id": this.tagId,
|
||||
"limit": 12,
|
||||
"page": this.page
|
||||
},
|
||||
header: { //默认 无 说明:请求头
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
})
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.courseList.records.length > 0) {
|
||||
var list = res.courseList.records
|
||||
this.courseList = this.courseList.concat(list)
|
||||
if(res.courseList.pages > this.page){
|
||||
this.status = 0
|
||||
}else{
|
||||
this.status = 2
|
||||
}
|
||||
} else if(this.page > 1){
|
||||
this.status = 2 // 加载完成
|
||||
|
||||
}else{
|
||||
|
||||
this.status = 3 // 暂无数据
|
||||
}
|
||||
console.log('status',this.status)
|
||||
}
|
||||
this.flag = true
|
||||
}).catch(e => {
|
||||
console.log(e,'数据报错')
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
.flexbox{display: flex; }
|
||||
.imgcontainer {
|
||||
background-color: $imgBg;
|
||||
}
|
||||
.box {
|
||||
background-color: #fff;
|
||||
@include pleft_right(10px);
|
||||
min-height: calc(100vh - 270rpx);
|
||||
}
|
||||
.newBox {
|
||||
|
||||
.item {
|
||||
margin-bottom: 20rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
@include ptop_bottm(10px);
|
||||
@include pleft_right(10px);
|
||||
|
||||
@include mshadow(10px, 1) .imgcontainer {
|
||||
display: block;
|
||||
width: 110rpx;
|
||||
margin-right: 20rpx;
|
||||
// background-size: cover;
|
||||
// background-position: center;
|
||||
height: 200rpx;
|
||||
flex-grow: 1;
|
||||
// @include ptop_bottm(10px);
|
||||
overflow: hidden;
|
||||
|
||||
// @include pleft_right(10px);
|
||||
image {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
}
|
||||
}
|
||||
.btn_box{ text-align: right;
|
||||
text{
|
||||
border-radius: 20rpx;
|
||||
padding: 3px 5px; @include theme("btn_bg");
|
||||
font-size: 28rpx; color: #fff;
|
||||
}
|
||||
}
|
||||
.buyItems {
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
.jianjie {
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
@include bov();
|
||||
color: #9c9c9c;
|
||||
}
|
||||
|
||||
.txt555 {
|
||||
font-size: 30rpx;
|
||||
color: #000;
|
||||
@include bov()
|
||||
}
|
||||
}
|
||||
}
|
||||
.learnBox {
|
||||
background-color: #fff;
|
||||
margin-top: 10px;
|
||||
@include ptop_bottm(10px);
|
||||
@include pleft_right(10px);
|
||||
|
||||
.learn { flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
margin-top: 20rpx;
|
||||
|
||||
.item {
|
||||
width: 48%;margin-bottom: 16px;
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
}
|
||||
|
||||
.txt555 { display: block; text-align: center;
|
||||
height: 40rpx; width: 100%;
|
||||
line-height: 40rpx;
|
||||
@include bov(1);
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user