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 {