123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389 |
- <template>
- <view class="study-type">
- <!-- 导航栏 -->
- <zs-header :background="background"></zs-header>
- <image class="banner" :src="bg" mode=""></image>
-
- <!-- 横向 -->
- <view v-for="(item,index) in pageContent" :key="item.id">
- <view class="title-box">
- <view class="type-title" v-if="item.list.length">
- {{item.title}}
- </view>
- <view class="more" @click="goTypeList(item.id,item.title)">
- 更多
- </view>
- </view>
- <!-- type-box横向 type-box1纵向 -->
- <view class="type-box">
- <view class="type-item" v-for="(i,d) in item.list" :key="i.goodsId" @click="goGoodsDetail(i.goodsId)">
- <zs-img :src="i.logoPath" width="344rpx" height="344rpx" mode=""></zs-img>
- <view class="info">
- <view class="title">
- {{i.goodsName||'冬季北疆·阿勒泰将军山喀纳斯-天木-白哈巴...'}}
- </view>
- <view class="desc">
- {{i.goodsDescribe||'了解中国古代印染工艺非遗传承的现状'}}
- </view>
- <view class="price-box">
- <view class="left">
- <!-- <view class="unit">
- ¥
- </view> -->
- <view class="price">
- ¥{{i.realPrice||50}}
- </view>
- </view>
-
- <view class="right">
- 销量{{i.saleNum||999}}
- </view>
- </view>
- </view>
- </view>
- </view>
-
- </view>
-
- <template>
- <view class="type-title" v-if="list.length||list1.length">
- 科普视频
- </view>
- <!-- 列表 -->
- <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
- <view class="left">
- <view class="store-item" v-for="(item,index) in list" :key="index" @click="goCourse(item.id)">
- <image class="play-icon" src="../static/play.png" mode="widthFix"></image>
- <zs-img :src="item.courseImg" width="344rpx" height="256rpx"></zs-img>
- <view class="info">
- <view class="title">
- {{item.courseName}}
- </view>
- <view class="user-info">
- <image class="head" src="../static/logo.png" mode=""></image>
- <view class="user-name">
- 研学官方账号
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="right">
-
- <view class="store-item" v-for="(item,index) in list1" :key="index" @click="goCourse(item.id)">
- <image class="play-icon" src="../static/play.png" mode=""></image>
- <zs-img :src="item.courseImg" width="344rpx" height="256rpx"></zs-img>
- <view class="info">
- <view class="title">
- {{item.courseName}}
- </view>
- <view class="user-info">
- <image class="head" src="../static/logo.png" mode=""></image>
- <view class="user-name">
- 研学官方账号
- </view>
- </view>
- </view>
- </view>
- </view>
-
- </zs-list>
- </template>
-
- </view>
- </template>
- <script>
- import {getMenu,getPage,videoList,studyGoods} from '@/api/study.js';
- export default {
- data() {
- return {
- bg:'',
- background:false,
- pageContent:[],
- status: 'more',
- list: [],
- list1: [],
- query:{
- columnId:0,
- currentPage:1,
- pageSize:10,
- }
- }
- },
- methods: {
- // 去商品详情
- goGoodsDetail(id){
- uni.navigateTo({
- url:'/study/studyGoodsDetail?id='+id
- })
- },
- goTypeList(id,title){
- uni.navigateTo({
- url:`/study/studyList?id=${id}&title=${title}`
- })
- },
- goDetail(){},
- // 去课程详情页
- goCourse(id){
- uni.navigateTo({
- url:'./courseDetail?id='+id
- })
- },
- loadMore() {
- this.videoList()
- },
- // 获取顶部栏目
- getPage(columnId){
- return new Promise((resolve,reject)=>{
- getPage({currentPage:1,pageSize:10,columnId,status:1}).then(res=>{
- if(res.state == 'Success'){
- res.content.map(item=>{
- let obj = {
- id:item.id,
- title:item.columnName,
- list:[]
- }
- this.pageContent.push(obj)
- })
- console.log(this.pageContent);
- resolve()
- }
- })
- })
- },
- // 课程视频
- videoList(){
- this.status = 'loading'
- videoList(this.query).then(res=>{
- if(res.state == 'Success'){
- let list = []
- let list1 = []
- res.content.records.map((item,index)=>{
- if(index%2){
- list1.push(item)
- }else{
- list.push(item)
- }
- })
- this.list = this.list.concat(list)
- this.list1 = this.list1.concat(list1)
- let total = this.list.length+this.list1.length
- if(total>=res.content.total){
- this.status = 'noMore'
- }else{
- this.status = 'more'
- this.query.currentPage++
- }
- }
- })
- },
- getStudyGoods(){
- this.pageContent.map(item=>{
- studyGoods({columnId:item.id,currentPage:1,pageSize:4}).then(res=>{
- if(res.state == 'Success'){
- item.list = res.content.records
- }
- })
- })
- }
-
- },
- onLoad(options) {
- this.query.columnId = options.id
- this.getPage(options.id).then(()=>{
- this.getStudyGoods()
- })
- let that = this
- const eventChannel = this.getOpenerEventChannel();
- if(JSON.stringify(eventChannel) !=='{}'){
- eventChannel.on('img', function(data) {
- that.bg = data
- })
- }
- },
- onPageScroll(e) {
- if(e.scrollTop >= 30){
- this.background = true
- }else{
- this.background = false
- }
- },
- }
- </script>
- <style lang="scss" >
- .study-type{
- padding: 0 20rpx;
- background: #F9F9F9;
- .banner{
- width: 750rpx;
- height: 420rpx;
- vertical-align: bottom;
- position: relative;
- left: -20rpx;
- }
- .title-box{
- display: flex;
- align-items: center;
- justify-content: space-between;
- .more{
- font-size: 20rpx;
- color: #AAAAAA;
- }
- }
-
- .type-title{
- font-weight: bold;
- color: #222222;
- font-size: 32rpx;
- margin: 30rpx 0 20rpx;
- }
- .type-box{
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- .type-item{
- width: 340rpx;
- margin-bottom: 20rpx;
- // box-shadow: 0rpx 0rpx 24rpx 2rpx rgba(0, 0, 0, 0.08);
- border-radius: 16rpx;
- background: #fff;
-
- .icon {
- width: 100%;
- height: 300rpx;
- border-radius: 16rpx 16rpx 0 0;
- }
-
- .info{
- flex: 1;
- padding: 16rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- position: relative;
- .title{
- font-size: 28rpx;
- font-weight: bold;
- width: 100%;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- margin-top: 10rpx;
- }
-
- .desc{
- font-size: 24rpx;
- color: #AAAAAA;
- overflow: hidden;
- text-overflow: ellipsis;
- /* 弹性伸缩盒子模型显示 */
- display: -webkit-box;
- /* 限制在一个块元素显示的文本的行数 */
- -webkit-line-clamp: 2;
- /* 设置或检索伸缩盒对象的子元素的排列方式 */
- -webkit-box-orient: vertical;
- margin-top: 12rpx;
- }
-
- .price-box{
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 12rpx;
- .left{
- display: flex;
- align-items: flex-end;
- .unit{
- font-size: 20rpx;
- color: $uni-color-primary;
- font-weight: bold;
- }
- .price{
- font-size: 32rpx;
- color: $uni-color-primary;
- font-weight: bold;
- }
- }
- .right{
- font-size: 24rpx;
- color: #AAAAAA;
- }
- }
-
- }
- }
- }
-
- .swiper {
- height: 272rpx;
- border-radius: 16rpx;
- margin-top: 28rpx;
- .swiper-item {
- width: 100%;
- height: 100%;
- border-radius: 16rpx;
- object-fit: cover;
- }
- }
-
- .zs-list {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .left {
-
- }
-
- .right {
-
- }
-
- .store-item{
- box-shadow: 0rpx 0rpx 24rpx 2rpx rgba(0,0,0,0.08);
- border-radius: 16rpx;
- width: 344rpx;
- margin-top: 20rpx;
- position: relative;
- .play-icon{
- position: absolute;
- top: 20rpx;
- right: 30rpx;
- width: 30rpx;
- height: 30rpx;
- z-index: 2;
- }
- .info{
- padding: 20rpx;
- .title{
- color: #222222;
- font-size: 24rpx;
- width: 100%;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2; /* 显示的最大行数 */
- overflow: hidden;
- }
- .user-info{
- display: flex;
- align-items: center;
- margin-top: 20rpx;
- .head{
- width: 40rpx;
- height: 40rpx;
- border-radius: 50%;
- }
- .user-name{
- color: #AAAAAA;
- font-size: 20rpx;
- margin-left: 12rpx;
- }
- }
- }
- }
- }
-
- }
- </style>
|