diff --git a/src/components/comment-input/comment-input.vue b/src/components/comment-input/comment-input.vue index a798767f..eaa9e03c 100644 --- a/src/components/comment-input/comment-input.vue +++ b/src/components/comment-input/comment-input.vue @@ -1,5 +1,5 @@ @@ -60,9 +113,22 @@ 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 } from 'vue'; + import { reactive, ref, watch, nextTick } from 'vue'; import { emojiList } from '@/emoji'; - import { queryTraMemeInfoList } from '@/api/courseDetail.js' + import { publishCrsEvaluation, queryTraMemeInfoList } from '@/api/courseDetail.js' + import common from '@/common/common.js'; + import { + uploadFile + } from '@/api/common' + + const props = defineProps({ + crsId:{ + type: String, + default: '' + } + }) + + const customStyle = { backgroundColor: 'rgb(227, 230, 237)', padding: '18rpx' @@ -77,11 +143,21 @@ if(!isShow.value) isShow.value = true } const textareaRef = ref() + const isFocus = ref(false) + const cursorLength = ref(0) + const currentIndex = ref(0) + const isImg = ref(true) + const changeCurrent = (event) => { + currentIndex.value = event.detail.current + } + const showKeyborad = () => { + isFocus.value = true + cursorLength.value = resStart.value || value.value.length + } const focus = (event) => { - popHeight.value = '278px' + popHeight.value = 'calc(270px + 120rpx)' isShow.value = true - console.log('event', event); - console.dir(textareaRef.value) + console.log('focusevent'); getMemList() } const resStart = ref(-1) @@ -90,15 +166,34 @@ // popHeight.value = '0px' resStart.value = event.detail.cursor isShow.value = true + isFocus.value = false + } + const hideAll = () => { + popHeight.value = '0px' + isShow.value = false + isFocus.value = false } const insertValue = (emojiItem) => { let _val = value.value value.value = _val.substring(0, resStart.value) + emojiItem + _val.substring(resStart.value, _val.length) resStart.value+=emojiItem.length } - const fileList = reactive([]); + const fileList = ref([]); + const bbsTag = ref('SUG') // 方法 - const upload = (limit = 4) => { + + const uploadNow = (limit = 3) => { + if(!isImg.value){ + upload(limit) + }else{ + common.show('','是否清空当前表情并重新添加?').then((res) => { + if (res) { + upload(limit) + } + }); + } + } + const upload = (limit = 3) => { uni.chooseImage({ count: limit, sizeType: ['original', 'compressed'], @@ -107,16 +202,19 @@ tempFilePaths }) => { const valid = tempFilePaths.every(url => { + const lastDotIndex = url.lastIndexOf('.') const extension = url.slice(lastDotIndex + 1).split('?')[0].toLowerCase() return ['png', 'jpg'].includes(extension) }) + console.log(tempFilePaths,valid) if (!valid) return common.msg('您选择的图片格式有误。') const data = { bizScen: 'S3005' } const upload_map = tempFilePaths.map((file) => uploadFile(file, data)) Promise.all(upload_map).then(res => { - fileList.push(...res.splice(0, limit - fileList.length)) + fileList.value.push(...res.splice(0, limit - fileList.value.length).map(t => t.fileId)) + isImg.value = true }).catch((err) => { common.msg(err) }) @@ -129,22 +227,107 @@ return } queryTraMemeInfoList().then(res=>{ - console.log(res) memList.value = res.body || [] }) } + const setMemValue = (item) => { + console.log(item) + if(!isImg.value || fileList.value.length == 0){ + fileList.value = [item.ossAddr] + isImg.value = false + return + } + common.show('','是否清空当前图片并重新添加?').then((res) => { + if (res) { + fileList.value = [item.ossAddr] + isImg.value = false + } + }); + } + + const submit = () => { + if (value.value === '') { + if (bbsTag.value === 'SUG') { + return common.msg('请输入你的建议'); + } else { + return common.msg('请输入你的问题'); + } + } + const loadingStartTime = Date.now(); + common.loading('评价中'); + let _params = { + crsId: props.crsId, + imgIdList: fileList.value, // 发表图片ID列表,文件ID集 + bbsGrade: bbsGrade.value, // 综合评分(最高10分) + bbsTag: bbsTag.value, // 评价标签 (SUG 建议 ASK 提问 ) + bbsContent: value.value // 评价内容 + } + console.log(_params) + publishCrsEvaluation(_params).then((res) => { + const loadingDuration = Date.now() - loadingStartTime; + const minLoadingTime = 700; + console.log(loadingStartTime, loadingDuration); + const delayTime = Math.max(0, minLoadingTime - loadingDuration); + console.log('delayTime', delayTime); + setTimeout(() => { + common.hideLoading(); + nextTick(() => common.msg('发表成功')); + setTimeout(() => { + uni.$emit('refresh_comment_data'); + hideAll() + if (from.value === 'study') { + } else { + } + }, 500); + }, delayTime); + }).catch(err=>{ + console.log(err) + }) + }; + const bbsGrade = ref(10) + const sliderChange = (event) => { + bbsGrade.value = event.detail.value; + }; + watch(()=> fileList.value, (val)=>{ + if(val.length === 0){ + isImg.value = true + } + }) + defineExpose({hideAll}) diff --git a/src/components/picture-upload/picture-upload.vue b/src/components/picture-upload/picture-upload.vue index 2a5a7f26..68a0a1f2 100644 --- a/src/components/picture-upload/picture-upload.vue +++ b/src/components/picture-upload/picture-upload.vue @@ -158,9 +158,9 @@ } .pic-item { - margin-right: 30rpx; - width: 170rpx; - height: 170rpx; + margin-right: 20rpx; + width: 120rpx; + height: 120rpx; border-radius: 8rpx; // background-color: red; margin-bottom: 24rpx; @@ -168,8 +168,8 @@ .add_icon { position: relative; - width: 170rpx; - height: 170rpx; + width: 120rpx; + height: 120rpx; border: 2rpx dashed #C0C0C0; border-radius: 8rpx; diff --git a/src/emoji.js b/src/emoji.js index 3812b961..a9cc48b4 100644 --- a/src/emoji.js +++ b/src/emoji.js @@ -1,11 +1,10 @@ export const emojiList = [ - '😀', '😃', '😄', '😁', '😆', '😅', '🤣', '😂', '🙂', '🙃', '😉', '😊', '😇', '🥰', '😍', '🤩', '😘', '😗', '☺', + '😀', '😃', '😄', '😁', '😆', '😅', '🤣', '😂', '🙂', '🙃', '😉', '😊', '😇', '🥰', '😍', '🤩', '😘', '😗', '😚', '😙', '🥲', '😋', '😛', '😜', '🤪', '😝', '🤑', '🤗', '🤭', '🤫', '🤔', '🤐', '🤨', '😐', '😑', '😶', '😏', '😒', '🙄', '😬', '🤥', '😌', '😔', '😪', '🤤', '😴', '😷', '🤒', '🤕', '🤢', '🤮', '🤧', '🥵', '🥶', - '🥴', '😵', '🤯', '🤠', '🥳', '🥸', '😎', '🤓', '🧐', '😕', '😟', '🙁', '☹', '😮', '😯', '😲', '😳', '🥺', '😦', + '🥴', '😵', '🤯', '🤠', '🥳', '🥸', '😎', '🤓', '🧐', '😕', '😟', '🙁', '😮', '😯', '😲', '😳', '🥺', '😦', '😧', '😨', '😰', '😥', '😢', '😭', '😱', '😖', '😣', '😞', '😓', '😩', '😫', '🥱', '😤', '😡', '😠', '🤬', - '😈', '👿', '💀', '☠', '*', '🤡', '👹', '👺', '👻', '👽', '👾', '🤖', '😺', '😸', '😹', '😻', '😼', '😽', '🙀', - '😿', '😾', '🙈', '🙉', '🙊', '💋', '💌', '💘', '💝', '💖', '💗', '💓', '💞', '💕', '💟', '❣', '💔', '❤', '🧡', - '💛', '💚', '💙', '💜', '🤎', '🖤', '🤍', '💯', '💢', '💥', '💫', '💦', '💨', '🕳', '💣', '💬', '👁‍🗨', '🗨', - '🗯', '💭', '💤' + '😈', '👿', '💀', '🤡', '👹', '👺', '👻', '👽', '👾', '🤖', '😺', '😸', '😹', '😻', '😼', '😽', '🙀', + '😿', '😾', '🙈', '🙉', '🙊', '💋', '💌', '💘', '💝', '💖', '💗', '💓', '💞', '💕', '💟', '💔', '🧡', + '💛', '💚', '💙', '💜', '🤎', '🖤', '🤍', '💯', '💢', '💥', '💫', '💦', '💨', '🕳', '💣', '💤' ] diff --git a/src/pages/courseDetail/index.vue b/src/pages/courseDetail/index.vue index 7a45d0d8..5ab8b42a 100644 --- a/src/pages/courseDetail/index.vue +++ b/src/pages/courseDetail/index.vue @@ -1,5 +1,5 @@ @@ -125,6 +125,7 @@ // tab栏 const tabList = ref([{ name: '课程介绍' }, { name: '知识点' }, { name: '评价' }]); const commentRef = ref(null); + const commentInputRef = ref(null) const form = ref({}); const crsId = ref(''); const collectId = ref(''); // 记录初始的收藏id @@ -149,7 +150,9 @@ commentRef.value?.getData(); } }; - + const hideKeyboradNow = () => { + commentInputRef.value.hideAll() + } const getData = async () => { common.loading(); try { diff --git a/src/pages/sparring/tip.vue b/src/pages/sparring/tip.vue index 048d7499..99c1fbb4 100644 --- a/src/pages/sparring/tip.vue +++ b/src/pages/sparring/tip.vue @@ -52,7 +52,8 @@ {{ detailInfo.sceneDesc }} - 陪练角色不具备主动终止场景陪练的功能,当用户完成预设陪练目标时,需由用户手动发起结束陪练操作。 + 1. 陪练角色不具备主动终止场景陪练的功能,当用户完成预设陪练目标时,需由用户手动发起结束陪练操作。 + 2. 存款挂牌利率仅供参考,实际执行利率以吉林银行分支机构最终办理结果为准。 -请点击下方按钮开始{{ detailInfo.traInterTypDesc }} @@ -889,9 +890,13 @@ onBackPress(res => { .talking-desc { // padding-top: 24rpx; padding: 24rpx 20rpx 0; + white-space: pre-line; font-size: 24rpx; // text-align: center; color: #999; + &.second{ + padding-top:0; + } } .talking-box {