Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online-pc
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online-pc
Commits
8b7a039f
提交
8b7a039f
authored
5月 09, 2020
作者:
lihuihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
课程讨论模块提取
上级
fbf2f920
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
574 行增加
和
491 行删除
+574
-491
index.js
client/src/modules/discuss/api/index.js
+37
-0
en.json
client/src/modules/discuss/assets/languages/en.json
+12
-0
zh-CN.json
client/src/modules/discuss/assets/languages/zh-CN.json
+11
-0
answerItem.vue
client/src/modules/discuss/components/answerItem.vue
+68
-0
childAnswer.vue
client/src/modules/discuss/components/childAnswer.vue
+0
-58
replyDetailItem.vue
client/src/modules/discuss/components/replyDetailItem.vue
+37
-0
replyItem.vue
client/src/modules/discuss/components/replyItem.vue
+40
-0
discussDetail.vue
client/src/modules/discuss/src/discussDetail.vue
+92
-156
discussDetail.vue
client/src/pages/learn/discussDetail.vue
+277
-277
没有找到文件。
client/src/modules/discuss/api/index.js
浏览文件 @
8b7a039f
...
...
@@ -56,3 +56,40 @@ export const callbackComment = (param) => {
{
headers
:
{
'Content-Type'
:
'application/json'
}
}
)
}
/**
* 回答问题
*/
export
const
answerQues
=
(
param
)
=>
{
return
httpRequest
.
post
(
'/v2/qa/answers'
,
param
,
{
headers
:
{
'Content-Type'
:
'application/json'
}
}
)
}
/**
* 删除回答
*/
export
const
deleteAnswer
=
(
aid
)
=>
{
return
httpRequest
.
delete
(
`/v2/qa/answers/
${
aid
}
`
)
}
/**
* 取消点赞
*/
export
const
unlike
=
(
tagid
)
=>
{
return
httpRequest
.
delete
(
`/v2/qa/tags/
${
tagid
}
`
)
}
/**
* 点赞
*/
export
const
like
=
(
param
)
=>
{
return
httpRequest
.
post
(
'/v2/qa/tags'
,
param
,
{
headers
:
{
'Content-Type'
:
'application/json'
}
}
)
}
client/src/modules/discuss/assets/languages/en.json
浏览文件 @
8b7a039f
...
...
@@ -4,6 +4,17 @@
"answers"
:
"Answers"
,
"votes"
:
"Votes"
,
"noData"
:
"No discussion"
},
"DiscussDetail"
:
{
"title"
:
"Problem details"
,
"like"
:
"Like"
,
"discuss"
:
"Discuss"
,
"reply"
:
"Reply"
,
"delete"
:
"Delete"
,
"send"
:
"Send"
,
"noAnswer"
:
"No answer"
,
"deleteSuccess"
:
"Delete success"
,
"answering"
:
"Answer"
}
}
}
\ No newline at end of file
client/src/modules/discuss/assets/languages/zh-CN.json
浏览文件 @
8b7a039f
...
...
@@ -4,6 +4,17 @@
"answers"
:
"回答"
,
"votes"
:
"投票"
,
"noData"
:
"暂无相关评论"
},
"DiscussDetail"
:
{
"title"
:
"问题详情"
,
"like"
:
"点赞"
,
"discuss"
:
"讨论"
,
"reply"
:
"回复"
,
"delete"
:
"删除"
,
"send"
:
"发送"
,
"noAnswer"
:
"暂无回答"
,
"deleteSuccess"
:
"删除成功"
,
"answering"
:
"回答问题"
}
}
}
client/src/modules/discuss/components/answerItem.vue
0 → 100644
浏览文件 @
8b7a039f
<
template
>
<div>
<div
class=
"ask"
>
<div
class=
"user-1"
>
<img
class=
"img-1"
:src=
"avatar"
/>
<div
class=
"right-1"
>
<div
class=
"name-1"
>
{{
data
.
replier
.
nickname
}}
</div>
<div
class=
"time-1"
>
{{
data
.
created_time
}}
</div>
</div>
</div>
<div
class=
"text"
v-html=
"data.contents"
></div>
<div
class=
"user"
>
<template
v-if=
"data.mine"
>
<div
class=
"right-txt"
@
click=
"deleteAnswer(data.id)"
>
{{
$t
(
'pages.learn.discussDetail.delete'
)
}}
</div>
</
template
>
<div
class=
"right-txt"
@
click=
"$emit('reply', {answer_id: data.id})"
>
{{ $t('pages.learn.discussDetail.reply') }}
</div>
<div
class=
"right-txt"
@
click=
"commentVisible = !commentVisible"
>
{{ $t('pages.learn.discussDetail.discuss') }}({{data.comments.length}})
</div>
<div
class=
"right-txt"
@
click=
"$emit('btnlike', {tagId: data.tag ? data.tag.id : null, ansId: data.id})"
>
点赞({{data.tag_count}})
</div>
</div>
<
template
v-if=
"commentVisible"
>
<!-- 评论列表 -->
<template
v-for=
"item in data.comments"
>
<reply-item
:data=
"item"
:dataId=
"data.id"
:key=
"item.id"
></reply-item>
</
template
>
</template>
</div>
</div>
</template>
<
script
>
import
*
as
api
from
'../api/index.js'
import
replyItem
from
'./replyItem.vue'
export
default
{
components
:
{
replyItem
},
props
:
{
data
:
{
type
:
Object
,
default
:
()
=>
{}
}
},
data
()
{
console
.
log
(
this
.
data
)
return
{
commentVisible
:
false
}
},
computed
:
{
avatar
()
{
return
this
.
data
.
replier
.
avatar
||
'../assets/images/person-default.jpg'
}
},
methods
:
{
deleteAnswer
(
id
)
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
''
,
spinner
:
''
,
background
:
'rgba(255, 255, 255, 0.9)'
})
api
.
deleteAnswer
(
id
).
then
(
json
=>
{
this
.
$parent
.
updateList
()
this
.
$message
({
type
:
'success'
,
message
:
this
.
$t
(
'pages.learn.discussDetail.deleteSuccess'
)
})
}).
catch
(
e
=>
{
this
.
$message
.
error
(
e
.
message
)
}).
finally
(()
=>
{
loading
.
close
()
})
}
}
}
</
script
>
<
style
lang=
"sass"
scoped
>
</
style
>
client/src/modules/discuss/components/childAnswer.vue
deleted
100644 → 0
浏览文件 @
fbf2f920
<
template
>
<div>
<div
class=
'ask'
>
<template
v-for=
'(item, index) in abswerData.comments'
>
<div
v-bind:key=
"index"
class=
'item-list'
:data-id=
'item.id'
>
<div
class=
'user'
>
<div
class=
'name'
>
{{
item
.
user
.
name
}}
</div>
<div
class=
'time'
>
{{
item
.
user
.
time
}}
</div>
<template
v-if=
'item.mine'
><div
class=
'right-txt'
@
click=
'deleteComment'
:data-cid=
'item.cid'
>
{{
$t
(
'pages.learn.discussDetail.delete'
)
}}
</div></
template
>
<div
class=
'right-txt'
@
click=
'callbackComment'
:data-sid=
'abswerData.sid'
:data-qid=
'abswerData.qid'
:data-quesid=
'abswerData.qid'
:data-to=
'item.user.name'
>
{{ $t('pages.learn.discussDetail.reply') }}
</div>
</div>
<div
class=
'text'
>
{{item.text}}
</div>
</div>
</template>
</div>
</div>
</template>
<
script
>
import
*
as
api
from
'../api/index'
export
default
{
data
()
{
return
{
abswerData
:
{}
}
},
props
:
{
dataJson
:
{
type
:
Object
,
require
:
false
}
},
mounted
()
{
},
methods
:
{
deleteComment
(
e
)
{
const
cid
=
e
.
currentTarget
.
dataset
.
cid
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
''
,
spinner
:
''
,
background
:
'rgba(255, 255, 255, 0.9)'
})
api
.
deleteComment
(
cid
).
then
(
json
=>
{
this
.
$emit
(
'updateList'
)
this
.
$message
({
type
:
'success'
,
message
:
this
.
$t
(
'pages.learn.discussDetail.deleteSuccess'
)
})
}).
catch
(
e
=>
{
this
.
$message
.
error
(
e
.
message
)
}).
finally
(()
=>
{
loading
.
close
()
})
},
callbackComment
()
{
}
},
watch
:
{
dataJson
:
function
(
newVal
,
oldVal
)
{
this
.
abswerData
=
newVal
console
.
log
(
this
.
abswerData
,
'=============='
)
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
</
style
>
client/src/modules/discuss/components/replyDetailItem.vue
0 → 100644
浏览文件 @
8b7a039f
<
template
>
<div
class=
"item-list"
>
<div
class=
"user"
>
<div
class=
"name"
>
{{
data
.
observer
.
nickname
}}
</div>
<div
class=
"time"
>
{{
data
.
created_time
}}
</div>
<template
v-if=
"data.mine"
>
<div
class=
"right-txt"
@
click=
"deleteComment(data.id)"
>
{{
$t
(
'pages.learn.discussDetail.delete'
)
}}
</div>
</
template
>
<div
class=
"right-txt"
@
click=
"$emit('reply', {to: data.observer.nickname, question_id: dataId})"
>
{{ $t('pages.learn.discussDetail.reply') }}
</div>
</div>
<div
class=
"text"
v-html=
"data.comments"
></div>
</div>
</template>
<
script
>
import
*
as
api
from
'../api/index.js'
export
default
{
props
:
{
data
:
{
type
:
Object
,
default
:
()
=>
{}
},
dataId
:
{
type
:
String
,
default
:
()
=>
{}
}
},
data
()
{
return
{}
},
methods
:
{
deleteComment
(
id
)
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
''
,
spinner
:
''
,
background
:
'rgba(255, 255, 255, 0.9)'
})
api
.
deleteComment
(
id
).
then
(
json
=>
{
this
.
$parent
.
updateList
()
this
.
$message
({
type
:
'success'
,
message
:
this
.
$t
(
'pages.learn.discussDetail.deleteSuccess'
)
})
}).
catch
(
e
=>
{
this
.
$message
.
error
(
e
.
message
)
}).
finally
(()
=>
{
loading
.
close
()
})
}
}
}
</
script
>
client/src/modules/discuss/components/replyItem.vue
0 → 100644
浏览文件 @
8b7a039f
<
template
>
<div
class=
"item-list"
>
<div
class=
"user"
>
<div
class=
"name"
>
{{
data
.
observer
.
nickname
}}
</div>
<div
class=
"time"
>
{{
data
.
created_time
}}
</div>
<template
v-if=
"data.mine"
>
<div
class=
"right-txt"
@
click=
"deleteComment(data.id)"
>
{{
$t
(
'pages.learn.discussDetail.delete'
)
}}
</div>
</
template
>
<div
class=
"right-txt"
@
click=
"reply({answer_id: dataId, to: data.observer.nickname})"
>
{{ $t('pages.learn.discussDetail.reply') }}
</div>
</div>
<div
class=
"text"
v-html=
"data.comments"
></div>
</div>
</template>
<
script
>
import
*
as
api
from
'../api/index.js'
export
default
{
props
:
{
data
:
{
type
:
Object
,
default
:
()
=>
{}
},
dataId
:
{
type
:
String
,
default
:
()
=>
{}
}
},
data
()
{
return
{}
},
methods
:
{
reply
(
param
)
{
this
.
$parent
.
$parent
.
replyComposeParam
(
param
)
},
deleteComment
(
id
)
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
''
,
spinner
:
''
,
background
:
'rgba(255, 255, 255, 0.9)'
})
api
.
deleteComment
(
id
).
then
(
json
=>
{
this
.
$parent
.
$parent
.
updateList
()
this
.
$message
({
type
:
'success'
,
message
:
this
.
$t
(
'pages.learn.discussDetail.deleteSuccess'
)
})
}).
catch
(
e
=>
{
this
.
$message
.
error
(
e
.
message
)
}).
finally
(()
=>
{
loading
.
close
()
})
}
}
}
</
script
>
client/src/modules/discuss/src/discussDetail.vue
浏览文件 @
8b7a039f
...
...
@@ -2,81 +2,47 @@
<div>
<div
class=
'discuss-detail-scroll'
>
<div
class=
'ques'
>
<div
class=
'title'
>
{{
d
iscussQues
.
title
}}
</div>
<div
class=
'text'
v-html=
"d
iscussQues.text
"
></div>
<div
class=
'title'
>
{{
d
etail
.
title
}}
</div>
<div
class=
'text'
v-html=
"d
etail.contents
"
></div>
<div
class=
'user'
>
<div
class=
'name'
>
{{
user
.
name
}}
</div>
<div
class=
'time'
>
{{
user
.
time
}}
</div>
<template
v-if=
'd
iscussQues.mine'
><div
class=
'right-txt'
@
click=
'deleteDiscuss'
>
{{
$t
(
'pages.learn.d
iscussDetail.delete'
)
}}
</div></
template
>
<div
class=
'right-txt'
@
click=
'
callbackComment'
:data-sid=
'discussQues.sid'
:data-qid=
'discussQues.qid'
:data-quesid=
'discussQues.qid'
>
{{ $t('pages.learn.d
iscussDetail.reply') }}
</div>
<div
class=
'right-txt'
@
click=
'
openOrcloseDis'
data-key=
'disQus'
>
{{ $t('pages.learn.discussDetail.discuss') }}({{discussQues.comCnt
}})
</div>
<
!-- <div class='right-txt' @click='btnlike' :data-quesid='discussQues.qid' :data-sid='discussQues.sid' :data-tagid='discussQues.tag_id
'>
{{ $t('
pages.learn.discussDetail.like') }}({{discussQues.likeCnt}})</div> --
>
<div
class=
'name'
>
{{
user
.
n
ickn
ame
}}
</div>
<div
class=
'time'
>
{{
detail
.
created_
time
}}
</div>
<template
v-if=
'd
etail.mine'
><div
class=
'right-txt'
@
click=
'deleteDiscuss'
>
{{
$t
(
'DiscussModule.D
iscussDetail.delete'
)
}}
</div></
template
>
<div
class=
'right-txt'
@
click=
'
replyComposeParam({question_id: detail.id})'
>
{{ $t('DiscussModule.D
iscussDetail.reply') }}
</div>
<div
class=
'right-txt'
@
click=
'
commentVisible = !commentVisible'
>
{{ $t('DiscussModule.DiscussDetail.discuss') }}({{detail.comments ? detail.comments.length : 0
}})
</div>
<
div
class=
'right-txt'
@
click=
'btnlike({tagId: detail.tag ? detail.tag.id : null})
'
>
{{ $t('
DiscussModule.DiscussDetail.like') }}({{detail.tag_count}})
</div
>
</div>
<div
v-show=
'disQus.isShowComment'
>
<answer
:dataJson=
"discussQues"
@
updateList=
"getData"
></answer>
</div>
</div>
<div
class=
'result'
>
{{discussQues.askCnt}} {{ $t('pages.learn.discussion.answers') }}
<div
style=
'display: inline-block; width: 0.2rem;'
></div>
{{discussQues.TouCnt}} {{ $t('pages.learn.discussion.votes') }}
</div>
<!-- <template v-for='(item, index) in answersList'>
<div v-bind:key="index" class='ask'>
<div class='user-1'>
<template v-if="item.user.url">
<img class='img-1' :src='item.user.url' />
</template>
<template v-else>
<img class='img-1' src='../assets/images/person-default.jpg' />
</template>
<div class='right-1'>
<div class='name-1'>{{item.user.name}}</div>
<div class='time-1'>{{item.user.time}}</div>
</div>
</div>
<div class='text' v-html="item.text"></div>
<div class='user'>
<template v-if='item.mine'><div class='right-txt' @click='deleteAnswer' :data-aid='item.aid'>{{ $t('pages.learn.discussDetail.delete') }}</div></template>
<div class='right-txt' @click='callbackComment' :data-sid='discussQues.sid' :data-qid='discussQues.qid' :data-ansid='item.aid'>{{ $t('pages.learn.discussDetail.reply') }}</div>
<div class='right-txt' @click='openOrcloseDis' :data-key='answers' :data-index='index'>{{ $t('pages.learn.discussDetail.discuss') }}({{item.comCnt}})</div>
<div class='right-txt' @click='btnlike' :data-sid='discussQues.sid' :data-quesid='discussQues.qid' :data-ansid='item.aid' :data-tagid='item.tag_id'>
点赞({{item.likeCnt}})</div>
</div>
<template v-if='answers[index].isShowComment'>
<template v-for='(item1, index) in item.comments'>
<div v-bind:key='index' class='item-list' :data-id='item1.id'>
<div class='user'>
<div class='name'>{{item1.user.name}}</div>
<div class='time'>{{item1.user.time}}</div>
<template v-if='item1.mine'><div class='right-txt' @click='deleteComment' :data-cid='item1.cid'>{{ $t('pages.learn.discussDetail.delete') }}</div></template>
<div class='right-txt' @click='callbackComment' :data-sid='discussQues.sid' :data-qid='discussQues.qid' :data-ansid='item.aid' :data-to='item.user.name'>{{ $t('pages.learn.discussDetail.reply') }}</div>
</div>
<div class='text' v-html="item1.text"></div>
</div>
</template>
<div
v-show=
'commentVisible'
>
<
template
v-for=
"item in detail.comments"
>
<reply-item
:data=
"item"
:key=
"item.id"
:dataId=
"detail.id"
@
reply=
"replyComposeParam"
></reply-item>
</
template
>
<template v-if='(!item.comments.length || !answers[index].isShowComment)'><div style='width: 100%; height: 0.2rem;'></div></template>
</div>
</template> -->
<!-- <template v-if='!answersList.length'>
<div class='no-data'>{{ $t('pages.learn.discussDetail.noAnswer') }}</div>
</div>
<div
class=
'result'
>
{{detail.answer_count}} {{ $t('DiscussModule.DiscussList.answers') }}
<div
style=
'display: inline-block; width: 0.2rem;'
></div>
{{detail.tag_total_count || 0}} {{ $t('DiscussModule.DiscussList.votes') }}
</div>
<!-- 回答列表 -->
<
template
v-for=
"item in detail.answers"
>
<answer-item
:data=
"item"
:key=
"item.id"
@
btnlike=
"btnlike"
@
updateList=
"updateList"
@
reply=
"replyComposeParam"
></answer-item>
</
template
>
<
template
v-if=
'!answersLength'
>
<div
class=
'no-data'
>
{{
$t
(
'DiscussModule.DiscussDetail.noAnswer'
)
}}
</div>
</
template
>
<div style='width: 750rpx; height: 200rpx;'></div>
-->
<div
style=
'width: 750rpx; height: 200rpx;'
></div>
</div>
<div
style=
"width: 100%; height: 1.7rem;"
></div>
<div
class=
'input-publish'
>
<textarea
id=
"editor"
></textarea>
<!-- <div class='ask'> -->
<!-- <image class='img' src='./icons/ask.png' mode='aspectFill'></image> -->
<!-- <input type='text' class="txt" placeholder='{{inputStatus.placeholder}}' focus='{{inputStatus.canFocus}}' bindblur='blurInput' confirm-type='send' bindconfirm='publishContent' value='{{inputStatus.input}}' cursor-spacing='20'/> -->
<!-- </div> -->
<el-button
type=
"primary"
@
click=
"publishContent"
>
{{ $t('pages.learn.discussDetail.send') }}
</el-button><em
class=
"send"
>
({{inputStatus.placeholder}})
</em>
<textarea
id=
"editor"
v-model=
"replyText"
ref=
"focusTextarea"
></textarea>
<el-button
type=
"primary"
@
click=
"publishContent"
>
{{ $t('DiscussModule.DiscussDetail.send') }}
</el-button><em
class=
"send"
>
({{inputStatus.placeholder}})
</em>
</div>
</div>
</template>
<
script
>
import
answer
from
'../components/childAnswer.vue'
import
replyItem
from
'../components/replyDetailItem.vue'
import
AnswerItem
from
'../components/answerItem.vue'
import
*
as
api
from
'../api/index.js'
export
default
{
components
:
{
answer
},
components
:
{
AnswerItem
,
replyItem
},
name
:
'DiscussDetail'
,
props
:
{
paramId
:
{
type
:
Object
,
require
:
false
}
...
...
@@ -86,7 +52,9 @@ export default {
},
data
()
{
return
{
discussQues
:
{},
replyText
:
''
,
commentVisible
:
false
,
detail
:
{},
/* 回复内容状态 */
call
:
{},
/* 存储状态值 的对象, 记录上次用户操作 */
...
...
@@ -95,125 +63,93 @@ export default {
},
inputStatus
:
{
canFocus
:
false
,
placeholder
:
`
${
this
.
$t
(
'
pages.learn.d
iscussDetail.answering'
)}
...`
,
placeholder
:
`
${
this
.
$t
(
'
DiscussModule.D
iscussDetail.answering'
)}
...`
,
input
:
''
}
},
answer
:
true
,
replyParam
:
{}
}
},
created
()
{
this
.
getData
()
this
.
updateList
()
},
computed
:
{
user
()
{
return
this
.
discussQues
.
user
||
{}
return
this
.
detail
.
questioner
||
{}
},
answersLength
()
{
return
this
.
detail
.
answers
?
this
.
detail
.
answers
.
length
:
false
}
},
methods
:
{
updateList
()
{
this
.
getData
()
// 点赞
btnlike
(
e
)
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
''
,
spinner
:
''
,
background
:
'rgba(255, 255, 255, 0.9)'
})
if
(
e
.
tagId
)
{
api
.
unlike
(
e
.
tagId
).
then
(
json
=>
{
this
.
updateList
()
}).
catch
(
e
=>
{
this
.
$message
.
error
(
e
.
message
)
}).
finally
(()
=>
{
loading
.
close
()
})
}
else
{
const
param
=
{}
if
(
this
.
detail
.
id
)
{
param
.
question_id
=
this
.
detail
.
id
}
if
(
e
.
ansId
)
{
param
.
answer_id
=
e
.
ansId
}
if
(
this
.
detail
.
semester_id
)
{
param
.
semester_id
=
this
.
detail
.
semester_id
}
api
.
like
(
param
).
then
(
json
=>
{
this
.
updateList
()
}).
catch
(
e
=>
{
this
.
$message
.
error
(
e
.
message
)
}).
finally
(()
=>
{
loading
.
close
()
})
}
},
// 删除问题
deleteDiscuss
()
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
''
,
spinner
:
''
,
background
:
'rgba(255, 255, 255, 0.9)'
})
api
.
deleteDiscuss
(
this
.
id
).
then
(
json
=>
{
this
.
$message
({
type
:
'success'
,
message
:
this
.
$t
(
'
pages.learn.d
iscussDetail.deleteSuccess'
)
})
api
.
deleteDiscuss
(
this
.
paramId
.
id
).
then
(
json
=>
{
this
.
$message
({
type
:
'success'
,
message
:
this
.
$t
(
'
DiscussModule.D
iscussDetail.deleteSuccess'
)
})
/* 返回上一级 菜单 */
setTimeout
(()
=>
{
// wx.navigateBack({ delta: 1 })
this
.
$router
.
go
(
-
1
)
},
1000
)
}).
catch
(
e
=>
{
this
.
$message
.
error
(
e
.
message
)
}).
finally
(()
=>
{
loading
.
close
()
})
},
getData
()
{
// 更新列表
updateList
()
{
api
.
getDiscussDetail
(
this
.
paramId
.
id
).
then
(
data
=>
{
const
json
=
this
.
setData
(
data
)
this
.
discussQues
=
json
.
ques
this
.
call
.
semester_id
=
this
.
discussQues
.
sid
this
.
disQus
.
isShowComment
=
json
.
ques
.
isShowComment
this
.
detail
=
data
})
// const loading = this.$loading({ lock: true, text: '', spinner: '', background: 'rgba(255, 255, 255, 0.9)' })
// .then(json => {
// this.discussQues = json.ques
// this.call.semester_id = this.discussQues.sid
// this.disQus.isShowComment = json.ques.isShowComment
// // const answers = []
// // for (let i = 0; i
<
json
.
answer
.
length
;
i
++
)
{
// // answers.push({
// // aid: json.answer[i].aid,
// // isShowComment: json.answer[i].isShowComment
// // })
// // }
// // this.answersList = json.answer
// // this.answers = answers
// }).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
},
callbackComment
(
e
)
{
// /* 如果,输入框中,本身已经存在输入内容,那么再点击其他回复时,不给提示,直接清空 */
this
.
inputStatus
.
input
=
''
// 这里如果想判断,不能使用 inputStatus.input这个 在blur时存储
const
_data
=
e
.
currentTarget
.
dataset
const
qid
=
_data
.
qid
const
quesid
=
_data
.
quesid
const
ansid
=
_data
.
ansid
const
to
=
_data
.
to
const
sid
=
_data
.
sid
const
json
=
{}
if
(
qid
)
{
json
.
questionId
=
qid
}
if
(
to
)
{
json
.
to
=
to
}
if
(
quesid
)
{
json
.
question_id
=
quesid
}
if
(
ansid
)
{
json
.
answer_id
=
ansid
}
if
(
sid
)
{
json
.
semester_id
=
sid
}
this
.
call
=
json
if
(
to
)
{
this
.
inputStatus
.
placeholder
=
this
.
$t
(
'pages.learn.discussDetail.reply'
)
+
to
+
':'
}
else
{
this
.
inputStatus
.
placeholder
=
`
${
this
.
$t
(
'pages.learn.discussDetail.reply'
)}
:`
}
this
.
inputStatus
.
canFocus
=
true
$
(
'#editor'
).
focus
()
},
openOrcloseDis
(
e
)
{
const
key
=
e
.
currentTarget
.
dataset
.
key
if
(
key
===
'disQus'
)
{
this
.
disQus
.
isShowComment
=
!
this
.
disQus
.
isShowComment
/**
* 点击 键盘发送按钮时
*/
publishContent
()
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
''
,
spinner
:
''
,
background
:
'rgba(255, 255, 255, 0.9)'
})
this
.
replyParam
.
comments
=
this
.
replyParam
.
to
?
`
${
this
.
$t
(
'DiscussModule.DiscussDetail.reply'
)}${
this
.
replyParam
.
to
}
:
${
this
.
replyText
}
`
:
this
.
replyText
if
(
this
.
answer
)
{
this
.
replyComposeParam
({
answer
:
true
,
contents
:
this
.
replyText
,
question_id
:
this
.
detail
.
id
},
true
)
api
.
answerQues
(
this
.
replyParam
).
then
(
json
=>
{
this
.
updateList
()
this
.
replyText
=
''
}).
catch
(
e
=>
{
this
.
$message
.
error
(
e
.
message
)
}).
finally
(()
=>
{
loading
.
close
()
})
}
else
{
const
index
=
e
.
currentTarget
.
dataset
.
index
this
.
answers
[
index
].
isShowComment
=
!
this
.
answers
[
index
].
isShowComment
api
.
callbackComment
(
this
.
replyParam
).
then
(
json
=>
{
this
.
updateList
()
this
.
replyText
=
''
}).
catch
(
e
=>
{
this
.
$message
.
error
(
e
.
message
)
}).
finally
(()
=>
{
loading
.
close
()
})
}
this
.
$refs
.
focusTextarea
.
focus
()
},
setData
(
_data
)
{
const
json
=
{
ques
:
{
qid
:
_data
.
id
,
sid
:
_data
.
semester_id
,
user
:
{
url
:
_data
.
questioner
.
avatar
||
''
,
name
:
_data
.
questioner
.
nickname
,
time
:
_data
.
created_time
},
title
:
_data
.
title
,
text
:
_data
.
contents
,
askCnt
:
_data
.
answer_count
||
0
,
TouCnt
:
_data
.
tag_total_count
||
0
,
likeCnt
:
_data
.
tag_count
||
0
,
comCnt
:
_data
.
comments
.
length
,
mine
:
_data
.
mine
,
isShowComment
:
false
,
has_tag
:
_data
.
has_tag
,
tag_id
:
(
_data
.
tag
&&
_data
.
tag
.
id
)
||
''
,
comments
:
_data
.
comments
.
map
((
_
,
i
)
=>
{
return
{
cid
:
_
.
id
,
user
:
{
url
:
_
.
observer
.
avatar
||
''
,
name
:
_
.
observer
.
nickname
,
time
:
_
.
created_time
},
text
:
_
.
comments
,
mine
:
_
.
mine
}
})
}
// 通过点击不同的回复按钮 拼成所要提交不同的参数
replyComposeParam
(
obj
,
answer
)
{
this
.
$refs
.
focusTextarea
.
focus
()
this
.
inputStatus
.
placeholder
=
obj
.
to
!==
undefined
?
`回复
${
obj
.
to
}
:`
:
'回复:'
this
.
answer
=
answer
||
false
const
commonParam
=
{
questionId
:
this
.
detail
.
id
,
semester_id
:
this
.
detail
.
semester_id
}
return
json
this
.
replyParam
=
Object
.
assign
(
commonParam
,
obj
)
}
}
}
...
...
@@ -249,7 +185,7 @@ export default {
.discuss-detail-scroll
.item-list
.text
{
margin-top
:
0
.15rem
;
font-size
:
0
.16rem
;
color
:
#535353
;
}
.discuss-detail-scroll
.item-list
.text.on
{
color
:
#2263d9
;
}
.discuss-detail-scroll
.no-data
{
padding
:
1rem
0
;
font-size
:
0
.24rem
;
color
:
#c9c9c9
;
text-align
:
center
;
}
.input-publish
{
position
:
fixed
;
z-index
:
2
;
height
:
1
.5rem
;
left
:
2
00px
;
right
:
15
px
;
bottom
:
0
;
padding
:
0
.2rem
;
background
:
#fff
;
box-sizing
:
border-box
;
}
.input-publish
{
position
:
fixed
;
z-index
:
2
;
height
:
1
.5rem
;
left
:
2
95px
;
right
:
30
px
;
bottom
:
0
;
padding
:
0
.2rem
;
background
:
#fff
;
box-sizing
:
border-box
;
}
.input-publish
#editor
{
width
:
100%
;
height
:
0
.7rem
;
font-size
:
18px
;
line-height
:
1
.5
;
outline
:
none
;
}
.input-publish
.send
{
font-size
:
14px
;
color
:
#ddd
;
margin-left
:
10px
;
}
.input-publish
.ask
{
position
:
relative
;
margin
:
12px
auto
;
width
:
90%
;
height
:
56px
;
border
:
1px
solid
#dcdcdc
;
box-sizing
:
border-box
;
-webkit-box-sizing
:
border-box
;
}
...
...
client/src/pages/learn/discussDetail.vue
浏览文件 @
8b7a039f
...
...
@@ -2,8 +2,8 @@
<div>
<div
class=
"con-title"
>
{{
$t
(
'pages.learn.discussDetail.title'
)
}}
</div>
<div
class=
"con-box"
>
<
!--
<discuss-detail
:paramId=
'paramId'
></discuss-detail>
--
>
<div
class=
'discuss-detail-scroll'
>
<
discuss-detail
:paramId=
'paramId'
></discuss-detail
>
<
!--
<
div
class=
'discuss-detail-scroll'
>
<div
class=
'ques'
>
<div
class=
'title'
>
{{
discussQues
.
title
}}
</div>
<div
class=
'text'
v-html=
"discussQues.text"
></div>
...
...
@@ -75,24 +75,24 @@
<div
class=
'no-data'
>
{{
$t
(
'pages.learn.discussDetail.noAnswer'
)
}}
</div>
</
template
>
<div
style=
'width: 750rpx; height: 200rpx;'
></div>
</div>
</div>
-->
</div>
<div
style=
"width: 100%; height: 1.7rem;"
></div>
<
!-- <
div style="width: 100%; height: 1.7rem;"></div>
<div class='input-publish'>
<textarea id="editor"></textarea>
<!-- <div class='ask'> -->
<!-- <image class='img' src='./icons/ask.png' mode='aspectFill'></image> -->
<!-- <input type='text' class="txt" placeholder='{{inputStatus.placeholder}}' focus='{{inputStatus.canFocus}}' bindblur='blurInput' confirm-type='send' bindconfirm='publishContent' value='{{inputStatus.input}}' cursor-spacing='20'/> -->
<!-- </div> -->
<el-button type="primary" @click="publishContent">{{ $t('pages.learn.discussDetail.send') }}</el-button><em class="send">({{inputStatus.placeholder}})</em>
</div>
</div> -->
<!-- <div class='ask'> -->
<!-- <image class='img' src='./icons/ask.png' mode='aspectFill'></image> -->
<!-- <input type='text' class="txt" placeholder='{{inputStatus.placeholder}}' focus='{{inputStatus.canFocus}}' bindblur='blurInput' confirm-type='send' bindconfirm='publishContent' value='{{inputStatus.input}}' cursor-spacing='20'/> -->
<!-- </div> -->
</div>
</template>
<
script
>
import
cAction
from
'@action'
//
import cAction from '@action'
import
CKEDITOR
from
'CKEDITOR'
//
import CKEDITOR from 'CKEDITOR'
export
default
{
props
:
{
...
...
@@ -104,42 +104,42 @@ export default {
return
{
paramId
:
{},
ckeditor
:
null
,
courseTitle
:
'课程问题'
,
discussQues
:
{
qid
:
''
,
user
:
{
url
:
'./icons/default.jpg'
,
name
:
'用户名000'
,
time
:
'2018-2-12 15:28:47'
},
// eslint-disable-line
title
:
'这是一个一句话问题这是一个一句话问题这是一个一句话问题标题这是一个一句话问题'
,
// eslint-disable-line
text
:
'<p>王家有三兄弟甲、乙、丙,丙幼年时送给胡某作养子,丙结婚时,胡某为其盖了新房,后因失火致使该房屋被烧毁。丙的生父母就将自己<p>'
,
// eslint-disable-line
askCnt
:
20
,
TouCnt
:
100
,
likeCnt
:
100
,
comCnt
:
100
,
mine
:
true
,
isShowComment
:
false
,
has_tag
:
false
,
tag_id
:
null
,
// eslint-disable-line
comments
:
[
// eslint-disable-line
{
cid
:
''
,
user
:
{
url
:
''
,
name
:
'用户名000'
,
time
:
'2018-2-12 15:28:47'
},
text
:
'在线学习课程'
,
mine
:
true
},
// eslint-disable-line
{
cid
:
''
,
user
:
{
url
:
''
,
name
:
'用户名000'
,
time
:
'2018-2-12 15:28:47'
},
text
:
'在线学习课程'
,
mine
:
false
}
// eslint-disable-line
]
// eslint-disable-line
},
answersList
:
[
// {
// aid: '', user: { url: '', name: '用户名000', time: '2018-2-12 15:28:47' }, // eslint-disable-line
// text: '
<
p
>
王家有三兄弟甲、乙、丙,丙幼年时送给胡某作养子,丙结婚时,胡某为其盖了新房,后因失火致使该房屋被烧毁。丙的生父母就将自己
<
p
>
', // eslint-disable-line
// likeCnt: 100, comCnt: 100, mine: true, isShowComment: false, has_tag: false, tag_id: null, // eslint-disable-line
// comments: [ // eslint-disable-line
// { cid: '', user: { url: '', name: '
用户名
000
', time: '
2018
-
2
-
12
15
:
28
:
47
' }, text: '
在线学习课程
', mine: true } // eslint-disable-line
// ] // eslint-disable-line
// }
],
courseTitle
:
'课程问题'
//
discussQues: {
//
qid: '', user: { url: './icons/default.jpg', name: '用户名000', time: '2018-2-12 15:28:47' }, // eslint-disable-line
//
title: '这是一个一句话问题这是一个一句话问题这是一个一句话问题标题这是一个一句话问题', // eslint-disable-line
//
text: '
<
p
>
王家有三兄弟甲、乙、丙,丙幼年时送给胡某作养子,丙结婚时,胡某为其盖了新房,后因失火致使该房屋被烧毁。丙的生父母就将自己
<
p
>
', // eslint-disable-line
//
askCnt: 20, TouCnt: 100, likeCnt: 100, comCnt: 100, mine: true, isShowComment: false, has_tag: false, tag_id: null, // eslint-disable-line
//
comments: [ // eslint-disable-line
//
{ cid: '', user: { url: '', name: '
用户名
000
', time: '
2018
-
2
-
12
15
:
28
:
47
' }, text: '
在线学习课程
', mine: true }, // eslint-disable-line
//
{ cid: '', user: { url: '', name: '
用户名
000
', time: '
2018
-
2
-
12
15
:
28
:
47
' }, text: '
在线学习课程
', mine: false } // eslint-disable-line
//
] // eslint-disable-line
//
},
//
answersList: [
//
// {
//
// aid: '', user: { url: '', name: '
用户名
000
', time: '
2018
-
2
-
12
15
:
28
:
47
' }, // eslint-disable-line
//
// text: '
<
p
>
王家有三兄弟甲、乙、丙,丙幼年时送给胡某作养子,丙结婚时,胡某为其盖了新房,后因失火致使该房屋被烧毁。丙的生父母就将自己
<
p
>
', // eslint-disable-line
//
// likeCnt: 100, comCnt: 100, mine: true, isShowComment: false, has_tag: false, tag_id: null, // eslint-disable-line
//
// comments: [ // eslint-disable-line
//
// { cid: '', user: { url: '', name: '
用户名
000
', time: '
2018
-
2
-
12
15
:
28
:
47
' }, text: '
在线学习课程
', mine: true } // eslint-disable-line
//
// ] // eslint-disable-line
//
// }
//
],
/* 存储状态值 的对象, 记录上次用户操作 */
disQus: {
isShowComment: false
},
answers: [ // 数组 跟 上面 answerList数组对应, 存储某些状态值,目前存储讨论打开关闭状态
{ aid: '', isShowComment: false } // eslint-disable-line
],
inputStatus: {
canFocus: false,
placeholder: `${this.$t('
pages
.
learn
.
discussDetail
.
answering
')} ...`,
input: ''
},
qid: '
6447416971762860032
',
//
disQus: {
//
isShowComment: false
//
},
//
answers: [ // 数组 跟 上面 answerList数组对应, 存储某些状态值,目前存储讨论打开关闭状态
//
{ aid: '', isShowComment: false } // eslint-disable-line
//
],
//
inputStatus: {
//
canFocus: false,
//
placeholder: `${this.$t('
pages
.
learn
.
discussDetail
.
answering
')} ...`,
//
input: ''
//
},
//
qid: '
6447416971762860032
',
/* 回复内容状态 */
call: {}
//
call: {}
}
},
created() {
...
...
@@ -148,238 +148,238 @@ export default {
cid: this.$route.params.cid,
id: this.$route.params.id
}
},
mounted () {
this.call = { questionId: this.id, semester_id: '', contents: '', question_id: this.id, answer: true }
const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
cAction.Discuss.getDiscussDetail(this.id).then(json => {
this.discussQues = json.ques
this.call.semester_id = this.discussQues.sid
this.disQus.isShowComment = json.ques.isShowComment
const answers = []
for (let i = 0; i < json.answer.length; i++) {
answers.push({
aid: json.answer[i].aid,
isShowComment: json.answer[i].isShowComment
})
}
this.answersList = json.answer
this.answers = answers
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
// this.initckeditor()
$('
#
editor
').on('
blur
', () => {
this.blurInput()
})
},
destroyed () {
/* 清空 ckeditor 需要调用方法删除 并 在DOM结构中也移除 */
this.ckeditor && this.ckeditor.destroy(true)
this.ckeditor = null
$('
#
editor
').off('
blur
')
},
methods: {
/**
* 打开或关闭 讨论
*/
openOrcloseDis (e) {
const key = e.currentTarget.dataset.key
if (key === '
disQus
') {
this.disQus.isShowComment = !this.disQus.isShowComment
} else {
const index = e.currentTarget.dataset.index
this.answers[index].isShowComment = !this.answers[index].isShowComment
}
},
/**
* 删除评论
*/
deleteComment (e) {
const cid = e.currentTarget.dataset.cid
const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
cAction.Discuss.deleteComment(cid).then(json => {
this.updateList()
this.$message({ type: '
success
', message: this.$t('
pages
.
learn
.
discussDetail
.
deleteSuccess
') })
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
},
/**
* 删除回答
*/
deleteAnswer (e) {
const aid = e.currentTarget.dataset.aid
const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
cAction.Discuss.deleteAnswer(aid).then(json => {
this.updateList()
this.$message({ type: '
success
', message: this.$t('
pages
.
learn
.
discussDetail
.
deleteSuccess
') })
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
},
/**
* 点赞 或 取消点赞 操作
*/
btnlike (e) {
const _data = e.currentTarget.dataset
const quesid = _data.quesid
const ansid = _data.ansid
const tagid = _data.tagid
const sid = _data.sid
if (tagid) { // 取消 点赞操作
// wx.showLoading({ title: '
操作中
...
', mask: true })
const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
cAction.Discuss.unlike(tagid).then(json => {
this.updateList()
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
} else { // 点赞操作
const param = {}
if (quesid) { param.question_id = quesid }
if (ansid) { param.answer_id = ansid }
if (sid) { param.semester_id = sid }
// wx.showLoading({ title: '
操作中
...
', mask: true })
const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
cAction.Discuss.like(param).then(json => {
this.updateList()
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
}
},
/**
* 删除问题
*/
deleteDiscuss () {
const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
cAction.Discuss.deleteDiscuss(this.id).then(json => {
this.$message({ type: '
success
', message: this.$t('
pages
.
learn
.
discussDetail
.
deleteSuccess
') })
/* 返回上一级 菜单 */
setTimeout(() => {
// wx.navigateBack({ delta: 1 })
this.$router.go(-1)
}, 1000)
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
},
/**
* 点击回复 调起输入框
*/
callbackComment (e) {
// /* 如果,输入框中,本身已经存在输入内容,那么再点击其他回复时,不给提示,直接清空 */
this.inputStatus.input = '' // 这里如果想判断,不能使用 inputStatus.input这个 在blur时存储
const _data = e.currentTarget.dataset
const qid = _data.qid
const quesid = _data.quesid
const ansid = _data.ansid
const to = _data.to
const sid = _data.sid
const json = {}
if (qid) { json.questionId = qid }
if (to) { json.to = to }
if (quesid) { json.question_id = quesid }
if (ansid) { json.answer_id = ansid }
if (sid) { json.semester_id = sid }
this.call = json
if (to) {
this.inputStatus.placeholder = this.$t('
pages
.
learn
.
discussDetail
.
reply
') + to + '
:
'
} else {
this.inputStatus.placeholder = `${this.$t('
pages
.
learn
.
discussDetail
.
reply
')}:`
}
this.inputStatus.canFocus = true
$('
#
editor
').focus()
},
/**
* 取消 聚焦状态, 使用 ckeditor 进行 聚焦监听
*/
blurInput (e) {
this.inputStatus.canFocus = false
if ($('
#
editor
').val()) {
// 输入框中存在内容则不做处理 - 这里不能做任何处理,否则会产生 输入框中内容遗留问题
} else {
this.inputStatus.placeholder = `${this.$t('
pages
.
learn
.
discussDetail
.
answering
')} ...`
this.inputStatus.input = ''
// 回答问题 方式
this.call = {
questionId: this.discussQues.qid,
semester_id: this.discussQues.sid,
contents: '',
question_id: this.discussQues.qid,
answer: true
}
}
},
/**
* 点击 键盘发送按钮时
*/
publishContent (e) {
const val = $('
#
editor
').val()
if (this.call.to) {
this.call.comments = this.$t('
pages
.
learn
.
discussDetail
.
reply
') + this.call.to + '
:
' + val
} else {
this.call.comments = val
}
if (this.call.answer) { // 回答问题
// wx.showLoading({ title: '
操作中
...
', mask: true })
this.call.contents = this.call.comments
const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
cAction.Discuss.answerQues(this.call).then(json => {
this.updateList()
// this.ckeditor.setData('')
$('
#
editor
').val('')
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
} else { // 回复评论
// wx.showLoading({ title: '
操作中
...
', mask: true })
const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
cAction.Discuss.callbackComment(this.call).then(json => {
this.updateList()
// this.ckeditor.setData('')
$('
#
editor
').val('')
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
}
// this.blurInput()
},
/* 刷新页面 全部状态 - 目前没有分页可以这么操作,如果存在分页,可能要重写 */
updateList () {
const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
cAction.Discuss.getDiscussDetail(this.id).then(json => {
this.discussQues = json.ques
const _answers = this.answers
for (let i = 0; i < _answers.length; i++) {
for (let j = 0; j < json.answer.length; j++) {
if (_answers[i].aid === json.answer[j].aid) {
json.answer[j].isShowComment = _answers[i].isShowComment
break
}
}
}
const answers = []
for (let i = 0; i < json.answer.length; i++) {
answers.push({
aid: json.answer[i].aid,
isShowComment: json.answer[i].isShowComment
})
}
this.answersList = json.answer
this.answers = answers
}).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
},
/* 初始化 ckeditor */
initckeditor () {
!this.ckeditor && (this.ckeditor = CKEDITOR.replace('
editor
', {
height: 100,
uiColor: '
#
eeeeee
',
filebrowserImageUploadUrl: '
/
api
/
ckeditor
/
img
/
upload
',
// resize_enabled: typeof this.props.resizable === '
boolean
' ? this.props.resizable : true,
toolbar: [
// { name: '
document
', items: [ '
Source
', '
-
', '
Save
', '
NewPage
', '
Preview
' ] },
{ name: '
styles
', items: "[ '
Styles
', '
Format
', '
Font
', '
FontSize
' ]" },
{ name: '
colors
', items: "[ '
TextColor
', '
BGColor
' ]" },
{ name: '
tools
', items: "[ '
Maximize
', '
ShowBlocks
' ]" },
// { name: '
clipboard
', items: [ '
Cut
', '
Copy
', '
Paste
', '
PasteText
', '
PasteFromWord
', '
-
', '
Undo
', '
Redo
' ] },
{ name: '
editing
', items: "[ '
Find
', '
Replace
' ]" },
// { name: '
forms
', items: [ '
Form
', '
Checkbox
', '
Radio
', '
TextField
', '
Textarea
', '
Select
', '
Button
', '
ImageButton
', '
HiddenField
' ] },
'
/
',
{ name: '
basicstyles
', items: "[ '
Bold
', '
Italic
', '
Underline
', '
Strike
', '
Subscript
', '
Superscript
', '
-
', '
RemoveFormat
' ]" },
{ name: '
paragraph
', items: "[ '
NumberedList
', '
BulletedList
', '
-
', '
Outdent
', '
Indent
', '
-
', '
Blockquote
', '
CreateDiv
', '
-
', '
JustifyLeft
', '
JustifyCenter
', '
JustifyRight
', '
JustifyBlock
', '
-
', '
BidiLtr
', '
BidiRtl
' ]" },
{ name: '
links
', items: "[ '
Link
', '
Unlink
', '
Anchor
' ]" },
{ name: '
insert
', items: "[ '
Image
', '
Table
', '
HorizontalRule
' ]" }
]
}))
}
}
// mounted () {
// this.call = { questionId: this.id, semester_id: '', contents: '', question_id: this.id, answer: true }
// const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
// cAction.Discuss.getDiscussDetail(this.id).then(json => {
// this.discussQues = json.ques
// this.call.semester_id = this.discussQues.sid
// this.disQus.isShowComment = json.ques.isShowComment
// const answers = []
// for (let i = 0; i < json.answer.length; i++) {
// answers.push({
// aid: json.answer[i].aid,
// isShowComment: json.answer[i].isShowComment
// })
// }
// this.answersList = json.answer
// this.answers = answers
// }).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
// // this.initckeditor()
// $('
#
editor
').on('
blur
', () => {
// this.blurInput()
// })
// },
// destroyed () {
// /* 清空 ckeditor 需要调用方法删除 并 在DOM结构中也移除 */
// this.ckeditor && this.ckeditor.destroy(true)
// this.ckeditor = null
// $('
#
editor
').off('
blur
')
// },
// methods: {
// /**
// * 打开或关闭 讨论
// */
// openOrcloseDis (e) {
// const key = e.currentTarget.dataset.key
// if (key === '
disQus
') {
// this.disQus.isShowComment = !this.disQus.isShowComment
// } else {
// const index = e.currentTarget.dataset.index
// this.answers[index].isShowComment = !this.answers[index].isShowComment
// }
// },
// /**
// * 删除评论
// */
// deleteComment (e) {
// const cid = e.currentTarget.dataset.cid
// const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
// cAction.Discuss.deleteComment(cid).then(json => {
// this.updateList()
// this.$message({ type: '
success
', message: this.$t('
pages
.
learn
.
discussDetail
.
deleteSuccess
') })
// }).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
// },
// /**
// * 删除回答
// */
// deleteAnswer (e) {
// const aid = e.currentTarget.dataset.aid
// const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
// cAction.Discuss.deleteAnswer(aid).then(json => {
// this.updateList()
// this.$message({ type: '
success
', message: this.$t('
pages
.
learn
.
discussDetail
.
deleteSuccess
') })
// }).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
// },
// /**
// * 点赞 或 取消点赞 操作
// */
// btnlike (e) {
// const _data = e.currentTarget.dataset
// const quesid = _data.quesid
// const ansid = _data.ansid
// const tagid = _data.tagid
// const sid = _data.sid
// if (tagid) { // 取消 点赞操作
// // wx.showLoading({ title: '
操作中
...
', mask: true })
// const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
// cAction.Discuss.unlike(tagid).then(json => {
// this.updateList()
// }).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
// } else { // 点赞操作
// const param = {}
// if (quesid) { param.question_id = quesid }
// if (ansid) { param.answer_id = ansid }
// if (sid) { param.semester_id = sid }
// // wx.showLoading({ title: '
操作中
...
', mask: true })
// const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
// cAction.Discuss.like(param).then(json => {
// this.updateList()
// }).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
// }
// },
// /**
// * 删除问题
// */
// deleteDiscuss () {
// const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
// cAction.Discuss.deleteDiscuss(this.id).then(json => {
// this.$message({ type: '
success
', message: this.$t('
pages
.
learn
.
discussDetail
.
deleteSuccess
') })
// /* 返回上一级 菜单 */
// setTimeout(() => {
// // wx.navigateBack({ delta: 1 })
// this.$router.go(-1)
// }, 1000)
// }).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
// },
// /**
// * 点击回复 调起输入框
// */
// callbackComment (e) {
// // /* 如果,输入框中,本身已经存在输入内容,那么再点击其他回复时,不给提示,直接清空 */
// this.inputStatus.input = '' // 这里如果想判断,不能使用 inputStatus.input这个 在blur时存储
// const _data = e.currentTarget.dataset
// const qid = _data.qid
// const quesid = _data.quesid
// const ansid = _data.ansid
// const to = _data.to
// const sid = _data.sid
// const json = {}
// if (qid) { json.questionId = qid }
// if (to) { json.to = to }
// if (quesid) { json.question_id = quesid }
// if (ansid) { json.answer_id = ansid }
// if (sid) { json.semester_id = sid }
// this.call = json
// if (to) {
// this.inputStatus.placeholder = this.$t('
pages
.
learn
.
discussDetail
.
reply
') + to + '
:
'
// } else {
// this.inputStatus.placeholder = `${this.$t('
pages
.
learn
.
discussDetail
.
reply
')}:`
// }
// this.inputStatus.canFocus = true
// $('
#
editor
').focus()
// },
// /**
// * 取消 聚焦状态, 使用 ckeditor 进行 聚焦监听
// */
// blurInput (e) {
// this.inputStatus.canFocus = false
// if ($('
#
editor
').val()) {
// // 输入框中存在内容则不做处理 - 这里不能做任何处理,否则会产生 输入框中内容遗留问题
// } else {
// this.inputStatus.placeholder = `${this.$t('
pages
.
learn
.
discussDetail
.
answering
')} ...`
// this.inputStatus.input = ''
// // 回答问题 方式
// this.call = {
// questionId: this.discussQues.qid,
// semester_id: this.discussQues.sid,
// contents: '',
// question_id: this.discussQues.qid,
// answer: true
// }
// }
// },
// /**
// * 点击 键盘发送按钮时
// */
// publishContent (e) {
// const val = $('
#
editor
').val()
// if (this.call.to) {
// this.call.comments = this.$t('
pages
.
learn
.
discussDetail
.
reply
') + this.call.to + '
:
' + val
// } else {
// this.call.comments = val
// }
// if (this.call.answer) { // 回答问题
// // wx.showLoading({ title: '
操作中
...
', mask: true })
// this.call.contents = this.call.comments
// const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
// cAction.Discuss.answerQues(this.call).then(json => {
// this.updateList()
// // this.ckeditor.setData('')
// $('
#
editor
').val('')
// }).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
// } else { // 回复评论
// // wx.showLoading({ title: '
操作中
...
', mask: true })
// const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
// cAction.Discuss.callbackComment(this.call).then(json => {
// this.updateList()
// // this.ckeditor.setData('')
// $('
#
editor
').val('')
// }).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
// }
// // this.blurInput()
// },
// /* 刷新页面 全部状态 - 目前没有分页可以这么操作,如果存在分页,可能要重写 */
// updateList () {
// const loading = this.$loading({ lock: true, text: '', spinner: '', background: '
rgba
(
255
,
255
,
255
,
0.9
)
' })
// cAction.Discuss.getDiscussDetail(this.id).then(json => {
// this.discussQues = json.ques
// const _answers = this.answers
// for (let i = 0; i < _answers.length; i++) {
// for (let j = 0; j < json.answer.length; j++) {
// if (_answers[i].aid === json.answer[j].aid) {
// json.answer[j].isShowComment = _answers[i].isShowComment
// break
// }
// }
// }
// const answers = []
// for (let i = 0; i < json.answer.length; i++) {
// answers.push({
// aid: json.answer[i].aid,
// isShowComment: json.answer[i].isShowComment
// })
// }
// this.answersList = json.answer
// this.answers = answers
// }).catch(e => { this.$message.error(e.message) }).finally(() => { loading.close() })
// },
// /* 初始化 ckeditor */
// initckeditor () {
// !this.ckeditor && (this.ckeditor = CKEDITOR.replace('
editor
', {
// height: 100,
// uiColor: '
#
eeeeee
',
// filebrowserImageUploadUrl: '
/
api
/
ckeditor
/
img
/
upload
',
// // resize_enabled: typeof this.props.resizable === '
boolean
' ? this.props.resizable : true,
// toolbar: [
// // { name: '
document
', items: [ '
Source
', '
-
', '
Save
', '
NewPage
', '
Preview
' ] },
// { name: '
styles
', items: "[ '
Styles
', '
Format
', '
Font
', '
FontSize
' ]" },
// { name: '
colors
', items: "[ '
TextColor
', '
BGColor
' ]" },
// { name: '
tools
', items: "[ '
Maximize
', '
ShowBlocks
' ]" },
// // { name: '
clipboard
', items: [ '
Cut
', '
Copy
', '
Paste
', '
PasteText
', '
PasteFromWord
', '
-
', '
Undo
', '
Redo
' ] },
// { name: '
editing
', items: "[ '
Find
', '
Replace
' ]" },
// // { name: '
forms
', items: [ '
Form
', '
Checkbox
', '
Radio
', '
TextField
', '
Textarea
', '
Select
', '
Button
', '
ImageButton
', '
HiddenField
' ] },
// '
/
',
// { name: '
basicstyles
', items: "[ '
Bold
', '
Italic
', '
Underline
', '
Strike
', '
Subscript
', '
Superscript
', '
-
', '
RemoveFormat
' ]" },
// { name: '
paragraph
', items: "[ '
NumberedList
', '
BulletedList
', '
-
', '
Outdent
', '
Indent
', '
-
', '
Blockquote
', '
CreateDiv
', '
-
', '
JustifyLeft
', '
JustifyCenter
', '
JustifyRight
', '
JustifyBlock
', '
-
', '
BidiLtr
', '
BidiRtl
' ]" },
// { name: '
links
', items: "[ '
Link
', '
Unlink
', '
Anchor
' ]" },
// { name: '
insert
', items: "[ '
Image
', '
Table
', '
HorizontalRule
' ]" }
// ]
// }))
// }
// }
}
</
script
>
...
...
@@ -413,7 +413,7 @@ export default {
.discuss-detail-scroll
.item-list
.text
{
margin-top
:
0
.15rem
;
font-size
:
0
.16rem
;
color
:
#535353
;
}
.discuss-detail-scroll
.item-list
.text.on
{
color
:
#2263d9
;
}
.discuss-detail-scroll
.no-data
{
padding
:
1rem
0
;
font-size
:
0
.24rem
;
color
:
#c9c9c9
;
text-align
:
center
;
}
.input-publish
{
position
:
fixed
;
z-index
:
2
;
height
:
1
.5rem
;
left
:
2
00px
;
right
:
15
px
;
bottom
:
0
;
padding
:
0
.2rem
;
background
:
#fff
;
box-sizing
:
border-box
;
}
.input-publish
{
position
:
fixed
;
z-index
:
2
;
height
:
1
.5rem
;
left
:
2
95px
;
right
:
30
px
;
bottom
:
0
;
padding
:
0
.2rem
;
background
:
#fff
;
box-sizing
:
border-box
;
}
.input-publish
#editor
{
width
:
100%
;
height
:
0
.7rem
;
font-size
:
18px
;
line-height
:
1
.5
;
outline
:
none
;
}
.input-publish
.send
{
font-size
:
14px
;
color
:
#ddd
;
margin-left
:
10px
;
}
.input-publish
.ask
{
position
:
relative
;
margin
:
12px
auto
;
width
:
90%
;
height
:
56px
;
border
:
1px
solid
#dcdcdc
;
box-sizing
:
border-box
;
-webkit-box-sizing
:
border-box
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论