收藏老师

feature/v-xuexi
wangdong 10 months ago
parent 028ff69d0d
commit 37ad3ae3d0
  1. 3
      pages/learning/index.vue
  2. 143
      pages/special/grade_list.vue

@ -54,7 +54,7 @@
</view>
<view>进度 <view class="progress-bg"><text class="progress" :style="{width: `${learningData.user_clock_in.progress}%` }"></text></view> <text class="progress-percent">{{ learningData.user_clock_in.progress }}%</text> </view>
</view>
<view class="content-right" :style="{ background: learningData.user_clock_in.list === 0 ? '#0F74BB' : '' }">{{ learningData.user_clock_in.list.length > 0 ? '已打卡' : '待打卡'}}</view>
<view class="content-right" :style="{ background: learningData.user_clock_in.list.length === 0 ? '#0F74BB' : '' }">{{ learningData.user_clock_in.list.length > 0 ? '已打卡' : '待打卡'}}</view>
</view>
</view>
<view v-for="(item, index) in learningData.exam_list" class="practice flex">
@ -333,7 +333,6 @@ page{
.record-content {
margin-top: 30rpx;
width: 100%;
height: 240rpx;
background: #fff;
border-radius: 10rpx;
padding: 0 23rpx 0 30rpx;

@ -4,11 +4,11 @@
<NavBarTitle title="我的收藏" :height="88"/>
<view v-if="type" ref="tabbar" class="tabbar">
<view :class="{ on: active === 1 }" @click="tab(1)">资料</view>
<!-- <view :class="{ on: active === 2 }" @click="tab(2)">老师</view> -->
<view :class="{ on: active === 2 }" @click="tab(2)">老师</view>
<view :class="{ on: active === 0 }" @click="tab(0)">课程</view>
</view>
<view v-if="makeGradeList.length" :class="{ material: active }" class="list">
<template>
<template v-if="active < 2">
<navigator
v-for="(item, index) in makeGradeList"
:key="item.id"
@ -60,6 +60,35 @@
</navigator>
</template>
<template v-else>
<navigator
v-for="(item, index) in makeGradeList"
:key="item.id"
:url="item.path"
ref="box_center"
class="list-item lecturer-item"
@touchstart="drawStart"
@touchmove="drawMove(index,$event)"
@touchend="drawEnd(index,$event)"
:style="{ left: activeHeaderMask === index ? '-120rpx' : '' }"
>
<view>
<image mode="aspectFill" :src="item.lecturer_head" alt="" />
<!-- <view v-if="!active">{{ type == 1 ? item.types : item.type }}</view> -->
</view>
<view class="function-mask" :style="{visibility: activeHeaderMask === index ? 'visible' : 'hidden' }" @click.stop="activeHeaderMask = -1"></view>
<view class="function">
<view class="btn" @click.stop="cancelCollect(item)">取消收藏</view>
</view>
<view>
<view class="lecturer-name">{{ item.lecturer_name }} <text v-for="(label, k) in item.label" class="label">{{ label }}</text></view>
<template>
<view class="lecturer-intro">{{ item.explain }}</view>
</template>
</view>
</navigator>
</template>
</view>
<view v-show="loading" class="loading">
<text class="fa fa-spinner"></text>
@ -82,8 +111,11 @@
<script>
import { toggleCollectMaterial } from "@/api/material";
import { collectSpecial } from "@/api/special";
import { getGradeList } from "@/api/special";
import { collectSpecial, getGradeList } from "@/api/special";
import {
getFollowList,
follow
} from "@/api/merchant";
import specialType from "@/constants/special-type";
export default {
@ -107,15 +139,19 @@ export default {
if (this.type) {
value.types = specialType[value.type];
}
if ("is_light" in value) {
if (value.is_light) {
value.path = `/pages/special/single_details?id=${value.s_id}`;
} else {
value.path = `/pages/special/details?id=${value.s_id}`;
}
} else {
value.path = `/pages/special/data_details?id=${value.id}`;
}
if (this.active < 2) {
if ("is_light" in value) {
if (value.is_light) {
value.path = `/pages/special/single_details?id=${value.s_id}`;
} else {
value.path = `/pages/special/details?id=${value.s_id}`;
}
} else {
value.path = `/pages/special/data_details?id=${value.id}`;
}
} else {
value.path = `/pages/merchant/teacher_detail?id=${value.id}`;
}
return value;
});
},
@ -145,18 +181,30 @@ export default {
this.loading = true;
uni.showLoading({ mask: true });
try {
const { data } = await getGradeList(this.active, this.page, this.limit);
const { list, page } = data;
this.gradeList.push.apply(this.gradeList, list);
this.loadend = list.length < this.limit;
this.page = page;
this.$set(this, "gradeList", this.gradeList);
uni.hideLoading();
} catch (err) {}
this.loading = false;
uni.hideLoading();
try {
if (this.active < 2) {
const { data } = await getGradeList(this.active, this.page, this.limit);
const { list, page } = data;
this.gradeList.push.apply(this.gradeList, list);
this.loadend = list.length < this.limit;
this.page = page;
this.$set(this, "gradeList", this.gradeList);
} else {
const { data } = await getFollowList({
page: this.page++,
limit: this.limit
});
data.forEach(function (item) {
item.label = JSON.parse(item.label);
});
this.gradeList.push.apply(this.gradeList, data);
this.loadend = data.length < this.limit;
this.$set(this, "gradeList", this.gradeList);
console.log(data);
}
uni.hideLoading();
} catch (err) {}
this.loading = false;
},
tab(active) {
if (this.loading) return;
@ -209,6 +257,17 @@ export default {
this.loadend = false;
this.getGradeList();
});
} else if (this.active === 2) {
follow({
mer_id: item.mer_id,
is_follow: 0
}).then(() => {
this.$util.showMsg("取消收藏成功");
this.$set(this, "gradeList", []);
this.page = 1;
this.loadend = false;
this.getGradeList();
})
} else {
collectSpecial(item.id)
.then(() => {
@ -263,6 +322,40 @@ page{
.list-item {
position: relative;
background: #ffffff;
&.lecturer-item {
image {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
}
.lecturer-name {
display: flex;
flex-wrap: wrap;
margin-bottom: 14rpx;
.label {
height: 39rpx;
background: #FFEDE9;
border-radius: 6rpx;
padding: 0 14rpx;
display: flex;
align-items: center;
color: #FF4B33;
font-size: 22rpx;
margin-left: 12rpx;
}
}
.lecturer-intro {
color: #999999!important;
font-size: 24rpx!important;
font-weight: normal!important;
max-height: 60rpx;
line-height: 30rpx;
-webkit-line-clamp: 2;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
}
}
.function-mask {
position: absolute;
left: 0;

Loading…
Cancel
Save