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

@@ -33,6 +33,18 @@ export default {
}
})
},
refreshPrevPageData(reset) {
const pages = getCurrentPages(); // 当前页面栈
if (pages.length > 1) {
const prevPage = pages[pages.length - 2]; // 上一页实例
if (prevPage && typeof prevPage.refreshData === 'function') {
console.log('at line 514:', '调用刷新函数')
prevPage.refreshData(reset); // 调用刷新函数
}
}
uni.navigateBack({ delta: 1 });
},
//复制内容
handleCopy(value, title) {
uniCopy({
@@ -44,22 +56,22 @@ export default {
})
},
error: (e) => {
}
})
},
//用户协议
async getAgreement(id) {
async getAgreement(id) {
console.log('id at line 56:', id)
var data = {
id: id
}
var result = {
title:'',
content:''
title: '',
content: ''
}
await $http
await $http
.request({
url: "sys/agreement/getAgreement",
method: "POST",
@@ -111,8 +123,8 @@ export default {
}
},
});
},
// 注销账户
},
// 注销账户
logout() {
let that = this;
uni.showModal({

View File

@@ -25,5 +25,35 @@ function debounce(func, wait = 500, immediate = false) {
}, wait)
}
}
export default debounce
function throttle(fn, delay = 1000, immediate = false) {
console.log("进入节流对象")
let timer
let status = false // 是否为重复点击状态
return function () {
let _this = this
let args = arguments
if (immediate) {
console.log("立即执行参数 执行一次方法")
fn.apply(_this, args)
immediate = false
return
}
if (status) {
console.log("当前点击状态为正在重复点击,请稍等片刻后在点击执行")
return
}
console.log("执行节流:当前执行了一次点击方法")
fn.apply(_this, args)
status = true // 修改状态
timer = setTimeout(() => {
console.log("规定时间到,重置状态,可以重新调用")
status = false
}, delay)
}
}
export {
debounce,
throttle
}

View File

