Merge branch 'develop' into manage-release

This commit is contained in:
wyx
2023-03-05 08:26:25 +08:00
12 changed files with 6018 additions and 5127 deletions

1
.env
View File

@@ -1,4 +1,5 @@
VITE_BASE=/fe-student VITE_BASE=/fe-student
VITE_BASE_H5=/fe-student-h5
VITE_BASE_API= VITE_BASE_API=
VITE_OUTPUT_DIR=./dist VITE_OUTPUT_DIR=./dist
VITE_FILE_PATH=/upload/ VITE_FILE_PATH=/upload/

10890
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -36,22 +36,30 @@ import {useStore} from "vuex";
import {onMounted} from "vue"; import {onMounted} from "vue";
import {useRoute} from "vue-router/dist/vue-router"; import {useRoute} from "vue-router/dist/vue-router";
import {USER_INFO} from "@/api/api"; import {USER_INFO} from "@/api/api";
import {IsPhone} from "@/api/utils";
console.log("版本1.3.5------------"); console.log("版本1.3.5------------");
const store = useStore(); const store = useStore();
const {path} = useRoute(); const { path } = useRoute();
onMounted(() => { onMounted(() => {
path === '/login' || getUserInfo(); path === "/login" || getUserInfo();
if (IsPhone()) {
if (import.meta.env.MODE === "development") {
window.location.href = window.location.href.replace(import.meta.env.VITE_BASE, import.meta.env.VITE_BASE_H5).replace('5173','5174');
} else {
window.location.href = window.location.href.replace(import.meta.env.VITE_BASE, import.meta.env.VITE_BASE_H5)
}
}
}); });
function getUserInfo() { function getUserInfo() {
if (import.meta.env.MODE === 'development' || import.meta.env.MODE === 'test') { if (import.meta.env.MODE === "development" || import.meta.env.MODE === "test") {
request(USER_INFO, {}).then(res => { request(USER_INFO, {}).then(res => {
store.commit("SET_USER", res.data); store.commit("SET_USER", res.data);
}) });
} else { } else {
boeRequest(GET_USER_INFO).then((res) => { boeRequest(GET_USER_INFO).then((res) => {
res.result.avatar = res.result.avatar || '/800e23f7-b58c-4192-820d-0c6a2b7544cc.png' res.result.avatar = res.result.avatar || "/800e23f7-b58c-4192-820d-0c6a2b7544cc.png";
store.commit("SET_USER", res.result); store.commit("SET_USER", res.result);
}); });
} }
@@ -75,7 +83,7 @@ function getUserInfo() {
.preNext { .preNext {
right: 115px !important; right: 115px !important;
margin-top:4px; margin-top: 4px;
} }
#container { #container {

View File

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

View File

@@ -25,4 +25,8 @@ export function useUserInfo(id) {
}) })
}) })
return userInfo return userInfo
}
export function IsPhone() {
return /mobile/i.test(navigator.userAgent);
} }

View File

