no message
This commit is contained in:
45
js/index.js
45
js/index.js
@@ -19,6 +19,7 @@ const forumApp = Vue.createApp({
|
||||
|
||||
})
|
||||
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('keydown', handleKeydown)
|
||||
window.removeEventListener('scroll', handleScroll);
|
||||
@@ -174,7 +175,9 @@ const forumApp = Vue.createApp({
|
||||
|
||||
keywordText.value = keyword.value || ''
|
||||
|
||||
page++
|
||||
// page++
|
||||
if (list.value.length != data['count']) page++
|
||||
else page = 0
|
||||
|
||||
if (keyword.value) isSearchMode.value = true
|
||||
else isSearchMode.value = false
|
||||
@@ -193,8 +196,6 @@ const forumApp = Vue.createApp({
|
||||
let data = res.data
|
||||
typeList.value = data
|
||||
|
||||
console.log("data", data);
|
||||
|
||||
getPageHeight()
|
||||
})
|
||||
}
|
||||
@@ -223,7 +224,8 @@ const forumApp = Vue.createApp({
|
||||
if (detailLoading.value) return
|
||||
detailLoading.value = true
|
||||
|
||||
// uniqid = "fubm5CnD05qj" // 标记一下 8yr1m1fOH5CS
|
||||
uniqid = "fubm5CnD05qj" // 标记一下 8yr1m1fOH5CS
|
||||
|
||||
detailsInfo.value = {}
|
||||
answerList.value = []
|
||||
answerPage.value = 0
|
||||
@@ -350,13 +352,6 @@ const forumApp = Vue.createApp({
|
||||
})
|
||||
}
|
||||
|
||||
// 操作 - 回答
|
||||
const operateIAnswer = (token = detailsToken, index) => {
|
||||
$ajax("/api/publish/answerSubmit", { token }).then(res => {
|
||||
console.log("res", res);
|
||||
})
|
||||
}
|
||||
|
||||
let IAnswerState = ref(false) // 我来回答-弹窗的状态
|
||||
let IAnswerEditState = ref(false) // 编辑回答-弹窗的状态
|
||||
|
||||
@@ -471,9 +466,9 @@ const forumApp = Vue.createApp({
|
||||
if (res.code != 200) return
|
||||
let data = res.data
|
||||
let slice3 = data.data.slice(3)
|
||||
console.log(answerList.value[index]['commentList'], "commentList");
|
||||
let merged = [...answerList.value[index]['commentList'], ...slice3.filter(item2 => !answerList.value[index]['commentList'].find(item1 => item1.id == item2.id))];
|
||||
|
||||
answerList.value[index]['commentList'] = answerList.value[index]['commentList'].concat(data.data.slice(3))
|
||||
// answerList.value[index]['commentList'] = answerList.value[index]['commentList'].concat(data.data.slice(3))
|
||||
answerList.value[index]['commentList'] = merged
|
||||
handleMsg('success', res['message'] || '操作成功')
|
||||
})
|
||||
@@ -549,6 +544,7 @@ const forumApp = Vue.createApp({
|
||||
|
||||
} else {
|
||||
let targetData = {
|
||||
id: data['commentid'],
|
||||
content,
|
||||
isauthor: 1,
|
||||
islike: 0,
|
||||
@@ -557,6 +553,7 @@ const forumApp = Vue.createApp({
|
||||
child: []
|
||||
}
|
||||
targetAnswerList[index]['commentList'].unshift(targetData)
|
||||
targetAnswerList[index]['commentCount']++
|
||||
}
|
||||
|
||||
closeAnswerCommentsChild()
|
||||
@@ -565,7 +562,7 @@ const forumApp = Vue.createApp({
|
||||
})
|
||||
}
|
||||
|
||||
// 回答-评论 点赞 operateIAnswer
|
||||
// 回答-评论 点赞
|
||||
const operateAnswerCommentsLike = (token, index, ind, i) => {
|
||||
$ajax("/api/comment/like", {
|
||||
token,
|
||||
@@ -591,15 +588,10 @@ const forumApp = Vue.createApp({
|
||||
|
||||
// 打开 回答-评论 的子评论
|
||||
const openAnswerCommentsChild = (index, ind, i) => {
|
||||
console.log("");
|
||||
closeAnswerCommentsChild()
|
||||
|
||||
if (i == null) {
|
||||
answerList.value[index].commentList[ind]['childState'] = true
|
||||
} else {
|
||||
answerList.value[index].commentList[ind]['child'][i]['childState'] = true
|
||||
}
|
||||
|
||||
if (i == null) answerList.value[index].commentList[ind]['childState'] = true
|
||||
else answerList.value[index].commentList[ind]['child'][i]['childState'] = true
|
||||
}
|
||||
|
||||
// 关闭 回答-评论 的子评论
|
||||
@@ -807,7 +799,6 @@ const forumApp = Vue.createApp({
|
||||
const handleQuestionsScroll = e => {
|
||||
const el = e.target;
|
||||
// 判断滚动到底部
|
||||
console.log(el.scrollHeight - el.scrollTop >= el.clientHeight + 10);
|
||||
if (el.scrollHeight - el.scrollTop >= el.clientHeight + 10) return
|
||||
getMyQuestions()
|
||||
}
|
||||
@@ -864,7 +855,6 @@ const forumApp = Vue.createApp({
|
||||
questionsObj.value['token'] = data['token']
|
||||
|
||||
questionsTypeList.value = data['typeList'] || []
|
||||
console.log("data['typeList']", data['typeList']);
|
||||
cutQuestionsSetp(1)
|
||||
})
|
||||
}
|
||||
@@ -1004,7 +994,7 @@ const forumApp = Vue.createApp({
|
||||
emulateJSON: true,
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
authorization: "efd8239b3f9ab533ac59311096738096"
|
||||
authorization: "017189d7d01fa8ccf649f36e82807937" // 头部标记
|
||||
}
|
||||
}).then(function (res) {
|
||||
var data = null
|
||||
@@ -1296,6 +1286,11 @@ const forumApp = Vue.createApp({
|
||||
})
|
||||
}
|
||||
|
||||
watch(() => {
|
||||
if (questionsSetp.value || myType.value || IAnswerEditState.value || IAnswerState.value || dialogSrc.value) document.body.style.overflow = 'hidden'
|
||||
else document.body.style.overflow = 'auto'
|
||||
|
||||
})
|
||||
|
||||
return {
|
||||
handleMenuState,
|
||||
@@ -1345,7 +1340,6 @@ const forumApp = Vue.createApp({
|
||||
amendIAnswer,
|
||||
openIAnswer,
|
||||
closeIAnswer,
|
||||
operateIAnswer,
|
||||
submitAnswer,
|
||||
openCommentState,
|
||||
submitAnswerComments,
|
||||
@@ -1407,5 +1401,4 @@ const forumApp = Vue.createApp({
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
forumApp.mount("#answer-app"); //初始化
|
||||
Reference in New Issue
Block a user