You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhishifufei_uniapp/pages/learning/index.vue

604 lines
15 KiB

9 months ago
<template>
<BaseContainer class="learning" :fixedNav="false">
<view class="learning-box">
<view class="swiper-box">
<swiper class="custom-banner" indicator-dots autoplay @click="handleBannerClick" >
<swiper-item v-for="(item, index) in banner" :key="index" :data-url="item.url" class="swiper-item">
<image :data-url="item.url" mode="aspectFill" :src="item.pic" :alt="item.title" />
</swiper-item>
</swiper>
</view>
<view class="my-exam flex">
<image :src="getImgPath('/static/frontend/exam-bg.png')" mode="aspectFill"></image>
<view class="exam-left flex">
<view class="exam-name flex">我的考试:
<text>{{ myExam.examName }}</text>
<image src="@/static/images/learning/change.png" mode="aspectFill" @click="changeCate"></image>
9 months ago
</view>
<view class="exam-time">开考时间:
<text>{{ myExam.examTime}}</text>
</view>
</view>
<view class="exam-right">
<view class="exam-days-title">距离考试</view>
<view class="exam-days-value"><text>{{ myExam.examDays }}</text></view>
</view>
</view>
<view class="learning-info flex">
<view class="info-item flex">
<view class="item-title">坚持天数</view>
<view class="item-value"><text style="color: #FF9500;">{{ info.signDays }}</text></view>
<view class="item-rank">排名:{{ info.signRank }}</view>
</view>
<view class="info-item flex">
<view class="item-title">背诵考点</view>
<view class="item-value"><text style="color: #0F74BB;">{{ info.reciteExamPoint }}</text></view>
<view class="item-rank">排名:{{ info.reciteRank }}</view>
</view>
<view class="info-item flex">
<view class="item-title">刷题正确率</view>
<view class="item-value"><text style="color: #52C794;">{{ info.currentPercent }}</text>%</view>
<view class="item-rank">排名:{{ info.currentRank }}</view>
</view>
</view>
<view class="sign-record">
<view class="record-title content-title">
打卡记录
9 months ago
<text class="more-content" @click="checkRecord">查看 ></text>
9 months ago
</view>
<view class="record-content flex">
<view class="content-left">
<view>
已背诵章节(词汇) <image src="@/static/images/learning/success.png" mode="aspectFill"></image>
</view>
<view>
今日背诵检测 <image src="@/static/images/learning/success.png" mode="aspectFill"></image>
</view>
<view>进度 <view class="progress-bg"><text class="progress" style="width: 100%;"></text></view> <text class="progress-percent">100%</text> </view>
</view>
<view class="content-right">已打卡</view>
</view>
</view>
<view class="practice flex">
2021-2022英语四级考试真题 <text>开始练习</text>
</view>
<view class="tab-container">
<view class="content-title">
刷题过关
<text class="more-content">更多 ></text>
</view>
<view class="flex tab-content">
<view :data-idx="index" class="tab-item" v-for="(item, index) in categoryList" :key="item.id" @click="handleCateClick(item)">
<image :src="item.pic" mode="aspectFill"></image>
<view>{{ item.name }}</view>
</view>
</view>
</view>
9 months ago
<advert :img="'/static/frontend/learning-advert.png'" :height="140"/>
9 months ago
<view class="tab-container">
<view class="content-title">
视频课
<text class="more-content">更多 ></text>
</view>
<view class="flex tab-content">
<view :data-idx="index" class="tab-item" v-for="(item, index) in categoryList" :key="item.id" @click="handleCateClick(item)">
<image :src="item.pic" mode="aspectFill"></image>
<view>{{ item.name }}</view>
</view>
</view>
</view>
9 months ago
<advert :img="'/static/frontend/learning-advert.png'" :height="140"/>
9 months ago
<template v-for="(item, index) in indexMenu">
<view v-if="specialData[item.key] && specialData[item.key].length > 0" :key="index" class="special-content">
<view class="content-title">
{{ item.menuName }}
<text v-if="item.menuName !== '线下课堂'" class="more-content">更多 ></text>
</view>
<square-style-course v-if="item.menuName === '直播课'" :specialList="specialData[item.key]" @detail="handleSpecialClick"></square-style-course>
<offline-style-course v-if="item.menuName === '线下课堂'" :specialList="specialData[item.key]" @detail="handleOfflineClick"></offline-style-course>
</view>
</template>
<view class="special-content">
<view class="content-title">
课程
<text class="more-content" @click="toMoreCourse">更多 ></text>
</view>
<square-style-course :specialList="specialList" @detail="handleSpecialClick"></square-style-course>
</view>
9 months ago
</view>
9 months ago
<!-- <message-box title="确认收货?" @submit="console.log('提交')"></message-box> -->
9 months ago
</BaseContainer>
</template>
<script>
import { getGoodsCateList, getIndexData } from "@/api/store";
import { getSpecialIndexData, getSpecialList } from "@/api/special";
9 months ago
import Advert from '@/components/Advert/index.vue';
import SquareStyleCourse from '@/components/Course/squareStyleCourse.vue';
import OfflineStyleCourse from '@/components/Course/offlineStyleCourse.vue';
9 months ago
import MessageBox from '@/components/Message/index.vue';
9 months ago
export default {
components: {
Advert,
SquareStyleCourse,
OfflineStyleCourse,
9 months ago
MessageBox,
9 months ago
},
data() {
return {
banner: [],
categoryList: [],
loading: false,
myExam: {
examName: '职业技能考试',
grade_id: 1,
subject_id: 7,
9 months ago
examTime: '2024-1-12',
examDays: 180,
},
info: {
signDays: 82,
signRank: 1,
reciteExamPoint: 8532,
reciteRank: 64,
currentPercent: 60,
currentRank: '--',
},
indexMenu: [
{ menuName: '直播课', key: 'hot_course' },
{ menuName: '线下课堂', key: 'offline_courses' },
],
specialData: [],
specialList: [],
9 months ago
};
},
onLoad() {
this.getGoodsCateList();
this.getIndexData();
this.getSpecialIndexData();
this.getSpecialList();
9 months ago
},
onShareAppMessage() {
return {};
},
onShareTimeline() {
return {};
},
mounted() {
},
methods: {
async getIndexData() {
try {
const { data } = await getIndexData();
this.banner = data;
if(!this.color_one && !this.color_two){
this.color_one = this.banner[0].color_one;
this.color_two = this.banner[0].color_two;
}
} catch (err) { }
},
async getSpecialIndexData() {
try {
const { data, code, msg } = await getSpecialIndexData();
this.loading = false;
if (code != 200) {
uni.showToast({
title: msg,
});
} else {
console.log(data, 646);
const { banner, category_list } = data;
this.bannerList = banner;
this.gradeCate = category_list;
// .concat([{
// grade_id: 0,
// name: '全部分类',
// }]);
this.specialData = { ...data };
console.log(this.gradeCate);
}
} catch (err) {
this.loading = false;
console.log(err);
}
},
// 点击轮播图
handleBannerClick(e) {
if (e.target.dataset.url === undefined) return;
uni.navigateTo({
url: e.target.dataset.url,
});
},
// 获取分类
async getGoodsCateList() {
try {
const { data } = await getGoodsCateList();
console.log(data);
this.categoryList = data.category_list.concat([
{
name: "全部",
id: 0,
},
]);
} catch (err) { }
},
async getSpecialList() {
try {
const { data } = await getSpecialList({
grade_id: this.myExam.grade_id,
subject_id: this.myExam.subject_id,
page: 1,
limit: 4,
});
this.specialList = data;
} catch (err) {
console.log(err);
}
this.loading = false;
},
9 months ago
handleSpecialClick(item) {
const url = item.is_light
? '/pages/special/single_details?id=' + item.id
: '/pages/special/details?id=' + item.id;
// this.$util.checkLogin(() => {
uni.navigateTo({
url,
});
// }, this.showLoginPage);
},
handleOfflineClick(item) {
uni.navigateTo({
url: `/pages/special/offline_details?id=${item.id}`,
});
},
9 months ago
checkRecord() {
uni.navigateTo({
url: '/pages/learningCenter/clockRecord',
})
},
changeCate() {
this.$util.checkLogin(() => {
uni.navigateTo({
url: '/pages/store/goodsCate?type=learning'
});
}, true)
},
toMoreCourse() {
uni.navigateTo({
url: `/pages/special/search?gradeId=${this.myExam.grade_id}&subjectId=${this.myExam.subject_id}`
})
},
9 months ago
},
};
</script>
<style>
page{
background: #F7F8F9;
}
</style>
<style lang="scss" scoped>
.learning {
background: #F4F4F4;
padding-bottom: 40rpx;
.learning-box {
padding: calc(20rpx + var(--safe-top)) 30rpx 0;
/* #ifdef MP-WEIXIN */
padding: calc(60rpx + var(--safe-top)) 30rpx 0;
/* #endif */
}
.my-exam {
width: 690rpx;
height: 175rpx;
background-color: #F6FBFE;
box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(68,68,68,0.04);
border-radius: 10rpx;
margin: 26rpx auto 0;
background-repeat: no-repeat;
background-position: center right;
background-size: auto 100%;
align-items: center;
padding: 0 36rpx 0 46rpx;
position: relative;
>image {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 0;
width: 301rpx;
height: 175rpx;
}
.exam-left {
height: 100%;
flex-direction: column;
justify-content: center;
font-size: 28rpx;
height: #333;
position: relative;
z-index: 10;
.exam-name {
margin-bottom: 24rpx;
align-items: center;
text {
color: #0F74BB;
}
image {
width: 29rpx;
height: 27rpx;
}
}
text {
margin-right: 8rpx;
margin-left: 20rpx;
}
}
.exam-right {
width: 108rpx;
height: 94rpx;
background: #fff;
box-shadow: 0rpx 5rpx 4rpx 0rpx rgba(68,68,68,0.03);
border-radius: 10rpx;
text-align: center;
margin-left: auto;
position: relative;
z-index: 10;
.exam-days-title {
background: #FF9500;
border-radius: 10rpx 10rpx 20rpx 0rpx;
height: 39rpx;
width: 100%;
line-height: 39rpx;
font-size: 22rpx;
color: #fff;
}
.exam-days-value {
height: 55rpx;
line-height: 55rpx;
color: #FF9A0C;
font-size: 20rpx;
text {
font-size: 30rpx;
}
}
}
}
.learning-info {
width: 690rpx;
height: 234rpx;
background: #fff;
border-radius: 10rpx;
margin: 20rpx auto 0;
padding: 40rpx 30rpx 37rpx 40rpx;
justify-content: space-between;
.info-item {
justify-content: space-between;
flex-direction: column;
.item-title {
color: #333;
font-size: 28rpx;
}
.item-value {
font-size: 20rpx;
color: #999;
text {
font-size: 40rpx;
}
}
.item-rank {
font-size: 24rpx;
color: #666;
}
}
}
.sign-record {
width: 690rpx;
margin: 50rpx auto 0;
.record-content {
margin-top: 30rpx;
width: 100%;
height: 240rpx;
background: #fff;
border-radius: 10rpx;
padding: 0 23rpx 0 30rpx;
justify-content: space-between;
align-items: center;
.content-left {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 100%;
padding: 38rpx 0 42rpx;
>view {
display: flex;
align-items: center;
font-size: 28rpx;
&:not(:last-child) {
width: 320rpx;
color: #333;
image {
width: 30rpx;
height: 30rpx;
margin-left: auto;
}
}
&:last-child {
color: #999;
.progress-bg {
position: relative;
background: #f5f5f5;
width: 180rpx;
height: 28rpx;
border-radius: 14rpx;
margin: 0 50rpx 0 10rpx;
.progress {
position: absolute;
top: 0;
left: 0;
height: 28rpx;
border-radius: 14rpx;
background: #FF9500;
}
}
.progress-percent {
color: #FF9500;
}
}
}
}
.content-right {
margin-left: auto;
width: 150rpx;
height: 50rpx;
background: linear-gradient(183deg, #48D9A2, #0CC57F);
border-radius: 25rpx;
color: #fff;
font-size: 28rpx;
text-align: center;
line-height: 50rpx;
}
}
}
.practice {
width: 690rpx;
height: 110rpx;
background-color: #fff;
box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(68,68,68,0.04);
border-radius: 10rpx;
margin: 18rpx auto 0;
align-items: center;
justify-content: space-between;
padding: 0 23rpx 0 29rpx;
font-size: 28rpx;
color: #333;
text {
width: 150rpx;
height: 50rpx;
border-radius: 25rpx;
border: 1px solid #2DD092;
font-size: 28rpx;
color: #28CE8F;
line-height: 50rpx;
text-align: center;
}
}
.tab-container {
margin: 50rpx auto 0;
width: 690rpx;
.tab-content {
margin-top: 30rpx;
background: #fff;
flex-wrap: wrap;
padding-top: 30rpx;
border-radius: 10rpx;
.tab-item {
width: 25%;
font-size: 24rpx;
line-height: 24rpx;
font-weight: 400;
color: #666;
margin-bottom: 50rpx;
display: flex;
flex-direction: column;
align-items: center;
>image {
width: 94rpx;
height: 94rpx;
margin-bottom: 11rpx;
}
>view {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
.special-content {
margin-top: 50rpx;
}
.content-title {
padding-left: 23rpx;
position: relative;
color: #333;
font-size: 34rpx;
line-height: 34rpx;
margin-bottom: 33rpx;
&:before {
content: '';
background: linear-gradient(0deg, #24a9e1, #0f74bb);
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
width: 8rpx;
height: 26rpx;
border-radius: 4rpx;
}
.more-content {
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
color: #999;
font-size: 24rpx;
}
}
}
swiper {
/deep/ {
.wx-swiper-dots-horizontal,
.uni-swiper-dots-horizontal {
left: 70%;
bottom: 60rpx;
}
.wx-swiper-dot,
.uni-swiper-dot {
width: 12rpx;
height: 8rpx;
background: #8ab1ff;
border-radius: 4rpx;
float: left;
}
.wx-swiper-dot-active,
.uni-swiper-dot-active {
width: 24rpx;
height: 8rpx;
background: #FFFFFF !important;
border-radius: 4rpx;
}
}
}
.swiper-box {
/* #ifndef MP-TOUTIAO */
height: 306rpx;
/* #endif */
}
.custom-banner {
width: 690rpx;
height: 290rpx;
margin: 0 auto;
overflow: hidden;
}
.swiper-item {
padding: 30rpx 0;
}
.swiper-item image {
width: 100%;
height: 100%;
}
</style>