@@ -24,6 +24,7 @@
</template> </template>
<script setup> <script setup>
import {computed, defineProps, ref} from "vue"; import {computed, defineProps, ref} from "vue";
import {ElMessage} from "element-plus";
import back from '@/assets/image/pathdetails/pathDetailBack.png' import back from '@/assets/image/pathdetails/pathDetailBack.png'
import nameBack from '@/assets/image/pathdetails/pathDetailImg.png' import nameBack from '@/assets/image/pathdetails/pathDetailImg.png'
import currentBack from '@/assets/image/pathdetails/pathDetailImgSelect.png' import currentBack from '@/assets/image/pathdetails/pathDetailImgSelect.png'
@@ -120,17 +121,51 @@ function show() {
} }
function toDetail(i) { 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
}
isStudy = true;
}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") (import.meta.env.MODE === "development" || import.meta.env.MODE === "test")
? router.push({ ? router.push({
path: "/pathdetails", 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.open(
`${window.location.protocol + import.meta.env.VITE_BOE_PATH_DETAIL_URL}/pathdetails&params=${encodeURIComponent( `${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'); ,'_top');
} }

View File

@@ -1,90 +1,89 @@
import {createStore} from 'vuex' import {createStore} from "vuex";
import {PROJECT_PROCESS, ROUTER_PROCESS} from "@/api/api"; import {PROJECT_PROCESS, ROUTER_PROCESS} from "@/api/api";
import {request} from "@/api/request"; import {request} from "@/api/request";
import {TASK_TYPES} from "@/api/CONST"; import {TASK_TYPES} from "@/api/CONST";
export default createStore({ export default createStore({
state: { state: {
userInfo: {}, userInfo: {},
projectInfo: {}, projectInfo: {},
routerInfo: {} routerInfo: {}
},
getters: {},
mutations: {
SET_USER(state, userInfo) {
state.userInfo = userInfo;
}, },
getters: { SET_PROJECT_INFO(state, info) {
state.projectInfo = info;
}, },
mutations: { INIT_PROJECT_INFO(state) {
SET_USER(state, userInfo) { if (state.projectInfo.status === -1) {
state.userInfo = userInfo state.projectInfo.stageProcessList.forEach((t) => {
}, t.statusName = "已结束";
SET_PROJECT_INFO(state, info) { t.taskProcessList?.forEach((s) => s.statusName = "已结束");
state.projectInfo = info });
}, return;
INIT_PROJECT_INFO(state) { }
if (state.projectInfo.status === -1) { if (state.projectInfo.unlockMode === 1) {
state.projectInfo.stageProcessList.forEach((t) => { state.projectInfo.stageProcessList.forEach((t) => {
t.statusName = '已结束'; t.statusName = "进行中";
t.taskProcessList?.forEach((s) => s.statusName = '已结束') t.taskProcessList?.forEach((s) => s.statusName = (s.status === 1) ? "已完成" : TASK_TYPES.toName[s.type]);
}) t.taskProcessList?.every((s) => s.status === 1) && (t.statusName = "已完成");
return });
} return;
if (state.projectInfo.unlockMode === 1) { }
state.projectInfo.stageProcessList.forEach((t) => { state.projectInfo.stageProcessList?.some((t) => {
t.statusName = '进行中' t.statusName = "已完成";
t.taskProcessList?.forEach((s) => s.statusName = (s.status === 1) ? '已完成' : TASK_TYPES.toName[s.type]) const stageState = t.taskProcessList?.some((s) => {
t.taskProcessList?.every((s) => s.status === 1) && (t.statusName = '已完成') s.unlock = true;
}) s.statusName = "已完成";
return s.status === 2 ? (s.statusName = "进行中") : (!s.status && (s.statusName = TASK_TYPES.toName[s.type]));
} return state.projectInfo.unlockMode === 2 ? s.status !== 1 : (s.status !== 1 && s.flag);
state.projectInfo.stageProcessList?.some((t) => { });
t.statusName = '已完成' stageState && (t.statusName = "进行中");
const stageState = t.taskProcessList?.some((s) => { return stageState;
s.unlock = true });
s.statusName = '已完成'
s.status !== 1 && (s.statusName = TASK_TYPES.toName[s.type])
return state.projectInfo.unlockMode === 2 ? s.status !== 1 : (s.status !== 1 && s.flag)
})
stageState && (t.statusName = '进行中');
return stageState
})
},
SET_ROUTER_INFO(state, info) {
state.routerInfo = info
},
INIT_ROUTER_INFO(state) {
// state.routerInfo.unlockMode 1自由模式 2闯关模式 3 闯关模式 必修 flag true
if (state.routerInfo.status === -1) {
state.routerInfo.statusName = '已结束'
state.routerInfo.taskBoList.forEach((t) => t.statusName = '已结束')
return
}
state.routerInfo.statusName = '进行中'
if (state.routerInfo.unlockMode === 1) {
state.routerInfo.taskBoList?.forEach((s) => s.statusName = (s.status === 1) ? '已完成' : TASK_TYPES.toName[s.type])
state.routerInfo.taskBoList?.every((s) => s.status === 1) && (state.routerInfo.statusName = '已完成')
return
}
state.routerInfo.statusName = '已完成'
state.routerInfo.taskBoList?.some((s) => {
s.unlock = true
s.statusName = '已完成'
s.status !== 1 && (s.statusName = TASK_TYPES.toName[s.type])
return state.routerInfo.unlockMode === 2 ? s.status !== 1 : (s.status !== 1 && s.flag)
}) && (state.routerInfo.statusName = '进行中')
},
}, },
actions: { SET_ROUTER_INFO(state, info) {
getProjectInfo(content, {projectId}) { state.routerInfo = info;
request(PROJECT_PROCESS, {projectId,type:1}).then(res => {
content.commit('SET_PROJECT_INFO', res.data)
content.commit('INIT_PROJECT_INFO')
})
},
getRouterInfo(content, {routerId}) {
request(ROUTER_PROCESS, {routerId,type:2}).then(res => {
content.commit('SET_ROUTER_INFO', res.data)
content.commit('INIT_ROUTER_INFO')
})
},
}, },
modules: {} INIT_ROUTER_INFO(state) {
}) // state.routerInfo.unlockMode 1自由模式 2闯关模式 3 闯关模式 必修 flag true
if (state.routerInfo.status === -1) {
state.routerInfo.statusName = "已结束";
state.routerInfo.taskBoList.forEach((t) => t.statusName = "已结束");
return;
}
state.routerInfo.statusName = "进行中";
if (state.routerInfo.unlockMode === 1) {
state.routerInfo.taskBoList?.forEach((s) => s.statusName = (s.status === 1) ? "已完成" : TASK_TYPES.toName[s.type]);
state.routerInfo.taskBoList?.every((s) => s.status === 1) && (state.routerInfo.statusName = "已完成");
return;
}
state.routerInfo.statusName = "已完成";
state.routerInfo.taskBoList?.some((s) => {
s.unlock = true;
s.statusName = "已完成";
s.status === 2 ? (s.statusName = "进行中") : (!s.status && (s.statusName = TASK_TYPES.toName[s.type]));
// s.status !== 1 && (s.statusName = TASK_TYPES.toName[s.type]);
return state.routerInfo.unlockMode === 2 ? s.status !== 1 : (s.status !== 1 && s.flag);
}) && (state.routerInfo.statusName = "进行中");
},
},
actions: {
getProjectInfo(content, { projectId }) {
request(PROJECT_PROCESS, { projectId, type: 1 }).then(res => {
content.commit("SET_PROJECT_INFO", res.data);
content.commit("INIT_PROJECT_INFO");
});
},
getRouterInfo(content, { routerId, chapterId }) {
request(ROUTER_PROCESS, chapterId ? { routerId, type: 2, chapterId } : { routerId, type: 2 }).then(res => {
content.commit("SET_ROUTER_INFO", res.data);
content.commit("INIT_ROUTER_INFO");
});
},
},
modules: {}
});

View File

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

View File

@@ -411,6 +411,7 @@ const getData = () => {
request(COMMENT_LIST, { request(COMMENT_LIST, {
id: e.data.id, id: e.data.id,
type: 1, type: 1,
current:hfPage.value.currentPage,
pageNo:hfPage.value.currentPage, pageNo:hfPage.value.currentPage,
pageSize:10 pageSize:10
}).then(res=>{ }).then(res=>{

View File

@@ -388,6 +388,7 @@ const getData = () => {
request(COMMENT_LIST, { request(COMMENT_LIST, {
id: courseId, id: courseId,
type: 2, type: 2,
current:hfPage.value.currentPage,
pageNo:hfPage.value.currentPage, pageNo:hfPage.value.currentPage,
pageSize:10 pageSize:10
}).then(res=>{ }).then(res=>{

View File

@@ -89,7 +89,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="goclass" <div v-if="isStudy=='true'" class="goclass"
:style="{ background: (value.statusName !== '已结束' && (value.statusName || data.unlockMode === 1)) ? '#2478ff' : '#999' }" :style="{ background: (value.statusName !== '已结束' && (value.statusName || data.unlockMode === 1)) ? '#2478ff' : '#999' }"
@click="toFinish(value)"> @click="toFinish(value)">
{{ value.statusName || (data.unlockMode === 1 ? TASK_TYPES.toName[value.type] : "未解锁") }} {{ value.statusName || (data.unlockMode === 1 ? TASK_TYPES.toName[value.type] : "未解锁") }}
@@ -174,7 +174,7 @@
<div class="box"></div> <div class="box"></div>
</div> </div>
<div class="rate"> <div v-if="isStudy=='true'" class="rate">
<div class="ratetext">上次学到{{ data.lastLearned }}</div> <div class="ratetext">上次学到{{ data.lastLearned }}</div>
<div v-if="data.lastLearned" class="ratebtn" @click="continueLearn(data.lastLearned, data.taskBoList)"> <div v-if="data.lastLearned" class="ratebtn" @click="continueLearn(data.lastLearned, data.taskBoList)">
继续学习 继续学习
@@ -289,7 +289,7 @@ import FileTypeImg from "@/components/FileTypeImg.vue";
import {useStore} from "vuex"; import {useStore} from "vuex";
const { const {
query: { routerId, routerName }, query: { routerId, routerName, isStudy, chapterId },
} = useRoute(); } = useRoute();
const router = useRouter(); const router = useRouter();
const returnclick = () => { const returnclick = () => {
@@ -303,7 +303,7 @@ console.log(data);
const activeName = ref("first"); const activeName = ref("first");
onMounted(() => { onMounted(() => {
dispatch("getRouterInfo", { routerId }); dispatch("getRouterInfo", { routerId, chapterId });
}); });
const handleClick = (tab, event) => { const handleClick = (tab, event) => {

View File

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