2022-08-01 09:03:10 +00:00
|
|
|
|
<template>
|
|
|
|
|
<view>
|
2022-10-11 09:20:12 +00:00
|
|
|
|
<status-container :ifReturn="false" titlet="萌狮武术">
|
2022-08-01 09:03:10 +00:00
|
|
|
|
<view slot="content">
|
|
|
|
|
<view class="" style="margin-top: -20rpx;">
|
2022-08-09 10:21:46 +00:00
|
|
|
|
<swiper-pu :bannerList="bannerList" newBottom="20rpx" newHeight="460rpx"></swiper-pu>
|
2022-08-01 09:03:10 +00:00
|
|
|
|
</view>
|
2022-08-03 13:28:45 +00:00
|
|
|
|
<view class="posi-sticky" :style="{top:newtop+'px'}">
|
|
|
|
|
<swiper-tab id="tab" :list="dataList" v-model="current" @changeEv="clickTab" :itemColor="'#e42417'" :lineColor="'#e42417'"></swiper-tab>
|
|
|
|
|
</view>
|
2022-08-05 10:01:57 +00:00
|
|
|
|
<view class="pad-zy20 pad-s25" v-if="ifLoading">
|
|
|
|
|
<view class="" v-if="bigCourse.length">
|
2022-08-14 14:27:26 +00:00
|
|
|
|
<view @tap="goBigCourse(item.id,dataList[current].id,item.is_buy)" class="radius8 bacf pad10 boxshow1" v-for="(item,index) in bigCourse" :key="index">
|
2022-08-05 10:01:57 +00:00
|
|
|
|
<view class="posir">
|
|
|
|
|
<image :src="item.cover" style="height: 518rpx;" mode="aspectFill" class="width100" lazy-load></image>
|
|
|
|
|
<view class="posia-xzy bac5 fon24 colf pad18">
|
|
|
|
|
<view class="clips1">{{item.name}}</view>
|
|
|
|
|
<view class="disjbac ae">
|
|
|
|
|
<view class="">
|
|
|
|
|
<span class="bold">¥{{item.price}}</span>
|
|
|
|
|
<span class="fon20 colf8 mar-z20 tline-through">¥{{item.original_price}}</span>
|
|
|
|
|
</view>
|
2022-08-14 14:27:26 +00:00
|
|
|
|
<view class="radius18 pad-zy12 pad-sx4 borbot-f disjcac">{{item.is_buy?'去学习':'购买'}}</view>
|
2022-08-03 13:28:45 +00:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2022-08-07 01:50:06 +00:00
|
|
|
|
<view class="" v-else>
|
|
|
|
|
<pitera textStr="查询课程列表无果o(╥﹏╥)o" textColor="#b0aaa9" paddingStr="40rpx 0 20rpx 0"></pitera>
|
|
|
|
|
</view>
|
2022-08-03 13:28:45 +00:00
|
|
|
|
<!-- 两列列表 start -->
|
2022-08-05 10:01:57 +00:00
|
|
|
|
<list ref="refcourse" @goDetail="goCourseDetail"></list>
|
2022-08-03 13:28:45 +00:00
|
|
|
|
<!-- 两列列表 end -->
|
|
|
|
|
<!-- 推荐视频 start -->
|
2022-10-11 09:49:39 +00:00
|
|
|
|
<view class="disjb ae mar-s40 mar-x20" v-if="parseInt(show_video)!==0">
|
2022-08-03 13:28:45 +00:00
|
|
|
|
<view class="fon32 bold colb">推荐视频</view>
|
2022-08-05 10:01:57 +00:00
|
|
|
|
<view class="fon20" style="color: #bbb4b3;" @tap="goMore(0)">更多+</view>
|
2022-08-03 13:28:45 +00:00
|
|
|
|
</view>
|
2022-10-11 09:49:39 +00:00
|
|
|
|
<view class="radius8 bacf pad10 boxshow1 mar-x30" v-for="(item,index) in videoList" :key="index" v-if="parseInt(show_video)!==0">
|
2022-08-18 08:21:58 +00:00
|
|
|
|
<view class="posir disjcac">
|
2022-08-05 10:01:57 +00:00
|
|
|
|
<image :src="item.cover" style="height: 388rpx;" mode="aspectFill" class="width100" lazy-load></image>
|
2022-08-18 08:21:58 +00:00
|
|
|
|
<image v-if="item.src.includes('.mp4')" @tap="palyVideo(index)" class="posia" src="/static/tabbar/icon-play.png" mode="" style="width: 70rpx;height: 70rpx;" lazy-load></image>
|
2022-08-03 13:28:45 +00:00
|
|
|
|
</view>
|
|
|
|
|
<view class="fon24 pad-sx16 disjcac" style="color: #262626;">
|
2022-08-05 10:01:57 +00:00
|
|
|
|
<view class="clips2">{{item.title}}</view>
|
2022-08-03 13:28:45 +00:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 推荐视频 end -->
|
|
|
|
|
<!-- 推荐商品 start -->
|
|
|
|
|
<view class="disjb ae mar-s40">
|
|
|
|
|
<view class="fon32 bold colb">推荐商品</view>
|
2022-08-05 10:01:57 +00:00
|
|
|
|
<view class="fon20" style="color: #bbb4b3;" @tap="goMore(1)">更多+</view>
|
2022-08-03 13:28:45 +00:00
|
|
|
|
</view>
|
2022-08-05 10:01:57 +00:00
|
|
|
|
<list ref="refshop" @goDetail="goShopDetail"></list>
|
2022-08-03 13:28:45 +00:00
|
|
|
|
<!-- 推荐商品 end -->
|
|
|
|
|
</view>
|
2022-08-01 09:03:10 +00:00
|
|
|
|
</view>
|
|
|
|
|
</status-container>
|
|
|
|
|
<!-- 底部tab -->
|
|
|
|
|
<foot-tab></foot-tab>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import swiperPu from '@/components/swipers/swiper-pu.vue';
|
|
|
|
|
import swiperTab from '@/components/swiper-tab/swiper-tab.vue';
|
|
|
|
|
import footTab from '@/components/foot-tabs/foot-tab.vue';
|
2022-08-03 13:28:45 +00:00
|
|
|
|
import list from '@/components/list.vue';
|
2022-08-07 01:50:06 +00:00
|
|
|
|
import pitera from '@/components/nothing/pitera.vue';
|
2022-08-10 10:18:06 +00:00
|
|
|
|
import {reportRecord} from '@/jsFile/public-api.js';
|
2022-08-01 09:03:10 +00:00
|
|
|
|
export default {
|
|
|
|
|
components:{
|
|
|
|
|
'foot-tab' :footTab,
|
|
|
|
|
swiperTab,
|
2022-08-03 13:28:45 +00:00
|
|
|
|
swiperPu,
|
2022-08-07 01:50:06 +00:00
|
|
|
|
list,
|
|
|
|
|
pitera
|
2022-08-01 09:03:10 +00:00
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2022-08-03 13:28:45 +00:00
|
|
|
|
newtop:uni.getSystemInfoSync().statusBarHeight + 40,
|
2023-03-16 09:10:21 +00:00
|
|
|
|
bannerList:[],//轮播图
|
2022-08-01 09:03:10 +00:00
|
|
|
|
current:0,
|
2022-08-05 10:01:57 +00:00
|
|
|
|
dataList:[],//分类列表
|
|
|
|
|
classId:'',//分类id
|
|
|
|
|
bigCourse:[],
|
|
|
|
|
videoList:[],//推荐视频
|
|
|
|
|
ifLoading:false,
|
2022-08-09 10:21:46 +00:00
|
|
|
|
ifCount:0,
|
2022-10-11 09:49:39 +00:00
|
|
|
|
show_video:'', //是否隐藏视频
|
2022-08-01 09:03:10 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2022-08-01 10:18:01 +00:00
|
|
|
|
onShow() {
|
2022-10-11 09:49:39 +00:00
|
|
|
|
// 判断视频是否隐藏
|
|
|
|
|
this.isVideoEv();
|
2022-08-01 10:18:01 +00:00
|
|
|
|
},
|
|
|
|
|
onHide() {
|
|
|
|
|
// 关闭banner图自动轮播
|
|
|
|
|
this.$store.commit('setAutoplay',false);
|
|
|
|
|
},
|
2022-08-12 10:14:13 +00:00
|
|
|
|
onShareAppMessage(res) {
|
|
|
|
|
var shareObj = {
|
|
|
|
|
title: ``, // 默认是小程序的名称(可以写slogan等)
|
|
|
|
|
path: `/pages/tabbar/pagehome/pagehome?invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
|
|
|
|
imageUrl: ``//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
|
|
|
|
};
|
|
|
|
|
return shareObj;
|
|
|
|
|
},
|
|
|
|
|
onLoad(op) {
|
2022-08-15 10:15:13 +00:00
|
|
|
|
// 解码一:unescape("http%3A//www.baidu.com%3Fname%3Dzhang@xiao@jie%26order%3D1");
|
|
|
|
|
// 解码二:decodeURIComponent("http%3A%2F%2Fwww.baidu.com%3Fname%3Dzhang%40xiao%40jie%26order%3D1")
|
|
|
|
|
if(op.q!=undefined){
|
|
|
|
|
this.$toolAll.tools.analysis(op.q);
|
|
|
|
|
}
|
2022-08-05 10:01:57 +00:00
|
|
|
|
// 调用获取分类列表
|
|
|
|
|
this.getCourseCate();
|
2022-08-09 10:21:46 +00:00
|
|
|
|
// 调用获取首页banner图
|
|
|
|
|
this.getBanner();
|
2023-03-16 09:10:21 +00:00
|
|
|
|
// 开启banner图自动轮播
|
|
|
|
|
this.$store.commit('setAutoplay',true);
|
2023-02-22 02:59:42 +00:00
|
|
|
|
console.log(op)
|
|
|
|
|
if(op) {
|
|
|
|
|
uni.setStorageSync('invite_code',op.invite_code);
|
|
|
|
|
}
|
2022-08-01 09:03:10 +00:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
2022-10-11 09:49:39 +00:00
|
|
|
|
// 判断视频是否隐藏
|
|
|
|
|
isVideoEv(){
|
|
|
|
|
this.$requst.get('/api/index/base-config').then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
this.show_video = res.data.show_video;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2022-08-09 10:21:46 +00:00
|
|
|
|
// 获取首页banner图
|
|
|
|
|
getBanner(){
|
|
|
|
|
this.$requst.get('/api/common/slides',{position:'home-banner'}).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
if(res.data.length){
|
|
|
|
|
res.data.forEach(item=>{
|
|
|
|
|
let obj = {
|
2023-02-21 06:20:06 +00:00
|
|
|
|
type:item.type,
|
2022-08-09 10:21:46 +00:00
|
|
|
|
imgSrc:item.src,
|
|
|
|
|
url:item.url,
|
|
|
|
|
isVideo:false,
|
|
|
|
|
poster:''
|
|
|
|
|
}
|
|
|
|
|
this.bannerList.push(obj);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2022-08-01 09:03:10 +00:00
|
|
|
|
// tab点击事件
|
|
|
|
|
clickTab(index){
|
|
|
|
|
this.current = index;
|
2022-08-05 10:01:57 +00:00
|
|
|
|
// 设置分类id
|
|
|
|
|
this.classId = this.dataList[index].id;
|
|
|
|
|
this.bigCourse = [];
|
|
|
|
|
this.$refs.refcourse.list = [];
|
|
|
|
|
this.ifCount++;
|
|
|
|
|
// 调用获取课程列表
|
|
|
|
|
this.getCourseList();
|
|
|
|
|
},
|
|
|
|
|
// 获取分类列表
|
|
|
|
|
getCourseCate(){
|
|
|
|
|
this.$requst.get('/api/spu/category',{type:'course'}).then(res=>{
|
|
|
|
|
// 设置分类列表
|
|
|
|
|
this.dataList = res.data;
|
|
|
|
|
// 如果分类列表不为空
|
|
|
|
|
if(this.dataList.length){
|
|
|
|
|
// 设置分类id
|
|
|
|
|
this.classId = this.dataList[0].id;
|
|
|
|
|
// 调用获取课程列表
|
|
|
|
|
this.getCourseList();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2022-08-14 14:27:26 +00:00
|
|
|
|
// 大图点击事件
|
|
|
|
|
goBigCourse(id,category_id,is_buy){
|
|
|
|
|
if(this.$toolAll.tools.judgeAuth()) {
|
|
|
|
|
this.$toolAll.tools.goPage(`/pagesB/course-detail/course-detail?id=${id}&category_id=${category_id}`);
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-08-05 10:01:57 +00:00
|
|
|
|
// 获取课程列表
|
|
|
|
|
getCourseList(){
|
|
|
|
|
let params = {
|
|
|
|
|
category_id:this.classId,
|
|
|
|
|
is_home:1
|
|
|
|
|
}
|
|
|
|
|
this.$requst.post('/api/spu/course',params).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
this.ifLoading = true;
|
|
|
|
|
if(!this.ifCount){
|
|
|
|
|
// 调用获取推荐视频列表
|
|
|
|
|
this.getVideoList();
|
|
|
|
|
// 调用获取推荐视频列表
|
|
|
|
|
this.getShopList();
|
|
|
|
|
}
|
|
|
|
|
let dataList = res.data.list;
|
|
|
|
|
if(dataList.length){
|
|
|
|
|
this.bigCourse.push(dataList[0]);
|
|
|
|
|
dataList.splice(0,1);
|
|
|
|
|
if(dataList.length){
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
// 设置课程列表
|
|
|
|
|
this.$refs.refcourse.list = dataList;
|
|
|
|
|
},200)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 获取推荐视频列表
|
|
|
|
|
getVideoList(){
|
2022-08-09 10:21:46 +00:00
|
|
|
|
let params = {
|
|
|
|
|
page:1,
|
|
|
|
|
size:50,
|
|
|
|
|
is_home:1
|
|
|
|
|
}
|
|
|
|
|
this.$requst.post('/api/spu/video',params).then(res=>{
|
2022-08-05 10:01:57 +00:00
|
|
|
|
if(res.code==0){
|
|
|
|
|
// 设置推荐视频列表
|
|
|
|
|
this.videoList = res.data.list;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 获取推荐商品
|
|
|
|
|
getShopList(){
|
|
|
|
|
let params = {
|
|
|
|
|
page:1,
|
2022-08-09 10:21:46 +00:00
|
|
|
|
size:50,
|
2022-08-05 10:01:57 +00:00
|
|
|
|
is_home:1
|
|
|
|
|
}
|
2022-08-09 10:21:46 +00:00
|
|
|
|
this.$requst.post('/api/spu/list',params).then(res=>{
|
2022-08-05 10:01:57 +00:00
|
|
|
|
if(res.code==0){
|
|
|
|
|
this.$refs.refshop.list = res.data.list;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 播放视频
|
|
|
|
|
palyVideo(index){
|
2022-08-14 14:27:26 +00:00
|
|
|
|
if(this.$toolAll.tools.judgeAuth()) {
|
|
|
|
|
if(this.videoList[index].type=="video_number"){
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
wx.openChannelsActivity({
|
|
|
|
|
finderUserName:this.videoList[index].video_number,
|
|
|
|
|
feedId:this.videoList[index].video_id,
|
|
|
|
|
success:(res)=>{
|
|
|
|
|
reportRecord({id:this.videoList[index].id}).then(result=>{})
|
|
|
|
|
},fail:()=>{
|
|
|
|
|
// this.$toolAll.tools.showToast('视频已丢失或已删除')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// #endif
|
|
|
|
|
} else {
|
|
|
|
|
let newArr = [];
|
|
|
|
|
newArr.push(this.videoList[index])
|
|
|
|
|
uni.setStorageSync('videoList',newArr);
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url:`/pagesB/play-video/play-video?current=${index}`
|
|
|
|
|
})
|
|
|
|
|
reportRecord({id:this.videoList[index].id}).then(result=>{})
|
|
|
|
|
}
|
2022-08-08 10:15:03 +00:00
|
|
|
|
}
|
2022-08-05 10:01:57 +00:00
|
|
|
|
},
|
|
|
|
|
// 更多
|
|
|
|
|
goMore(index){
|
|
|
|
|
uni.reLaunch({
|
|
|
|
|
url:['/pages/tabbar/video/video','/pages/tabbar/shop/shop'][index]
|
|
|
|
|
})
|
2022-08-03 13:28:45 +00:00
|
|
|
|
},
|
|
|
|
|
// 去课程详情
|
|
|
|
|
goCourseDetail(id){
|
2022-08-14 14:27:26 +00:00
|
|
|
|
if(this.$toolAll.tools.judgeAuth()) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url:`/pagesB/course-detail/course-detail?id=${id}`
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-08-03 13:28:45 +00:00
|
|
|
|
},
|
|
|
|
|
// 去商品详情
|
|
|
|
|
goShopDetail(id){
|
2022-08-14 14:27:26 +00:00
|
|
|
|
if(this.$toolAll.tools.judgeAuth()) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url:`/pagesB/shop-detail/shop-detail?id=${id}`
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-08-01 09:03:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
|
|
</style>
|