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/merchant/institution_detail.vue

1110 lines
26 KiB

<template>
<BaseContainer :fixedNav="false">
<NavBarTitle :title="'机构详情'" />
<view class="teacher-detail">
<view class="header">
<view class="teacher">
<view class="inner">
<image :src="lecturer.lecturer_head" />
<view class="con">
<view class="name">
{{ lecturer.lecturer_name||'' }}
</view>
<view class="info">{{ lecturer.explain }}</view>
<navigator v-if="merId === lecturer.mer_id && lecturer.mer_id"
:url="`/pages/merchant/info?mer_id=${lecturer.mer_id}&type=2`" hover-class="none" class="info-btn">
查看信息
<i class="iconfont iconxiangyou"></i>
</navigator>
</view>
</view>
<button v-if="!(merId === lecturer.mer_id && lecturer.mer_id)" :class="{ followed: isFollow }" class="follow"
@click="follow"><i v-if="!isFollow" class="iconfont icontianjia"></i>{{ isFollow ? '已关注' : '关注'
}}</button>
<navigator v-if="merId === lecturer.mer_id && lecturer.mer_id"
:url="`/pages/spread/withdraw?mer_id=${lecturer.mer_id}&type=2`" hover-class="none" class="cash-btn">
<i class="iconfont icontixian"></i>
提现
</navigator>
</view>
<view class="tag-group">
<text v-for="label in lecturer.label" :key="label" class="tag">{{ label }}</text>
</view>
<view class="total-list" v-if="merId === lecturer.mer_id && lecturer.mer_id">
<view class="total-item">
<view>{{ total }}</view>
<navigator :url="`/pages/merchant/income?mer_id=${lecturer.mer_id}&type=2`" hover-class="none">
机构总收益
<i class="iconfont iconxiangyou"></i>
</navigator>
</view>
<view class="total-item">
<view>{{ today }}</view>
<view>机构今日收益</view>
</view>
<view class="total-item">
<view>{{ extract }}</view>
<navigator :url="`/pages/merchant/income?active=2&mer_id=${lecturer.mer_id}&type=2`" hover-class="none">
机构累计提现
<i class="iconfont iconxiangyou"></i>
</navigator>
</view>
<!-- <view class="total-item">
<view>{{ gold }}</view>
<navigator :url="`/pages/merchant/income?active=3&mer_id=${lecturer.mer_id}&type=2`" hover-class="none">
机构金币收益
<i class="iconfont iconxiangyou"></i>
</navigator>
</view> -->
</view>
</view>
<view class="main">
<view class="nav">
<view v-for="item in navList" :key="item.value" :class="{ active: navActive === item.value }" class="item"
@click="navActive = item.value">
{{ item.name }}
</view>
</view>
<mp-html v-if="navActive === 1" class="panel1" container-style="padding: 30rpx;background: #ffffff;"
:content="lecturer.introduction"></mp-html>
<view v-if="navActive === 2 && list.length" class="panel2">
<navigator v-for="item in list" :key="item.id" :url="
item.is_light
? `/pages/special/single_details`
: `/pages/special/details?id=${item.id}`
" class="item" hover-class="none">
<view class="item-hd">
<image :src="item.image" mode="aspectFit" />
<view v-if="item.type === 1 || item.light_type === 1" class="tag">图文</view>
<view v-else-if="item.type === 2 || item.light_type === 2" class="tag">
音频
</view>
<view v-else-if="item.type === 3 || item.light_type === 3" class="tag">
视频
</view>
<view v-else-if="item.type === 4" class="tag">直播</view>
<view v-else-if="item.type === 5" class="tag">专栏</view>
</view>
<view class="item-bd">
<view class="title">{{ item.title }}</view>
<view class="tag-group">
<text v-for="label in item.label" :key="label" class="tag">
{{ label }}
</text>
</view>
<view class="money">
¥<text>{{ item.money }}</text>
</view>
</view>
</navigator>
</view>
<view v-if="navActive === 3 && list.length" class="panel3">
<navigator v-for="item in list" :key="item.id" :url="`/pages/special/data_details?id=${item.id}`"
class="item" hover-class="none">
<view class="item-hd">
<image :src="item.image" mode="aspectFit" />
</view>
<view class="item-bd">
<view class="title">{{ item.title }}</view>
<view class="money">
¥<text>{{ item.money }}</text>
</view>
<view class="wrap">
<view class="people">{{ item.ficti + item.sales }}人已下载</view>
<view class="button">去下载</view>
</view>
</view>
</navigator>
</view>
<view v-if="navActive === 4 && list.length" class="panel4">
<navigator v-for="item in list" :key="item.id" :url="`/pages/activity/index?id=${item.id}`" hover-class="none"
class="item">
<view class="item-hd">
<image :src="item.image" />
</view>
<view class="item-bd">
<view class="title">{{ item.title }}</view>
<view class="time"><i class="iconfont iconshijian"></i>{{ item.time }}</view>
<view class="wrap">
<view class="money">
¥<text>{{ item.price }}</text>
</view>
<view class="people">{{ item.count }}人已报名</view>
</view>
</view>
</navigator>
</view>
<view v-if="navActive === 5 && list.length" class="panel5">
<navigator v-for="item in list" :key="item.id" :url="`/pages/store/detail?id=${item.id}`" class="item" hover-class="none">
<view class="item-hd">
<image :src="item.image" />
</view>
<view class="item-bd">
<view class="title">{{ item.store_name }}</view>
<view class="wrap">
<view class="money">
¥<text>{{ item.price }}</text>
</view>
<view class="sales">已售{{ item.sales }}件</view>
</view>
</view>
</navigator>
</view>
<!-- 练习 -->
<view v-if="navActive === 6 && list.length" class="problem">
<navigator v-for="item in list" :url="`/pages/topic/problem_index?id=${item.id}`" class="item" hover-class="none">
<view class="title">{{ item.title }}</view>
<view class="attribute">
<view>{{ item.fake_sales + item.answer }}人已答题</view>
<view class="button">练习</view>
</view>
</navigator>
</view>
<!-- 考试 -->
<view v-if="navActive === 7 && list.length" class="question">
<navigator v-for="item in list" :key="item.id" :url="`/pages/special/question_index?id=${item.id}`" hover-class="none"
class="item">
<view>
<image mode="aspectFill" :src="item.image" class="image" />
</view>
<view class="text">
<view class="title">{{ item.title }}</view>
<view class="attribute">
<view>共{{ item.item_number }}题</view>
<view class="button">答题</view>
</view>
</view>
</navigator>
</view>
<view v-if="!list.length && finished" class="empty">
<image mode="aspectFit" :src="getImgPath('/wap/first/zsff/images/empty.png')" />
<view>暂无{{ navCurrent }}</view>
</view>
</view>
</view>
</BaseContainer>
</template>
<script>
import {
getLecturerDownloadList,
getLecturerEventList,
getLecturerIncome,
getLecturerSpecialList,
getLecturerStoreList,
getInstitutionDetail,
getProblemList,
getQuestionList,
getIsFollow,
follow
} from "@/api/institution";
import mpHtml from "mp-html/dist/uni-app/components/mp-html/mp-html.vue";
export default {
components: {
mpHtml,
},
data() {
return {
isFollow: false,
lecturer: {},
business: {},
merId: 0,
extract: 0,
today: 0,
total: 0,
gold: 0,
navList: [
{
name: "简介",
value: 1,
},
{
name: "专题",
value: 2,
},
{
name: "资料",
value: 3,
},
{
name: "活动",
value: 4,
},
{
name: "商品",
value: 5,
},
{
name: '练习',
value: 6
},
{
name: '考试',
value: 7
},
],
navActive: 1,
page: 1,
limit: 16,
list: [],
finished: false,
id: 0,
type: ''
};
},
computed: {
navCurrent() {
for (let i = 0; i < this.navList.length; i++) {
if (this.navList[i].value === this.navActive) {
return this.navList[i].name;
}
}
},
},
watch: {
navActive() {
this.page = 1;
this.list = [];
this.finished = false;
this.getData();
},
},
onLoad({ id }) {
this.id = id
this.getInitData().then(() => {
this.lecturer_income();
this.getIsFollow()
});
},
onReachBottom() {
this.getData();
},
methods: {
getInitData() {
return getInstitutionDetail({ id: this.id }).then(({ data }) => {
const { lecturer, business, mer_id } = data;
Object.assign(this, {
lecturer,
business,
merId: mer_id,
});
});
},
getData() {
switch (this.navActive) {
case 2:
this.lecturer_special_list();
break;
case 3:
this.lecturer_download_list();
break;
case 4:
this.lecturer_event_list();
break;
case 5:
this.lecturer_store_list();
break;
case 6:
this.getProblemList(1);
break;
case 7:
this.getProblemList(2);
break;
}
},
async getDataByApi(api) {
if (this.finished) return;
uni.showLoading({ mask: true });
try {
const { data } = await api({
mer_id: this.lecturer.mer_id,
page: this.page,
limit: this.limit,
type: this.type
});
uni.hideLoading();
this.list = this.list.concat(data);
this.finished = this.limit > data.length;
} catch (err) {
uni.hideLoading();
this.$util.showMsg(err);
}
},
// 讲师名下课程
lecturer_special_list() {
this.type = '';
this.getDataByApi(getLecturerSpecialList);
},
// 讲师名下资料
lecturer_download_list() {
this.type = '';
this.getDataByApi(getLecturerDownloadList);
},
// 讲师名下活动
lecturer_event_list() {
this.type = '';
this.getDataByApi(getLecturerEventList);
},
// 讲师名下商品
lecturer_store_list() {
this.type = '';
this.getDataByApi(getLecturerStoreList);
},
// 讲师名下练习 / 考试
getProblemList(type) {
this.type = type;
this.getDataByApi(getProblemList);
},
// 收益及提现统计
lecturer_income() {
getLecturerIncome({
mer_id: this.lecturer.mer_id,
}).then(({ data }) => {
this.extract = data.extract;
this.today = data.today;
this.total = data.total;
this.gold = data.gold;
});
},
getIsFollow: function () {
var vm = this;
getIsFollow({
mer_id:this.lecturer.mer_id
}).then(res => {
vm.isFollow = res.data;
})
},
// 关注
follow: function () {
var vm = this;
follow({
mer_id: this.lecturer.mer_id,
is_follow: Number(!vm.isFollow)
}).then(res => {
vm.isFollow = !vm.isFollow;
this.$util.showMsg(vm.isFollow ? '关注成功' : '取消关注成功')
})
},
},
};
</script>
<style>
page{
background: #F7F8F9;
}
</style>
<style scoped lang="scss">
.icontianjia:before {
content: "\e672";
}
.teacher-detail .follow {
position: absolute;
top: 29rpx;
right: 30rpx;
width: 160rpx;
height: 60rpx;
border-radius: 34rpx;
border: 2rpx solid #1D8DFF;
color: #1D8DFF;
line-height: 60rpx;
}
.teacher-detail {
position: absolute;
left: 0;
right: 0;
margin: 0 auto;
margin-top: calc(128rpx + var(--safe-top));
/* #ifdef MP-TOUTIAO */
margin-top: 128rpx;
/* #endif */
border-radius: 24rpx;
z-index: 999;
}
.teacher-detail .teacher .follow .iconfont {
margin-right: 5rpx;
vertical-align: 3rpx;
font-size: 15rpx;
}
.teacher-detail .follow.followed {
border-color: #999999;
color: #999999;
}
.iconfont {
display: inline;
}
/* 讲师详情 */
.teacher-detail {
overflow: hidden;
}
.teacher-detail .header {
// position: relative;
// padding-bottom: 32rpx;
/* border-radius: 16rpx 16rpx 0 0; */
/* margin-top: 139rpx; */
// padding-top: 50rpx;
// background: linear-gradient(180deg, #B1E5FF 0%, #DFFBFF 100%);
}
.teacher-detail .teacher {
display: flex;
align-items: flex-end;
padding: 0 30rpx 0 40rpx;
}
.teacher-detail .teacher .inner {
flex: 1;
display: flex;
align-items: center;
.con{
margin-left: 32rpx;
}
/* margin-top: -64rpx; */
}
.teacher-detail .teacher image {
width: 128rpx;
height: 128rpx;
border: 4rpx solid #ffffff;
border-radius: 50%;
background-color: #ffffff;
vertical-align: middle;
}
.teacher-detail .teacher .name {
margin-top: 16rpx;
font-weight: 600;
font-size: 36rpx;
line-height: 56rpx;
color: #333333;
}
.teacher-detail .teacher .info-btn {
display: inline-block;
// padding: 4px 13rpx;
border-radius: 16rpx;
// margin-left: 12rpx;
// background-color: #f1f8ff;
font-size: 18rpx;
line-height: 25rpx;
color: #2c8eff;
}
.teacher-detail .teacher .info-btn .iconfont {
margin-left: 5rpx;
font-size: 12rpx;
}
.teacher-detail .teacher .cash-btn {
width: 140rpx;
height: 54rpx;
border-radius: 27rpx;
margin-bottom: 42rpx;
background-color: #2c8eff;
text-align: center;
font-size: 26rpx;
line-height: 54rpx;
color: #ffffff;
}
.teacher-detail .teacher .iconfont {
margin-right: 11rpx;
vertical-align: bottom;
font-size: 30rpx;
}
.teacher-detail .header .info {
// padding: 10rpx 30rpx 0 40rpx;
font-size: 24rpx;
font-weight: 400;
color: #7A808A;
line-height: 32rpx;
color: #999999;
}
.teacher-detail .header .tag-group {
padding: 15rpx 30rpx 20rpx 40rpx;
font-size: 0;
}
.teacher-detail .header .tag {
display: inline-block;
padding: 6rpx 16rpx;
border-radius: 18rpx;
margin-right: 12rpx;
background-color: #EAECF0;
font-size: 22rpx;
line-height: 30rpx;
color: #7A808A;
}
.teacher-detail .header .tag:last-child {
margin-right: 0;
}
.teacher-detail .header .total-list {
display: flex;
border-radius: 10rpx;
margin: 0 30rpx 0;
background-color: #ffffff;
}
.teacher-detail .header .total-item {
position: relative;
flex: 1;
padding: 32rpx 0 20rpx;
text-align: center;
font-size: 22rpx;
line-height: 30rpx;
color: rgba(51, 51, 51, 0.6);
}
.teacher-detail .header .total-item::before {
content: "";
position: absolute;
top: 50%;
left: 0;
width: 1px;
height: 50rpx;
background-color: rgba(0, 0, 0, 0.08);
transform: translateY(-50%);
}
.teacher-detail .header .total-item:first-child::before {
display: none;
}
.teacher-detail .header .total-item>view:first-child {
margin-bottom: 8rpx;
font-size: 38rpx;
line-height: 38rpx;
color: #2c8eff;
}
.teacher-detail .header .total-item navigator {
font-size: 22rpx;
color: rgba(51, 51, 51, 0.6);
}
.teacher-detail .header .total-item .iconfont {
margin-left: 10rpx;
font-size: 18rpx;
color: #848484;
}
.teacher-detail .main {
border-top: 14rpx solid #f5f5f5;
}
.teacher-detail .nav {
position: relative;
display: flex;
height: 96rpx;
background-color: #ffffff;
font-size: 30rpx;
line-height: 96rpx;
color: #999999;
border-radius: 32rpx 32rpx 0rpx 0rpx;
}
.teacher-detail .nav .item {
padding: 0 25rpx;
white-space: nowrap;
cursor: pointer;
}
.teacher-detail .nav .item:first-child {
padding-left: 30rpx;
}
.teacher-detail .nav .item.active {
position: relative;
font-weight: 600;
font-size: 26rpx;
color: #333333;
}
.teacher-detail .nav .item.active::after {
content: "";
position: absolute;
bottom: 24rpx;
left: 50%;
width: 44rpx;
height: 8rpx;
border-radius: 10rpx;
background-color: #2c8eff;
transform: translateX(-50%);
}
.teacher-detail .panel1 {
padding: 40rpx 30rpx;
line-height: normal;
}
.teacher-detail .panel1 image,
.teacher-detail .panel1 video,
.teacher-detail .panel1 audio {
max-width: 100%;
}
.teacher-detail .panel2 {
padding: 30rpx;
background: #ffffff;
}
.teacher-detail .panel2 .item {
display: flex;
margin-top: 40rpx;
}
.teacher-detail .panel2 .item:first-child {
margin-top: 0;
}
.teacher-detail .panel2 .item-hd {
position: relative;
width: 250rpx;
height: 140rpx;
}
.teacher-detail .panel2 .item-hd image {
width: 100%;
height: 100%;
border-radius: 10rpx;
object-fit: cover;
vertical-align: middle;
}
.teacher-detail .panel2 .item-hd .tag {
position: absolute;
right: 10rpx;
bottom: 10rpx;
padding: 0 11rpx;
border-radius: 3rpx;
background-color: rgba(0, 0, 0, 0.5);
font-size: 22rpx;
line-height: 34rpx;
color: #ffffff;
}
.teacher-detail .panel2 .item-bd {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
padding-left: 20rpx;
}
.teacher-detail .panel2 .title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 30rpx;
line-height: 42rpx;
color: #333333;
}
.teacher-detail .panel2 .tag-group {
flex: 1;
padding-top: 8rpx;
font-size: 0;
}
.teacher-detail .panel2 .tag-group .tag {
display: inline-block;
padding: 0 12rpx;
border-radius: 4rpx;
margin-right: 10rpx;
background-color: rgba(44, 142, 255, 0.06);
font-size: 20rpx;
line-height: 38rpx;
color: #2c8eff;
}
.teacher-detail .panel2 .tag-group .tag:last-child {
margin-right: 0;
}
.teacher-detail .panel2 .money {
font-weight: 500;
font-size: 24rpx;
line-height: 45rpx;
color: #ff6b00;
}
.teacher-detail .panel2 .money text {
font-size: 32rpx;
}
.teacher-detail .panel3 {
padding: 30rpx;
background: #ffffff;
}
.teacher-detail .panel3 .item {
display: flex;
margin-top: 40rpx;
}
.teacher-detail .panel3 .item:first-child {
margin-top: 0;
}
.teacher-detail .panel3 .item-hd image {
width: 250rpx;
height: 140rpx;
border-radius: 10rpx;
object-fit: cover;
vertical-align: middle;
}
.teacher-detail .panel3 .item-hd {
width: 250rpx;
height: 140rpx;
}
.teacher-detail .panel3 .item-hd image {
width: 100%;
height: 100%;
border-radius: 10rpx;
vertical-align: middle;
}
.teacher-detail .panel3 .item-bd {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
padding-left: 22rpx;
}
.teacher-detail .panel3 .title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 30rpx;
line-height: 42rpx;
color: #333333;
}
.teacher-detail .panel3 .money {
flex: 1;
padding-top: 9rpx;
font-weight: 500;
font-size: 22rpx;
line-height: 45rpx;
color: #ff6b00;
}
.teacher-detail .panel3 .money text {
font-size: 32rpx;
}
.teacher-detail .panel3 .wrap {
display: flex;
align-items: center;
}
.teacher-detail .panel3 .people {
flex: 1;
font-size: 22rpx;
line-height: 30rpx;
color: #999999;
}
.teacher-detail .panel3 .button {
padding: 0 19rpx;
border-radius: 19rpx;
background-color: #2c8eff;
font-size: 22rpx;
line-height: 38rpx;
color: #ffffff;
}
.teacher-detail .panel4 {
padding: 30rpx;
background: #ffffff;
}
.teacher-detail .panel4 .item {
display: flex;
margin-top: 30rpx;
}
.teacher-detail .panel4 .item:first-child {
margin-top: 0;
}
.teacher-detail .panel4 .item-hd image {
width: 250rpx;
height: 140rpx;
border-radius: 10rpx;
object-fit: contain;
vertical-align: middle;
}
.teacher-detail .panel4 .item-bd {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
padding-left: 20rpx;
}
.teacher-detail .panel4 .title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 28rpx;
line-height: 40rpx;
color: #333333;
}
.teacher-detail .panel4 .time {
flex: 1;
padding-top: 10rpx;
font-size: 22rpx;
line-height: 30rpx;
color: #999999;
}
.teacher-detail .panel4 .time .iconfont {
margin-right: 9rpx;
font-size: 22rpx;
}
.teacher-detail .panel4 .wrap {
display: flex;
align-items: center;
}
.teacher-detail .panel4 .money {
flex: 1;
font-weight: 500;
font-size: 24rpx;
line-height: 45rpx;
color: #ff6b00;
}
.teacher-detail .panel4 .money text {
font-size: 32rpx;
}
.teacher-detail .panel4 .people {
font-size: 22rpx;
line-height: 30rpx;
color: #999999;
}
.teacher-detail .panel5 {
display: flex;
flex-wrap: wrap;
padding: 30rpx;
margin: 0 -30rpx -30rpx 0;
background: #ffffff;
}
.teacher-detail .panel5 .item {
width: 330rpx;
margin: 0 30rpx 30rpx 0;
}
.teacher-detail .panel5 .item-hd image {
width: 330rpx;
height: 330rpx;
border-radius: 10rpx;
object-fit: cover;
vertical-align: middle;
}
.teacher-detail .panel5 .item-bd {
padding: 35rpx 5rpx 0;
}
.teacher-detail .panel5 .item-bd {
padding: 35rpx 5rpx 0;
}
.teacher-detail .panel5 .title {
height: 80rpx;
overflow: hidden;
-webkit-line-clamp: 2;
font-size: 28rpx;
line-height: 40rpx;
color: #333333;
}
.teacher-detail .panel5 .wrap {
display: flex;
align-items: center;
margin-top: 10rpx;
}
.teacher-detail .panel5 .money {
flex: 1;
font-weight: 500;
font-size: 24rpx;
line-height: 45rpx;
color: #ff6b00;
}
.teacher-detail .panel5 .money text {
font-size: 32rpx;
}
.teacher-detail .panel5 .sales {
font-size: 22rpx;
line-height: 30rpx;
color: #999999;
}
.teacher-detail .empty image {
width: 414rpx;
height: 305rpx;
object-fit: contain;
vertical-align: middle;
}
.teacher-detail .empty {
margin-top: 100rpx;
text-align: center;
font-size: 24rpx;
color: #b4b4b4;
}
.problem {
padding: 30rpx;
background: #ffffff;
}
.problem .item {
display: block;
padding: 30rpx;
border-radius: 12rpx;
margin-top: 30rpx;
box-shadow: 0 3rpx 2rpx 1px rgba(0, 0, 0, 0.07);
}
.problem .item:first-child {
margin-top: 0;
}
.problem .title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 30rpx;
line-height: 42rpx;
color: #282828;
}
.problem .attribute {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 30rpx;
font-size: 22rpx;
color: #999999;
}
.problem .button {
width: 120rpx;
height: 42rpx;
border-radius: 21rpx;
background-color: #2C8EFF;
text-align: center;
line-height: 42rpx;
color: #FFFFFF;
}
.question {
padding: 30rpx;
background: #ffffff;
}
.question .item {
display: flex;
padding: 30rpx 30rpx 36rpx;
border-radius: 12rpx;
margin-top: 30rpx;
box-shadow: 0 3rpx 2rpx 1px rgba(0, 0, 0, 0.07);
}
.question .item:first-child {
margin-top: 0;
}
.question .image {
width: 240rpx;
height: 135rpx;
border-radius: 10rpx;
}
.question .text {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
margin-left: 20rpx;
}
.question .title {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
font-size: 30rpx;
line-height: 41rpx;
color: #333333;
}
.question .attribute {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 22rpx;
color: #FF6B00;
}
.question .button {
width: 120rpx;
height: 42rpx;
border-radius: 21rpx;
background-color: #2C8EFF;
text-align: center;
line-height: 42rpx;
color: #FFFFFF;
}
</style>