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

@@ -3,8 +3,8 @@
class="content"
:class="`${options.type == 'detail' ? 'content_detail' : ''}`"
>
<z-nav-bar :title="options.navTitle" bgColor="#fff" fontColor="#333">
<template v-slot:right >
<z-nav-bar :title="options.navTitle" bgColor="#5188e5" fontColor="#fff">
<template v-slot:right v-if="options.type != 'detail'">
<view class="top_right" @tap="handleSubmit('submit')">
<text
style="
@@ -12,7 +12,7 @@
margin-right: 10rpx;
border-radius: 20rpx;
line-height: 40rpx;
color: #333;
color: #fff;
"
>去发布</text
>
@@ -104,39 +104,93 @@
v-if="options.type == 'detail'"
:style="`height: calc(100% - ${
48 + statusBarHeight + 60
}px);padding: 0 20rpx;text-align: justify;`"
}px);padding:40rpx 20rpx;text-align: justify;`"
>
<view class="analysis_box" style="height: 100%">
<view
class="analysis_title analysis_title_detail"
style="color: #302f35"
>
{{ articleInfo.title }}
</view>
<view class="analysis_box" style="height: auto">
<view class="analysis_img_box">
<view class="analysis_img">
<image :src="articleInfo.taihuTalent.icon"></image>
<image
v-if="
articleInfo &&
articleInfo.taihuTalent &&
articleInfo.taihuTalent.icon
"
:src="articleInfo.taihuTalent.icon"
/>
<image v-else src="/static/icon/noIcon.png" />
<view class="taihuTalentBox">
<view class="taihuTalent_name">{{
articleInfo &&
articleInfo.taihuTalent &&
articleInfo.taihuTalent.name
? articleInfo.taihuTalent.name
: "普通用户"
}}</view>
<view class="taihuTalent_title"
<view
class="taihuTalent_title"
style="margin-top: 20rpx"
v-if="
articleInfo &&
articleInfo.taihuTalent &&
articleInfo.taihuTalent.title
"
><text class="zhicheng">{{
articleInfo.taihuTalent.title
}}</text></view
>
</view>
</view>
<view style="color: #525156">{{ articleInfo.readCount }}人阅读</view>
<view style="color: #5188e5; text-align: right"
>{{ articleInfo.readCount }}人阅读</view
>
</view>
<view
class="analysis_title analysis_title_detail"
style="color: #302f35; font-size: 36rpx; line-height: 42rpx"
>
{{ articleInfo.title }}
</view>
<rich-text
:nodes="articleInfo.content"
style="height: auto; margin-bottom: 260rpx; color: #4b4b4b"
/>
</view>
<view class="allImage">
<view class="imgList">
<view
class="images"
:class="`${fileList1.length > 4 ? 'images3' : ''}`"
v-for="(item, index) in fileList1"
:key="index"
>
<image
@click.stop="previewImg(index)"
class="oneimg"
:src="item"
mode="aspectFill"
:style="{
width: imgWidth + 'px',
'max-height': imgHeight + 'px',
}"
></image>
</view>
</view>
</view>
<view class="likeList" v-if="likeList.length > 0" style="color: #5188e5">
<uni-icons
type="heart"
size="20"
style="color: #5188e5; margin-right: 10rpx"
></uni-icons>
<view class="">{{
likeList
.map((item) =>
item.user.nickname ? item.user.nickname : "普通用户"
)
.join(" , ")
}}</view>
</view>
<!-- 显示聊天记录 -->
<!-- <articleDetail
:loading="loading"
@@ -153,12 +207,17 @@
<view class="footer_box">
<template>
<view class="footer_item" style="color: #9a9a9a">
<view
class="footer_item"
style="color: #9a9a9a"
@click.stop="clickLike"
>
<view class="footer_item_icon"
><uni-icons
type="hand-up-filled"
size="30"
style="color: #9a9a9a"
:style="{ color: articleInfo.likeFlag ? '#ff4949' : '#9a9a9a' }"
></uni-icons>
<view class="footer_item_count" style="text-align: center">{{
articleInfo.likeCount ? articleInfo.likeCount : "0"
@@ -183,7 +242,11 @@
</view>
<text style="letter-spacing: 4rpx">评论</text>
</view>
<view class="footer_item" style="color: #9a9a9a">
<view
class="footer_item"
style="color: #9a9a9a"
@click.stop="newOnShare"
>
<view class="footer_item_icon"
><uni-icons
type="redo-filled"
@@ -196,14 +259,17 @@
</template>
</view>
</view>
<uni-popup ref="share" type="share" safeArea backgroundColor="#fff">
<uni-popup-share @select="haveSelected"></uni-popup-share>
</uni-popup>
<!-- <z-navigation></z-navigation> -->
<u-popup
:show="orderModalShow"
mode="bottom"
:round="8"
background-color="#fff"
style="background-color: #fff"
:background="'#fff'"
style="background: #fff"
backgroundColor="#fff"
>
<view class="orderModalShow popup_box">
<view style="text-align: center"
@@ -223,12 +289,11 @@
"
></u-icon>
<hb-comment
style="margin-top: 40rpx; height: 60vh;overflow: auto;padding-bottom: 60rpx;"
:user="articleInfo.taihuTalent"
style="padding-top: 40rpx; overflow: auto; padding-bottom: 100rpx"
:user="currentUser"
ref="hbComment"
@add="sendComment"
@del="del"
@focusOn="focusOn"
:deleteTip="'确认删除?'"
:cmData="commentData"
@@ -253,6 +318,9 @@ export default {
},
data() {
return {
currentUser: {},
likeList: [],
orderModalShow: false,
commentData: [],
articleInfo: {},
@@ -311,6 +379,10 @@ export default {
recordData: {},
editableMap: {},
isRefreshing: false, //刷新状态
windowWidth: 0, //屏幕可用宽度
windowHeight: 0, //屏幕可用高度
imgWidth: 0, //图片宽度
imgHeight: 0, //图片高度
};
},
computed: {
@@ -319,46 +391,25 @@ export default {
async onLoad(options) {
this.options = options;
this.medicalId = options.id;
if (this.options.type == "add") {
this.loading = true;
} else {
this.loading = true;
await this.getMedicalDetail(() => {
this.medicalForm = { ...this.medicalRecords };
console.log("this.medicalForm at line 193:", this.medicalForm);
if (this.medicalRecords.img) {
this.$refs.commonMedicalDetail.fileList1 = this.medicalRecords.img
.split(",")
.map((image, i) => ({
uid: i, // 假设 id 是唯一标识符
name: i, // 文件名
status: "done", // 状态
url: image, // 文件 URL
}));
}
});
// this.tishi=true
}
uni.hideTabBar();
uni.removeStorageSync("homeParams");
//获取设备信息
const systemInfo = uni.getSystemInfoSync();
this.containerHeight = systemInfo.windowHeight; //获取设备的窗口高度
// this.sendQuestion();
this.windowHeight = systemInfo.windowHeight;
this.windowWidth = systemInfo.windowWidth;
},
onShow() {
// console.log('进入到onShow方法')
// this.activeRecord = null;
// this.getRecordsData();
// this.getUserAiVipCount(); //更新次数
// //我的-会话记录跳转来的
// this.pageData = uni.getStorageSync('homeParams').data;
// this.pageType = uni.getStorageSync('homeParams').type;
// let index = uni.getStorageSync('homeParams').index;
// if(this.pageData&&!this.pageType){
// this.clickRecord(this.pageData, index);
// }
async onShow() {
if (this.options.type == "add") {
this.loading = true;
} else {
this.loading = true;
await this.getMedicalDetail();
// this.tishi=true
}
},
async onPullDownRefresh() {
this.isRefreshing = true;
@@ -371,20 +422,7 @@ export default {
} else {
this.showMessages = true;
this.loading = true;
await this.getMedicalDetail(() => {
this.medicalForm = { ...this.medicalRecords };
console.log("this.medicalForm at line 193:", this.medicalForm);
if (this.medicalRecords.img) {
this.$refs.commonMedicalDetail.fileList1 = this.medicalRecords.img
.split(",")
.map((image, i) => ({
uid: i, // 假设 id 是唯一标识符
name: i, // 文件名
status: "done", // 状态
url: image, // 文件 URL
}));
}
});
await this.getMedicalDetail();
// this.tishi=true
}
@@ -395,8 +433,101 @@ export default {
}, 800);
},
methods: {
newOnShare() {
this.$refs.share.open();
},
haveSelected(data) {
let image = "";
this.articleInfo.img && this.articleInfo.img != ""
? (image = this.articleInfo.img.split(",")[0])
: (image = "static/logo_zi.png");
console.log(data, " 选择的是");
if (data.index == 0) {
// 分享到好友
uni.share({
provider: "weixin",
scene: "WXSceneSession",
type: 0,
href: this.$apkUrl,
title: `【太湖云医】 ${this.articleInfo.title}`,
// summary: `${this.productInfo.content}`,
imageUrl: image,
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
},
});
} else if (data.index == 1) {
// 分享到朋友圈
uni.share({
provider: "weixin",
scene: "WXSceneTimeline",
type: 0,
href: this.$apkUrl,
title: `【太湖云医】 ${this.articleInfo.title}`,
// summary: `${this.taskInfo.content}`,
imageUrl: image,
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
},
});
}
},
// 自适应判断
judgeImg() {
if (this.fileList1.length == 1) {
this.imgWidth = ((this.windowWidth - 10) * 2) / 3;
this.imgHeight = (this.windowHeight * 3) / 5;
} else if (this.fileList1.length == 4) {
this.imgWidth = (this.windowWidth - 10) / 3.3;
this.imgHeight = this.imgWidth;
} else {
this.imgWidth = (this.windowWidth - 10) / 3.4;
this.imgHeight = this.imgWidth;
}
},
previewImg(index) {
uni.previewImage({
urls: this.fileList1,
// longPressActions: {
// itemList: ["保存图片"],
// },
current: index, // 设置当前预览的图片索引
});
},
clickLike() {
console.log("childThumbsup");
this.$http
.request({
url: "common/taihuTalentArticle/addOrCancelArticleLike",
method: "POST",
data: {
articleId: this.articleInfo.id,
},
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
console.log("res at line 308:", res);
this.getMedicalDetail();
this.$forceUpdate();
});
// common/taihuTalentArticle/addOrCancelArticleLike
},
onHandleClickOpenComment() {
console.log("111 at line 384:", 111);
console.log(
"this.currentUser at line 365:",
this.articleInfo.taihuTalent
);
this.orderModalShow = true;
},
closeOrderModalShow() {
@@ -696,13 +827,13 @@ export default {
});
},
//创建新对话
sendComment(comment,pid) {
sendComment(comment, pid) {
this.$http
.request({
url: "common/taihuTalentArticle/addArticleComment",
method: "POST",
data: {
pid: pid?pid:0, //第一条评论为0
pid: pid ? pid : 0, //第一条评论为0
articleId: this.options.id, //文章id
content: comment, //内容
},
@@ -713,6 +844,7 @@ export default {
.then((res) => {
console.log("res at line 713:", res);
if (res.code == 0) {
this.getMedicalDetail();
} else {
this.$commonJS.showToast("评论失败");
}
@@ -754,14 +886,32 @@ export default {
console.log("res at line 682:", res);
if (res.code == 0) {
this.loading = false;
this.articleInfo = res.article;
this.commentData = res.comments;
this.articleInfo = res.article;
this.medicalForm = { ...this.articleInfo };
console.log("this.medicalForm at line 193:", this.articleInfo);
if (this.articleInfo.img) {
this.fileList1 = this.articleInfo.img.split(",");
}
this.$nextTick(() => {
// if (this.userInfo.id == this.articleInfo.userId) {
// this.currentUser = this.articleInfo.taihuTalent;
// } else {
this.currentUser = {
...this.userInfo,
icon: this.userInfo.avatar,
};
console.log("this.currentUser at line 823:", this.currentUser);
// }
});
this.likeList = res.article.likeList;
this.commentData = res.comments;
this.commentData = {
commentSize: res.commentCount,
comment: this.getTree(this.commentData),
};
this.judgeImg();
this.$forceUpdate();
// 滚动到最底部锚点
@@ -1215,7 +1365,7 @@ h3 {
display: flex;
/* #endif */
flex-direction: row;
z-index: 502;
z-index: 10;
box-sizing: content-box;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
@@ -1268,8 +1418,8 @@ h3 {
font-weight: 700;
}
.analysis_title_detail {
margin-top: 30rpx;
margin-bottom: 50rpx;
margin-top: 20rpx;
margin-bottom: 30rpx;
// color: #1781ff;
font-size: 42rpx;
font-weight: 700;
@@ -1313,7 +1463,7 @@ h3 {
padding: 0;
}
.analysis_img_box {
margin-bottom: 30rpx;
margin-bottom: 4rpx;
}
.analysis_img {
display: flex;
@@ -1330,7 +1480,6 @@ h3 {
width: calc(100% - 140rpx);
color: #1b1b1b;
.taihuTalent_name {
margin-bottom: 20rpx;
font-size: 36rpx;
font-weight: 600;
}
@@ -1360,4 +1509,36 @@ h3 {
}
}
}
.allImage {
margin-top: 40rpx;
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
}
.imgList {
// margin: 0 30rpx;
}
.images:not(:nth-child(3n)) {
/* margin-right: 10rpx; */
}
.text {
margin: 1% 3% 2%;
}
.images {
margin-right: 10rpx;
display: inline-block;
}
.images3:nth-child(3n) {
margin-right: 0rpx;
}
.likeList {
background: #f7f7f7;
border-radius: 4rpx;
padding: 8rpx 20rpx;
box-sizing: border-box;
margin: 20rpx 0;
display: flex;
align-items: center;
}
</style>