收藏老师

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>进度 <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="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>
<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> </view>
<view v-for="(item, index) in learningData.exam_list" class="practice flex"> <view v-for="(item, index) in learningData.exam_list" class="practice flex">
@ -333,7 +333,6 @@ page{
.record-content { .record-content {
margin-top: 30rpx; margin-top: 30rpx;
width: 100%; width: 100%;
height: 240rpx;
background: #fff; background: #fff;
border-radius: 10rpx; border-radius: 10rpx;
padding: 0 23rpx 0 30rpx; padding: 0 23rpx 0 30rpx;

@ -4,11 +4,11 @@
<NavBarTitle title="我的收藏" :height="88"/> <NavBarTitle title="我的收藏" :height="88"/>
<view v-if="type" ref="tabbar" class="tabbar"> <view v-if="type" ref="tabbar" class="tabbar">
<view :class="{ on: active === 1 }" @click="tab(1)">资料</view> <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 :class="{ on: active === 0 }" @click="tab(0)">课程</view>
</view> </view>
<view v-if="makeGradeList.length" :class="{ material: active }" class="list"> <view v-if="makeGradeList.length" :class="{ material: active }" class="list">
<template> <template v-if="active < 2">
<navigator <navigator
v-for="(item, index) in makeGradeList" v-for="(item, index) in makeGradeList"
:key="item.id" :key="item.id"
@ -60,6 +60,35 @@
</navigator> </navigator>
</template> </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>
<view v-show="loading" class="loading"> <view v-show="loading" class="loading">
<text class="fa fa-spinner"></text> <text class="fa fa-spinner"></text>
@ -82,8 +111,11 @@
<script> <script>
import { toggleCollectMaterial } from "@/api/material"; import { toggleCollectMaterial } from "@/api/material";
import { collectSpecial } from "@/api/special"; import { collectSpecial, getGradeList } from "@/api/special";
import { getGradeList } from "@/api/special"; import {
getFollowList,
follow
} from "@/api/merchant";
import specialType from "@/constants/special-type"; import specialType from "@/constants/special-type";
export default { export default {
@ -107,15 +139,19 @@ export default {
if (this.type) { if (this.type) {
value.types = specialType[value.type]; value.types = specialType[value.type];
} }
if ("is_light" in value) { if (this.active < 2) {
if (value.is_light) { if ("is_light" in value) {
value.path = `/pages/special/single_details?id=${value.s_id}`; if (value.is_light) {
} else { value.path = `/pages/special/single_details?id=${value.s_id}`;
value.path = `/pages/special/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/special/data_details?id=${value.id}`;
}
} else {
value.path = `/pages/merchant/teacher_detail?id=${value.id}`;
}
return value; return value;
}); });
}, },
@ -145,18 +181,30 @@ export default {
this.loading = true; this.loading = true;
uni.showLoading({ mask: true }); uni.showLoading({ mask: true });
try { try {
const { data } = await getGradeList(this.active, this.page, this.limit); if (this.active < 2) {
const { list, page } = data; const { data } = await getGradeList(this.active, this.page, this.limit);
this.gradeList.push.apply(this.gradeList, list); const { list, page } = data;
this.loadend = list.length < this.limit; this.gradeList.push.apply(this.gradeList, list);
this.page = page; this.loadend = list.length < this.limit;
this.$set(this, "gradeList", this.gradeList); this.page = page;
uni.hideLoading(); this.$set(this, "gradeList", this.gradeList);
} catch (err) {} } else {
const { data } = await getFollowList({
this.loading = false; page: this.page++,
uni.hideLoading(); 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) { tab(active) {
if (this.loading) return; if (this.loading) return;
@ -209,6 +257,17 @@ export default {
this.loadend = false; this.loadend = false;
this.getGradeList(); 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 { } else {
collectSpecial(item.id) collectSpecial(item.id)
.then(() => { .then(() => {
@ -263,6 +322,40 @@ page{
.list-item { .list-item {
position: relative; position: relative;
background: #ffffff; 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 { .function-mask {
position: absolute; position: absolute;
left: 0; left: 0;

Loading…
Cancel
Save