This commit is contained in:
2025-08-12 17:11:08 +08:00
parent 4cca2c8aec
commit a4d52c864b
9 changed files with 2766 additions and 265 deletions

View File

@@ -6,7 +6,11 @@
fontColor="#fff"
:backState="2000"
></z-nav-bar>
<view class="doctors_module" :style="`top: ${42 + statusBarHeight}px;`">
<view
class="doctors_module"
:style="`top: ${42 + statusBarHeight}px;`"
style="z-index: 10"
>
<view class="tab-bar">
<view
class="tab-item left-tab"
@@ -24,7 +28,7 @@
</view>
</view>
<template v-if="activeTab == 0">
<view class="cateList flexbox" >
<view class="cateList flexbox">
<common-sticky
itemStyle="width:33.3%; height: 38px;font-size:24rpx;"
:list="tabsList"
@@ -45,7 +49,7 @@
</view>
</template>
<template v-if="activeTab == 1">
<!--
<view class="name_search">
<uni-easyinput
v-model="courseName"
@@ -55,128 +59,180 @@
class="center-input"
/>
<button @click="getArticleListData(true)">查询</button>
</view>
</view> -->
</template>
</view>
<scroll-view
scroll-y="true"
:scroll-top="scrollTop"
@scrolltolower="loadMore"
:style="`
height: calc(100vh - ${activeTab==0?320:280}rpx);
margin-top: ${activeTab==0?260:180}rpx;
padding-bottom: 140rpx;`
"
v-if="show == true"
>
<view class="doctors_list" id="top">
<view
class="doctors_item"
v-for="(item, index) in list"
:key="index"
@click="goToDetail(item)"
>
<view class="flex">
<view class="flex">
<image
v-if="item.squareImage"
:src="item.squareImage"
class="item_image"
mode="aspectFit"
></image>
<image
v-else
src="../../static/logo_zi.png"
class="item_image"
mode="aspectFit"
></image>
<view class="item_right" v-if="currentCateIndex != 2">
<!-- <view class="item_top">
<scroll-view
scroll-y="true"
:scroll-top="scrollTop"
@scrolltolower="loadMore"
:style="`
height: calc(100vh - ${activeTab == 0 ? 320 : 200}rpx);
margin-top: ${activeTab == 0 ? 260 : 100}rpx;
padding-bottom: 140rpx;`"
v-if="show == true"
>
<view class="doctors_list" id="top" v-if="activeTab == 0">
<view
class="doctors_item"
v-for="(item, index) in list"
:key="index"
@click="goToDetail(item)"
>
<view class="flex">
<view class="flex">
<image
v-if="item.squareImage"
:src="item.squareImage"
class="item_image"
mode="aspectFit"
></image>
<image
v-else
src="../../static/logo_zi.png"
class="item_image"
mode="aspectFit"
></image>
<view class="item_right" v-if="currentCateIndex != 2">
<!-- <view class="item_top">
<text
class="item_name"
v-if="item.taihuTalent && item.taihuTalent.length > 0"
>{{ item.taihuTalent[0].name }}</text
>
</view> -->
<text class="item_con">{{ item.title }}</text>
<view class="item_info hidden2" style="margin-top: 20rpx;">
<rich-text style="color: #666;"
:nodes="item.content"
v-if="item.content"
></rich-text
>
</view>
</view>
<view class="item_right" v-else>
<view class="item_top">
<text class="item_name">{{ item.title }}</text>
</view>
<text class="item_con">{{
item.taihuTalent.map((talent) => talent.name).join(" ")
}}</text>
<text class="item_con">{{ item.title }}</text>
<view class="item_info hidden2" style="margin-top: 20rpx">
<rich-text
style="color: #666"
:nodes="item.content"
v-if="item.content"
></rich-text>
</view>
</view>
</view>
<view class="list_item_bt">
<view
class="list_item_price"
v-if="item.courseCatalogueEntityList.length == 1"
>
<text v-if="item.courseCatalogueEntityList[0].halfFee == 0"
>免费</text
>
<text v-else
>¥{{ item.courseCatalogueEntityList[0].halfFee }}/{{
item.courseCatalogueEntityList[0].fee
}}</text
>
</view>
<view
class="list_item_price"
v-if="item.courseCatalogueEntityList.length > 1"
>
<text v-for="(v, i) in item.courseCatalogueEntityList" :key="i">
{{ formatContent(v.title)
}}<text v-if="i !== item.courseCatalogueEntityList.length - 1"
>/</text
>
</text>
<view class="item_right" v-else>
<view class="item_top">
<text class="item_name">{{ item.title }}</text>
</view>
<text
v-if="item.courseCatalogueEntityList[0].halfFee == 0"
style="padding-left: 20rpx"
>免费</text
>
<text v-else style="margin-left: 20rpx"
>{{ item.courseCatalogueEntityList[0].halfFee }}/{{
item.courseCatalogueEntityList[0].fee
class="item_con"
v-if="item.taihuTalent && item.taihuTalent.length > 0"
>{{
item.taihuTalent.map((talent) => talent.name).join(" ")
}}</text
>
</view>
<text class="list_item_study">了解课程</text>
</view>
</view>
<view class="list_item_bt">
<view
class="list_item_price"
v-if="
item.courseCatalogueEntityList &&
item.courseCatalogueEntityList.length == 1
"
>
<text v-if="item.courseCatalogueEntityList[0].halfFee == 0"
>免费</text
>
<text v-else
>¥{{ item.courseCatalogueEntityList[0].halfFee }}/{{
item.courseCatalogueEntityList[0].fee
}}</text
>
</view>
<view
class="list_item_price"
v-if="
item.courseCatalogueEntityList &&
item.courseCatalogueEntityList.length > 1
"
>
<text v-for="(v, i) in item.courseCatalogueEntityList" :key="i">
{{ formatContent(v.title)
}}<text v-if="i !== item.courseCatalogueEntityList.length - 1"
>/</text
>
</text>
<text
v-if="item.courseCatalogueEntityList[0].halfFee == 0"
style="padding-left: 20rpx"
>免费</text
>
<text v-else style="margin-left: 20rpx"
>各{{ item.courseCatalogueEntityList[0].halfFee }}/{{
item.courseCatalogueEntityList[0].fee
}}</text
>
</view>
<text class="list_item_study">了解课程</text>
</view>
</view>
<text v-show="showText && count > list.length" class="show-more"
>加载更多</text
</view>
<view
class="doctors_list"
id="top"
v-if="activeTab == 1"
style="margin: 0"
>
<!-- <view
class="doctors_item"
v-for="(item, index) in list"
:key="index"
@click="goToDetail(item)"
>
</view> -->
<Dynamic
v-for="(item, index) in list"
key="id"
:imgList="item.fileList1"
:avatar="item.taihuTalent.icon"
:name="item.taihuTalent.name"
:createTime="item.createTime"
:title="item.title"
:content="item.content"
:isLike="item.likeFlag"
:isGiveReward="item.isGiveReward"
:likeCount="item.likeCount"
:likeList="item.likeList"
:readCount="item.readCount"
:giveRewardNumber="item.giveRewardNumber"
:commentCount="item.commentCount"
@clickDynamic="clickDynamic(index)"
@clickUser="clickUser(item.id)"
@clickFocus="clickFocus(index)"
@clickThumbsup="(type) => clickThumbsup(item.id, type)"
@clickGiveReward="clickGiveReward(item.id)"
@clickChat="clickChat(item.id)"
>
<text v-show="noMore" class="no-more">没有更多了</text>
</scroll-view>
<text class="null_text" v-else>{{ null_text }}</text>
</Dynamic>
</view>
<text v-show="showText && count > list.length" class="show-more"
>加载更多</text
>
<text v-show="noMore" class="no-more">没有更多了</text>
</scroll-view>
<text class="null_text" v-else>{{ null_text }}</text>
<z-navigation></z-navigation>
<common-pinglun ref="pinglun" @close="close"></common-pinglun>
<common-likeList ref="commonLikeList" @close="close"></common-likeList>
</view>
</template>
<script>
import $http from "@/config/requestConfig.js";
import commonArticle from "./article.vue";
import Dynamic from "@/components/qizai-dynamic/Dynamic.vue";
import commonPinglun from "../articleList/pinglun.vue";
import commonLikeList from "../articleList/likeList.vue";
export default {
data() {
return {
@@ -184,6 +240,7 @@ export default {
tabsList: [],
currentCateIndex: 0,
list: [],
null_text: "",
current: 1,
@@ -202,9 +259,11 @@ export default {
},
components: {
commonArticle,
Dynamic,
commonPinglun,
commonLikeList,
},
onPullDownRefresh() {
this.isRefreshing = true;
console.log("下拉刷新");
@@ -226,19 +285,120 @@ export default {
},
onShow() {},
methods: {
changeActiveTab(e){
this.activeTab=e
if(e==0){
if(!this.taihumedId){
this.taihumedId = this.tabsList[0].id;
}
clickDynamic(id) {
//评论
console.log("childDynamic");
},
// 点击用户信息
clickUser(e) {
console.log(e);
console.log("childUser");
},
// 点击关注
clickFocus(e) {
this.list[e].isFocusOn = this.list[e].isFocusOn ? false : true;
console.log(e);
console.log("childUser");
},
close(id){
this.getArticleDetail(id);
},
this.getListData(this.taihumedId);
}
else{
this.getArticleListData(true);
}
},
// 点赞
clickThumbsup(id, type) {
console.log("childThumbsup");
if (type == "like") {
this.$http
.request({
url: "common/taihuTalentArticle/addOrCancelArticleLike",
method: "POST",
data: {
articleId: id,
},
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
console.log("res at line 308:", res);
this.getArticleDetail(id);
this.$forceUpdate();
});
} else if (type == "pinglun") {
this.$refs.pinglun.onHandleClickOpenComment(id);
} else if (type == "likeList") {
this.$refs.commonLikeList.onHandleClickOpenComment(id);
}
},
getArticleDetail(id) {
//清空消息记录
this.$http
.request({
url: "common/taihuTalentArticle/getArticleLikeAndComment",
method: "POST",
data: {
articleId: id,
},
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
console.log("res at line 682:", res);
if (res.code == 0) {
this.list.forEach((item) => {
if (item.id == id) {
item.isLike = res.article.isLike;
item.likeCount = res.article.likeCount;
item.readCount = res.article.readCount;
item.commentCount = res.article.commentCount;
item.likeList = res.article.likeList;
item.likeFlag = res.article.likeFlag;
}
});
}
})
.catch((error) => {
console.log("请求出错:", error);
});
//调用后端 SSE 接口,发送问题并接收实时回答
// this.startSSE(params);
},
// 点击打赏
clickGiveReward(e) {
console.log(e);
console.log("clickGiveReward");
},
// 点击聊天
clickChat(e) {
console.log(e);
console.log("clickChat");
},
changeActiveTab(e) {
this.current = 1;
this.list = [];
this.noMore = false;
console.log("e at line 309:", e, this.taihumedId);
this.activeTab = e;
this.$forceUpdate();
if (e == 0) {
if (!this.taihumedId) {
this.taihumedId = this.tabsList[0].id;
}
this.getListData(this.taihumedId);
} else {
this.getArticleListData(true);
}
},
//判断显示‘上/中/下’
formatContent(content) {
const keywords = ["上部", "中部", "下部"];
@@ -254,28 +414,26 @@ else{
},
//获取tab数据
getTabData() {
if(this.activeTab==0){
this.$http
.request({
url: "taihumed/course/getCourseTaihumedList",
method: "POST",
data: {},
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
if (res.list && res.list.length > 0) {
this.tabsList = res.list;
this.taihumedId = this.tabsList[0].id;
this.getListData(this.taihumedId);
}
});
}
else if(this.activeTab==1){
this.getArticleListData();
}
if (this.activeTab == 0) {
this.$http
.request({
url: "taihumed/course/getCourseTaihumedList",
method: "POST",
data: {},
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
if (res.list && res.list.length > 0) {
this.tabsList = res.list;
this.taihumedId = this.tabsList[0].id;
this.getListData(this.taihumedId);
}
});
} else if (this.activeTab == 1) {
this.getArticleListData();
}
},
//获取列表数据
getArticleListData(type) {
@@ -297,7 +455,6 @@ else{
data: {
current: this.current,
limit: this.limit,
},
header: {
"Content-Type": "application/json",
@@ -306,9 +463,9 @@ else{
.then((res) => {
uni.hideLoading();
this.count = res.pageRes.total; //总数
let length = res.pageRes.records.length;
if (res.pageRes.records && length > 0) {
this.count = res.page.total; //总数
let length = res.page.records.length;
if (res.page.records && length > 0) {
this.show = true;
//如果返回的数据少于每页数量,表示没有更多数据
if (
@@ -318,7 +475,15 @@ else{
) {
this.noMore = true;
}
this.list = [...this.list, ...res.pageRes.records];
this.list = [
...this.list,
...res.page.records.map((e) => {
return {
...e,
fileList1: e.img ? e.img.split(",") : [],
};
}),
];
this.current += 1; //更新页码
//显示提示语
this.showText = true;
@@ -397,12 +562,11 @@ else{
},
//加载更多
loadMore() {
if(this.activeTab==0){
this.getListData(this.taihumedId);
}else{
this.getArticleListData();
}
if (this.activeTab == 0) {
this.getListData(this.taihumedId);
} else {
this.getArticleListData();
}
},
//切换tab状态
ordersTabCLi(data, index) {
@@ -614,9 +778,9 @@ else{
box-shadow: 0 0 8rpx rgba(0, 0, 0, 0.04),
/* 外部柔光阴影 */ inset -4rpx 0 6rpx rgba(0, 0, 0, 0.03); /* 内阴影模拟夹层效果 */
}
.hidden2{
line-height: 24px;
max-height: 48px;
height: auto;
}
.hidden2 {
line-height: 24px;
max-height: 48px;
height: auto;
}
</style>