mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-13 12:56:47 +08:00
feat:增加讨论发帖
This commit is contained in:
@@ -139,7 +139,7 @@
|
||||
</button>
|
||||
<button
|
||||
class="submitbtn btn01"
|
||||
@click="submitPost">
|
||||
@click="postAdd">
|
||||
发布
|
||||
</button>
|
||||
</div>
|
||||
@@ -155,15 +155,27 @@ import {
|
||||
COMMENT_PRAISE,
|
||||
DISCUSS_LIST,
|
||||
QueryDiscussSubmitDetailByDiscussId,
|
||||
FILE_UPLOAD
|
||||
FILE_UPLOAD,
|
||||
|
||||
PostAdd,
|
||||
PostDelete,
|
||||
PostUpdate,
|
||||
PostList,
|
||||
|
||||
PostPraise,
|
||||
PostCollection,
|
||||
|
||||
} from "@/api/api";
|
||||
|
||||
import "@wangeditor/editor/dist/css/style.css";
|
||||
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
|
||||
import { reactive, ref, toRefs, shallowRef } from "vue";
|
||||
import { reactive, ref, toRefs, shallowRef, computed } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import store from "@/store";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { fileUp } from "../../api/request";
|
||||
|
||||
const userInfo = computed(() => store.state.userInfo);
|
||||
const router = useRouter();
|
||||
const returnclick = () => {
|
||||
router.back();
|
||||
@@ -230,13 +242,6 @@ request(DISCUSS_LIST, {
|
||||
}).then(e=>{
|
||||
console.log('112233---->',e)
|
||||
state.info = e.data;
|
||||
// 获取该讨论下面的帖子
|
||||
console.log('我是查询讨论下帖子的参数',{
|
||||
"discussId": e.data.discussDtoList[0].discussId,
|
||||
"pageNo": state.pageNo,
|
||||
"pageSize": state.pageSize,
|
||||
"searchType": state.searchType
|
||||
})
|
||||
getPostList(e.data.discussDtoList[0].discussId);
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
@@ -244,20 +249,32 @@ request(DISCUSS_LIST, {
|
||||
|
||||
// 获取帖子
|
||||
function getPostList(discussId) {
|
||||
console.log({
|
||||
console.log('获取帖子参数', {
|
||||
"discussId": discussId,
|
||||
"pageNo": state.pageNo,
|
||||
"pageSize": state.pageSize,
|
||||
"searchType": state.searchType
|
||||
"id": "",
|
||||
"title": "",
|
||||
"content": "",
|
||||
"userId": userInfo.value.id,
|
||||
"userJobName": userInfo.value.jobName,
|
||||
"userName": userInfo.value.realName,
|
||||
"userOrgName": userInfo.value.orgName
|
||||
})
|
||||
|
||||
request(
|
||||
QueryDiscussSubmitDetailByDiscussId,
|
||||
PostList,
|
||||
{
|
||||
"discussId": discussId,
|
||||
"pageNo": state.pageNo,
|
||||
"pageSize": state.pageSize,
|
||||
"searchType": state.searchType
|
||||
"id": "",
|
||||
"title": "",
|
||||
"content": "",
|
||||
"userId": userInfo.value.id,
|
||||
"userJobName": userInfo.value.jobName,
|
||||
"userName": userInfo.value.realName,
|
||||
"userOrgName": userInfo.value.orgName
|
||||
}).then(e=>{
|
||||
console.log('我是当前讨论下的帖子',e)
|
||||
state.postList = e.data.rows;
|
||||
@@ -369,15 +386,49 @@ function showPostModal() {
|
||||
dialogVisible.value = true;
|
||||
}
|
||||
|
||||
function submitPost() {
|
||||
dialogVisible.value = false;
|
||||
}
|
||||
|
||||
|
||||
// 取消发布
|
||||
function cancelPost() {
|
||||
dialogVisible.value = false;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------
|
||||
// 发表帖子
|
||||
const postAdd = () => {
|
||||
console.log('用户信息', userInfo.value)
|
||||
let obj = {
|
||||
"collectionNum": 0,
|
||||
"commentNum": 0,
|
||||
"content": valueHtml.value,
|
||||
"ctime": "",
|
||||
"discussId": state.info.discussDtoList[0].discussId,
|
||||
"id": 0,
|
||||
"mtime": "",
|
||||
"praiseNum": 0,
|
||||
"status": 0,
|
||||
"title": titleName.value,
|
||||
"userAvatar": userInfo.value.avatar,
|
||||
"userId": userInfo.value.id,
|
||||
"userJobName": userInfo.value.jobName,
|
||||
"userName": userInfo.value.realName,
|
||||
"userOrgName": userInfo.value.orgName
|
||||
}
|
||||
|
||||
console.log('发表帖子传递的参数', obj)
|
||||
request(PostAdd,obj).then(res=>{
|
||||
console.log(res)
|
||||
if(res.code==200){
|
||||
dialogVisible.value = false;
|
||||
ElMessage.success("发帖成功");
|
||||
getPostList();
|
||||
}
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
|
||||
// -------------------------------
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user