@@ -10,7 +10,8 @@
mode="aspectFill"
class="user__header-image"
></image>
<image v-else
<image
v-else
src="/static/icon/noIcon.png"
mode="aspectFill"
class="user__header-image"
@@ -24,9 +25,10 @@
@click.stop="clickUser()"
>{{ name }}</text
>
<view style="display: flex; align-items: center"
<view style="display: flex; align-items: center;margin-top: 14rpx;"
><text class="user__content-note uni-ellipsis">{{
createTime
createTime
}}</text>
<view style="display: flex; align-items: center; color: #808080"
><uni-icons
@@ -45,97 +47,105 @@
</view>
</view>
</view>
<view style="padding: 0rpx 30rpx"
>
<u-read-more showHeight="284" :toggle="true" color="#5a6988">
<view class="title" style="text-indent: 0 !important;">{{ title }}</view>
<view style="padding: 0rpx 30rpx; width: calc(100% - 100rpx);margin-left: 100rpx;">
<u-read-more showHeight="120" :toggle="true" color="#5a6988">
<view class="title" style="text-indent: 0 !important">{{ title }}</view>
<rich-text
:nodes="content"
style="
height: auto;
color: #4b4b4b;
margin-bottom: 40rpx;
" /></u-read-more
></view>
<view class="allImage">
<view class="imgList">
<view
class="images"
:class="`${imgList.length > 4 ? 'images3' : ''}`"
v-for="(item, index) in imgList"
:key="index"
>
<image
@click.stop="previewImg(index)"
class="oneimg"
:src="item"
mode="aspectFill"
:style="{ width: imgWidth + 'px', 'max-height': imgHeight + 'px' }"
></image>
font-size: 28rpx;
"
/></u-read-more>
<view class="allImage">
<view class="imgList">
<view
class="images"
:class="`${imgList.length > 4 ? 'images3' : ''}`"
v-for="(item, index) in imgList"
: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>
<view class="likeList" v-if="likeList.length > 0" style="color: #5188e5" @click.stop="clickThumbsup('likeList')">
<uni-icons
<view class="icon uni-row uni-center" ref="commentIcon" @click="showComment">
<text class="dot mr-5"></text>
<text class="dot"></text>
</view>
<view
class="likeList"
v-if="likeList.length > 0"
style="color: #5188e5"
@click.stop="clickThumbsup('likeList')"
>
<uni-icons
type="heart"
size="20"
style="color: #5188e5; margin-right: 10rpx"
></uni-icons
></uni-icons>
<view class="hidden2">{{
likeList
.map((item) =>
item.user.nickname ? item.user.nickname : "普通用户"
)
.join(" , ")
}}</view>
</view>
<view class="operate" style="width: 100%">
<view
@click.stop="clickThumbsup('like')"
style="display: flex; align-items: center; color: #9a9a9a"
>
<uni-icons
type="hand-up-filled"
size="24"
style="color: #9a9a9a; margin-right: 10rpx"
:style="{ color: thumbsupColor }"
></uni-icons
>{{ likeCount ? likeCount : "0" }}
</view>
<view
style="display: flex; align-items: center; color: #9a9a9a"
@click.stop="clickThumbsup('pinglun')"
><uni-icons
type="chat-filled"
size="24"
style="color: #9a9a9a; margin-right: 10rpx"
></uni-icons
>{{ commentCount ? commentCount : "0" }}</view
>
<view class="hidden2">{{ likeList.map(item => item.user.nickname?item.user.nickname:'普通用户').join(' , ') }}</view>
</view>
<view class="operate" style="width: 100%">
<view
@click.stop="clickThumbsup('like')"
style="display: flex; align-items: center; color: #9a9a9a"
>
<uni-icons
type="hand-up-filled"
size="24"
style="color: #9a9a9a; margin-right: 10rpx"
:style="{ color: thumbsupColor }"
></uni-icons
>{{ likeCount ? likeCount : "0" }}
</view>
<view
style="display: flex; align-items: center; color: #9a9a9a"
@click.stop="clickThumbsup('pinglun')"
><uni-icons
type="chat-filled"
size="24"
style="color: #9a9a9a; margin-right: 10rpx"
></uni-icons
>{{ commentCount ? commentCount : "0" }}</view
>
<view
@click.stop="clickThumbsup('share')"
style="display: flex; align-items: center; color: #9a9a9a"
>
<uni-icons
type="redo-filled"
size="24"
style="color: #9a9a9a; margin-right: 10rpx"
></uni-icons
>分享
</view>
</view></view
>
<view
@click.stop="clickThumbsup()"
style="display: flex; align-items: center; color: #5188e5"
>
<uni-icons
type="redo-filled"
size="24"
style="color: #5188e5; margin-right: 10rpx"
></uni-icons
>分享
</view>
</view>
<view class="bottom-line"></view>
</view>
</template>
<script>
export default {
props: {
avatar: {
@@ -193,7 +203,7 @@ export default {
this.initOperate();
},
},
data() {
return {
emptyAvatar: "/static/icon/noIcon.png",
@@ -254,80 +264,47 @@ export default {
// 自适应判断
judgeImg() {
if (this.imgList.length == 1) {
this.imgWidth = (this.windowWidth * 2) / 3;
this.imgWidth = ((this.windowWidth - 60) * 2) / 3;
this.imgHeight = (this.windowHeight * 3) / 5;
} else if (this.imgList.length == 4) {
this.imgWidth = this.windowWidth / 3.3;
this.imgWidth = (this.windowWidth - 60) / 3.3;
this.imgHeight = this.imgWidth;
} else {
this.imgWidth = this.windowWidth / 3.4;
this.imgWidth = (this.windowWidth - 60) / 3.4;
this.imgHeight = this.imgWidth;
}
},
timestampFormat(timestamp) {
if (!timestamp) return "";
function zeroize(num) {
return (String(num).length == 1 ? "0" : "") + num;
}
formatTimeAgo(dateString) {
const date = new Date(dateString);
const now = new Date();
const diffMs = now - date; // 毫秒差
var curTimestamp = parseInt(new Date().getTime() / 1000); //当前时间戳
var timestampDiff = curTimestamp - timestamp; // 参数时间戳与当前时间戳相差秒数
const diffSeconds = Math.floor(diffMs / 1000);
if (diffSeconds < 60) {
return '刚刚';
}
var curDate = new Date(curTimestamp * 1000); // 当前时间日期对象
var tmDate = new Date(timestamp * 1000); // 参数时间戳转换成的日期对象
const diffMinutes = Math.floor(diffSeconds / 60);
if (diffMinutes < 60) {
return diffMinutes + '分钟前';
}
var Y = tmDate.getFullYear(),
m = tmDate.getMonth() + 1,
d = tmDate.getDate();
var H = tmDate.getHours(),
i = tmDate.getMinutes(),
s = tmDate.getSeconds();
const diffHours = Math.floor(diffMinutes / 60);
if (diffHours < 24) {
return diffHours + '小时前';
}
const diffDays = Math.floor(diffHours / 24);
if (diffDays === 1) {
return '昨天';
}
if (diffDays < 30) {
return diffDays + '天前';
}
return date.toLocaleDateString();
},
if (timestampDiff < 60) {
// 一分钟以内
return "刚刚";
} else if (timestampDiff < 3600) {
// 一小时前之内
return Math.floor(timestampDiff / 60) + "分钟前";
} else if (
curDate.getFullYear() == Y &&
curDate.getMonth() + 1 == m &&
curDate.getDate() == d
) {
return "今天" + zeroize(H) + ":" + zeroize(i);
} else {
var newDate = new Date((curTimestamp - 86400) * 1000); // 参数中的时间戳加一天转换成的日期对象
if (
newDate.getFullYear() == Y &&
newDate.getMonth() + 1 == m &&
newDate.getDate() == d
) {
return "昨天" + zeroize(H) + ":" + zeroize(i);
} else if (curDate.getFullYear() == Y) {
return (
zeroize(m) +
"月" +
zeroize(d) +
"日 " +
zeroize(H) +
":" +
zeroize(i)
);
} else {
return (
Y +
"年" +
zeroize(m) +
"月" +
zeroize(d) +
"日 " +
zeroize(H) +
":" +
zeroize(i)
);
}
}
},
/** 触发父级事件 */
// 点击动态
@@ -373,7 +350,7 @@ export default {
justify-content: flex-start;
}
.imgList {
margin: 20rpx 30rpx;
margin: 14rpx 0 4rpx;
}
.images:not(:nth-child(3n)) {
/* margin-right: 10rpx; */
@@ -390,12 +367,12 @@ export default {
}
.operate {
width: 94%;
padding: 10rpx 0;
padding: 8rpx 0;
margin-top: 10rpx;
font-size: 14px;
display: flex;
align-items: center;
background-color: #e9f0ff73;
border-top: 4rpx solid #f3f3f3;
justify-content: space-around;
}
.chat-custom-right {
@@ -413,7 +390,7 @@ export default {
color: #999;
}
.bottom-line {
border-bottom: 4px solid #efefef;
border-bottom: 8px solid #efefef;
}
.user__container {
@@ -425,17 +402,17 @@ export default {
-webkit-box-flex: 1;
/* -webkit-flex: 1; */
flex: 1;
padding: 10px 15px;
padding: 10px 15px 6px;
position: relative;
overflow: hidden;
}
.user__header {
display: flex;
width: 100rpx;
height: 100rpx;
width: 80rpx;
height: 80rpx;
overflow: hidden;
border-radius: 120rpx;
border-radius: 80rpx;
}
.user__header-image {
display: flex;
@@ -448,9 +425,9 @@ export default {
-webkit-box-align: center;
align-items: center;
flex-wrap: wrap-reverse;
width: 100rpx;
height: 100rpx;
border-radius: 100rpx;
width: 80rpx;
height: 80rpx;
border-radius: 80rpx;
overflow: hidden;
}
@@ -463,6 +440,7 @@ export default {
flex: 1;
overflow: hidden;
padding: 2px 0;
margin-top: -10rpx;
}
.user__content-main {
display: -webkit-box;
@@ -508,12 +486,13 @@ export default {
color: #292929;
font-weight: 600;
font-size: 32rpx;
margin-bottom: 20rpx;
margin-bottom: 10rpx;
}
.user__content-title {
color: #5a6988;
font-weight: 600;
font-size: 34rpx;
font-size: 30rpx;
line-height: 38rpx;
}
::v-deep rich-text {
text-align: justify;
@@ -523,19 +502,20 @@ export default {
::v-deep rich-text p {
text-indent: 0 !important;
}
.likeList{
background: #f7f7f7;
border-radius: 4rpx;
padding: 8rpx 20rpx;
box-sizing: border-box;
margin: 20rpx 32rpx;
display: flex;
align-items: center;
.likeList {
background: #f7f7f7;
border-radius: 4rpx;
padding: 8rpx 20rpx;
box-sizing: border-box;
margin: 10rpx 0;
display: flex;
align-items: center;
margin-top: 0;
}
.hidden2 {
line-height: 24px;
max-height: 120px;
-webkit-line-clamp: 5;
height: auto;
}
.hidden2{
line-height: 24px;
max-height: 120px;
-webkit-line-clamp: 5;
height: auto;
}
</style>

View File

@@ -47,6 +47,8 @@ uni.getSystemInfo({
import commonGoodsNav from '@/pages/component/commonComponents/goodsNav.vue'
Vue.component('common-goods-nav', commonGoodsNav);
import commentLikePopup from '@/pages/component/commonComponents/comment-like-popup.vue'
Vue.component('comment-like-popup', commentLikePopup);
import commonList from '@/pages/component/commonComponents/list.vue'
Vue.component('common-list', commonList);
import commonOrderSubmit from '@/pages/component/commonComponents/orderSubmit.vue'

View File

@@ -88,7 +88,7 @@
"path": "pages/articleList/article",
"style": {
"navigationBarTitleText": "文章",
"enablePullDownRefresh": true, // 禁止下拉刷新
"app-plus": {
"bounce": "none",
"titleNView": false,

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 {

View File

@@ -0,0 +1,92 @@
<template>
<view class="tool uni-row uni-center" ref="commentElement">
<view class="zan uni-row uni-center" @click="dianzan">
<uni-icons type="heart" color="#fff"></uni-icons>
<text class="color-white font-14"></text>
</view>
<view class="comment uni-row uni-center" @click="pinglun">
<uni-icons type="chat" color="#fff"></uni-icons>
<text class="color-white font-14">评论</text>
</view>
</view>
</template>
<script>
export default {
name: 'commentPopup',
data() {
return {
commentToolStatus: false,
};
},
mounted() {
// 监听显示点赞/评论浮窗事件
uni.$on('showCommentPopup', this.showCommentPopup);
},
beforeDestroy() {
// 组件销毁时注销事件监听,防止内存泄漏
uni.$off('showCommentPopup', this.showCommentPopup);
},
methods: {
dianzan() {
this.hideCommentPopup();
uni.showToast({ title: "点赞", icon: "none" });
},
pinglun(e) {
this.hideCommentPopup();
// e.y 可能在 Vue 2 中无法直接获得,可以自己传递参数或用其他方式
// 这里假设你发射事件时传入的是 y 坐标
uni.$emit('commentScrollEvent', e && e.y ? e.y : 0);
uni.showToast({ title: "评论", icon: "none" });
},
showCommentPopup(y) {
if (!this.commentToolStatus) {
const element = this.$refs.commentElement;
if (element && element.style) {
element.style.top = y + 'px';
element.style.width = '160px';
element.style.opacity = '1';
}
this.commentToolStatus = true;
} else {
this.hideCommentPopup();
}
},
hideCommentPopup() {
if (!this.commentToolStatus) return;
const element = this.$refs.commentElement;
if (element && element.style) {
element.style.width = '0px';
element.style.opacity = '0';
}
this.commentToolStatus = false;
}
}
};
</script>
<style scoped lang="scss">
.tool {
position: absolute;
right: 60px;
z-index: 999;
width: 0;
height: 35px;
background-color: #666;
border-radius: 3px;
opacity: 0;
transition-property: width, opacity;
transition-duration: 100ms;
.comment,
.zan {
width: 80px;
}
.zan {
border-right: 0.5px solid #555;
}
}
</style>

View File

@@ -5,7 +5,14 @@
bgColor="#5188e5"
fontColor="#fff"
:backState="2000"
></z-nav-bar>
>
<template v-slot:right v-if="activeTab === 1">
<view class="top_right" @tap="createFolder" style="margin-right: 20rpx;">
<uni-icons type="folder-add" size="17" color="#fff"></uni-icons>
<text>发布文章</text>
</view>
</template>
</z-nav-bar>
<view
class="doctors_module"
:style="`top: ${42 + statusBarHeight}px;`"
@@ -68,8 +75,8 @@
:scroll-top="scrollTop"
@scrolltolower="loadMore"
:style="`
height: calc(100vh - ${activeTab == 0 ? 320 : 200}rpx);
margin-top: ${activeTab == 0 ? 260 : 100}rpx;
height: calc(100vh - ${activeTab == 0 ? 320 : 180}rpx);
margin-top: ${activeTab == 0 ? 260 : 80}rpx;
padding-bottom: 140rpx;`"
v-if="show == true"
>
@@ -189,7 +196,7 @@
</view> -->
<Dynamic
v-for="(item, index) in list"
key="id"
:key="item.id"
:imgList="item.fileList1"
:avatar="item.taihuTalent.icon"
:name="item.taihuTalent.name"
@@ -222,7 +229,9 @@
<z-navigation></z-navigation>
<common-pinglun ref="pinglun" @close="close"></common-pinglun>
<common-likeList ref="commonLikeList" @close="close"></common-likeList>
<uni-popup ref="share" type="share" safeArea backgroundColor="#fff">
<uni-popup-share @select="haveSelected"></uni-popup-share>
</uni-popup>
</view>
</template>
@@ -236,6 +245,7 @@ import commonLikeList from "../articleList/likeList.vue";
export default {
data() {
return {
shareId: null,
activeTab: 0,
tabsList: [],
currentCateIndex: 0,
@@ -272,8 +282,13 @@ export default {
this.current = 1;
this.list = [];
this.noMore = false;
if (this.activeTab == 0) {
this.getListData(this.tabsList[this.currentCateIndex].id);
} else {
this.getArticleListData();
}
this.getListData(this.tabsList[this.currentCateIndex].id);
uni.stopPullDownRefresh();
this.isRefreshing = false;
console.log("下拉刷新已停止");
@@ -285,6 +300,57 @@ export default {
},
onShow() {},
methods: {
createFolder() {
uni.navigateTo({
url: `/pages/articleList/article?navTitle=文章&title=文章&type=add`,
});
},
newOnShare() {
this.$refs.share.open();
},
haveSelected() {
var data = this.list.find((item) => item.id == this.shareId);
let image = "";
data.img && data.img != ""
? (image = data.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: `我在【太湖云医】发布了文章 “ ${data.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: `我在【太湖云医】发布了文章 “ ${data.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));
},
});
}
},
clickDynamic(id) {
//评论
console.log("childDynamic");
@@ -300,7 +366,7 @@ export default {
console.log(e);
console.log("childUser");
},
close(id){
close(id) {
this.getArticleDetail(id);
},
@@ -324,13 +390,13 @@ export default {
this.getArticleDetail(id);
this.$forceUpdate();
});
} else if (type == "pinglun") {
this.$refs.pinglun.onHandleClickOpenComment(id);
} else if (type == "likeList") {
this.$refs.commonLikeList.onHandleClickOpenComment(id);
} else if (type == "share") {
this.shareId = id;
this.newOnShare();
}
},

View File

@@ -1,5 +1,5 @@
<template>
<view class="hb-comment" style="height: 80vh">
<view class="hb-comment" style="height: 60vh">
<!-- 阅读数-start -->
<!-- 阅读数-end -->
@@ -169,21 +169,22 @@
<image v-if="user.icon"
:src="user.icon"
style="
width: 70rpx;
height: 70rpx;
width: 60rpx;
height: 60rpx;
margin: 0 8rpx;
display: block;
border-radius: 70rpx;
border-radius: 60rpx;
margin-top: 4rpx;
"
/>
<image v-else
src="/static/icon/noIcon.png"
style="
width: 70rpx;
height: 70rpx;
width: 60rpx;
height: 60rpx;
margin: 0 8rpx;
display: block;
border-radius: 70rpx;
border-radius: 60rpx;margin-top: 4rpx;
"
/>
@@ -193,7 +194,7 @@
width: calc(100% - 100rpx);
margin-right: 20rpx;
position: relative;
padding: 20rpx 20rpx;
padding: 14rpx 20rpx;
border-radius: 10rpx;
"
>
@@ -214,7 +215,7 @@
:style="{ bottom: keyboardHeight + 'px' }"
v-if="showInput"
>
<view style="overflow: hidden; margin-bottom: 12rpx"
<view style="overflow: hidden; margin-bottom: 4rpx;font-size: 26rpx"
><text
@click="
showInput = false;
@@ -229,7 +230,7 @@
<view>
<textarea
auto-height
style="max-height: 200rpx; overflow-y: auto; padding: 20rpx"
style="max-height: 200rpx; overflow-y: auto; padding: 14rpx"
v-model="commentContent"
class="comment-input"
maxlength="-1"
@@ -708,7 +709,7 @@ export default {
}
.comment-none {
padding: 16rpx 0;
padding: 4rpx 0;
width: 100%;
// text-align: center;
color: #999999;
@@ -785,7 +786,7 @@ export default {
left: 0;
width: 100%;
// display: flex;
padding: 10px;
padding: 10rpx;
background-color: #fff;
border-top: 1px solid #eee;
box-sizing: border-box;

View File

@@ -1,5 +1,6 @@
<template>
<view class="uni-popup-share">
<view class="uni-share-title"><text class="uni-share-title-text">{{shareTitleText}}</text></view>
<view class="uni-share-content">
<view class="uni-share-content-box">
@@ -32,6 +33,7 @@
type: String,
default: ''
},
beforeClose: {
type: Boolean,
default: false

View File

@@ -423,7 +423,7 @@
.uni-popup {
position: fixed;
/* #ifndef APP-NVUE */
z-index: 99;
z-index: 1000;
/* #endif */
&.top,