diff --git a/.gitignore b/.gitignore index 93242f79..a908cd36 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ yarn-error.log* pnpm-debug.log* lerna-debug.log* package-lock - +package-lock.json node_modules .DS_Store dist diff --git a/package.json b/package.json index 9760aa44..8b55ed63 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "dev:h5": "uni", "dev:h5:sit": "uni -p h5 --mode sit", "dev:h5:uat": "uni -p h5 --mode uat", - "dev:h5:production": "uni -p h5 --mode production", - "build:app-plus:dev": "uni build -p app-plus --mode development", + "dev:h5:production": "uni -p h5 --mode production", + "build:app-plus:dev": "uni build -p app-plus --mode development", "build:app-plus:sit": "uni build -p app-plus --mode sit", "build:app-plus:uat": "uni build -p app-plus --mode uat", "build:app-plus": "uni build -p app-plus", @@ -31,6 +31,7 @@ "@dcloudio/uni-mp-xhs": "3.0.0-4060620250520001", "@dcloudio/uni-quickapp-webview": "3.0.0-4060620250520001", "crypto-js": "^3.1.9-1", + "markdown-it": "^14.1.0", "pinia": "^2.3.1", "terser": "^5.42.0", "uuid": "^11.1.0", diff --git a/src/common/common.js b/src/common/common.js index a5dd98c7..3384863f 100644 --- a/src/common/common.js +++ b/src/common/common.js @@ -59,8 +59,9 @@ const navigateBack = (delta = 1, fun = () => {}) => { } //关闭当前页面,跳转到应用内的某个页面。 -const redirectTo = url => uni.redirectTo({ - url: url +const redirectTo = (url, obj = {}) => uni.redirectTo({ + url: url, + ...obj }); // 时间转换时间戳 diff --git a/src/components/image-preview/image-preview.vue b/src/components/image-preview/image-preview.vue index 34f3d51f..932e2628 100644 --- a/src/components/image-preview/image-preview.vue +++ b/src/components/image-preview/image-preview.vue @@ -1,5 +1,12 @@ - \ No newline at end of file diff --git a/src/components/image-preview/video-preview.vue b/src/components/image-preview/video-preview.vue index 3d04e21d..fc0cc02f 100644 --- a/src/components/image-preview/video-preview.vue +++ b/src/components/image-preview/video-preview.vue @@ -30,6 +30,10 @@ watch: { fileId: { handler(newval, oldval) { + if(newval.indexOf('http:') === 0){ + this.fileUrlShow = newval + return + } if (newval && this.watching) { this.getPreviewUrlBlob(newval); } @@ -57,7 +61,11 @@ }, mounted() { if (this.fileId) { - this.getPreviewUrlBlob(this.fileId); + if(this.fileId.indexOf('http:') === 0){ + this.fileUrlShow = this.fileId + }else{ + this.getPreviewUrlBlob(this.fileId); + } } this.watching = true }, diff --git a/src/components/markdown-preview/markdown-preview.vue b/src/components/markdown-preview/markdown-preview.vue index 4520cdc6..df00d1ad 100644 --- a/src/components/markdown-preview/markdown-preview.vue +++ b/src/components/markdown-preview/markdown-preview.vue @@ -5,11 +5,18 @@ diff --git a/src/components/picture-upload/picture-upload.vue b/src/components/picture-upload/picture-upload.vue index 6a48e4a8..a01f55b0 100644 --- a/src/components/picture-upload/picture-upload.vue +++ b/src/components/picture-upload/picture-upload.vue @@ -52,7 +52,13 @@ mark: { type: [String, Number], default: '' - } + }, + fileType: { + type: Array, + default: function() { + return ['jpg', 'png'] + } + }, }) // 状态管理 const fileList = reactive([]) @@ -105,13 +111,22 @@ success: async ({ tempFilePaths }) => { + const valid = tempFilePaths.every(url => { + if (props.fileType.length === 0) return true; + console.log(url); + const lastDotIndex = url.lastIndexOf('.') + if (lastDotIndex === -1) return false; + const extension = url.slice(lastDotIndex + 1).split('?')[0].toLowerCase() + return props.fileType.includes(extension) + }) + if (!valid) return common.msg('您选择的图片格式有误。') + console.log(valid) const data = { bizScen: 'S3005' } - console.log(tempFilePaths[0]); const upload_map = tempFilePaths.map((file) => uploadFile(file, data)) Promise.all(upload_map).then(res => { - fileList.push(...res) + fileList.push(...res.splice(0, props.limit - fileList.length)) emits('update:modelValue', fileList.map(res => res.fileId)) }).catch(() => { diff --git a/src/pages/course/components/talkingItem.vue b/src/pages/course/components/talkingItem.vue index 2539c2ca..d75bce6a 100644 --- a/src/pages/course/components/talkingItem.vue +++ b/src/pages/course/components/talkingItem.vue @@ -24,7 +24,7 @@ {{ showContent }} - + @@ -317,9 +317,11 @@ const audioCacheObj = computed(() => storageStore.audioObj) // 重播 const restartPlay = () => { if(itemVoice.value){ + emit('changePlay', '') emit('changePlay', unref(dataInfo)?.id) setTimeout(()=>{ talkVoiceObj.value.src = itemVoice.value + talkVoiceObj.value.seek(0) talkVoiceObj.value.play() },100) }else{ @@ -335,7 +337,7 @@ const audioCacheObj = computed(() => storageStore.audioObj) } // readType 阅读内容类型pgrh段落/qns问题 emit('changePlay', unref(dataInfo)?.id) - if(talkVoiceObj.value.src === itemVoice.value) { + if(talkVoiceObj.value.src && talkVoiceObj.value.src === itemVoice.value) { talkVoiceObj.value.play() return } diff --git a/src/pages/course/components/touchBtn.vue b/src/pages/course/components/touchBtn.vue index fb819dba..bcfc8de7 100644 --- a/src/pages/course/components/touchBtn.vue +++ b/src/pages/course/components/touchBtn.vue @@ -9,7 +9,7 @@ >按住说话 - @@ -60,6 +60,7 @@ const recordObjCom = uni.getRecorderManager() const initRecord = () => { unref(recordObjCom)?.onStop((res, duration)=>{ audioPath.value = res.tempFilePath + console.log(duration) }) } const startRecord = () => { @@ -112,6 +113,7 @@ const showOverlayTalking = (obj) => { } } const hideOverlayTalking = (obj) => { + if(!showTalkingModel.value) return showTalkingModel.value = false //#ifdef APP-PLUS stopRecord() diff --git a/src/pages/course/index.vue b/src/pages/course/index.vue index 6cc5f62b..cf4fa96a 100644 --- a/src/pages/course/index.vue +++ b/src/pages/course/index.vue @@ -167,16 +167,11 @@ import { onMounted, ref, computed } from 'vue' } // 点击生产线分类 const changePrdLine = (item)=>{ - activePrdlineType.value = item.value + activePrdlineType.value = item.value === activePrdlineType.value ? '' : item.value } // 点击课程分类 const changeCourseType = (item)=>{ - activeCourseType.value = item.value - - setTimeout(()=>{ - console.log(courseListTreeShow.value) - }) - + activeCourseType.value = item.value === activeCourseType.value ? '' : item.value } const showTypeName = computed(()=>{ return (activeTab.value === '全部' && activeCourseType.value === '') || (activeTab.value === '生产线' && activePrdlineType.value === '') @@ -241,7 +236,7 @@ import { onMounted, ref, computed } from 'vue' const changeTab = (item) => { if(!item) return activeTab.value = item.name - activeTag.value = '' + // activeTag.value = '' activeCourseType.value = '' activePrdlineType.value = '' switch (item.name){ diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index cfa8209c..1c18b310 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -21,7 +21,8 @@ {{item.teacherName}} 描述:{{item.voiceDesc || '--'}} - + + @@ -243,6 +244,7 @@ teacherVoiceObj.onEnded(()=>{ activeVoiceTeachNo.value = '' teacherVoiceObj.src = '' }) +const loadingTeacherVoice = ref(false) const playTeacherVoice = (item) =>{ teacherVoiceObj.stop() teacherVoiceObj.src = '' @@ -253,12 +255,15 @@ const playTeacherVoice = (item) =>{ teacherVoiceObj.src = item.voicePath teacherVoiceObj.play() }else{ + loadingTeacherVoice.value = true storageStore.getStorageById('audio', item.teacherNo, (url)=>{ if(url){ - teacherVoiceObj.src = _cache + teacherVoiceObj.src = url teacherVoiceObj.play() + loadingTeacherVoice.value = false }else{ downloadVoiceFile('/trastudy/traStdyInfo/trialListening?teachNo='+item.teacherNo).then(res=>{ + loadingTeacherVoice.value = false item.voicePath = res.tempFilePath teacherVoiceObj.src = item.voicePath teacherVoiceObj.play() @@ -534,12 +539,13 @@ onLoad((params) => { crsId.value = params.crsId||''; crsNum.value = params.crsNum||''; startPgrphId.value = params.pgrphId||''; + getData('1'); }); const showTalkingModel = ref(false) // 录音 -onMounted(()=>{ - getData('1'); -}) +// onMounted(()=>{ +// getData('1'); +// }) // onShow(()=>{ // getData('2'); // }) @@ -675,17 +681,6 @@ const withdrawNow = (data) => { const loadingQstLogId = ref('') // 完成 const finishQuestionNow = (data) => { - let _id1 = new Date().getTime() + 'id' - talkingList.value.push({ - id: _id1, - talkingContent: '完成', - userInfo: {...choiceTeacherInfo.value}, - type: 0 - }) - // waitMakeEvaluateApi({ - // qstLogId: data.qstLogId - // }) - textChartApi({ processType: 'ANSER-OVER', requestBody: JSON.stringify({ @@ -694,6 +689,18 @@ const finishQuestionNow = (data) => { }) .then(res=> { // common.msg('完成成功,开始获取评分维度数据!') + let _state = res.body.chatBody.processStat + if(_state = 'ER'){ + common.msg('提交答案失败!') + return + } + let _id1 = new Date().getTime() + 'id' + talkingList.value.push({ + id: _id1, + talkingContent: '完成', + userInfo: {...choiceTeacherInfo.value}, + type: 0 + }) loadingQstLogId.value = res.body.chatBody.qstLogId qstLogId.value = loadingQstLogId.value let _id = new Date().getTime() + 'id' @@ -711,10 +718,6 @@ const finishQuestionNow = (data) => { // 查询问题回答评分 const getQuestionEvalateRequest = (id, data) => { if(loadingQstLogId.value){ - // queryQuestionEvalateApi({ - // qstLogId:loadingQstLogId.value - // }) - textChartApi({ processType: 'ANSER-RESULT', requestBody: JSON.stringify({ @@ -957,6 +960,7 @@ const chooseRateNow = (item) => { .talking-gif{ width: 140rpx; height: 40rpx; + margin-right: 20rpx; // background-color: #ccc; background: url(@/static/images/course/voice-gray.png) no-repeat; background-size: 100%; diff --git a/src/pages/courseDetail/components/knowledge.vue b/src/pages/courseDetail/components/knowledge.vue index 56ca11bb..82019f52 100644 --- a/src/pages/courseDetail/components/knowledge.vue +++ b/src/pages/courseDetail/components/knowledge.vue @@ -5,9 +5,9 @@ - 知识点0{{ index + 1 }} + 知识点{{ item.pgrphNm }} - + {{ item.pgrphStdyStateName }} @@ -21,14 +21,24 @@ diff --git a/src/pages/courseDetail/index.vue b/src/pages/courseDetail/index.vue index a6feeb10..29af4020 100644 --- a/src/pages/courseDetail/index.vue +++ b/src/pages/courseDetail/index.vue @@ -82,6 +82,7 @@ import { getCourseDetailApi } from '@/api/courseDetail.js'; + import common from '@/common/common'; import introduceVue from './components/introduce.vue'; import knowledge from './components/knowledge.vue'; diff --git a/src/pages/courseDetail/submit.vue b/src/pages/courseDetail/submit.vue index 72890785..c670a83a 100644 --- a/src/pages/courseDetail/submit.vue +++ b/src/pages/courseDetail/submit.vue @@ -37,7 +37,7 @@ @@ -53,9 +53,7 @@ reactive, ref } from 'vue'; - import { - TextareaInputLimitCharacter - } from "@/enum.js" + import { onLoad } from '@dcloudio/uni-app'; diff --git a/src/pages/index/dialog.vue b/src/pages/index/dialog.vue index df93e492..badbb0ba 100644 --- a/src/pages/index/dialog.vue +++ b/src/pages/index/dialog.vue @@ -1,8 +1,11 @@ - + .main_div { + display: flex; + flex-direction: column; + background-color: #f6f8ff; + } + \ No newline at end of file