diff --git a/src/components/comment-input/comment-input.vue b/src/components/comment-input/comment-input.vue
index eaa9e03c..a8a8c051 100644
--- a/src/components/comment-input/comment-input.vue
+++ b/src/components/comment-input/comment-input.vue
@@ -1,5 +1,5 @@
-
+
@@ -9,7 +9,7 @@
ref="textareaRef"
v-model="value"
border="none"
- placeholder="发条评论,和大家一起讨论"
+ :placeholder="placeholder"
:customStyle="customStyle"
autoHeight
:adjustPosition="false"
@@ -21,18 +21,33 @@
>
-
+
-
+
- 最多可添加3张图片
+ 最多可添加4张图片
- 综合评分
+
+
+ 建议
+
+
+ 提问
+
+
-
-
- 建议
-
-
- 提问
-
-
-
+
-
+
@@ -82,7 +82,7 @@
-
+
@@ -96,7 +96,7 @@
-
+
@@ -113,7 +113,7 @@
import commentInput2 from '@/static/images/courseDetail/comment-input-2.png'
import commentInput3 from '@/static/images/courseDetail/comment-input-3.png'
import commentInput4 from '@/static/images/courseDetail/comment-input-4.png'
- import { reactive, ref, watch, nextTick } from 'vue';
+ import { reactive, ref, watch, nextTick, computed } from 'vue';
import { emojiList } from '@/emoji';
import { publishCrsEvaluation, queryTraMemeInfoList } from '@/api/courseDetail.js'
import common from '@/common/common.js';
@@ -128,7 +128,14 @@
}
})
+ const emit = defineEmits(['submitOver', 'sendReply'])
+ const isReply = ref(false)
+ const clickHandler = () => {
+ if(!isShow.value){
+ isReply.value = false
+ }
+ }
const customStyle = {
backgroundColor: 'rgb(227, 230, 237)',
padding: '18rpx'
@@ -158,8 +165,17 @@
popHeight.value = 'calc(270px + 120rpx)'
isShow.value = true
console.log('focusevent');
- getMemList()
+ if(!isReply.value){
+ getMemList()
+ }
}
+ const placeholder = computed(()=>{
+ if(isReply.value){
+ return answerData.value.placeholder||'请输入回复信息'
+ }else{
+ return '发条评论,和大家一起讨论'
+ }
+ })
const resStart = ref(-1)
const blur = (event) => {
console.log('失去焦点不一定关闭',event);
@@ -168,10 +184,26 @@
isShow.value = true
isFocus.value = false
}
- const hideAll = () => {
+ const hideAll = (flag=false) => {
popHeight.value = '0px'
+ console.log('hideAll');
isShow.value = false
isFocus.value = false
+ if(flag){
+ value.value = ''
+ fileList.value = []
+ }
+ }
+ const answerData = ref({})
+ const resetVal = (data={} , $isReply = true) => {
+ value.value = ''
+ fileList.value = []
+ isReply.value = $isReply
+ answerData.value = data || {}
+ if($isReply){
+ focus()
+ // showKeyborad()
+ }
}
const insertValue = (emojiItem) => {
let _val = value.value
@@ -182,7 +214,7 @@
const bbsTag = ref('SUG')
// 方法
- const uploadNow = (limit = 3) => {
+ const uploadNow = (limit = 4) => {
if(!isImg.value){
upload(limit)
}else{
@@ -193,7 +225,7 @@
});
}
}
- const upload = (limit = 3) => {
+ const upload = (limit = 4) => {
uni.chooseImage({
count: limit,
sizeType: ['original', 'compressed'],
@@ -246,6 +278,10 @@
}
const submit = () => {
+ if(isReply.value){
+ reply_send()
+ return
+ }
if (value.value === '') {
if (bbsTag.value === 'SUG') {
return common.msg('请输入你的建议');
@@ -275,6 +311,9 @@
setTimeout(() => {
uni.$emit('refresh_comment_data');
hideAll()
+ value.value = ''
+ fileList.value = []
+ emit('submitOver')
if (from.value === 'study') {
} else {
}
@@ -284,6 +323,9 @@
console.log(err)
})
};
+ const reply_send = async () => {
+ emit('sendReply', {...answerData.value, bbsContent: value.value})
+ };
const bbsGrade = ref(10)
const sliderChange = (event) => {
bbsGrade.value = event.detail.value;
@@ -293,7 +335,7 @@
isImg.value = true
}
})
- defineExpose({hideAll})
+ defineExpose({hideAll, resetVal})
diff --git a/src/pages/courseDetail/components/comment.vue b/src/pages/courseDetail/components/comment.vue
index 68523f84..72dfa1b4 100644
--- a/src/pages/courseDetail/components/comment.vue
+++ b/src/pages/courseDetail/components/comment.vue
@@ -119,6 +119,7 @@
import {setupKeyboardHeightListener} from '@/common/common.js';
import { get_base_url } from '@/api/request.js';
+ const emit = defineEmits(['replayInput'])
const popup = ref(null);
const popup_input_bottom = ref('0px');
const message_list = reactive([]);
@@ -143,16 +144,25 @@
});
const click_reply = (item, parentBbsId, index) => {
- popup.value.open('bottom');
+ // popup.value.open('bottom');
reply_data.placeholder = '回复 ' + item.userName + ':';
reply_data.parentBbsId = parentBbsId;
reply_data.bbsId = item.bbsId;
reply_data.index = index;
- setupKeyboardHeightListener((height) => {
- popup_input_bottom.value = `${height}px`;
- });
+ // setupKeyboardHeightListener((height) => {
+ // popup_input_bottom.value = `${height}px`;
+ // });
+ emit('replayInput', reply_data)
};
- const reply_send = async () => {
+ const setReplyData = (data,cb) => {
+ reply_data.placeholder = data.placeholder
+ reply_data.parentBbsId = data.parentBbsId
+ reply_data.bbsId = data.bbsId
+ reply_data.index = data.index
+ reply_data.bbsContent = data.bbsContent
+ reply_send(cb)
+ }
+ const reply_send = async (cb=()=>{}) => {
if (reply_data.bbsContent === '') {
return common.msg('回复内容不能为空');
}
@@ -171,6 +181,7 @@
});
message_list[reply_data.index]['children'] = res.body;
Object.assign(reply_data, reply_data_init);
+ cb()
} catch (e) {
common.msg('发送失败');
} finally {
@@ -234,7 +245,8 @@
});
};
defineExpose({
- getData
+ getData,
+ setReplyData
});
onMounted(() => {
getData();
diff --git a/src/pages/courseDetail/index.vue b/src/pages/courseDetail/index.vue
index 5ab8b42a..112c6df7 100644
--- a/src/pages/courseDetail/index.vue
+++ b/src/pages/courseDetail/index.vue
@@ -1,13 +1,8 @@
-
+
@@ -21,55 +16,35 @@
-
+
当前进度
- ({{ form.styParaGraphNum || 0 }}/{{ form.pgrphNum || 0 }})
+ ({{ form.styParaGraphNum || 0 }}/{{ form.pgrphNum || 0 }})
-
-
+
+
考试排行榜
-
+
+
-
+ :lineColor="`url(${LineBg}) 10% 10%`">
@@ -79,43 +54,64 @@
-
+
-
- 去学习
-
-
- 去练习
-
-
- 去考试
-
-
+
+ 去学习
+
+
+ 去练习
+
+
+ 去考试
+
+
-
-
-
-
+
+
+
+
-
+