feat:增加关卡预览和可以学习部分判断、增加投票浏览和参与数接口调用。

This commit is contained in:
wyx
2023-03-04 16:16:59 +08:00
parent abaaea8609
commit b6c8062459
5 changed files with 53 additions and 7 deletions

View File

@@ -123,6 +123,8 @@ export const PostList = `/statement/list`
// 查询单个测评的状态
export const QueryEvaluationTaskStatusOne = `/evaluation/queryEvaluationTaskStatusOne`
// 投票浏览和参与数目
export const EditVoteInvolvedAndBrowse = `/vote/editVoteInvolvedAndBrowse post`

View File

@@ -24,6 +24,7 @@
</template>
<script setup>
import {computed, defineProps, ref} from "vue";
import {ElMessage} from "element-plus";
import back from '@/assets/image/pathdetails/pathDetailBack.png'
import nameBack from '@/assets/image/pathdetails/pathDetailImg.png'
import currentBack from '@/assets/image/pathdetails/pathDetailImgSelect.png'
@@ -120,17 +121,50 @@ function show() {
}
function toDetail(i) {
if (current.value !== i) {
return
// 预览和学习设置
let previewSetting = props.detail.previewSetting;
let studySetting = props.detail.studySetting;
let isStudy = false;
let chapterId = props.detail.chapterDtoList[i].id
console.log(studySetting)
if(previewSetting==null){
// 如果未设置预览 则只可以看当前关卡 其余关卡不让点击
if (current.value !== i) {
ElMessage.warning("当前关卡不可预览");
return
}
}else{
if (current.value !== i) {
let lookArr = [];
lookArr = previewSetting.split(',')
if((i+1)>=lookArr[0] && (i+1)<=lookArr[1]){
if(studySetting!==null){
let studyArr = [];
studyArr = studySetting.split(',')
if((i+1)>=studyArr[0] && (i+1)<=studyArr[1]){
isStudy = true;
}else{
isStudy = false;
}
}else{
isStudy = false;
}
}else{
ElMessage.warning("当前关卡不可预览");
return
}
}else{
isStudy = true;
}
}
(import.meta.env.MODE === "development" || import.meta.env.MODE === "test")
? router.push({
path: "/pathdetails",
query: {routerId: props.detail.id, routerName: props.detail.name},
query: {routerId: props.detail.id, routerName: props.detail.name, isStudy, chapterId},
})
: window.open(
`${window.location.protocol + import.meta.env.VITE_BOE_PATH_DETAIL_URL}/pathdetails&params=${encodeURIComponent(
`routerId=${props.detail.id}&routerName=${props.detail.name}`
`routerId=${props.detail.id}&routerName=${props.detail.name}&chapterId=${chapterId}&studySetting=${studySetting}`
)}`
,'_top');
}

View File

@@ -186,12 +186,12 @@
</template>
<script setup>
import {useRequest} from "@/api/request";
import {VOTE_DETAIL3, VOTE_DETAIL_SUBMIT} from "@/api/api";
import {VOTE_DETAIL3, VOTE_DETAIL_SUBMIT, EditVoteInvolvedAndBrowse} from "@/api/api";
import dayjs from "dayjs";
import store from "@/store";
import {ElMessage} from "element-plus";
import {useRoute, useRouter} from "vue-router/dist/vue-router";
import {computed} from "vue";
import {computed,watch} from "vue";
import {useTaskPage} from "@/api/useCommon";
const {
@@ -206,6 +206,11 @@ const { data: dataInfo } = useRequest(VOTE_DETAIL3(courseId), {type});
const userInfo = computed(() => store.state.userInfo);
const answerTime = dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss");
// 增加浏览量
watch(dataInfo, () => {
useRequest(EditVoteInvolvedAndBrowse, {operationType:2, voteId:dataInfo.id });
})
// 选择题目
const choiceQuestion = (item, value) => {
if (dataInfo.value.isSubmit) {
@@ -245,6 +250,8 @@ const submitVote = () => {
voteName: dataInfo.value.voteName,
};
useRequest(VOTE_DETAIL_SUBMIT, obj);
// 增加参与数目
useRequest(EditVoteInvolvedAndBrowse, {operationType:1, voteId:dataInfo.id });
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->

View File

@@ -289,7 +289,7 @@ import FileTypeImg from "@/components/FileTypeImg.vue";
import {useStore} from "vuex";
const {
query: { routerId, routerName },
query: { routerId, routerName, isStudy, chapterId },
} = useRoute();
const router = useRouter();
const returnclick = () => {

View File

@@ -164,6 +164,9 @@ export default defineConfig(({ command, mode }) =>
},'/evaluation/queryEvaluationTaskStatusOne': {
target: loadEnv(mode, process.cwd()).VITE_PROXY_URL,
changeOrigin: true,
},'/vote/editVoteInvolvedAndBrowse': {
target: loadEnv(mode, process.cwd()).VITE_PROXY_URL,
changeOrigin: true,
}
}
}