123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690 |
- <template>
- <view class="study-type">
- <!-- 导航栏 -->
- <zs-header :background="background" color="#000" :title="title"></zs-header>
- <image class="banner" :src="bg" mode=""></image>
- <view style="margin-bottom: 0;" class="type-title more-title">
- 推荐线路
- <view class="more-box" @click="jump('./community/goods?columnId='+ query.columnId)">
- <view>
- 更多
- </view>
- <image class="more" src="../static/jiantou-icon.png" mode=""></image>
- </view>
- </view>
- <zs-list class="store-recommend-box" mt="0">
- <view class="left">
- <view class="store-item" v-for="(item, index) in recommendList" :key="index"
- @click="goGoodsDetail(item.goodsId)">
- <zs-img :src="item.goodsPath" width="344rpx" height="344rpx" mode=""></zs-img>
- <view class="info">
- <view class="title">
- {{ item.goodsName }}
- </view>
- <view class="user-info">
- <!-- <image class="head" :src="item.goodsPath"></image> -->
- <view class="user-name">
- {{ item.goodsDescribe }}
- </view>
- </view>
- <view class="price-box">
- <view class="left">
- <view class="unit">
- ¥
- </view>
- <view class="price">
- {{ item.realPrice }}
- </view>
- <view class="old-price">
- ¥{{ item.marketPrice }}
- </view>
- </view>
- <view class="right">
- {{ item.saleNum }}人已购
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="right">
- <view class="store-item" v-for="(item, index) in recommendList1" :key="index"
- @click="goGoodsDetail(item.goodsId)">
- <zs-img :src="item.goodsPath" width="344rpx" height="344rpx" mode=""></zs-img>
- <view class="info">
- <view class="title">
- {{ item.goodsName }}
- </view>
- <view class="user-info">
- <!-- <image class="head" :src="item.goodsPath" mode=""></image> -->
- <view class="user-name">
- {{ item.goodsDescribe }}
- </view>
- </view>
- <view class="price-box">
- <view class="left">
- <view class="unit">
- ¥
- </view>
- <view class="price">
- {{ item.realPrice }}
- </view>
- <view class="old-price">
- ¥{{ item.marketPrice }}
- </view>
- </view>
- <view class="right">
- {{ item.saleNum }}人已购
- </view>
- </view>
- </view>
- </view>
- </view>
- </zs-list>
- <view class="type-title more-title">
- 互动社区
- <view class="more-box" @click="jump('./community/index?id=' + tab)">
- <view>
- 更多
- </view>
- <image class="more" src="../static/jiantou-icon.png" mode=""></image>
- </view>
- </view>
- <scroll-view class="tab-box" enable-flex scroll-x>
- <view class="tab" :class="[tab == item.id ? 'active' : '']" v-for="(item, index) in tabList" :key="index"
- @click="handleTab(item.id)">
- {{ item.communityName }}
- </view>
- </scroll-view>
- <template>
- <!-- 列表 -->
- <zs-list class="store-box" mt="0">
- <view class="left">
- <view class="store-item" v-for="(item, index) in communityList" :key="index" @click="goCommunity(item.tabId)">
- <!-- <image class="play-icon" src="../static/play.png" mode="widthFix"></image> -->
- <zs-img :src="item.coverImg" width="344rpx" height="256rpx"></zs-img>
- <view class="info">
- <view class="title">
- {{ item.communityTitle }}
- </view>
- <view class="user-info">
- <view class="head">
- {{ item.communityName }}
- </view>
- <view class="user-name">
- 观看 {{ item.viewedCount }}
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="right">
- <view class="store-item" v-for="(item, index) in communityList1" :key="index"
- @click="goCommunity(item.tabId)">
- <image class="play-icon" src="../static/play.png" mode=""></image>
- <zs-img :src="item.coverImg" width="344rpx" height="256rpx"></zs-img>
- <view class="info">
- <view class="title">
- {{ item.communityTitle }}
- </view>
- <view class="user-info">
- <view class="head">
- {{ item.communityName }}
- </view>
- <view class="user-name">
- 观看 {{ item.viewedCount }}
- </view>
- </view>
- </view>
- </view>
- </view>
- <view v-if="communityList.length == 0 && communityList1.length == 0" class="noneContent">
- <view>没有数据</view>
- </view>
- </zs-list>
- </template>
- <view class="type-title more-title">
- 科普视频
- <view class="more-box" @click="jump('./community/video?columnId=' + query.columnId)">
- <view>
- 更多
- </view>
- <image class="more" src="../static/jiantou-icon.png" mode=""></image>
- </view>
- </view>
- <template>
- <!-- 列表 -->
- <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">
- <view class="head" mode=""> 科普视频</view>
- <view class="user-name">
- 观看{{ item.viewedCount }}
- </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">
- <view class="head">科普视频</view>
- <!-- <image class="head" src="../static/logo.png" mode=""></image> -->
- <view class="user-name">
- 观看{{ item.viewedCount }}
- </view>
- </view>
- </view>
- </view>
- </view>
- </zs-list>
- </template>
- </view>
- </template>
- <script>
- import { getPage, videoList, studyGoods, studyGoodsByUser, getCommunitys, getItem, } from '@/api/study.js';
- export default {
- data() {
- return {
- bg: '',
- title: '',
- background: false,
- pageContent: [],
- status: 'more',
- list: [],
- list1: [],
- recommendList: [],
- recommendList1: [],
- communityList: [],
- communityList1: [],
- tab: 0,
- tabList: [],
- query: {
- columnId: 0,
- currentPage: 1,
- pageSize: 10,
- }
- }
- },
- methods: {
- jump(url) {
- uni.navigateTo({
- url
- });
- },
- // 去商品详情
- 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
- })
- },
- goCommunity(id) {
- console.log(id)
- uni.navigateTo({
- url: './community/detail?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
- }
- })
- })
- },
- studyRecommendByUser() {
- studyGoodsByUser({
- columnId: this.query.columnId,
- currentPage: 1,
- pageSize: 4
- }).then(res => {
- if (res.state == 'Success') {
- let recommendList = []
- let recommendList1 = []
- res.content.records.map((item, index) => {
- if (index % 2) {
- recommendList1.push(item)
- } else {
- recommendList.push(item)
- }
- })
- this.recommendList = this.recommendList.concat(recommendList)
- this.recommendList1 = this.recommendList1.concat(recommendList1)
- }
- })
- },
- getColumnTabs() {
- getCommunitys({ columnId: this.query.columnId }).then(res => {
- if (res.state == 'Success') {
- this.tabList = res.content
- if (this.tabList.length > 0) {
- this.tab = this.tabList[0].id
- this.getItem(this.tab)
- }
- }
- })
- },
- // 点击社区tab
- handleTab(tab) {
- this.tab = tab
- this.communityList = []
- this.communityList1 = []
- this.getItem(tab)
- },
- //获取社区分类列表
- getItem(communityId) {
- getItem({ communityId, currentPage: 1, pageSize: 2, state: 2 }).then(res => {
- if (res.state == 'Success') {
- let communityList = []
- let communityList1 = []
- res.content.records.map((item, index) => {
- if (index % 2) {
- communityList1.push(item)
- } else {
- communityList.push(item)
- }
- })
- this.communityList = this.communityList.concat(communityList)
- this.communityList1 = this.communityList1.concat(communityList1)
- }
- })
- },
- },
- onLoad(options) {
- this.query.columnId = options.id
- // this.getPage(options.id).then(()=>{
- // this.getStudyGoods()
- // })
- this.getColumnTabs()
- this.studyRecommendByUser()
- let that = this
- const eventChannel = this.getOpenerEventChannel();
- if (JSON.stringify(eventChannel) !== '{}') {
- eventChannel.on('img', function (img, name) {
- that.bg = img
- that.title = name
- })
- }
- },
- 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: 480rpx;
- vertical-align: bottom;
- position: relative;
- left: -20rpx;
- }
- .title-box {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .more {
- font-size: 20rpx;
- color: #AAAAAA;
- }
- }
- .more-title {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .more-box {
- display: flex;
- align-items: center;
- font-size: 24rpx;
- color: #AAAAAA;
- .more {
- width: 20rpx;
- height: 20rpx;
- display: block;
- margin-left: 6rpx;
- }
- }
- }
- .tab-box {
- display: flex;
- align-items: flex-start;
- .tab {
- flex-shrink: 0;
- padding: 10rpx 24rpx;
- // margin-top: 28rpx;
- color: #AAAAAA;
- background: #EEEEEE;
- font-size: 28rpx;
- margin-right: 20rpx;
- border-radius: 8rpx;
- }
- .tab.active {
- color: #222222;
- // background: #CEE0FF;
- }
- }
- .type-title {
- font-weight: bold;
- color: #222222;
- font-size: 32rpx;
- margin: 20rpx 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;
- }
- }
- .noneContent {
- display: flex;
- justify-content: center;
- width: 100%;
- padding-top: 10rpx;
- color: #777777;
- font-size: 28rpx;
- }
- .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;
- height: 76rpx;
- font-size: 28rpx;
- font-weight: bold;
- width: 100%;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- /* 显示的最大行数 */
- overflow: hidden;
- }
- .user-info {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-top: 20rpx;
- font-size: 20rpx;
- color: #AAAAAA;
- .head {
- font-size: 20rpx;
- }
- .user-name {
- font-size: 20rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 1;
- }
- }
- .price-box {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 12rpx;
- .left {
- display: flex;
- align-items: flex-end;
- .unit {
- font-size: 24rpx;
- color: $uni-color-primary;
- font-weight: bold;
- }
- .price {
- font-size: 32rpx;
- color: $uni-color-primary;
- font-weight: bold;
- }
- .old-price {
- font-size: 20rpx;
- color: #AAAAAA;
- text-decoration: line-through;
- margin-left: 10rpx;
- }
- }
- .right {
- font-size: 20rpx;
- color: #AAAAAA;
- }
- }
- }
- }
- }
- }
- </style>
|