|
@@ -48,6 +48,7 @@ onMounted(() => {
|
|
|
// queryMsg()
|
|
|
})
|
|
|
//界面销毁函数
|
|
|
+const parentId = ref<string>('')
|
|
|
|
|
|
const pageNum = ref<number>(1)
|
|
|
const pageSize = ref<number>(10)
|
|
@@ -71,22 +72,22 @@ const queryMsg = async () => {
|
|
|
list.value.push(...res.data.content)
|
|
|
totol.value = res.data.totalElements
|
|
|
} else {
|
|
|
+
|
|
|
+ //显示没有更多了
|
|
|
list.value = []
|
|
|
totol.value = 0
|
|
|
+ noMore.value = true
|
|
|
+
|
|
|
// totalElements
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
//获取数据报
|
|
|
const getData = async () => {
|
|
|
console.log('架子了')
|
|
|
//判断总条数是否大于当前页面的数据
|
|
|
// console.log(totol.value == list.value.length)
|
|
|
//先判断
|
|
|
- // debugger;
|
|
|
if (totol.value < list.value.length) {
|
|
|
noMore.value = true;
|
|
|
return
|
|
@@ -105,10 +106,10 @@ const getData = async () => {
|
|
|
}
|
|
|
|
|
|
|
|
|
- //先是加载中的话就不加载了
|
|
|
- if (isLoading.value) {
|
|
|
- return
|
|
|
- }
|
|
|
+ // //先是加载中的话就不加载了
|
|
|
+ // if (isLoading.value) {
|
|
|
+ // return
|
|
|
+ // }
|
|
|
isLoading.value = true;
|
|
|
//参数构造
|
|
|
|
|
@@ -133,7 +134,8 @@ const queryMsg1 = async () => {
|
|
|
let params = {
|
|
|
pageNum: pageNum1.value,
|
|
|
pageSize: pageSize1.value,
|
|
|
- parentUserNo: parentUserNo.value
|
|
|
+ //parentUserNo: parentUserNo.value
|
|
|
+ parentId: parentId.value
|
|
|
}
|
|
|
let res: any = await queryMsgApi1(params)
|
|
|
|
|
@@ -202,7 +204,6 @@ const openPubMsg = () => {
|
|
|
|
|
|
//点击进行发布信息
|
|
|
const pubMsg = async () => {
|
|
|
- des_input.value.value = ''
|
|
|
//判断用户是否登陆了
|
|
|
if (!userInfo.token) {
|
|
|
ElMessage({
|
|
@@ -225,12 +226,19 @@ const pubMsg = async () => {
|
|
|
let params = {
|
|
|
userNo: userNo.value,
|
|
|
userName: userName.value,
|
|
|
- commentContent: des_input.value.value
|
|
|
+ commentContent: des_input.value
|
|
|
}
|
|
|
let res: any = await pubMsgApi(params)
|
|
|
+ //
|
|
|
+ //重新刷新列表
|
|
|
+ //
|
|
|
+ //重新渲染列表数据
|
|
|
+ // list.value = []
|
|
|
+ // pageNum.value = 1
|
|
|
+ // getData()
|
|
|
if (res.code == 200) {
|
|
|
list.value.push(res.data)
|
|
|
- des_input.value.value = ''
|
|
|
+ des_input.value = ''
|
|
|
isLock.value = false
|
|
|
pub_visible.value = false
|
|
|
} else {
|
|
@@ -239,9 +247,7 @@ const pubMsg = async () => {
|
|
|
type: 'error'
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
//调用新增留言的方法
|
|
|
-
|
|
|
}
|
|
|
//打开子页面进行回复
|
|
|
//评论名称
|
|
@@ -254,7 +260,7 @@ const parentUserNo = ref<string>('')
|
|
|
//评论性别
|
|
|
const comSex = ref<string>('0')
|
|
|
const subFun = (item: any) => {
|
|
|
-
|
|
|
+ parentId.value = item.id;
|
|
|
comName.value = item.userName;
|
|
|
comTime.value = item.createTime;
|
|
|
comDes.value = item.commentContent;
|
|
@@ -279,8 +285,6 @@ const subPubMsg = async () => {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
if (subMM.value == '') {
|
|
|
ElMessage({
|
|
|
message: '留言不能为空',
|
|
@@ -300,11 +304,22 @@ const subPubMsg = async () => {
|
|
|
userNo: userNo.value,
|
|
|
userName: userName.value,
|
|
|
commentContent: subMM.value,
|
|
|
- parentUserNo: parentUserNo.value
|
|
|
+ // parentUserNo: parentUserNo.value
|
|
|
+ parentId: parentId.value
|
|
|
}
|
|
|
let res: any = await subPubMsgApi(params)
|
|
|
if (res.code == 200) {
|
|
|
|
|
|
+ //查找list中ID等于parentID的对象,将起count+1
|
|
|
+ // let li = list.value.filter((item:any)=>{
|
|
|
+ // return item.id==parentId.value
|
|
|
+ // })
|
|
|
+ for (let i = 0; i < list.value.length; i++) {
|
|
|
+ if (list.value[i].id == parentId.value) {
|
|
|
+ list.value[i].count += 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
isLock.value = false
|
|
|
// sub_visible.value = false
|
|
|
//调用个查询
|
|
@@ -312,7 +327,6 @@ const subPubMsg = async () => {
|
|
|
console.log(list1.value)
|
|
|
list1.value.push(res.data)
|
|
|
subMM.value = ''
|
|
|
-
|
|
|
//禁用滚动
|
|
|
//在这里应该需要滚动到最底部
|
|
|
// resetFun()
|
|
@@ -323,9 +337,7 @@ const subPubMsg = async () => {
|
|
|
type: 'error'
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
//调用新增留言的方法
|
|
|
-
|
|
|
}
|
|
|
const resetFun = () => {
|
|
|
pageNum1.value = 1;
|
|
@@ -378,7 +390,7 @@ onUnmounted(() => {
|
|
|
</div>
|
|
|
<!-- //留言内容 -->
|
|
|
<div class="com_out" style="overflow: auto" :infinite-scroll-distance="20"
|
|
|
- v-infinite-scroll="getData">
|
|
|
+ :infinite-scroll-disabled="isLoading || noMore" v-infinite-scroll="getData">
|
|
|
<div v-for="item in list">
|
|
|
<div class="com_title">
|
|
|
<img src="../assets/kepu/man.png" />
|
|
@@ -420,8 +432,10 @@ onUnmounted(() => {
|
|
|
<div style="margin-left:20px">{{ userName }}</div>
|
|
|
</div>
|
|
|
|
|
|
- <textarea ref="des_input" rows="5" cols="43" placeholder="写下你珍贵的留言" />
|
|
|
-
|
|
|
+ <!-- <textarea ref="des_input" rows="5" cols="43" placeholder="写下你珍贵的留言" /> -->
|
|
|
+ <el-input type="textarea" style="margin-top: 20px;" :autosize="{ minRows: 6 }" placeholder="写下你珍贵的留言"
|
|
|
+ v-model="des_input">
|
|
|
+ </el-input>
|
|
|
|
|
|
<div class="home_mid_plan_button">
|
|
|
|
|
@@ -431,13 +445,7 @@ onUnmounted(() => {
|
|
|
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
</el-dialog>
|
|
|
-
|
|
|
- <!-- comName.value = item.userName;
|
|
|
- comTime.value = item.createTime;
|
|
|
- comDes.value = item.commentContent; -->
|
|
|
-
|
|
|
<el-dialog v-model="sub_visible" :show-close="true" width="60%" top="5vh" style="border-radius: 40px;">
|
|
|
<template #header="{ close, titleId, titleClass }">
|
|
|
<div class="my-header">
|
|
@@ -452,12 +460,6 @@ onUnmounted(() => {
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!-- 新增恢复 -->
|
|
|
- <!-- "parentUserNo": "string",
|
|
|
- "userName": "string",
|
|
|
- "userNo": "string"
|
|
|
- "commentContent": "string", -->
|
|
|
- <!-- <textarea ref="des_input" rows="5" cols="43" placeholder="写下你珍贵的留言" /> -->
|
|
|
<div class="com_des">
|
|
|
{{ comDes }}
|
|
|
</div>
|
|
@@ -495,7 +497,6 @@ onUnmounted(() => {
|
|
|
|
|
|
|
|
|
<div class="home_mid_plan_button">
|
|
|
-
|
|
|
<div class="pub_button" @click="subPubMsg"> 发布
|
|
|
</div>
|
|
|
</div>
|
|
@@ -537,6 +538,13 @@ onUnmounted(() => {
|
|
|
// font-size: 0.8rem;
|
|
|
// letter-spacing: 1px;
|
|
|
// }
|
|
|
+:deep(.el-textarea__inner) {
|
|
|
+ background-color: #F7F7F7 !important;
|
|
|
+ border: none !important;
|
|
|
+ border-radius: 20px;
|
|
|
+ border: none !important;
|
|
|
+ box-shadow: none !important;
|
|
|
+}
|
|
|
|
|
|
textarea {
|
|
|
margin-top: 30px;
|