Commit b6146c42 by guomingpang

fix:修正考试详情userId取值

parent 934bb444
...@@ -10,6 +10,7 @@ import React, { useState, useEffect, useRef } from 'react'; ...@@ -10,6 +10,7 @@ import React, { useState, useEffect, useRef } from 'react';
import { Route, withRouter } from 'react-router-dom'; import { Route, withRouter } from 'react-router-dom';
import User from '@/common/js/user'; import User from '@/common/js/user';
import Service from '@/common/js/service'; import Service from '@/common/js/service';
import Lottie from 'lottie-web';
import './AnswerDescPage.less'; import './AnswerDescPage.less';
import { message } from 'antd'; import { message } from 'antd';
import XMAudio from './XMAudio'; import XMAudio from './XMAudio';
...@@ -71,14 +72,23 @@ function AnswerDescPage(props) { ...@@ -71,14 +72,23 @@ function AnswerDescPage(props) {
getPaperDetail(); getPaperDetail();
getExamDetail(); getExamDetail();
}, []); }, []);
useEffect(() => {
Lottie.loadAnimation({
path: 'https://image.xiaomaiketang.com/xm/AcQWnGATCM.json',
name: 'test',
renderer: 'svg',
loop: true,
autoplay: true,
container: document.getElementById('lottie-box'),
});
}, []);
// 获取考试详情 // 获取考试详情
function getExamDetail() { function getExamDetail() {
const params = { const params = {
examId, examId,
source: 0, source: 0,
tenantId: User.getStoreId() || window.getParameterByName('id'), tenantId: User.getStoreId() || window.getParameterByName('id'),
userId: User.getCustomerId(), userId: props.userId,
}; };
Service.Hades('public/customerHades/queryUserExamResult', params, { Service.Hades('public/customerHades/queryUserExamResult', params, {
reject: true, reject: true,
...@@ -104,7 +114,7 @@ function AnswerDescPage(props) { ...@@ -104,7 +114,7 @@ function AnswerDescPage(props) {
readAnswer: true, readAnswer: true,
source: 0, source: 0,
tenantId: User.getStoreId() || window.getParameterByName('id'), tenantId: User.getStoreId() || window.getParameterByName('id'),
userId: User.getCustomerId(), userId: props.userId,
}).then((res) => { }).then((res) => {
const { paperDetailVO, userExamAnswerVO } = res.result; const { paperDetailVO, userExamAnswerVO } = res.result;
const paperDetail = { ...paperDetailVO }; const paperDetail = { ...paperDetailVO };
...@@ -669,9 +679,7 @@ function AnswerDescPage(props) { ...@@ -669,9 +679,7 @@ function AnswerDescPage(props) {
</div> </div>
{errorCount === 0 && onlyError ? ( {errorCount === 0 && onlyError ? (
<div className='empty'> <div className='empty'>
<div className='img-box'> <div className='img-box' id='lottie-box'></div>
<img src={'https://image.xiaomaiketang.com/xm/sz3CMdQKQE.png'} alt='' />
</div>
<div className='empty-text'>本次考试无错题</div> <div className='empty-text'>本次考试无错题</div>
</div> </div>
) : ( ) : (
......
...@@ -18,6 +18,7 @@ import Breadcrumbs from '@/components/Breadcrumbs'; ...@@ -18,6 +18,7 @@ import Breadcrumbs from '@/components/Breadcrumbs';
function TestDetailPage(props) { function TestDetailPage(props) {
const examId = props.match.params.testId.replace(/\?.+/, ''); const examId = props.match.params.testId.replace(/\?.+/, '');
const paperId = window.getParameterByName('paperId'); const paperId = window.getParameterByName('paperId');
const userId = window.getParameterByName('userId');
const [examDetail, setExamDetail] = useState({ const [examDetail, setExamDetail] = useState({
answerAnalysis: '', answerAnalysis: '',
resultShow: '', resultShow: '',
...@@ -59,7 +60,7 @@ function TestDetailPage(props) { ...@@ -59,7 +60,7 @@ function TestDetailPage(props) {
examId, examId,
source: 0, source: 0,
tenantId: User.getStoreId() || window.getParameterByName('id'), tenantId: User.getStoreId() || window.getParameterByName('id'),
userId: User.getCustomerId(), userId,
}; };
Service.Hades('public/customerHades/queryUserExamResult', params, { Service.Hades('public/customerHades/queryUserExamResult', params, {
reject: true, reject: true,
...@@ -84,7 +85,7 @@ function TestDetailPage(props) { ...@@ -84,7 +85,7 @@ function TestDetailPage(props) {
source: 0, source: 0,
readAnswer: true, readAnswer: true,
tenantId: User.getStoreId() || window.getParameterByName('id'), tenantId: User.getStoreId() || window.getParameterByName('id'),
userId: User.getCustomerId(), userId,
}).then((res) => { }).then((res) => {
if (res.success) { if (res.success) {
const { paperDetailVO, userExamAnswerVO } = res.result; const { paperDetailVO, userExamAnswerVO } = res.result;
...@@ -194,7 +195,7 @@ function TestDetailPage(props) { ...@@ -194,7 +195,7 @@ function TestDetailPage(props) {
})} })}
</div> </div>
</div> </div>
<AnswerDescPage /> <AnswerDescPage userId={userId} />
</div> </div>
); );
} }
......
...@@ -80,7 +80,6 @@ function DataAnalysic(props: any) { ...@@ -80,7 +80,6 @@ function DataAnalysic(props: any) {
useEffect(() => { useEffect(() => {
queryRef.current = query; queryRef.current = query;
queryExamUserDataList(); queryExamUserDataList();
getCustomerId();
}, [query]); }, [query]);
function queryExamUserData() { function queryExamUserData() {
...@@ -221,25 +220,11 @@ function DataAnalysic(props: any) { ...@@ -221,25 +220,11 @@ function DataAnalysic(props: any) {
}); });
} }
//查看答题详情 //查看答题详情
function checkAnswerDetail(record: object) { function checkAnswerDetail(record: any) {
const { paperId, userExamState } = props.examDetail?.examPaper; const { paperId, userExamState } = props.examDetail?.examPaper;
const { userId } = record;
window.RCHistory.push({ window.RCHistory.push({
pathname: `/test-detail/${props.examId}?paperId=${paperId}&userExamState=${userExamState}`, pathname: `/test-detail/${props.examId}?paperId=${paperId}&userExamState=${userExamState}&userId=${userId}`,
});
// console.log(record);
}
//C端 的学员学院列表
function getCustomerId() {
let params = {
userId: User.getUserId(),
};
Service.Hades('public/customerHades/getStoreListCustomer', params).then((res) => {
res.result.map((item: any) => {
if (User.getStoreId() === item.storeId) {
User.setCustomerId(item.storeCustomerId);
}
});
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment