Commit 5381bb5a authored by hewenhao's avatar hewenhao

feat: update

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