mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-08 18:36:48 +08:00
feat:增加讨论发帖
This commit is contained in:
@@ -90,3 +90,18 @@ export const PointList = `/stu/project/rank_list/point_list`
|
||||
|
||||
// 根据ID获取测评信息详情
|
||||
export const QueryEvaluationDetailById = evaluationId => `/evaluation/queryEvaluationDetailById?evaluationId=${evaluationId} post`
|
||||
|
||||
|
||||
// 发表帖子
|
||||
export const PostAdd = `/statement/add post`
|
||||
// 帖子收藏
|
||||
export const PostCollection = `/statement/collection post`
|
||||
// 帖子删除
|
||||
export const PostDelete = postId => `/statement/delete/?id=${postId} post`
|
||||
// 查询讨论下的帖子
|
||||
export const PostList = `/statement/list`
|
||||
// 贴子点赞
|
||||
export const PostPraise = `/statement/praise post`
|
||||
// 帖子更新
|
||||
export const PostUpdate = `/statement/update post`
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -108,6 +108,24 @@ export default defineConfig(({ command, mode }) =>
|
||||
},'/evaluation/queryEvaluationDetailById': {
|
||||
target: loadEnv(mode, process.cwd()).VITE_PROXY_URL,
|
||||
changeOrigin: true,
|
||||
},'/statement/add': {
|
||||
target: loadEnv(mode, process.cwd()).VITE_PROXY_URL,
|
||||
changeOrigin: true,
|
||||
},'/statement/collection': {
|
||||
target: loadEnv(mode, process.cwd()).VITE_PROXY_URL,
|
||||
changeOrigin: true,
|
||||
},'/statement/delete': {
|
||||
target: loadEnv(mode, process.cwd()).VITE_PROXY_URL,
|
||||
changeOrigin: true,
|
||||
},'/statement/praise': {
|
||||
target: loadEnv(mode, process.cwd()).VITE_PROXY_URL,
|
||||
changeOrigin: true,
|
||||
},'/statement/update': {
|
||||
target: loadEnv(mode, process.cwd()).VITE_PROXY_URL,
|
||||
changeOrigin: true,
|
||||
},'/statement/list': {
|
||||
target: loadEnv(mode, process.cwd()).VITE_PROXY_URL,
|
||||
changeOrigin: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user