Commit 24c6eabe authored by mqf_0707's avatar mqf_0707

wnf

parents 4f8658da e9151e29
......@@ -50,7 +50,7 @@
"react": "^16.10.0",
"react-dom": "^16.10.0",
"taro-ui": "^3.0.0-alpha.3",
"tbcc-sdk-ts": "^1.0.2"
"tbcc-sdk-ts": "^1.0.4"
},
"devDependencies": {
"@babel/core": "^7.8.0",
......
......@@ -7,7 +7,7 @@ import './taro-ui.scss'
import config from './config'
import './utils/mdProxy'
const { env } = config
const { env, tornadoAPI, defaultActivityId } = config
cloud.init({ env })
......@@ -16,7 +16,9 @@ class App extends Component {
console.log('options :>> ', options)
const { activityId } = options.query || {}
const app = getApp()
app.activityId = activityId || config.defaultActivityId
app.cloud = cloud
app.tornadoAPI = tornadoAPI
app.activityId = activityId || defaultActivityId
}
// this.props.children 是将要会渲染的页面
......
......@@ -9,6 +9,7 @@ import config from '@/config'
import { useThrottle } from '@/hooks/useThrottle'
import { TASK_STATUS, TASK_CONFIG } from '@/const'
import './TasksModal.less'
import { useDidShow } from '@tarojs/taro'
const { commonToast, favorShop, navigateTo, navigateToOutside, showSharePanel } = tbccTs.tb
......@@ -22,15 +23,17 @@ export default function TasksModal(props) {
const { taskList, fetchTaskList } = useTasks()
const { taskIcon, commonTaskTxt, doTaskTxt, browseType, browseTime } = TASK_CONFIG
useEffect(() => {
if (app.isFlashTask && taskFlag !== props.taskFlag) {
useDidShow(() => {
if (app.isFlashTask) {
app.isFlashTask = false
if (preBrowseTime && ((Date.now() - preBrowseTime) / 1000) >= browseTime) {
doCompleteTaskHandle(currentTaskType, true)
} else {
commonToast(`未达到${browseTime}秒~`)
fetchTaskList()
}
}
}, [ props.taskFlag ])
})
const handleTapItem = useThrottle(async(item) => {
const { status, taskType } = item
......@@ -66,7 +69,9 @@ export default function TasksModal(props) {
jumpLink: async() => {
navigateToOutside(url || 'https://www.feizhu.com')
if (browseType === 1) {
setTimeout(() => {
doCompleteTaskHandle(taskType)
}, 1000)
} else {
app.isFlashTask = true
setPreBrowseTime(Date.now())
......
......@@ -28,15 +28,16 @@ export function useLogin(callback = noopFn) {
const { inviteId } = params
const res = await login({ userNick, avatar, isFollow, inviteId })
if (res?.success) {
setLoginInfo({
const _loginInfo = {
...res.data,
userNick,
avatar,
inviteId
})
}
setLoginInfo(_loginInfo)
setLoginStatus(true)
console.log('isLogin :>> ', true)
callback(loginInfo)
callback(_loginInfo)
}
}
......
......@@ -27,8 +27,6 @@ function Index() {
const [ ruleModalVisible, setRuleModalVisible ] = useState(false)
const [ tasksModalVisible, setTasksModalVisible ] = useState(false)
const [ taskFlag, setTaskFlag ] = useState(0)
const fetchActivityInfo = async() => {
const { success, data } = await API.getActivityBaseInfoById()
success && setActivityInfoAndStatus(data)
......@@ -51,10 +49,6 @@ function Index() {
}
})
useDidShow(() => {
setTaskFlag(Math.floor(Math.random() * 1000))
})
const onClose = () => {
setMemberVisible(false)
}
......@@ -80,7 +74,6 @@ function Index() {
{
tasksModalVisible &&
<TasksModal
taskFlag={taskFlag}
onUpdate={() => {}}
onClose={() => setTasksModalVisible(false)}
/>
......
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