Commit 3c550bcf authored by Mac's avatar Mac

我的学习

parent 3fe53dfe
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
Name: '', Name: '',
GoodsType: 0, GoodsType: 0,
CategoryIds: '', CategoryIds: '',
OrderBy: 0, OrderBy: 1,
GoodsPageType:0 GoodsPageType:0
}, },
newsortType: 1, newsortType: 1,
......
...@@ -135,6 +135,8 @@ ...@@ -135,6 +135,8 @@
}); });
this.mc = this.$uiConfig.mainColor; this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary; this.secondary = this.$uiConfig.secondary;
let MallBaseId = uni.getStorageSync("mall_UserInfo").MallBaseId ? uni.getStorageSync("mall_UserInfo").MallBaseId: 1;
this.action = this.host2+'/api/File/UploadTencent?MallBaseId='+MallBaseId
}, },
methods: { methods: {
uploadSuccessHandler(data, index, lists) { uploadSuccessHandler(data, index, lists) {
......
...@@ -72,6 +72,8 @@ ...@@ -72,6 +72,8 @@
this.mainColor = this.$uiConfig.mainColor; this.mainColor = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary; this.secondary = this.$uiConfig.secondary;
// this.init() // this.init()
let MallBaseId = uni.getStorageSync("mall_UserInfo").MallBaseId ? uni.getStorageSync("mall_UserInfo").MallBaseId: 1;
this.action = this.host2+'/api/File/UploadTencent?MallBaseId='+MallBaseId
}, },
mounted() { mounted() {
let currentPages = getCurrentPages(); let currentPages = getCurrentPages();
......
...@@ -169,6 +169,8 @@ export default { ...@@ -169,6 +169,8 @@ export default {
}); });
this.btn2.background = this.$uiConfig.mainColor; this.btn2.background = this.$uiConfig.mainColor;
this.init(); this.init();
let MallBaseId = uni.getStorageSync("mall_UserInfo").MallBaseId ? uni.getStorageSync("mall_UserInfo").MallBaseId: 1;
this.action = this.host2+'/api/File/UploadTencent?MallBaseId='+MallBaseId
}, },
methods: { methods: {
init() { init() {
......
...@@ -97,6 +97,8 @@ export default { ...@@ -97,6 +97,8 @@ export default {
}); });
this.mc = this.$uiConfig.mainColor; this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary; this.secondary = this.$uiConfig.secondary;
let MallBaseId = uni.getStorageSync("mall_UserInfo").MallBaseId ? uni.getStorageSync("mall_UserInfo").MallBaseId: 1;
this.action = this.host2+'/api/File/UploadTencent?MallBaseId='+MallBaseId
}, },
methods: { methods: {
uploadSuccessHandler(data, index, lists) { uploadSuccessHandler(data, index, lists) {
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
@error="videoErrorCallback" controls duration='selectcourse.VideoTime'></video> @error="videoErrorCallback" controls duration='selectcourse.VideoTime'></video>
</view> </view>
<view class="course-t"> <view class="course-t">
<button open-type="share" class="course-t-item"> <view class="course-t-item">
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/fengx.png" class="share-icon" /> <image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/fengx.png" class="share-icon" />
<text>分享</text> <text>分享</text>
</button> </view>
<view class="course-t-item" @click="setFavorite"> <view class="course-t-item" @click="setFavorite">
<u-icon :name="favorite ? 'like' : 'like-o'" size="44" :color="favorite ? pricecolor : '#333'"></u-icon> <u-icon :name="favorite ? 'like' : 'like-o'" size="44" :color="favorite ? pricecolor : '#333'"></u-icon>
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/huanc.png" class="share-icon" /> <image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/huanc.png" class="share-icon" />
<text>缓存</text> <text>缓存</text>
</view> </view>
<button style="width: 33.3%;height: 80%;position: absolute;left: 0,top:0;opacity: 0;" open-type="share"></button>
</view> </view>
<view style="width: 100%;height: 15px;background: #FAF8F9;"></view> <view style="width: 100%;height: 15px;background: #FAF8F9;"></view>
<view class="title"> <view class="title">
...@@ -52,11 +53,22 @@ ...@@ -52,11 +53,22 @@
<view class="goback" @click="goback" :style="{'padding-top':paddingHTop}"> <view class="goback" @click="goback" :style="{'padding-top':paddingHTop}">
<u-icon name="arrow-left" size="48" color="#fff"></u-icon> <u-icon name="arrow-left" size="48" color="#fff"></u-icon>
</view> </view>
<coupon
v-if="showCoupons"
:coupon-message="couponMessage"
@goLook="goLook"
@closeBtn="closeBtn"
></coupon>
</view> </view>
</template> </template>
<script> <script>
import coupon from "@/components/coupons/coupons";
export default { export default {
components: {
coupon,
},
data(){ data(){
return{ return{
mc:'', mc:'',
...@@ -69,6 +81,9 @@ ...@@ -69,6 +81,9 @@
name:'', name:'',
selectcourse:{}, selectcourse:{},
favorite:false,//是否收藏 favorite:false,//是否收藏
timer:null,
showCoupons: false,
couponMessage: "",
} }
}, },
onLoad(options) { onLoad(options) {
...@@ -79,6 +94,11 @@ ...@@ -79,6 +94,11 @@
this.name = options.name this.name = options.name
this.getGoodsCourseList()//获取课程目录 this.getGoodsCourseList()//获取课程目录
this.getAppletCourseCollect()//获取课程是否收藏 this.getAppletCourseCollect()//获取课程是否收藏
this.setMyStudyTime()//增加课程学习时间
this.timer = setInterval(()=>{
this.setMyStudyTime(10)
},10000)
} }
// 多反了个字段 IsRead 是否已学习, 1是 2否 // 多反了个字段 IsRead 是否已学习, 1是 2否
}, },
...@@ -89,7 +109,34 @@ ...@@ -89,7 +109,34 @@
this.nav = uni.getMenuButtonBoundingClientRect().top; this.nav = uni.getMenuButtonBoundingClientRect().top;
this.paddingHTop = this.nav +'px'; this.paddingHTop = this.nav +'px';
}, },
onUnload(){//监听页面卸载
if(this.timer) {
clearInterval(this.timer);
this.timer = null;
console.log('清楚定时器')
}
},
methods:{ methods:{
onShareAppMessage() {
setTimeout(() => {
console.log("分享朋友调用");
this.getReceive();
}, 2500);
let u = uni.getStorageSync("mall_UserInfo");
let uid = u.UserId ? u.UserId : 0;
if(uid==0){
uid = uni.getStorageSync("pid")?uni.getStorageSync("pid").pid:0
}
let SmallShopId = u.SmallShopId ? u.SmallShopId : 0;
if(SmallShopId == 0){//如果微店id为0 去找所属微店id
SmallShopId = u.UserSmallShopId? u.UserSmallShopId:0
}
return {
title: this.name,
path: "/pages/index/index?id=" + this.id + "&user_id=" + uid+ "&SmallShopId=" + SmallShopId+ "&Up=" + this.Up+'&JumpType=5',
imageUrl: ''
};
},
goback(){ goback(){
uni.navigateBack({}) uni.navigateBack({})
}, },
...@@ -100,7 +147,8 @@ ...@@ -100,7 +147,8 @@
}, },
res => { res => {
this.courseList = res.data.pageData; this.courseList = res.data.pageData;
this.selectcourse=this.courseList[this.index] this.selectcourse=this.courseList[this.index];
this.setMyCourseStudyOK()//课程已阅读
} }
); );
}, },
...@@ -136,7 +184,50 @@ ...@@ -136,7 +184,50 @@
gocourse(item,index){ gocourse(item,index){
this.index = index; this.index = index;
this.selectcourse=item this.selectcourse=item
this.setMyCourseStudyOK()//在换章节的时候标记
},
setMyStudyTime(time=1){
this.request2({
url: '/api/AppletEducation/SetMyStudyTime',
data: {GoodsId: this.id,Time:time}
},
res => { }
);
},
setMyCourseStudyOK(){
this.request2({
url: '/api/AppletEducation/SetMyCourseStudyOK',
data: {GoodsId: this.id,CourseId:this.selectcourse.Id}
},
res => { }
);
},
getReceive() {
//分享进入调取领券接口
// 1-分享,2-购买并付款
this.request2(
{
url: "/api/AppletUser/ShareCoupon",
data: {
TriggerType: 1,
},
},
(res) => {
if (res.couponResultCode == 1) {
this.couponMessage = res.couponMessage;
this.showCoupons = true;
}
}
);
},
goLook() {
this.showCoupons = true;
uni.navigateTo({
url: "/pages/coupon/index/index",
});
},
closeBtn() {
this.showCoupons = false;
}, },
} }
} }
...@@ -162,6 +253,7 @@ ...@@ -162,6 +253,7 @@
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
height: 80px; height: 80px;
position: relative;
} }
.courseContent .course-t-item{ .courseContent .course-t-item{
width: 33.3%; width: 33.3%;
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="studyB-lately"> <view class="studyB-lately" @click="gorecord()">
<text style="font-size: 16px;color: #1B1D1E;">最近学习</text> <text style="font-size: 16px;color: #1B1D1E;">最近学习</text>
<view style="display: flex;flex-direction: row;align-items: center;"> <view style="display: flex;flex-direction: row;align-items: center;">
<text style="font-size: 12px;color: #999999;">更多</text> <text style="font-size: 12px;color: #999999;">更多</text>
...@@ -52,21 +52,51 @@ ...@@ -52,21 +52,51 @@
</view> </view>
</view> </view>
</view> </view>
<view style="display: flex;width:100%;flex-direction: row;overflow-x: auto;padding-bottom: 15px;background: #FFF;"> <view style="display: flex;width:100%;flex-direction: row;overflow-x: auto;padding-bottom: 15px;background: #FFF;" v-if="RecentStudy.length>0">
<view class="latelybox-item" v-for="(item,index) in RecentStudy" :key="index" :style="{'margin-right':RecentStudy.length==index+1?'15px':'0'}"> <view v-for="(item,index) in RecentStudy" :key="index">
<image style="width: 134px; height: 75px;border-radius: 4px;" mode="aspectFill" :src="item.CarouselImage" /> <view class="latelybox-item" :style="{'margin-right':RecentStudy.length==index+1?'15px':'0'}" @click="gocourse(item)">
<view style="height: 30px;line-height: 30px;width: 134px;padding: 0 5px;"> <image style="width: 134px; height: 75px;border-radius: 4px;" mode="aspectFill" :src="item.CarouselImage" />
<text class="name">{{item.GoodsName}}</text> <view style="height: 30px;line-height: 30px;width: 134px;padding: 0 5px;">
<text class="name">{{item.GoodsName}}</text>
</view>
</view>
</view>
</view>
<view style="width: 100%;background: #FFF;" v-if='RecentStudy.length==0'>
<u-empty text="暂无学习内容" mode="list"></u-empty>
</view>
<view style="padding:0 15px;background: #FFF;width: 100%;">
<view class="studyB-lately" @click="gosignup()">
<text style="font-size: 16px;color: #1B1D1E;">报名记录</text>
<view style="display: flex;flex-direction: row;align-items: center;">
<text style="font-size: 12px;color: #999999;">更多</text>
<u-icon name="arrow" size='20' color='#A5A3AB'></u-icon>
</view>
</view>
<view style="width: 100%;" v-if="StudyRecord.length>0">
<view class="good" v-for="(cx, ci) in StudyRecord" :key="ci" @click="gocourse(cx)">
<view class="good-img">
<image mode="aspectFill" :src="cx.CarouselImage" style="width: 100%; height: 100%;border-radius: 4px;" ></image>
</view>
<view class="good-r" :style="{'width': (windowWidth -15 - 125 -26)+'px'}">
<view class="good-name">
{{ cx.GoodsName }}
</view>
<view class="good-r-b">
<text v-if="cx.SurplusNum==-1">未开始</text>
<text v-if="cx.SurplusNum==0">已看完</text>
<text v-if="cx.SurplusNum>0">剩余{{cx.SurplusNum}}章未学习</text>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
<view style="width: 100%;background: #FFF;" v-if="StudyRecord.length==0">
<u-empty text="暂无报名记录" mode="list"></u-empty>
</view>
</view> </view>
</view> </view>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth= 'goback'></auth> <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth= 'goback'></auth>
</view> </view>
</template> </template>
...@@ -97,6 +127,7 @@ ...@@ -97,6 +127,7 @@
current:0, current:0,
studyTime:{}, studyTime:{},
RecentStudy:[], RecentStudy:[],
StudyRecord:[],
} }
}, },
components: { components: {
...@@ -126,6 +157,7 @@ ...@@ -126,6 +157,7 @@
// this.init(); // this.init();
this.getMyStudyTime()//我的学习时间 this.getMyStudyTime()//我的学习时间
this.getMyRecentStudyPageList()//最近学习 this.getMyRecentStudyPageList()//最近学习
this.getMyOrderStudyRecordPageList()//我的报名记录列表
} }
}, },
methods:{ methods:{
...@@ -154,32 +186,38 @@ ...@@ -154,32 +186,38 @@
}, },
res => { res => {
this.RecentStudy = res.data.pageData this.RecentStudy = res.data.pageData
this.RecentStudy =[{ }
"GoodsId":367486,
"GoodsName":"计算机基础 大学英语 1A 大学英语 1B 中国近现代史纲要 高等数学(工) 现在报名超值优惠大礼包等着你~",
"CarouselImage":"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/1601448769000_118.jpg"
},
{
"GoodsId":367485,
"GoodsName":"大东第一课1",
"CarouselImage":"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/1599208676000_42.jpeg"
},{
"GoodsId":367486,
"GoodsName":"计算机基础 大学英语 1A 大学英语 1B 中国近现代史纲要 高等数学(工) 现在报名超值优惠大礼包等着你~",
"CarouselImage":"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/1601448769000_118.jpg"
},{
"GoodsId":367486,
"GoodsName":"计算机基础 大学英语 1A 大学英语 1B 中国近现代史纲要 高等数学(工) 现在报名超值优惠大礼包等着你~",
"CarouselImage":"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/1601448769000_118.jpg"
},]
}
); );
}, },
getMyOrderStudyRecordPageList(){
this.request2({
url: '/api/AppletEducation/GetMyOrderStudyRecordPageList',
data: {pageIndex:1,pageSize:5}
},
res => {
this.StudyRecord = res.data.pageData;
}
);
},
change(val){ change(val){
console.log(val)
this.current = val this.current = val
},
gocourse(item){//跳到学习界面
uni.navigateTo({
url:'/pages/school/courseContent?id='+item.GoodsId+'&name='+item.GoodsName+'&index=0'
})
},
gorecord(){//跳到学习记录
uni.navigateTo({
url:'/pages/school/mystudy/studyrecord'
})
},
gosignup(){//跳到报名记录
uni.navigateTo({
url:'/pages/school/mystudy/orderStudy'
})
} }
} }
} }
...@@ -221,6 +259,7 @@ ...@@ -221,6 +259,7 @@
.mystudy .plot{ .mystudy .plot{
width: 100%; width: 100%;
height: 160px; height: 160px;
} }
.mystudy .studyB-b{ .mystudy .studyB-b{
width: 100%; width: 100%;
...@@ -293,5 +332,45 @@ ...@@ -293,5 +332,45 @@
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 1; -webkit-line-clamp: 1;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
}
.mystudy .good{
background: #fff;
padding: 10px 0;
display: flex;
flex-direction: row;
font-family: aa;
}
.mystudy .good-r-b{
font-size: 11px;
color: #9A9A9A;
}
.mystudy .good-img{
width: 125px;
height: 70px;
border-radius: 4px;
box-shadow:0 4px 10px 1px #D2D2D2;
}
.mystudy .good-r{
margin-left: 15px;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 3px;
}
.mystudy .good .good-name {
/* height: 37px; */
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
margin-bottom: 3px;
font-size: 14px;
color: #1B1D1E;
}
.u-empty{
padding-top: 0 !important;
} }
</style> </style>
<template>
<view class="orderStudy" :style="{ height: contentHeight }">
<u-empty v-if="g.length == 0" text="暂无相关学习卡" mode="list"></u-empty>
<view
v-if="g.length > 0"
style="
height: calc(100vh);
width: calc(100vw);
overflow: hidden;
padding-bottom: 50px;
"
>
<scroll-view
:scroll-y="true"
:enable-back-to-top="true"
:enable-flex="true"
@scrolltolower="lower"
:style="{ height: '100%' }"
>
<view class="details">
<view class="item" v-for="(x, i) in g" :key="i" @click="gocourse(x)">
<view class="ticket">
<image mode="aspectFill" :src="x.CarouselImage" style="width: 100%; height: 100%;border-top-left-radius: 5px;border-bottom-left-radius: 5px;" ></image>
</view>
<view class="detail">
<view class="coupond">
<view class="name">{{x.GoodsName}}</view>
<view class="rule">
<text v-if="x.SurplusNum==-1">未开始</text>
<text v-if="x.SurplusNum==0">已看完</text>
<text v-if="x.SurplusNum>0">剩余{{x.SurplusNum}}章未学习</text>
</view>
</view>
</view>
</view>
</view>
<u-loadmore
:status="status"
:load-text="loadText"
:font-size="24"
:margin-top="20"
:margin-bottom="20"
bg-color="#FFF"
/>
</scroll-view>
</view>
<!-- 加载中 -->
<view class="loading" v-if="loading">
<u-loading mode="flower" size="48">></u-loading>
<Text style="color: #fff; margin-top: 10rpx;">加载中...</Text>
</view>
<!-- 取消提示 -->
<u-toast ref="uToast" />
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth= 'gbAuth'></auth>
</view>
</template>
<script>
import auth from "@/components/auth/index.vue";
export default {
components: {
auth
},
data() {
return {
pageTitle: "报名记录",
showAuth:false,
u:{},
mainColor: "",
contentHeight: 0,
msg:{
pageIndex: 1,
pageSize:10,
},
page_count: 1,
g: [],
loading: false,
status: "loadmore",
loadText: {
loadmore: "轻轻上拉,加载更多",
loading: "努力加载中",
nomore: "没有更多了",
},
};
},
created() {
this.contentHeight = this.$utils.calcContentHeight(-40) + "px";
this.mainColor = this.$uiConfig.mainColor;
},
mounted() {
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
onLoad: function (option) {
this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) {
this.u = {
nickName: "未登录",
avatarUrl: ""
};
this.showAuth = true;
} else{
this.init();
}
},
methods: {
init() {
this.msg.SmallShopId = this.u.UserSmallShopId
this.request2(
{
url: '/api/AppletEducation/GetMyOrderStudyRecordPageList',
data: this.msg
},
res => {
if(res.resultCode==1){
this.loading = false;
this.g = this.g.concat(res.data.pageData);
this.page_count = res.data.pageCount;
if (this.page_count == 1) {
this.status = "nomore";
}
}
}
);
},
lower(e) {
if (this.msg.pageIndex < this.page_count) {
this.msg.pageIndex++;
this.status = "loading";
this.init();
} else {
this.status = "nomore";
}
},
gocourse(item){
uni.navigateTo({
url:'/pages/school/courseContent?id='+item.GoodsId+'&name='+item.GoodsName+'&index=0'
})
},
reloadUserinfo() {
this.u = uni.getStorageSync("mall_UserInfo");
// this.showAuth=false;
this.init();
},
//关闭登录窗口
gbAuth(){
uni.navigateBack()
},
},
};
</script>
<style>
.orderStudy {
width: 100%;
height: 100%;
background: #FFF;
position: relative;
}
.orderStudy .loading {
width: 180rpx;
height: 180rpx;
background: #000000;
opacity: 0.7;
border-radius: 10rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: fixed;
left: 50%;
top: 30%;
margin-left: -100rpx;
z-index: 999;
}
.orderStudy .details{
padding: 15px;
display: flex;
flex-direction: column;
position: relative;
}
.orderStudy .item {
display: flex;
margin-bottom: 10px;
align-items: flex-start;
background: #fff;
border-radius: 5px;
box-shadow:0 4px 6px 1px rgba(76, 76, 76, 0.1);
}
.orderStudy .details .item .ticket {
width: 104px;
height: 78px;
}
.orderStudy .details .item .detail {
width: 1px;
flex: 1;
background: #fff;
padding: 10px;
display: flex;
align-items: center;
}
.orderStudy .details .item .detail .coupond {
flex: 1;
}
.orderStudy .details .item .detail .coupond .name {
font-size: 13px;
font-weight: 600;
color: #000;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.orderStudy .details .item .detail .coupond .date {
margin-top: 5px;
font-size: 11px;
color: #777;
}
.orderStudy .details .item .detail .coupond .rule{
font-size: 11px;
color:#777;
margin-top: 5px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.orderStudy .details .item .detail .chosen {
width: 60px;
height: 25px;
display: flex;
align-items: center;
justify-content: center;
font-size: 11px;
border-radius: 4px;
color: #FFF;
}
</style>
<template>
<view class="studyrecord">
<scroll-view
:scroll-y="true"
:enable-back-to-top="true"
:enable-flex="true"
@scrolltolower="lower"
:style="{ height: '100%' }">
<view
class="headStatus"
:style="[
headStyle,
]"
>
<view class="arrow" @click="goback">
<u-icon name="arrow-left" size="48" color="#FFF"></u-icon>
</view>
<view class="title" style="color: #FFF;" >我的学习记录</view>
<view class="arrow"></view>
</view>
<view class="studyBox">
<view class="plot"></view>
<view class="studyB-b">
<view class="s-b-time">
<view class="s-b-time-i" style="border-right: 1px solid #D8D8D8;">
<text>今日学习</text>
<view style="display: flex;flex-direction: row;align-items: flex-end;">
<text class="time">{{studyTime.ToDayTime.Time?studyTime.ToDayTime.Time:'0'}}</text>
<text class="unit">{{studyTime.ToDayTime.Unit?studyTime.ToDayTime.Unit:'分钟'}}</text>
</view>
</view>
<view class="s-b-time-i" style="border-right: 1px solid #D8D8D8;">
<text>连续学习</text>
<view style="display: flex;flex-direction: row;align-items: flex-end;">
<text class="time">{{studyTime.StydyDay?studyTime.StydyDay:'0'}}</text>
<text class="unit"></text>
</view>
</view>
<view class="s-b-time-i">
<text>累计学习</text>
<view style="display: flex;flex-direction: row;align-items: flex-end;">
<text class="time">{{studyTime.TotalTime.Time?studyTime.TotalTime.Time:'0'}}</text>
<text class="unit">{{studyTime.TotalTime.Unit?studyTime.TotalTime.Unit:'分钟'}}</text>
</view>
</view>
</view>
<view v-if="g.length==0">
<u-empty text="暂无学习记录" mode="list"></u-empty>
</view>
<view v-if="g.length>0">
<view style="width: 100%;margin-top: 30px;" v-for="(item, index) in g" :key="index" >
<view style="width: 100%;height: 30px;line-height: 30px;color: #1C1E1F;font-size: 13px;">{{item.Day}}</view>
<u-time-line>
<u-time-line-item v-for="(x, i) in item.list" :key="i" >
<!-- 此处没有自定义左边的内容,会默认显示一个点 -->
<template v-slot:node>
<view
class="u-node"
:style="{ background: mc, }"
></view
>
</template>
<template v-slot:content>
<view>
<view style="font-size: 11px;color: #9A9A9A;padding: 5px 0;">{{x.Hour}}</view>
<view class="time-l" @click="gocourse(x)">
<view class="ticket">
<image mode="aspectFill" :src="x.CarouselImage" style="width: 100%; height: 100%;" ></image>
</view>
<view class="detail">
<view class="coupond">
<view class="name">{{x.GoodsName}}</view>
</view>
</view>
</view>
</view>
</template>
</u-time-line-item>
</u-time-line>
</view>
</view>
</view>
</view>
<u-loadmore
:status="status"
:load-text="loadText"
:font-size="24"
:margin-top="20"
:margin-bottom="20"
bg-color="#FFF"
/>
</scroll-view>
</view>
</template>
<script>
export default {
data(){
return{
mc:'',
pricecolor:'',
secondary:'',
paddingHTop:0,
windowWidth:0,
scrollTop:0,
headStyle:{},
pageTitle:'学习记录',
studyTime:{},
page_count: 1,
g: [],
msg:{
pageIndex: 1,
pageSize:20,
},
loading: false,
status: "loadmore",
loadText: {
loadmore: "轻轻上拉,加载更多",
loading: "努力加载中",
nomore: "没有更多了",
},
}
},
onLoad(options) {
},
created() {
this.mc = this.$uiConfig.mainColor;
this.pricecolor = this.$uiConfig.pricecolor;
this.secondary = this.$uiConfig.secondary;
this.nav = uni.getMenuButtonBoundingClientRect().top;
this.paddingHTop = this.nav +'px';
this.windowWidth = this.$utils.SystemInfo().windowWidth;
this.headStyle.paddingTop = this.nav +'px';
this.getMyStudyTime()//我的学习时间
this.init()//获取最近学习详情列表
},
methods:{
goback(){
uni.navigateBack({})
},
reloadUserinfo() {
this.u = uni.getStorageSync("mall_UserInfo");
},
getMyStudyTime(){
this.request2({
url: '/api/AppletEducation/GetMyStudyTime',
data: {Day: 0}
},
res => {
this.studyTime = res.data
}
);
},
init(){
this.request2({
url: '/api/AppletEducation/GetMyStudyDetailPageList',
data: this.msg
},
res => {
let data = this.groupArr(res.data.pageData,'Day');
let data2 = data
if(this.g.length>0){
data2.forEach(x=>{
if(x.Day == this.g[this.g.length-1].Day){//判断当前第一条数据和已有的是否同一天 放在一起
console.log('进入一次')
this.g[this.g.length-1].list=this.g[this.g.length-1].list.concat(x.list);
data.splice(0,1)
}
})
}
this.g = this.g.concat(data);
this.page_count = res.data.pageCount;
if (this.page_count == 1) {
this.status = "nomore";
}
}
);
},
groupArr(list,field){
var fieldList = [],att=[];
list.map((e)=>{
fieldList.push(e[field])
})
//数组去重
fieldList = fieldList.filter((e,i,self)=>{
return self.indexOf(e)==i
})
for(var j=0;j<fieldList.length;j++){
//过滤出匹配到的数据
var arr = list.filter((e)=>{
return e.Day==fieldList[j];
})
att.push({
Day:arr[0].Day,
list:arr
})
}
return att;
},
lower(e) {
if (this.msg.pageIndex < this.page_count) {
this.msg.pageIndex++;
this.status = "loading";
this.init();
} else {
this.status = "nomore";
}
},
gocourse(item){//跳到学习界面
uni.navigateTo({
url:'/pages/school/courseContent?id='+item.GoodsId+'&name='+item.GoodsName+'&index=0'
})
},
}
}
</script>
<style>
.studyrecord {
width: 100%;
height: 100vh;
background: #FAF8F9;
}
.studyrecord .headStatus {
overflow: hidden;
position: relative;
width: 140vw;
padding-right: 40vw;
padding-bottom: 10px;
position: fixed;
left: 0;
right: 0;
top: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
background: #FFF;
background-image: url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/recordbanner.png');
background-repeat: no-repeat;
background-size: cover;
z-index: 999;
}
.studyrecord .arrow {
height: 24px;
margin: 5px;
width: 24px;
}
.studyrecord .studyBox{
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.studyrecord .plot{
width: 100%;
height: 223px;
background-image: url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/recordbanner.png');
background-repeat: no-repeat;
background-size: cover;
}
.studyrecord .studyB-b{
width: 100%;
padding: 15px;
background: #FFF;
border-top-left-radius:30px ;
border-top-right-radius: 30px;
margin-top: -37px;
}
.studyrecord .s-b-time{
width: 100%;
height: 102px;
border-radius: 10px;
background: #F5F5F7;
display: flex;
flex-direction: row;
align-items: center;
padding: 20px 0;
}
.studyrecord .s-b-time-i{
width: 33.2%;
display: flex;
flex-direction: column;
justify-content: space-between;
font-size: 13px;
color: #111111;
padding-left:20px ;
}
.studyrecord .s-b-time-i .time{
font-size: 28px;
color: #111111;
font-weight: 500;
}
.studyrecord .s-b-time-i .unit{
font-size: 12px;
color: #999999;
margin-bottom: 3px;
}
.studyrecord .studyB-lately{
width: 100%;
height: 40px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.studyrecord .time-l{
width: 100%;
height: 80px;
display: flex;
flex-direction: row;
align-items: center;
}
.studyrecord .u-node {
width: 24rpx;
height: 24rpx;
border-radius: 100rpx;
display: flex;
justify-content: center;
align-items: center;
}
.studyrecord .u-time-axis.data-v-bd98783e:before{
top: 32rpx;
}
.studyrecord .ticket {
width: 125px;
height: 70px;
border-radius: 4px;
overflow: hidden;
box-shadow:0 4px 6px 1px rgba(76, 76, 76, 0.1);
}
.studyrecord .detail {
width: 1px;
height: 70px;
flex: 1;
background: #fff;
padding:5px 10px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.studyrecord .detail .coupond {
flex: 1;
}
.studyrecord .detail .coupond .name {
font-size: 13px;
font-weight: 600;
color: #000;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
.u-empty{
padding-top: 0 !important;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment