Commit 5381bb5a authored by hewenhao's avatar hewenhao

feat: update

parent cf7c7825
......@@ -26,7 +26,7 @@ module.exports = function configEnv () {
}
const hash = crypto.createHash('md5')
hash.update('GEEK-ONLINE-WEAPP-V4')
hash.update('GEEK-PK-MATH-WEAPP-V1')
hash.update(`build-${env}`)
hash.update(`build-${process.env.SERVER_ENDPOINT || ''}`)
process.env.TARO_STORAGE_KEY = hash.digest('base64').substring(0, 5)
......
......@@ -83,7 +83,6 @@ const MainPage = () => {
useEffect(() => {
if (isFocus) {
player.play()
tutorialRef.current?.start()
}
}, [player, isFocus])
......
......@@ -2,6 +2,7 @@ import { useState, useImperativeHandle, forwardRef, useCallback, useEffect } fro
import { showToast } from '@tarojs/taro'
import { getAreaAndGrades, type AreaAndGrades } from '@/api'
import { useStoreState, useStoreActions } from '@/store/hooks'
import { useFocus } from '@/hooks'
import ModalArea from './modal-area'
import ModalGrade from './modal-grade'
import ModalResult from './modal-result'
......@@ -27,6 +28,7 @@ const Tutorial = forwardRef<TutorialRef, {}>((_, ref) => {
const [step, setStep] = useState(0)
const [selected, setSelected] = useState({ area: '', grade: '' })
const [enable, setEnable] = useState(false)
const isFocus = useFocus()
useEffect(() => {
if (!joinDefered) {
......@@ -81,34 +83,23 @@ const Tutorial = forwardRef<TutorialRef, {}>((_, ref) => {
}, [updateUserInfo])
useEffect(() => {
loadData()
}, [loadData])
useImperativeHandle(ref, () => {
return {
start: () => {
if (!data.areas.length) {
loadData().catch(() => {
showToast({
title: '加载数据失败',
icon: 'none'
})
})
}
// 没选择城市
if (!userInfo.city) {
setStep(1)
} else if (!userInfo.grade) { // 没选择年级
setStep(2)
} else {
setStep(0)
if (!isMainGuideComplete) {
updateGuideActive(true)
}
if (isFocus) {
if (!data.areas.length) {
loadData()
}
// 没选择城市
if (!userInfo.city) {
setStep(1)
} else if (!userInfo.grade) { // 没选择年级
setStep(2)
} else {
setStep(0)
if (!isMainGuideComplete) {
updateGuideActive(true)
}
}
}
})
}, [isFocus, data.areas, isMainGuideComplete, updateGuideActive, loadData, userInfo.city, userInfo.grade])
if (!enable) {
return null
......
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