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) { handleCopy(value, title) {
uniCopy({ uniCopy({
@@ -50,16 +62,16 @@ export default {
}, },
//用户协议 //用户协议
async getAgreement(id) { async getAgreement(id) {
console.log('id at line 56:', id) console.log('id at line 56:', id)
var data = { var data = {
id: id id: id
} }
var result = { var result = {
title:'', title: '',
content:'' content: ''
} }
await $http await $http
.request({ .request({
url: "sys/agreement/getAgreement", url: "sys/agreement/getAgreement",
method: "POST", method: "POST",
@@ -112,7 +124,7 @@ export default {
}, },
}); });
}, },
// 注销账户 // 注销账户
logout() { logout() {
let that = this; let that = this;
uni.showModal({ uni.showModal({

View File

@@ -25,5 +25,35 @@ function debounce(func, wait = 500, immediate = false) {
}, wait) }, wait)
} }
} }
function throttle(fn, delay = 1000, immediate = false) {
console.log("进入节流对象")
let timer
let status = false // 是否为重复点击状态
return function () {
let _this = this
let args = arguments
export default debounce 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" mode="aspectFill"
class="user__header-image" class="user__header-image"
></image> ></image>
<image v-else <image
v-else
src="/static/icon/noIcon.png" src="/static/icon/noIcon.png"
mode="aspectFill" mode="aspectFill"
class="user__header-image" class="user__header-image"
@@ -24,9 +25,10 @@
@click.stop="clickUser()" @click.stop="clickUser()"
>{{ name }}</text >{{ 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">{{ ><text class="user__content-note uni-ellipsis">{{
createTime
createTime
}}</text> }}</text>
<view style="display: flex; align-items: center; color: #808080" <view style="display: flex; align-items: center; color: #808080"
><uni-icons ><uni-icons
@@ -45,97 +47,105 @@
</view> </view>
</view> </view>
</view> </view>
<view style="padding: 0rpx 30rpx" <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>
<u-read-more showHeight="284" :toggle="true" color="#5a6988">
<view class="title" style="text-indent: 0 !important;">{{ title }}</view>
<rich-text <rich-text
:nodes="content" :nodes="content"
style=" style="
height: auto; height: auto;
color: #4b4b4b; color: #4b4b4b;
margin-bottom: 40rpx; margin-bottom: 40rpx;
" /></u-read-more font-size: 28rpx;
></view> "
/></u-read-more>
<view class="allImage"> <view class="allImage">
<view class="imgList"> <view class="imgList">
<view <view
class="images" class="images"
:class="`${imgList.length > 4 ? 'images3' : ''}`" :class="`${imgList.length > 4 ? 'images3' : ''}`"
v-for="(item, index) in imgList" v-for="(item, index) in imgList"
:key="index" :key="index"
> >
<image <image
@click.stop="previewImg(index)" @click.stop="previewImg(index)"
class="oneimg" class="oneimg"
:src="item" :src="item"
mode="aspectFill" mode="aspectFill"
:style="{ width: imgWidth + 'px', 'max-height': imgHeight + 'px' }" :style="{
></image> width: imgWidth + 'px',
'max-height': imgHeight + 'px',
}"
></image>
</view>
</view> </view>
</view> </view>
</view> <view class="icon uni-row uni-center" ref="commentIcon" @click="showComment">
<view class="likeList" v-if="likeList.length > 0" style="color: #5188e5" @click.stop="clickThumbsup('likeList')"> <text class="dot mr-5"></text>
<text class="dot"></text>
<uni-icons </view>
<view
class="likeList"
v-if="likeList.length > 0"
style="color: #5188e5"
@click.stop="clickThumbsup('likeList')"
>
<uni-icons
type="heart" type="heart"
size="20" size="20"
style="color: #5188e5; margin-right: 10rpx" 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
@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>
<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()"
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 class="bottom-line"></view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
props: { props: {
avatar: { avatar: {
@@ -254,80 +264,47 @@ export default {
// 自适应判断 // 自适应判断
judgeImg() { judgeImg() {
if (this.imgList.length == 1) { if (this.imgList.length == 1) {
this.imgWidth = (this.windowWidth * 2) / 3; this.imgWidth = ((this.windowWidth - 60) * 2) / 3;
this.imgHeight = (this.windowHeight * 3) / 5; this.imgHeight = (this.windowHeight * 3) / 5;
} else if (this.imgList.length == 4) { } else if (this.imgList.length == 4) {
this.imgWidth = this.windowWidth / 3.3; this.imgWidth = (this.windowWidth - 60) / 3.3;
this.imgHeight = this.imgWidth; this.imgHeight = this.imgWidth;
} else { } else {
this.imgWidth = this.windowWidth / 3.4; this.imgWidth = (this.windowWidth - 60) / 3.4;
this.imgHeight = this.imgWidth; this.imgHeight = this.imgWidth;
} }
}, },
timestampFormat(timestamp) { formatTimeAgo(dateString) {
if (!timestamp) return ""; const date = new Date(dateString);
function zeroize(num) { const now = new Date();
return (String(num).length == 1 ? "0" : "") + num; const diffMs = now - date; // 毫秒差
}
var curTimestamp = parseInt(new Date().getTime() / 1000); //当前时间戳 const diffSeconds = Math.floor(diffMs / 1000);
var timestampDiff = curTimestamp - timestamp; // 参数时间戳与当前时间戳相差秒数 if (diffSeconds < 60) {
return '刚刚';
}
var curDate = new Date(curTimestamp * 1000); // 当前时间日期对象 const diffMinutes = Math.floor(diffSeconds / 60);
var tmDate = new Date(timestamp * 1000); // 参数时间戳转换成的日期对象 if (diffMinutes < 60) {
return diffMinutes + '分钟前';
}
var Y = tmDate.getFullYear(), const diffHours = Math.floor(diffMinutes / 60);
m = tmDate.getMonth() + 1, if (diffHours < 24) {
d = tmDate.getDate(); return diffHours + '小时前';
var H = tmDate.getHours(), }
i = tmDate.getMinutes(),
s = tmDate.getSeconds(); 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; justify-content: flex-start;
} }
.imgList { .imgList {
margin: 20rpx 30rpx; margin: 14rpx 0 4rpx;
} }
.images:not(:nth-child(3n)) { .images:not(:nth-child(3n)) {
/* margin-right: 10rpx; */ /* margin-right: 10rpx; */
@@ -390,12 +367,12 @@ export default {
} }
.operate { .operate {
width: 94%; width: 94%;
padding: 10rpx 0; padding: 8rpx 0;
margin-top: 10rpx; margin-top: 10rpx;
font-size: 14px; font-size: 14px;
display: flex; display: flex;
align-items: center; align-items: center;
background-color: #e9f0ff73; border-top: 4rpx solid #f3f3f3;
justify-content: space-around; justify-content: space-around;
} }
.chat-custom-right { .chat-custom-right {
@@ -413,7 +390,7 @@ export default {
color: #999; color: #999;
} }
.bottom-line { .bottom-line {
border-bottom: 4px solid #efefef; border-bottom: 8px solid #efefef;
} }
.user__container { .user__container {
@@ -425,17 +402,17 @@ export default {
-webkit-box-flex: 1; -webkit-box-flex: 1;
/* -webkit-flex: 1; */ /* -webkit-flex: 1; */
flex: 1; flex: 1;
padding: 10px 15px; padding: 10px 15px 6px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
.user__header { .user__header {
display: flex; display: flex;
width: 100rpx; width: 80rpx;
height: 100rpx; height: 80rpx;
overflow: hidden; overflow: hidden;
border-radius: 120rpx; border-radius: 80rpx;
} }
.user__header-image { .user__header-image {
display: flex; display: flex;
@@ -448,9 +425,9 @@ export default {
-webkit-box-align: center; -webkit-box-align: center;
align-items: center; align-items: center;
flex-wrap: wrap-reverse; flex-wrap: wrap-reverse;
width: 100rpx; width: 80rpx;
height: 100rpx; height: 80rpx;
border-radius: 100rpx; border-radius: 80rpx;
overflow: hidden; overflow: hidden;
} }
@@ -463,6 +440,7 @@ export default {
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
padding: 2px 0; padding: 2px 0;
margin-top: -10rpx;
} }
.user__content-main { .user__content-main {
display: -webkit-box; display: -webkit-box;
@@ -508,12 +486,13 @@ export default {
color: #292929; color: #292929;
font-weight: 600; font-weight: 600;
font-size: 32rpx; font-size: 32rpx;
margin-bottom: 20rpx; margin-bottom: 10rpx;
} }
.user__content-title { .user__content-title {
color: #5a6988; color: #5a6988;
font-weight: 600; font-weight: 600;
font-size: 34rpx; font-size: 30rpx;
line-height: 38rpx;
} }
::v-deep rich-text { ::v-deep rich-text {
text-align: justify; text-align: justify;
@@ -523,19 +502,20 @@ export default {
::v-deep rich-text p { ::v-deep rich-text p {
text-indent: 0 !important; text-indent: 0 !important;
} }
.likeList{ .likeList {
background: #f7f7f7; background: #f7f7f7;
border-radius: 4rpx; border-radius: 4rpx;
padding: 8rpx 20rpx; padding: 8rpx 20rpx;
box-sizing: border-box; box-sizing: border-box;
margin: 20rpx 32rpx; margin: 10rpx 0;
display: flex; display: flex;
align-items: center; 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> </style>

View File

@@ -47,6 +47,8 @@ uni.getSystemInfo({
import commonGoodsNav from '@/pages/component/commonComponents/goodsNav.vue' import commonGoodsNav from '@/pages/component/commonComponents/goodsNav.vue'
Vue.component('common-goods-nav', commonGoodsNav); 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' import commonList from '@/pages/component/commonComponents/list.vue'
Vue.component('common-list', commonList); Vue.component('common-list', commonList);
import commonOrderSubmit from '@/pages/component/commonComponents/orderSubmit.vue' import commonOrderSubmit from '@/pages/component/commonComponents/orderSubmit.vue'

View File

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

View File

@@ -3,9 +3,17 @@
class="content" class="content"
:class="`${options.type == 'detail' ? 'content_detail' : ''}`" :class="`${options.type == 'detail' ? 'content_detail' : ''}`"
> >
<z-nav-bar :title="options.navTitle" bgColor="#5188e5" fontColor="#fff"> <z-nav-bar
<template v-slot:right v-if="options.type != 'detail'"> :title="options.navTitle"
<view class="top_right" @tap="handleSubmit('submit')"> :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 <text
style=" style="
padding: 4rpx 10rpx; padding: 4rpx 10rpx;
@@ -14,7 +22,24 @@
line-height: 40rpx; line-height: 40rpx;
color: #fff; 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> </view>
</template> </template>
@@ -39,7 +64,7 @@
<!-- 固定标题和输入框部分 --> <!-- 固定标题和输入框部分 -->
<view class="analysis_box"> <view class="analysis_box">
<view class="analysis_title"> <view class="analysis_title" style="margin-bottom: 10rpx">
<textarea <textarea
auto-height auto-height
v-model="formData.title" v-model="formData.title"
@@ -120,7 +145,7 @@
<image v-else src="/static/icon/noIcon.png" /> <image v-else src="/static/icon/noIcon.png" />
<view class="taihuTalentBox"> <view class="taihuTalentBox">
<view class="taihuTalent_name">{{ <view class="taihuTalent_name" style="color: #5a6988">{{
articleInfo && articleInfo &&
articleInfo.taihuTalent && articleInfo.taihuTalent &&
articleInfo.taihuTalent.name articleInfo.taihuTalent.name
@@ -141,19 +166,26 @@
> >
</view> </view>
</view> </view>
<view style="color: #5188e5; text-align: right" <view style="color: #aaacab; text-align: right">
>{{ articleInfo.readCount }}人阅读</view {{ articleInfo.readCount }}人阅读</view
> >
</view> </view>
<view <view
class="analysis_title analysis_title_detail" class="analysis_title analysis_title_detail"
style="color: #302f35; font-size: 36rpx; line-height: 42rpx" style="color: #302f35; font-size: 32rpx"
> >
{{ articleInfo.title }} {{ articleInfo.title }}
</view> </view>
<rich-text <rich-text
:nodes="articleInfo.content" :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>
<view class="allImage"> <view class="allImage">
@@ -177,6 +209,11 @@
</view> </view>
</view> </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"> <view class="likeList" v-if="likeList.length > 0" style="color: #5188e5">
<uni-icons <uni-icons
type="heart" type="heart"
@@ -259,11 +296,15 @@
</template> </template>
</view> </view>
</view> </view>
<uni-popup ref="share" type="share" safeArea backgroundColor="#fff"> <view style="padding-bottom: 20px">
<uni-popup-share @select="haveSelected"></uni-popup-share> <uni-popup ref="share" type="share" safeArea backgroundColor="#fff">
</uni-popup> <uni-popup-share :bottom="500" @select="haveSelected"></uni-popup-share>
</uni-popup>
</view>
<!-- <z-navigation></z-navigation> --> <!-- <z-navigation></z-navigation> -->
<u-popup <u-popup
@close="orderModalShow = false"
:show="orderModalShow" :show="orderModalShow"
mode="bottom" mode="bottom"
:round="8" :round="8"
@@ -272,7 +313,7 @@
backgroundColor="#fff" backgroundColor="#fff"
> >
<view class="orderModalShow popup_box"> <view class="orderModalShow popup_box">
<view style="text-align: center" <view style="text-align: center; padding-bottom: 20rpx"
>全部 {{ articleInfo.commentCount }} 条评论</view >全部 {{ articleInfo.commentCount }} 条评论</view
> >
@@ -301,6 +342,32 @@
></hb-comment> ></hb-comment>
</view> </view>
</u-popup> </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> </view>
</template> </template>
@@ -311,6 +378,8 @@ import articleDetail from "./articleDetail.vue";
import commonEditor from "./common-editor.vue"; import commonEditor from "./common-editor.vue";
import qs from "qs"; import qs from "qs";
import text from "uview-ui/libs/config/props/text"; import text from "uview-ui/libs/config/props/text";
import { debounce, throttle } from "@/common/debounce.js";
export default { export default {
components: { components: {
articleDetail, articleDetail,
@@ -322,6 +391,8 @@ export default {
likeList: [], likeList: [],
orderModalShow: false, orderModalShow: false,
showDel: false,
showSubmit: false,
commentData: [], commentData: [],
articleInfo: {}, articleInfo: {},
editorOption: {}, editorOption: {},
@@ -400,17 +471,31 @@ export default {
// this.sendQuestion(); // this.sendQuestion();
this.windowHeight = systemInfo.windowHeight; this.windowHeight = systemInfo.windowHeight;
this.windowWidth = systemInfo.windowWidth; this.windowWidth = systemInfo.windowWidth;
},
async onShow() {
if (this.options.type == "add") { if (this.options.type == "add") {
this.loading = true; this.loading = true;
} else { } else {
this.loading = true; 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 // this.tishi=true
} }
}, },
async onShow() {},
async onPullDownRefresh() { async onPullDownRefresh() {
this.isRefreshing = true; this.isRefreshing = true;
console.log("下拉刷新"); console.log("下拉刷新");
@@ -433,10 +518,71 @@ export default {
}, 800); }, 800);
}, },
methods: { 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() { newOnShare() {
this.$refs.share.open(); this.$refs.share.open();
}, },
haveSelected(data) { haveSelected(data) {
if (!this.articleInfo) {
return false;
}
let image = ""; let image = "";
this.articleInfo.img && this.articleInfo.img != "" this.articleInfo.img && this.articleInfo.img != ""
? (image = this.articleInfo.img.split(",")[0]) ? (image = this.articleInfo.img.split(",")[0])
@@ -534,25 +680,9 @@ export default {
this.orderModalShow = false; this.orderModalShow = false;
}, },
saveContens(content) { saveContens(content) {
console.log("content at line 322:", content);
this.formData.message = content; this.formData.message = content;
}, },
handleSubmit(type, isNewSave) { handleSubmit: throttle(function (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;
}
var data = { var data = {
img: img:
this.fileList1.length > 0 this.fileList1.length > 0
@@ -561,7 +691,7 @@ export default {
title: this.formData.title ? this.formData.title : "", title: this.formData.title ? this.formData.title : "",
content: this.formData.message ? this.formData.message : "", content: this.formData.message ? this.formData.message : "",
}; };
// debounce(() => {
this.$http this.$http
.request({ .request({
url: "common/taihuTalentArticle/addArticle", url: "common/taihuTalentArticle/addArticle",
@@ -575,15 +705,14 @@ export default {
}) })
.then((res) => { .then((res) => {
if (res.code == 0) { if (res.code == 0) {
uni.redirectTo({ this.$commonJS.refreshPrevPageData(1);
url: "/pages/articleList/index",
});
} else { } else {
this.$commonJS.showToast(res.msg); this.$commonJS.showToast(res.msg);
} }
}) })
.catch((err) => {}); .catch((err) => {});
}, }, 3000),
async addPic(e) { async addPic(e) {
let that = this; let that = this;
for (var i = 0; i < e.file.length; i++) { for (var i = 0; i < e.file.length; i++) {
@@ -913,7 +1042,9 @@ export default {
}; };
this.judgeImg(); this.judgeImg();
this.$forceUpdate(); this.$forceUpdate();
if (fn) {
fn();
}
// 滚动到最底部锚点 // 滚动到最底部锚点
// that.$nextTick(() => { // that.$nextTick(() => {
// that.scrollToBottom(); // that.scrollToBottom();
@@ -1365,7 +1496,7 @@ h3 {
display: flex; display: flex;
/* #endif */ /* #endif */
flex-direction: row; flex-direction: row;
z-index: 10; z-index: 10 !important;
box-sizing: content-box; box-sizing: content-box;
padding-bottom: constant(safe-area-inset-bottom); padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
@@ -1418,8 +1549,8 @@ h3 {
font-weight: 700; font-weight: 700;
} }
.analysis_title_detail { .analysis_title_detail {
margin-top: 20rpx; margin-top: 10rpx;
margin-bottom: 30rpx; margin-bottom: 10rpx;
// color: #1781ff; // color: #1781ff;
font-size: 42rpx; font-size: 42rpx;
font-weight: 700; font-weight: 700;
@@ -1468,19 +1599,19 @@ h3 {
.analysis_img { .analysis_img {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 10rpx; // margin-bottom: 10rpx;
image { image {
width: 120rpx; width: 80rpx;
height: 120rpx; height: 80rpx;
border-radius: 120rpx; border-radius: 80rpx;
margin-right: 20rpx; margin-right: 20rpx;
} }
} }
.taihuTalentBox { .taihuTalentBox {
width: calc(100% - 140rpx); width: calc(100% - 100rpx);
color: #1b1b1b; color: #1b1b1b;
.taihuTalent_name { .taihuTalent_name {
font-size: 36rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
} }
.zhicheng { .zhicheng {

View File

@@ -53,8 +53,7 @@
></image> --> ></image> -->
<view class="item_right"> <view class="item_right">
<view class="item_top" <view class="item_top">
>
<PrecisionImageGrid <PrecisionImageGrid
:imageList="item.fileList1" :imageList="item.fileList1"
style=" style="
@@ -66,27 +65,53 @@
" "
/> />
<view class="right"> <view class="right">
<view class="item_name hidden2">{{ item.title }}</view> <view class="item_name hidden2">{{ item.title }}</view>
<view class="item_time" <view class="item_time"
><text style="margin-right: 30rpx; color: #e38d54" v-if="item.come==1" ><text
>医案转发</text style="margin-right: 30rpx; color: #e38d54"
><text style="letter-spacing: 1rpx;">{{ v-if="item.come == 1"
item.createTime ? item.createTime : "" >医案转发</text
}}</text></view ><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 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 ><uni-icons
type="redo-filled" type="redo-filled"
size="18" size="18"
@@ -94,9 +119,8 @@
></uni-icons ></uni-icons
>分享</view >分享</view
> --> > -->
</view>
</view> </view>
</view>
</view> </view>
<!-- <view class="list_item_bt"> <!-- <view class="list_item_bt">
@@ -118,6 +142,17 @@
</scroll-view> </scroll-view>
<text class="null_text" v-else>{{ null_text }}</text> <text class="null_text" v-else>{{ null_text }}</text>
<z-navigation></z-navigation> <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> </view>
</template> </template>
@@ -128,6 +163,28 @@ export default {
components: { PrecisionImageGrid }, components: { PrecisionImageGrid },
data() { data() {
return { return {
selectArticleId: null,
showOperate: false, // 控制弹窗显示隐藏
operateList: [
{
name: "查看评论",
fontSize: "16",
},
{
name: "分享文章",
fontSize: "16",
},
{
name: "删除",
color: "#aa3629",
fontSize: "16",
},
],
tabsList: [], tabsList: [],
currentCateIndex: 0, currentCateIndex: 0,
list: [], list: [],
@@ -166,12 +223,66 @@ export default {
}, },
onLoad() { onLoad() {
uni.hideTabBar(); uni.hideTabBar();
this.getTabData(); this.getTabData()
}, },
onShow() { onShow() {
// this.getListData(this.taihumedId); // this.getListData(this.taihumedId);
}, },
methods: { 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) { getGridColumns(length) {
if (length === 1) return "1fr"; // 1 张图 → 1 列 if (length === 1) return "1fr"; // 1 张图 → 1 列
if (length === 2) return "repeat(2, 1fr)"; // 2 张图 → 2 列 if (length === 2) return "repeat(2, 1fr)"; // 2 张图 → 2 列
@@ -189,7 +300,7 @@ export default {
}, },
createFolder() { createFolder() {
uni.navigateTo({ 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) { getListData(taihumedId, type) {
console.log('taihumedId at line 344:', taihumedId)
if (type) { if (type) {
this.current = 1; this.current = 1;
this.list = []; this.list = [];
@@ -388,17 +540,18 @@ export default {
line-height: 30rpx; line-height: 30rpx;
} }
.item_top { .item_top {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
// line-height: 30rpx; // line-height: 30rpx;
// margin-top: 8rpx; // margin-top: 8rpx;
} }
.right{ .right {
width: calc(100% - 186rpx); width: calc(100% - 186rpx);
} }
.item_name { .item_name {
font-size: 32rpx;line-height: 26rpx; font-size: 32rpx;
line-height: 26rpx;
white-space: pre-wrap; white-space: pre-wrap;
word-wrap: break-word; /* 避免长单词造成溢出 */ word-wrap: break-word; /* 避免长单词造成溢出 */
@@ -595,9 +748,19 @@ export default {
display: block; display: block;
color: #333; color: #333;
} }
.hidden2{ .hidden2 {
line-height: 24px; line-height: 24px;
max-height: 48px; max-height: 48px;
height: auto; height: auto;
} }
.operate {
display: flex;
align-items: center;
justify-content: space-around;
}
.like,
.comment,
.more {
margin: 0 5px;
}
</style> </style>

View File

@@ -336,7 +336,7 @@ export default {
} }
.comment-box { .comment-box {
padding: 20rpx 0; padding: 12rpx 0;
} }
.comment-box-item { .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" bgColor="#5188e5"
fontColor="#fff" fontColor="#fff"
:backState="2000" :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 <view
class="doctors_module" class="doctors_module"
:style="`top: ${42 + statusBarHeight}px;`" :style="`top: ${42 + statusBarHeight}px;`"
@@ -68,8 +75,8 @@
:scroll-top="scrollTop" :scroll-top="scrollTop"
@scrolltolower="loadMore" @scrolltolower="loadMore"
:style="` :style="`
height: calc(100vh - ${activeTab == 0 ? 320 : 200}rpx); height: calc(100vh - ${activeTab == 0 ? 320 : 180}rpx);
margin-top: ${activeTab == 0 ? 260 : 100}rpx; margin-top: ${activeTab == 0 ? 260 : 80}rpx;
padding-bottom: 140rpx;`" padding-bottom: 140rpx;`"
v-if="show == true" v-if="show == true"
> >
@@ -189,7 +196,7 @@
</view> --> </view> -->
<Dynamic <Dynamic
v-for="(item, index) in list" v-for="(item, index) in list"
key="id" :key="item.id"
:imgList="item.fileList1" :imgList="item.fileList1"
:avatar="item.taihuTalent.icon" :avatar="item.taihuTalent.icon"
:name="item.taihuTalent.name" :name="item.taihuTalent.name"
@@ -222,7 +229,9 @@
<z-navigation></z-navigation> <z-navigation></z-navigation>
<common-pinglun ref="pinglun" @close="close"></common-pinglun> <common-pinglun ref="pinglun" @close="close"></common-pinglun>
<common-likeList ref="commonLikeList" @close="close"></common-likeList> <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> </view>
</template> </template>
@@ -236,6 +245,7 @@ import commonLikeList from "../articleList/likeList.vue";
export default { export default {
data() { data() {
return { return {
shareId: null,
activeTab: 0, activeTab: 0,
tabsList: [], tabsList: [],
currentCateIndex: 0, currentCateIndex: 0,
@@ -272,8 +282,13 @@ export default {
this.current = 1; this.current = 1;
this.list = []; this.list = [];
this.noMore = false; 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(); uni.stopPullDownRefresh();
this.isRefreshing = false; this.isRefreshing = false;
console.log("下拉刷新已停止"); console.log("下拉刷新已停止");
@@ -285,6 +300,57 @@ export default {
}, },
onShow() {}, onShow() {},
methods: { 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) { clickDynamic(id) {
//评论 //评论
console.log("childDynamic"); console.log("childDynamic");
@@ -300,7 +366,7 @@ export default {
console.log(e); console.log(e);
console.log("childUser"); console.log("childUser");
}, },
close(id){ close(id) {
this.getArticleDetail(id); this.getArticleDetail(id);
}, },
@@ -324,13 +390,13 @@ export default {
this.getArticleDetail(id); this.getArticleDetail(id);
this.$forceUpdate(); this.$forceUpdate();
}); });
} else if (type == "pinglun") { } else if (type == "pinglun") {
this.$refs.pinglun.onHandleClickOpenComment(id); this.$refs.pinglun.onHandleClickOpenComment(id);
} else if (type == "likeList") { } else if (type == "likeList") {
this.$refs.commonLikeList.onHandleClickOpenComment(id); this.$refs.commonLikeList.onHandleClickOpenComment(id);
} else if (type == "share") {
this.shareId = id;
this.newOnShare();
} }
}, },

View File

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

View File

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

View File

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