This commit is contained in:
2025-08-13 14:53:35 +08:00
parent 1f5f069988
commit b2009403d8
13 changed files with 761 additions and 282 deletions

View File

@@ -3,9 +3,17 @@
class="content"
:class="`${options.type == 'detail' ? 'content_detail' : ''}`"
>
<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')">
<z-nav-bar
:title="options.navTitle"
:bgColor="options.type == 'detail' ? '#d8e6ff73' : '#5188e5'"
:fontColor="options.type == 'detail' ? '#5188e5' : '#fff'"
>
<template v-slot:right>
<view
class="top_right"
@tap="handleOpenShowSubmit"
v-if="options.type == 'add'"
>
<text
style="
padding: 4rpx 10rpx;
@@ -14,7 +22,24 @@
line-height: 40rpx;
color: #fff;
"
>去发布</text
>提交</text
>
</view>
<view
v-if="options.type == 'detail'"
class="top_right"
@tap="showDel = true"
style="display: flex; align-items: center"
>
<uni-icons
type="trash-filled"
size="22"
style="color: #aa3629; margin-left: 40rpx"
></uni-icons>
<text
style="letter-spacing: 4rpx; color: #aa3629; margin-right: 20rpx"
>删除</text
>
</view>
</template>
@@ -39,7 +64,7 @@
<!-- 固定标题和输入框部分 -->
<view class="analysis_box">
<view class="analysis_title">
<view class="analysis_title" style="margin-bottom: 10rpx">
<textarea
auto-height
v-model="formData.title"
@@ -120,7 +145,7 @@
<image v-else src="/static/icon/noIcon.png" />
<view class="taihuTalentBox">
<view class="taihuTalent_name">{{
<view class="taihuTalent_name" style="color: #5a6988">{{
articleInfo &&
articleInfo.taihuTalent &&
articleInfo.taihuTalent.name
@@ -141,19 +166,26 @@
>
</view>
</view>
<view style="color: #5188e5; text-align: right"
>{{ articleInfo.readCount }}人阅读</view
<view style="color: #aaacab; text-align: right">
{{ articleInfo.readCount }}人阅读</view
>
</view>
<view
class="analysis_title analysis_title_detail"
style="color: #302f35; font-size: 36rpx; line-height: 42rpx"
style="color: #302f35; font-size: 32rpx"
>
{{ articleInfo.title }}
</view>
<rich-text
:nodes="articleInfo.content"
style="height: auto; margin-bottom: 260rpx; color: #4b4b4b"
style="
height: auto;
margin-bottom: 260rpx;
color: #4b4b4b;
text-align: justify;
white-space: pre-wrap;
word-wrap: break-word;
"
/>
</view>
<view class="allImage">
@@ -177,6 +209,11 @@
</view>
</view>
</view>
<view
style="letter-spacing: 1rpx; color: #aaacab; margin-top: 20rpx"
v-if="articleInfo.createTime"
>{{ articleInfo.createTime }}
</view>
<view class="likeList" v-if="likeList.length > 0" style="color: #5188e5">
<uni-icons
type="heart"
@@ -259,11 +296,15 @@
</template>
</view>
</view>
<uni-popup ref="share" type="share" safeArea backgroundColor="#fff">
<uni-popup-share @select="haveSelected"></uni-popup-share>
</uni-popup>
<view style="padding-bottom: 20px">
<uni-popup ref="share" type="share" safeArea backgroundColor="#fff">
<uni-popup-share :bottom="500" @select="haveSelected"></uni-popup-share>
</uni-popup>
</view>
<!-- <z-navigation></z-navigation> -->
<u-popup
@close="orderModalShow = false"
:show="orderModalShow"
mode="bottom"
:round="8"
@@ -272,7 +313,7 @@
backgroundColor="#fff"
>
<view class="orderModalShow popup_box">
<view style="text-align: center"
<view style="text-align: center; padding-bottom: 20rpx"
>全部 {{ articleInfo.commentCount }} 条评论</view
>
@@ -301,6 +342,32 @@
></hb-comment>
</view>
</u-popup>
<u-modal
:show="showDel"
@confirm="confirmDel"
@cancel="showDel = false"
ref="uModalDel"
:asyncClose="true"
:showCancelButton="true"
confirmText="删除"
confirmColor="#aa3629"
title="提示"
>
<view class="slot-content"> 您确定要删除该文章吗? </view>
</u-modal>
<u-modal
:show="showSubmit"
@confirm="confirmSubmit"
@cancel="showSubmit = false"
ref="uModalSubmit"
:asyncClose="true"
:showCancelButton="true"
confirmText="发布"
confirmColor="#5188e5"
title="提示"
>
<view class="slot-content"> 是否立即发布文章? </view>
</u-modal>
</view>
</template>
@@ -311,6 +378,8 @@ import articleDetail from "./articleDetail.vue";
import commonEditor from "./common-editor.vue";
import qs from "qs";
import text from "uview-ui/libs/config/props/text";
import { debounce, throttle } from "@/common/debounce.js";
export default {
components: {
articleDetail,
@@ -322,6 +391,8 @@ export default {
likeList: [],
orderModalShow: false,
showDel: false,
showSubmit: false,
commentData: [],
articleInfo: {},
editorOption: {},
@@ -400,17 +471,31 @@ export default {
// this.sendQuestion();
this.windowHeight = systemInfo.windowHeight;
this.windowWidth = systemInfo.windowWidth;
},
async onShow() {
if (this.options.type == "add") {
this.loading = true;
} else {
this.loading = true;
await this.getMedicalDetail();
await this.getMedicalDetail(() => {
if (this.options.open) {
// if (this.options.open == "查看文章") {
// this.onHandleClickOpenComment();
// }
if (this.options.open == "查看评论") {
this.onHandleClickOpenComment();
}
if (this.options.open == "分享文章") {
this.newOnShare();
}
delete this.options.open;
}
});
// this.tishi=true
}
},
async onShow() {},
async onPullDownRefresh() {
this.isRefreshing = true;
console.log("下拉刷新");
@@ -433,10 +518,71 @@ export default {
}, 800);
},
methods: {
confirmDel: throttle(function () {
this.delArticle();
}, 2000),
handleOpenShowSubmit() {
if (!this.formData.title) {
this.$commonJS.showToast("请输入文章标题");
return;
}
if (!this.formData.message) {
this.$commonJS.showToast("请输入文章正文内容");
return;
}
if (this.fileList1.length == 0) {
this.$commonJS.showToast("请至少上传一张图片");
return;
}
this.showSubmit = true;
},
confirmSubmit: throttle(function () {
this.handleSubmit("submit");
}, 2000),
delArticle() {
var that = this;
uni.showLoading({
title: "加载中",
});
this.$http
.request({
url: "common/taihuTalentArticle/delArticle",
method: "POST",
data: {
id: this.articleInfo.id,
},
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
uni.hideLoading();
if (res.code == 0) {
uni.showToast({
title: "删除成功",
icon: "success",
duration: 2000,
});
this.$commonJS.refreshPrevPageData();
} else {
uni.showToast({
title: "删除失败",
icon: "success",
duration: 2000,
});
}
});
},
newOnShare() {
this.$refs.share.open();
},
haveSelected(data) {
if (!this.articleInfo) {
return false;
}
let image = "";
this.articleInfo.img && this.articleInfo.img != ""
? (image = this.articleInfo.img.split(",")[0])
@@ -534,25 +680,9 @@ export default {
this.orderModalShow = false;
},
saveContens(content) {
console.log("content at line 322:", content);
this.formData.message = content;
},
handleSubmit(type, isNewSave) {
console.log("this.editableMap at line 243:", this.formData);
if (!this.formData.title) {
this.$commonJS.showToast("请输入文章标题");
return;
}
if (!this.formData.message) {
this.$commonJS.showToast("请输入文章正文内容");
return;
}
if (this.fileList1.length == 0) {
this.$commonJS.showToast("请至少上传一张图片");
return;
}
handleSubmit: throttle(function (type, isNewSave) {
var data = {
img:
this.fileList1.length > 0
@@ -561,7 +691,7 @@ export default {
title: this.formData.title ? this.formData.title : "",
content: this.formData.message ? this.formData.message : "",
};
// debounce(() => {
this.$http
.request({
url: "common/taihuTalentArticle/addArticle",
@@ -575,15 +705,14 @@ export default {
})
.then((res) => {
if (res.code == 0) {
uni.redirectTo({
url: "/pages/articleList/index",
});
this.$commonJS.refreshPrevPageData(1);
} else {
this.$commonJS.showToast(res.msg);
}
})
.catch((err) => {});
},
}, 3000),
async addPic(e) {
let that = this;
for (var i = 0; i < e.file.length; i++) {
@@ -913,7 +1042,9 @@ export default {
};
this.judgeImg();
this.$forceUpdate();
if (fn) {
fn();
}
// 滚动到最底部锚点
// that.$nextTick(() => {
// that.scrollToBottom();
@@ -1365,7 +1496,7 @@ h3 {
display: flex;
/* #endif */
flex-direction: row;
z-index: 10;
z-index: 10 !important;
box-sizing: content-box;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
@@ -1418,8 +1549,8 @@ h3 {
font-weight: 700;
}
.analysis_title_detail {
margin-top: 20rpx;
margin-bottom: 30rpx;
margin-top: 10rpx;
margin-bottom: 10rpx;
// color: #1781ff;
font-size: 42rpx;
font-weight: 700;
@@ -1468,19 +1599,19 @@ h3 {
.analysis_img {
display: flex;
align-items: center;
margin-bottom: 10rpx;
// margin-bottom: 10rpx;
image {
width: 120rpx;
height: 120rpx;
border-radius: 120rpx;
width: 80rpx;
height: 80rpx;
border-radius: 80rpx;
margin-right: 20rpx;
}
}
.taihuTalentBox {
width: calc(100% - 140rpx);
width: calc(100% - 100rpx);
color: #1b1b1b;
.taihuTalent_name {
font-size: 36rpx;
font-size: 32rpx;
font-weight: 600;
}
.zhicheng {

View File

@@ -53,8 +53,7 @@
></image> -->
<view class="item_right">
<view class="item_top"
>
<view class="item_top">
<PrecisionImageGrid
:imageList="item.fileList1"
style="
@@ -66,27 +65,53 @@
"
/>
<view class="right">
<view class="item_name hidden2">{{ item.title }}</view>
<view class="item_time"
><text style="margin-right: 30rpx; color: #e38d54" v-if="item.come==1"
>医案转发</text
><text style="letter-spacing: 1rpx;">{{
item.createTime ? item.createTime : ""
}}</text></view
>
<view class="item_time item_bottom">
<view class="left">
<view><text>{{ item.readCount?item.readCount:0 }}</text>阅读</view
><text class="drop">·</text>
<view><text>{{ item.likeCount?item.likeCount:0 }}</text>点赞</view
><text class="drop">·</text>
<view><text>{{ item.commentCount?item.commentCount:0 }}</text>评论</view></view
<view class="item_time"
><text
style="margin-right: 30rpx; color: #e38d54"
v-if="item.come == 1"
>医案转发</text
><text style="letter-spacing: 1rpx">{{
item.createTime ? item.createTime : ""
}}</text></view
>
<!-- <view style="color: #5188e5"
<view class="item_time item_bottom">
<view class="left">
<view
><text>{{ item.readCount ? item.readCount : 0 }}</text
>阅读</view
><text class="drop">·</text>
<view
><text>{{ item.likeCount ? item.likeCount : 0 }}</text
>点赞</view
><text class="drop">·</text>
<view
><text>{{
item.commentCount ? item.commentCount : 0
}}</text
>评论</view
></view
>
<view
class="operate"
@click.stop="handleMore(item)"
style="
line-height: 10rpx;
font-size: 38rpx;
margin-top: -20rpx;
"
>
...
<!-- <button class="like" @click.stop="handleLike">
</button>
<button class="comment" @click.stop="handleComment">
评论
</button> -->
</view>
<!-- <view style="color: #5188e5"
><uni-icons
type="redo-filled"
size="18"
@@ -94,9 +119,8 @@
></uni-icons
>分享</view
> -->
</view>
</view>
</view>
</view>
<!-- <view class="list_item_bt">
@@ -118,6 +142,17 @@
</scroll-view>
<text class="null_text" v-else>{{ null_text }}</text>
<z-navigation></z-navigation>
<u-action-sheet
:actions="operateList"
:title="title"
@select="selectClick"
:show="showOperate"
@close="showOperate = false"
safeAreaInsetBottom
cancelText="取消"
round="8"
></u-action-sheet>
</view>
</template>
@@ -128,6 +163,28 @@ export default {
components: { PrecisionImageGrid },
data() {
return {
selectArticleId: null,
showOperate: false, // 控制弹窗显示隐藏
operateList: [
{
name: "查看评论",
fontSize: "16",
},
{
name: "分享文章",
fontSize: "16",
},
{
name: "删除",
color: "#aa3629",
fontSize: "16",
},
],
tabsList: [],
currentCateIndex: 0,
list: [],
@@ -166,12 +223,66 @@ export default {
},
onLoad() {
uni.hideTabBar();
this.getTabData();
this.getTabData()
},
onShow() {
// this.getListData(this.taihumedId);
},
methods: {
refreshData(reset) {
this.current = 1;
this.list = [];
this.noMore = false;
if(reset){
this.currentCateIndex = 0;
this.courseName = "";
this.taihumedId = this.tabsList[this.currentCateIndex].id;
this.statusTitle = this.tabsList[this.currentCateIndex].statusTitle;
this.statusColor = this.tabsList[this.currentCateIndex].color;
//重置
this.list = [];
this.noMore = false;
this.show = false;
this.count = 0;
this.current = 1;
this.getListData(this.taihumedId);
}else{
this.getListData(this.taihumedId);
}
},
selectClick(e) {
console.log(e.name);
if (e.name == "删除") {
this.delArticle();
} else {
uni.navigateTo({
url: `/pages/articleList/article?navTitle=文章详情&title=文章详情&id=${this.selectArticleId}&type=detail&statusId=1&open=${e.name}`,
});
}
},
handleMore(item) {
// uni.showActionSheet({
// itemList: ['选项1', '选项2', '选项3'],
// success: (res) => {
// console.log('点击了:', res.tapIndex);
// },
// fail: (err) => {
// console.log('调用失败', err);
// }
// })
this.selectArticleId = item.id;
this.showOperate = true;
// this.$refs.commentLikePopup.showCommentPopup();
},
getGridColumns(length) {
if (length === 1) return "1fr"; // 1 张图 → 1 列
if (length === 2) return "repeat(2, 1fr)"; // 2 张图 → 2 列
@@ -189,7 +300,7 @@ export default {
},
createFolder() {
uni.navigateTo({
url: `/pages/articleList/article?navTitle=创建文章&title=创建文章&type=add`,
url: `/pages/articleList/article?navTitle=文章&title=文章&type=add`,
});
},
//判断显示‘上/中/下’
@@ -228,8 +339,49 @@ export default {
// }
// });
},
//获取列表数据
delArticle() {
var that = this;
uni.showLoading({
title: "加载中",
});
this.$http
.request({
url: "common/taihuTalentArticle/delArticle",
method: "POST",
data: {
id: this.selectArticleId,
},
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
uni.hideLoading();
if (res.code == 0) {
uni.showToast({
title: "删除成功",
icon: "success",
duration: 2000,
});
}
this.$nextTick(()=>{
this.list=this.list.filter((e)=>{
return e.id!=this.selectArticleId
})
this.count=this.list.length
})
});
},
getListData(taihumedId, type) {
console.log('taihumedId at line 344:', taihumedId)
if (type) {
this.current = 1;
this.list = [];
@@ -388,17 +540,18 @@ export default {
line-height: 30rpx;
}
.item_top {
display: flex;
align-items: center;
justify-content: space-between;
display: flex;
align-items: center;
justify-content: space-between;
// line-height: 30rpx;
// margin-top: 8rpx;
}
.right{
.right {
width: calc(100% - 186rpx);
}
.item_name {
font-size: 32rpx;line-height: 26rpx;
font-size: 32rpx;
line-height: 26rpx;
white-space: pre-wrap;
word-wrap: break-word; /* 避免长单词造成溢出 */
@@ -595,9 +748,19 @@ export default {
display: block;
color: #333;
}
.hidden2{
line-height: 24px;
max-height: 48px;
height: auto;
}
.hidden2 {
line-height: 24px;
max-height: 48px;
height: auto;
}
.operate {
display: flex;
align-items: center;
justify-content: space-around;
}
.like,
.comment,
.more {
margin: 0 5px;
}
</style>

View File

@@ -336,7 +336,7 @@ export default {
}
.comment-box {
padding: 20rpx 0;
padding: 12rpx 0;
}
.comment-box-item {