feat:增加帖子列表收藏点赞

This commit is contained in:
wyx
2023-02-18 16:15:13 +08:00
parent e75e61d337
commit abcdabd0e4

View File

@@ -90,7 +90,7 @@
<span
class="iconfont icon-shoucang"
:style="{
color: d.collected ? 'red' : '#b3bdc4',
color: d.collectionInfo ? 'red' : '#b3bdc4',
marginLeft: '19px',
}"
></span>
@@ -199,7 +199,8 @@ const state = reactive({
postList: [], //帖子列表
total:0, // 帖子总条数
currentPage: 1
currentPage: 1,
content: 1
});
@@ -249,7 +250,8 @@ function getPostList(discussId) {
console.log('获取帖子参数', {
"discussId": discussId,
"pageNo": state.pageNo,
"pageSize": state.pageSize
"pageSize": state.pageSize,
"content": 1
})
request(
@@ -269,6 +271,7 @@ function getPostList(discussId) {
// 最新
function nowPost(discussId) {
state.content = 1;
state.searchType = 1;
state.pageNo = 1;
state.currentPage = 1;
@@ -276,6 +279,7 @@ function nowPost(discussId) {
}
// 最热
function hotPost(discussId) {
state.content = 2;
state.searchType = 2;
state.pageNo = 1;
state.currentPage = 1;
@@ -296,10 +300,10 @@ function comment({ discussId: id, id: postID }) {
}
function like(d) {
d.praised ? ((d.praiseNum) -= 1) : (d.praiseNum += 1);
d.praised ? ((d.praiseNum) -= 1) : ((d.praiseNum) += 1);
d.praised = !d.praised;
console.log('我是点赞传递的参数', { targetId: d.discussId, type: 2 })
request(PostPraise, { targetId: d.discussId, type: 2 }).then(res=>{
console.log('我是点赞传递的参数', { targetId: d.id, type: 2 })
request(PostPraise, { targetId: d.id, type: 2 }).then(res=>{
console.log('我是点赞的操作',res)
}).catch(err=>{
console.log(err)
@@ -307,10 +311,10 @@ function like(d) {
}
function collection(d) {
d.collected ? (d.collectionNum -= 1) : (d.collectionNum += 1);
d.collected = !d.collected;
console.log('我是收藏传递的参数', { targetId: d.discussId, type: 2 })
request(PostCollection, { targetId: d.discussId, type: 2 }).then(res=>{
d.collectionInfo ? ((d.collectionNum) -= 1) : ((d.collectionNum) += 1);
d.collectionInfo = !d.collectionInfo;
console.log('我是收藏传递的参数', { targetId: d.id, type: 2 })
request(PostCollection, { targetId: d.id, type: 2 }).then(res=>{
console.log('我是收藏的操作',res)
}).catch(err=>{
console.log(err)