Commit 10bc6224 authored by mqf_0707's avatar mqf_0707

wnf

parents 4ebb440a 0396bc04
export default { export default {
hasGameModule:false, // 是否开启游戏模块自动注入dist hasGameModule:false, // 是否开启游戏模块自动注入dist
hasLottieAnimation: true,// 使用Lottie动画 hasLottieAnimation: false,// 使用Lottie动画
defaultPlugins: [ defaultPlugins: [
[ [
'@pluve/taro-plugin-mars', // taro暂时未支持阿里小程序自定义插件 需要引用插件的页面需配置 '@pluve/taro-plugin-mars', // taro暂时未支持阿里小程序自定义插件 需要引用插件的页面需配置
......
This diff is collapsed.
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
"@tarojs/taro": "v3.2.0-canary.9", "@tarojs/taro": "v3.2.0-canary.9",
"@tbmp/mp-cloud-sdk": "^1.4.2", "@tbmp/mp-cloud-sdk": "^1.4.2",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"fyge": "*",
"hox": "^1.1.2", "hox": "^1.1.2",
"lodash": "4.17.15", "lodash": "4.17.15",
"react": "^16.10.0", "react": "^16.10.0",
......
...@@ -68,7 +68,7 @@ export default function TasksModal(props) { ...@@ -68,7 +68,7 @@ export default function TasksModal(props) {
// 跳转任务 https://www.feizhu.com // 跳转任务 https://www.feizhu.com
jumpLink: async() => { jumpLink: async() => {
navigateToOutside(url) navigateToOutside(url)
if (browseType === 1) { if (browseType === 2) {
doCompleteTaskHandle(taskType) doCompleteTaskHandle(taskType)
} else { } else {
app.isFlashTask = true app.isFlashTask = true
......
...@@ -7,7 +7,9 @@ Component({ ...@@ -7,7 +7,9 @@ Component({
props: { props: {
type: 1 type: 1
}, },
didMount() {}, didMount() {
},
didUpdate() {}, didUpdate() {},
didUnmount() { didUnmount() {
//舞台销毁 //舞台销毁
......
...@@ -95,6 +95,7 @@ export const TASK_CONFIG = { ...@@ -95,6 +95,7 @@ export const TASK_CONFIG = {
orderGoods: '去完成', orderGoods: '去完成',
collectGoods: '去完成' collectGoods: '去完成'
}, },
browseType: 1, // 1 跳转即算完成 2 跳转浏览15s 才算完成 browseType: 2, // 1 跳转浏览15s 才算完成 2 跳转即算完成
browseTime: 15 // 浏览时间 browseTime: 15, // 浏览时间
jumpType: 1 // 1 浏览15s 才算完成 2 点击就算完成任务
} }
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { View } from '@tarojs/components' import { View } from '@tarojs/components'
import GoodsPage from '@/components/GoodsPage/GoodsPage' import GoodsPage from '@/components/GoodsPage/GoodsPage'
import { useDidShow, useRouter } from '@tarojs/taro' import { useDidShow, useRouter, useDidHide } from '@tarojs/taro'
import API from '@/api' import API from '@/api'
import { TASK_CONFIG } from '@/const' import { TASK_CONFIG } from '@/const'
import { useRequest } from '@/hooks/useRequest' import { useRequest } from '@/hooks/useRequest'
...@@ -25,7 +25,7 @@ function BrowseGoodsPage() { ...@@ -25,7 +25,7 @@ function BrowseGoodsPage() {
const [ percent, setPercent ] = useState(0) const [ percent, setPercent ] = useState(0)
const [ isJumpLink, setIsJumpLink ] = useState(false) const [ isJumpLink, setIsJumpLink ] = useState(false)
const { browseType, browseTime } = TASK_CONFIG const { jumpType, browseTime } = TASK_CONFIG
let browserTimer = null let browserTimer = null
let usePercent = 0 let usePercent = 0
...@@ -35,17 +35,22 @@ function BrowseGoodsPage() { ...@@ -35,17 +35,22 @@ function BrowseGoodsPage() {
useEffect(() => { useEffect(() => {
listSuccess && list.length && browseGoodsTimes() listSuccess && list.length && browseGoodsTimes()
return () => clearInterval(this.timer) return () => clearInterval(browserTimer)
}, [ list ]) }, [ list ])
useDidShow(() => { useDidShow(() => {
// 重新回到页面开启倒计时 // 重新回到页面开启倒计时
if (!browserTimer && browseType === 1 && isJumpLink) { if (!browserTimer && jumpType === 1 && isJumpLink) {
usePercent = percent usePercent = percent
browseGoodsTimes() browseGoodsTimes()
} }
}) })
useDidHide(() => {
// 页面关闭清除定时器
clearInterval(browserTimer)
})
const onCompleteTask = async(itemId) => { const onCompleteTask = async(itemId) => {
const { success } = await API.doCompleteTask({ taskType: browseConfig.taskType, itemId }) const { success } = await API.doCompleteTask({ taskType: browseConfig.taskType, itemId })
if (success) { if (success) {
...@@ -55,10 +60,10 @@ function BrowseGoodsPage() { ...@@ -55,10 +60,10 @@ function BrowseGoodsPage() {
} }
const onOpenDetail = (itemId) => { const onOpenDetail = (itemId) => {
if (browseType === 1) { if (jumpType === 1) {
setPercent(usePercent) setPercent(usePercent)
setIsJumpLink(true) setIsJumpLink(true)
clearInterval(this.timer) clearInterval(browserTimer)
return return
} }
onCompleteTask(itemId) onCompleteTask(itemId)
......
import React from 'react' import React, { useState, useEffect } from 'react'
import { View } from '@tarojs/components' import { View } from '@tarojs/components'
import GoodsPage from '@/components/GoodsPage/GoodsPage' import GoodsPage from '@/components/GoodsPage/GoodsPage'
import { useRequest } from '@/hooks/useRequest'
import { useRouter } from '@tarojs/taro' import { useRouter } from '@tarojs/taro'
import tbccTs from 'tbcc-sdk-ts' import tbccTs from 'tbcc-sdk-ts'
import API from '@/api' import API from '@/api'
...@@ -25,19 +24,29 @@ const browseConfig = { ...@@ -25,19 +24,29 @@ const browseConfig = {
function CollectGoodsPage() { function CollectGoodsPage() {
const router = useRouter() const router = useRouter()
const [goodsList, setGoodsList] = useState([])
const { itemIds } = router?.params const { itemIds } = router?.params
const { data } = useRequest(API.getCollectGoodsList, { itemIds })
useEffect(() => {
getGoodsList()
}, [])
const getGoodsList = async () => {
const { data } = await API.getCollectGoodsList({ itemIds })
setGoodsList(data?.list || [])
}
const onCompleteTask = useThrottle(async(taskType, itemId) => { const onCompleteTask = useThrottle(async(taskType, itemId) => {
const { success } = await API.doCompleteTask({ taskType, itemId }) const { success } = await API.doCompleteTask({ taskType, itemId })
if (success) { if (success) {
getGoodsList()
commonToast('收藏成功') commonToast('收藏成功')
} }
}) })
return ( return (
<View> <View>
<GoodsPage goodsList={data?.list || []} task={browseConfig} onCompleteTask={() => onCompleteTask} /> <GoodsPage goodsList={goodsList} task={browseConfig} onCompleteTask={() => onCompleteTask} />
</View> </View>
) )
} }
......
...@@ -5631,11 +5631,6 @@ download@^7.1.0: ...@@ -5631,11 +5631,6 @@ download@^7.1.0:
p-event "^2.1.0" p-event "^2.1.0"
pify "^3.0.0" pify "^3.0.0"
duiba-utils@^1.0.0:
version "1.0.9"
resolved "http://npm.dui88.com:80/duiba-utils/-/duiba-utils-1.0.9.tgz#7a1e09e08a8754a1563b18aa6b117cb270f76877"
integrity sha512-3YB5w05gNruS4yyN0cx2Qktr0vG0AXYOumfV6WYlzlMx3kGX3AihBLT2/PouERtkLfFk2q4cIikSkgwramHTmg==
duplexer3@^0.1.4: duplexer3@^0.1.4:
version "0.1.4" version "0.1.4"
resolved "http://npm.dui88.com:80/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" resolved "http://npm.dui88.com:80/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
...@@ -7246,14 +7241,6 @@ functional-red-black-tree@^1.0.1: ...@@ -7246,14 +7241,6 @@ functional-red-black-tree@^1.0.1:
resolved "http://npm.dui88.com:80/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" resolved "http://npm.dui88.com:80/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
fyge@*:
version "2.0.23"
resolved "http://npm.dui88.com:80/fyge/-/fyge-2.0.23.tgz#36550f93d9578cd3b02ae9772f93aa94730abd25"
integrity sha512-nNUD5HAPyknIMKdxxa50HzriLuBFmk4XLnZw5CgiX3mH7ROJzsh/ToRMTKXcxwH3r3ICid95cgEo0iCPIHSIsQ==
dependencies:
duiba-utils "^1.0.0"
tslib "^2.1.0"
gauge@~2.7.3: gauge@~2.7.3:
version "2.7.4" version "2.7.4"
resolved "http://npm.dui88.com:80/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" resolved "http://npm.dui88.com:80/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"
...@@ -14599,11 +14586,6 @@ tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0: ...@@ -14599,11 +14586,6 @@ tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0:
resolved "http://npm.dui88.com:80/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" resolved "http://npm.dui88.com:80/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha1-zy04vcNKE0vK8QkcQfZhni9nLQA= integrity sha1-zy04vcNKE0vK8QkcQfZhni9nLQA=
tslib@^2.1.0:
version "2.2.0"
resolved "http://npm.dui88.com:80/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
integrity sha1-+yxHWXfjXiQTEe3iaTzuHsZpj1w=
tsutils@^3.17.1: tsutils@^3.17.1:
version "3.20.0" version "3.20.0"
resolved "http://npm.dui88.com:80/tsutils/-/tsutils-3.20.0.tgz#ea03ea45462e146b53d70ce0893de453ff24f698" resolved "http://npm.dui88.com:80/tsutils/-/tsutils-3.20.0.tgz#ea03ea45462e146b53d70ce0893de453ff24f698"
......
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