This commit is contained in:
2025-08-14 16:49:58 +08:00
parent b2009403d8
commit 26c1ac5ced
15 changed files with 1144 additions and 351 deletions

View File

@@ -1,5 +1,6 @@
<template>
<view class="content" style="background-color: #d8e6ff57">
<z-nav-bar title="我的文章" bgColor="#5188e5" fontColor="#fff">
<template v-slot:right>
<view class="top_right" @tap="createFolder">
@@ -94,7 +95,8 @@
>评论</view
></view
>
<view
<view v-if="item.showFlag != 0"
class="operate"
@click.stop="handleMore(item)"
style="
@@ -104,12 +106,27 @@
"
>
...
<!-- <button class="like" @click.stop="handleLike">
</button>
<button class="comment" @click.stop="handleComment">
评论
</button> -->
</view>
<view v-else
class="operate"
@click.stop="selectArticleId = item.id;showDel=true"
style="
line-height: 10rpx;
font-size: 38rpx;
/* margin-top: -20rpx; */
"
>
<uni-icons
type="trash-filled"
size="22"
color="#aa3629"
></uni-icons
>
</view>
<!-- <view style="color: #5188e5"
><uni-icons
@@ -153,37 +170,34 @@
cancelText="取消"
round="8"
></u-action-sheet>
<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>
</view>
</template>
<script>
import $http from "@/config/requestConfig.js";
import PrecisionImageGrid from "./PrecisionImageGrid.vue";
import { debounce, throttle } from "@/common/debounce.js";
export default {
components: { PrecisionImageGrid },
data() {
return {
selectArticleId: null,
showDel: false, // 控制弹窗显示隐藏
showOperate: false, // 控制弹窗显示隐藏
operateList: [
{
name: "查看评论",
fontSize: "16",
},
{
name: "分享文章",
fontSize: "16",
},
{
name: "删除",
color: "#aa3629",
fontSize: "16",
},
],
operateList: [],
tabsList: [],
currentCateIndex: 0,
@@ -223,46 +237,44 @@ export default {
},
onLoad() {
uni.hideTabBar();
this.getTabData()
this.getTabData();
},
onShow() {
// this.getListData(this.taihumedId);
},
methods: {
confirmDel: throttle(function () {
this.delArticle();
}, 2000),
refreshData(reset) {
this.current = 1;
this.list = [];
this.noMore = false;
if(reset){
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);
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();
this.showDel=true;
} else {
uni.navigateTo({
url: `/pages/articleList/article?navTitle=文章详情&title=文章详情&id=${this.selectArticleId}&type=detail&statusId=1&open=${e.name}`,
@@ -279,6 +291,37 @@ export default {
// console.log('调用失败', err);
// }
// })
var list = [];
if (item.showFlag != 0) {
list = [
// {
// name: "查看评论",
// fontSize: "16",
// },
{
name: "分享文章",
fontSize: "16",
}
];
}
if (item.come == 1) {
this.operateList = list;
} else {
this.operateList = [
...list,
{
name: "删除文章",
color: "#aa3629",
fontSize: "16",
},
];
}
this.selectArticleId = item.id;
this.showOperate = true;
// this.$refs.commentLikePopup.showCommentPopup();
@@ -365,23 +408,17 @@ export default {
icon: "success",
duration: 2000,
});
}
this.$nextTick(()=>{
this.list=this.list.filter((e)=>{
return e.id!=this.selectArticleId
})
this.count=this.list.length
})
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)
console.log("taihumedId at line 344:", taihumedId);
if (type) {
this.current = 1;
this.list = [];
@@ -390,6 +427,9 @@ this.count=this.list.length
if (this.noMore) {
return false;
}
if (this.current == 1) {
this.list = [];
}
uni.showLoading({
title: "加载中",
});
@@ -421,15 +461,28 @@ this.count=this.list.length
) {
this.noMore = true;
}
this.list = [
...this.list,
...res.page.records.map((e) => {
return {
...e,
fileList1: e.img ? e.img.split(",") : [],
};
}),
];
if (this.current == 1) {
this.list = [
...res.page.records.map((e) => {
return {
...e,
fileList1: e.img ? e.img.split(",") : [],
};
}),
];
} else {
this.list = [
...this.list,
...res.page.records.map((e) => {
return {
...e,
fileList1: e.img ? e.img.split(",") : [],
};
}),
];
}
this.current += 1; //更新页码
//显示提示语
this.showText = true;
@@ -473,21 +526,13 @@ this.count=this.list.length
switch (this.taihumedId) {
case 0:
navTitle = "编辑文章";
type = "edit";
navTitle = "文章详情";
type = "detail";
break;
case 1:
navTitle = "文章详情";
type = "detail";
break;
case 3:
navTitle = "文章详情";
type = "detail";
break;
case 2:
navTitle = "文章详情";
type = "detail";
break;
}
uni.navigateTo({
url: `/pages/articleList/article?navTitle=${navTitle}&title=${navTitle}&id=${item.id}&type=${type}&statusId=${this.taihumedId}`,