Commit d5613eed authored by hewenhao's avatar hewenhao

feat: update

parent 341d45f2
...@@ -15,7 +15,7 @@ interface BattlesModel { ...@@ -15,7 +15,7 @@ interface BattlesModel {
const battlesModel: BattlesModel = { const battlesModel: BattlesModel = {
details: null, details: null,
summary: null, summary: null,
modalIsVisible: true, modalIsVisible: false,
setModalIsVisible: action((state, payload) => { setModalIsVisible: action((state, payload) => {
state.modalIsVisible = payload state.modalIsVisible = payload
......
...@@ -2,7 +2,7 @@ import { type CompleteStageParam, type StageDetail, StageLevel, type CompleteQue ...@@ -2,7 +2,7 @@ import { type CompleteStageParam, type StageDetail, StageLevel, type CompleteQue
import { getLogManager } from '@tarojs/taro' import { getLogManager } from '@tarojs/taro'
import { getStorage, StorageKeys } from '@/utils/storage' import { getStorage, StorageKeys } from '@/utils/storage'
import { UserInfo } from '@/types' import { UserInfo } from '@/types'
import { type QuestionType, isBlankQuestion, isVerticalDivisionQuestion, isSelectionQuestion } from '../types' import { type QuestionType, isBlankQuestion, isVerticalDivisionQuestion, isSelectionQuestion, isFractionAddMinusQuestion, isVerticalAddMinusQuestion } from '../types'
const logger = getLogManager({ level: 1 }) const logger = getLogManager({ level: 1 })
...@@ -99,13 +99,6 @@ export function buildCompleteStageParam (questionList: QuestionType[], stageDeta ...@@ -99,13 +99,6 @@ export function buildCompleteStageParam (questionList: QuestionType[], stageDeta
} }
function convert (inQuestion: QuestionType): CompleteQuestion { function convert (inQuestion: QuestionType): CompleteQuestion {
if (isBlankQuestion(inQuestion)) {
return {
...inQuestion,
userAnswers: inQuestion.answers.map(c => c.userAnswer!),
}
}
if (isSelectionQuestion(inQuestion)) { if (isSelectionQuestion(inQuestion)) {
return { return {
...inQuestion, ...inQuestion,
...@@ -113,7 +106,12 @@ function convert (inQuestion: QuestionType): CompleteQuestion { ...@@ -113,7 +106,12 @@ function convert (inQuestion: QuestionType): CompleteQuestion {
} }
} }
if (isVerticalDivisionQuestion(inQuestion)) { if (
isVerticalDivisionQuestion(inQuestion) ||
isBlankQuestion(inQuestion) ||
isFractionAddMinusQuestion(inQuestion) ||
isVerticalAddMinusQuestion(inQuestion)
) {
return { return {
...inQuestion, ...inQuestion,
userAnswers: inQuestion.answers.map(c => c.userAnswer!), userAnswers: inQuestion.answers.map(c => c.userAnswer!),
...@@ -125,15 +123,16 @@ function convert (inQuestion: QuestionType): CompleteQuestion { ...@@ -125,15 +123,16 @@ function convert (inQuestion: QuestionType): CompleteQuestion {
/** 已答题目 */ /** 已答题目 */
export function answeredQuestion (question: QuestionType) { export function answeredQuestion (question: QuestionType) {
if (isBlankQuestion(question)) {
return question.answers.every(c => c.userAnswer)
}
if (isSelectionQuestion(question)) { if (isSelectionQuestion(question)) {
return question.options.some(c => c.userAnswer) return question.options.some(c => c.userAnswer)
} }
if (isVerticalDivisionQuestion(question)) { if (
isBlankQuestion(question) ||
isVerticalDivisionQuestion(question) ||
isFractionAddMinusQuestion(question) ||
isVerticalAddMinusQuestion(question)
) {
return question.answers.every(c => c.userAnswer) return question.answers.every(c => c.userAnswer)
} }
...@@ -142,15 +141,16 @@ export function answeredQuestion (question: QuestionType) { ...@@ -142,15 +141,16 @@ export function answeredQuestion (question: QuestionType) {
/** 判题 */ /** 判题 */
export function determinQuestion (question: QuestionType) { export function determinQuestion (question: QuestionType) {
if (isBlankQuestion(question)) {
return question.answers.every(c => c.userAnswer === c.contentText)
}
if (isSelectionQuestion(question)) { if (isSelectionQuestion(question)) {
return question.options.every(c => c.answer === c.userAnswer) return question.options.every(c => c.answer === c.userAnswer)
} }
if (isVerticalDivisionQuestion(question)) { if (
isBlankQuestion(question) ||
isVerticalDivisionQuestion(question) ||
isFractionAddMinusQuestion(question) ||
isVerticalAddMinusQuestion(question)
) {
return question.answers.every(c => c.userAnswer === c.contentText) return question.answers.every(c => c.userAnswer === c.contentText)
} }
......
...@@ -23,6 +23,7 @@ preloadImage([ ...@@ -23,6 +23,7 @@ preloadImage([
]) ])
export { StageStatus, StageLevel, Stage, StageType } export { StageStatus, StageLevel, Stage, StageType }
const isProduction = process.env.SERVER_ENDPOINT === 'https://geek.jkwljy.com'
export const CurrentRoundId = '__current_round__' export const CurrentRoundId = '__current_round__'
...@@ -51,10 +52,10 @@ function stageToStageNext (stageList: Stage[]): {nextList: StageNext[]; showList ...@@ -51,10 +52,10 @@ function stageToStageNext (stageList: Stage[]): {nextList: StageNext[]; showList
const currentIndex = newList.findIndex(c => c.status === StageStatus.CURRENT) const currentIndex = newList.findIndex(c => c.status === StageStatus.CURRENT)
let showList: Stage[] = [] let showList: Stage[] = []
if (currentIndex === -1) { if (currentIndex === -1 || !isProduction) {
showList = newList showList = newList
} else { } else {
showList = newList.slice(0, Math.max(currentIndex + 30, 5)) showList = newList.slice(0, Math.max(currentIndex + 3, 5))
} }
/** 设置pk历史页面返回后引导 */ /** 设置pk历史页面返回后引导 */
if (showList[currentIndex - 1]) { if (showList[currentIndex - 1]) {
......
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