feat:讨论api及参数修改

This commit is contained in:
wyx
2023-02-19 14:44:34 +08:00
parent e43a5db9ed
commit bfbe89f43d
3 changed files with 17 additions and 60 deletions

View File

@@ -106,7 +106,7 @@ export const PostCollection = `/statement/collection post`
// 帖子删除
export const PostDelete = postId => `/statement/delete?id=${postId} post`
// 贴子点赞
export const PostPraise = `/statement/praise post`
export const PostPraise = `/statement/praise`
// 帖子更新
export const PostUpdate = `/statement/update post`

View File

@@ -67,8 +67,7 @@
<div
class="discusslist"
v-for="(d, j) in state?.postList"
:key="j"
>
:key="j">
<div class="itemtitle" @click="comment(d)">{{ d.title }}</div>
<div class="itemdiscuss" @click="comment(d)" :v-html="d.content"></div>
<div class="allstar clearfix">
@@ -153,15 +152,12 @@ import {
DISCUSS_LIST,
QueryDiscussSubmitDetailByDiscussId,
FILE_UPLOAD,
PostAdd,
PostDelete,
PostUpdate,
PostList,
PostPraise,
PostCollection,
} from "@/api/api";
import "@wangeditor/editor/dist/css/style.css";
@@ -181,11 +177,6 @@ const {
query: { id, type, pName, sName },
} = useRoute();
const param = ref({
type,
id,
});
const dialogVisible = ref(false);
const titleName = ref("");
@@ -196,14 +187,12 @@ const state = reactive({
pageNo:1,
pageSize:10,
searchType:1,
postList: [], //帖子列表
total:0, // 帖子总条数
currentPage: 1,
content: 1
});
// 编辑器实例,必须用 shallowRef
const editorRef = shallowRef();
@@ -238,7 +227,6 @@ request(DISCUSS_LIST, {
type:type==1?2:1,
id,
}).then(e=>{
console.log('112233---->',e)
state.info = e.data;
getPostList(e.data.discussDtoList[0].id);
}).catch(err=>{
@@ -248,18 +236,16 @@ request(DISCUSS_LIST, {
// 获取帖子
function getPostList(discussId) {
console.log('获取帖子参数', {
"discussId": discussId,
"pageNo": state.pageNo,
"pageSize": state.pageSize,
"content": 1
"pid": discussId,
"current": state.pageNo,
"order": 1
})
request(
PostList,
{
"discussId": discussId,
"pageNo": state.pageNo,
"pageSize": state.pageSize
"pid": discussId,
"current": state.pageNo,
"order": state.content
}).then(e=>{
console.log('我是当前讨论下的帖子',e)
state.postList = e.data.records;
@@ -285,7 +271,6 @@ function hotPost(discussId) {
state.currentPage = 1;
getPostList(discussId);
}
// 分页
function handleCurrentChange(e, k) {
console.log('分页打印', e, k)
@@ -293,14 +278,13 @@ function handleCurrentChange(e, k) {
state.pageNo = e;
getPostList(state.info.discussDtoList[0].id);
}
// 评论点击跳转
function comment({ discussId: id, id: postID }) {
router.push({ path: "discussdetail", query: { id, type, pName, sName, postID, postName:state.info.discussDtoList[0].discussName } });
}
// 帖子点赞
function like(d) {
d.praised ? ((d.praiseNum) -= 1) : ((d.praiseNum) += 1);
d.praised ? ((d.praiseNum) = Number(d.praiseNum) - 1) : ((d.praiseNum) = Number(d.praiseNum) + 1);
d.praised = !d.praised;
console.log('我是点赞传递的参数', { targetId: d.id, type: 2 })
request(PostPraise, { targetId: d.id, type: 3 }).then(res=>{
@@ -309,9 +293,9 @@ function like(d) {
console.log(err)
});
}
// 帖子收藏
function collection(d) {
d.collected ? ((d.collectionNum) -= 1) : ((d.collectionNum) += 1);
d.collected ? ((d.collectionNum) = Number(d.collectionNum) - 1) : ((d.collectionNum) = Number(d.collectionNum) + 1);
d.collected = !d.collected;
console.log('我是收藏传递的参数', { targetId: d.id, type: 2 })
request(PostPraise, { targetId: d.id, type: 4 }).then(res=>{
@@ -320,22 +304,15 @@ function collection(d) {
console.log(err)
});
}
// 发表帖子
// 发表帖子弹框显示
function showPostModal() {
dialogVisible.value = true;
}
// 取消发布
function cancelPost() {
dialogVisible.value = false;
}
// -------------------------------
// 发表帖子
// 发表帖子发布操作
const postAdd = () => {
console.log('用户信息', userInfo.value)
let obj = {
@@ -355,7 +332,6 @@ const postAdd = () => {
"userName": userInfo.value.realName,
"userOrgName": userInfo.value.orgName
}
console.log('发表帖子传递的参数', obj)
request(PostAdd,obj).then(res=>{
console.log(res)
@@ -370,9 +346,6 @@ const postAdd = () => {
console.log(err)
})
}
// -------------------------------
</script>
<style scoped lang="scss">

View File

@@ -312,10 +312,8 @@ import {
PostDelete,
PostUpdate,
PostList,
PostPraise,
PostCollection,
GetComments,
PostDetails,
GetMoreComments
@@ -336,13 +334,6 @@ const {
query: { id, discussSubmitId, type, pName, sName, postID, postName },
} = useRoute();
// const { data: commontList, fetchData: commonFetch } = usePage(COMMENT_LIST, {
// id,
// type: 1,
// });
// const { data: disDetail } = useRequest(DISCUSS_DETAIL, { id, type });
// 编辑器实例,必须用 shallowRef
const editorRef = shallowRef();
@@ -373,17 +364,16 @@ const handleCreated = (editor) => {
editorRef.value = editor; // 记录 editor 实例,重要!
};
const disDetail = ref({});
const commontList = ref([]);
const spreadReply = ref(-1);
// 查看更多
// 查看更多-展开回复列表
function lookMore(i) {
i == spreadReply.value ? spreadReply.value = -1 : spreadReply.value = i;
}
// 清空回复输入框
// 清空回复及评论输入框
const clearText = () => {
disComment.value.content = "";
fileListComment.value = [];
@@ -406,11 +396,6 @@ function handleCurrentChange(e, k) {
getData();
}
// 清空评论回复输入框
const clearApplyText = () => {
}
// 获取数据
const getData = () => {
useRequest(PostDetails, {id:postID}, (e)=>{
@@ -562,7 +547,6 @@ function submitReplayComment() {
});
}
</script>
<style lang="scss">