Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
824d386b
Commit
824d386b
authored
Sep 06, 2021
by
mqf_0707
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wnf
parent
bc01f0ad
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
211 additions
and
160 deletions
+211
-160
package.json
c_client/package.json
+1
-1
api.js
c_client/src/api.js
+3
-4
app.js
c_client/src/app.js
+4
-0
DoHelpModal.jsx
...ient/src/components/_tb_modal/DoHelpModal/DoHelpModal.jsx
+2
-2
TasksModal.jsx
c_client/src/components/_tb_modal/TasksModal/TasksModal.jsx
+8
-128
config.js
c_client/src/config/config.js
+2
-2
task.config.js
c_client/src/config/task.config.js
+10
-1
useLogin.js
c_client/src/hooks/useLogin.js
+1
-1
useTasks.js
c_client/src/hooks/useTasks.js
+135
-5
index.jsx
c_client/src/pages/index/index.jsx
+1
-6
browseGoods.jsx
c_client/src/pages/packageGood/browseGoods/browseGoods.jsx
+1
-1
cartGoods.jsx
c_client/src/pages/packageGood/cartGoods/cartGoods.jsx
+1
-1
collectGoods.jsx
c_client/src/pages/packageGood/collectGoods/collectGoods.jsx
+1
-1
myPrize.jsx
c_client/src/pages/packagePrize/myPrize/myPrize.jsx
+3
-1
loginInfo.js
c_client/src/store/loginInfo.js
+1
-0
util.js
c_client/src/utils/util.js
+33
-0
yarn.lock
c_client/yarn.lock
+4
-6
No files found.
c_client/package.json
View file @
824d386b
...
...
@@ -51,7 +51,7 @@
"react"
:
"^17.0.0"
,
"react-dom"
:
"^17.0.0"
,
"taro-ui"
:
"^3.0.0-alpha.3"
,
"tbcc-sdk-ts"
:
"^1.0.
6
"
"tbcc-sdk-ts"
:
"^1.0.
7
"
},
"devDependencies"
:
{
"@babel/core"
:
"^7.8.0"
,
...
...
c_client/src/api.js
View file @
824d386b
...
...
@@ -2,7 +2,7 @@ import cloud from '@tbmp/mp-cloud-sdk'
import
tbccTs
from
'tbcc-sdk-ts'
import
conifg
from
'./config/config'
const
{
utils
:
{
generateAPI
},
request
:
tbccRequest
,
capi
,
capiFn
}
=
tbccTs
const
{
utils
:
{
generateAPI
},
request
:
tbccRequest
,
capi
}
=
tbccTs
const
{
cloudName
,
requestType
}
=
conifg
const
request
=
tbccRequest
({
...
...
@@ -27,8 +27,8 @@ const apiList = {
},
login
:
'login'
,
getTaskList
:
'getTaskList'
,
doCompleteTask
:
'doC
ompleteTask'
,
receiveTask
Rewards
:
'receiveTaskRewards
'
,
completeTask
:
'c
ompleteTask'
,
receiveTask
:
'receiveTask
'
,
addStat
:
'addStat'
,
doHelp
:
'doHelp'
,
drawLotteryPrize
:
'drawLotteryPrize'
,
...
...
@@ -58,6 +58,5 @@ const apiList = {
// 生成API
const
API
=
generateAPI
(
apiList
,
request
)
API
.
Fn
=
capiFn
(
apiList
,
request
)
export
default
API
c_client/src/app.js
View file @
824d386b
...
...
@@ -20,6 +20,10 @@ class App extends Component {
app
.
tornadoAPI
=
tornadoAPI
app
.
activityId
=
activityId
||
defaultActivityId
}
// 页面后台切前台
componentDidShow
()
{}
// 页面前台切后台
componentDidHide
()
{}
render
()
{
return
this
.
props
.
children
}
...
...
c_client/src/components/_tb_modal/DoHelpModal/DoHelpModal.jsx
View file @
824d386b
...
...
@@ -9,7 +9,7 @@ import { checkIsMember } from 'tbcc-sdk-ts/lib/utils'
import
{
commonToast
}
from
'tbcc-sdk-ts/lib/core/tb'
import
{
HELP_MODAL_TYPE
,
HELP_CONFIG
}
from
'@/config/help.config'
export
default
function
Rule
Modal
(
props
)
{
export
default
function
DoHelp
Modal
(
props
)
{
const
{
activityInfo
}
=
useActivityInfoModel
()
const
{
type
=
HELP_MODAL_TYPE
.
HELP
,
onClose
=
()
=>
{},
newVip
=
true
,
helpInfo
=
{}
}
=
props
const
[
memberModalVisible
,
setMemberModalVisible
]
=
useState
(
false
)
...
...
@@ -59,7 +59,7 @@ export default function RuleModal(props) {
},
[
HELP_MODAL_TYPE
.
FAIL
]:
async
()
=>
onClose
(
type
),
[
HELP_MODAL_TYPE
.
REWARDS
]:
async
()
=>
{
const
{
success
,
data
}
=
await
API
.
receiveTask
Rewards
({
taskType
:
'invites'
})
const
{
success
,
data
}
=
await
API
.
receiveTask
({
taskType
:
'invites'
})
if
(
success
&&
data
)
{
onClose
(
type
)
}
...
...
c_client/src/components/_tb_modal/TasksModal/TasksModal.jsx
View file @
824d386b
import
{
View
,
ScrollView
,
Image
}
from
'@tarojs/components'
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
import
React
,
{
useState
}
from
'react'
import
{
noopFn
}
from
'@/utils/util'
import
tbccTs
from
'tbcc-sdk-ts'
import
API
from
'@/api'
import
config
from
'@/config/config'
import
{
useThrottle
}
from
'@/hooks/useThrottle'
import
Popup
from
'@/components/_base/Popup/Popup'
import
{
SHOP_ID
}
from
'@/const'
import
styles
from
'./TasksModal.module.less'
import
{
useDidShow
}
from
'@tarojs/taro'
import
{
TASK_DATA
}
from
'@/mock'
import
{
checkIsMember
}
from
'tbcc-sdk-ts/lib/utils'
import
{
TASK_CONFIG
,
ORDER_GOOD_TYPE
,
BROSE_GOOD_TYPE
,
TASK_STATUS
}
from
'@/config/task.config'
import
{
useTasks
}
from
'@/hooks/useTasks'
import
{
TASK_CONFIG
,
TASK_STATUS
}
from
'@/config/task.config'
const
{
commonToast
,
favorShop
,
navigateTo
,
navigateToOutside
,
showSharePanel
,
navigateToTaobaoPage
}
=
tbccTs
.
tb
const
{
icons
,
commonTxt
,
doTxt
,
rewardMsg
}
=
TASK_CONFIG
export
default
function
TasksModal
(
props
)
{
const
app
=
getApp
()
const
{
onClose
=
noopFn
,
onUpdate
,
taskFlag
}
=
props
const
{
onClose
=
noopFn
}
=
props
const
[
memberShopVisible
,
setMemberShopVisible
]
=
useState
(
false
)
const
[
currentTaskType
,
setCurrentTaskType
]
=
useState
(
''
)
const
preBrowseTime
=
useRef
(
null
)
const
[
taskList
,
setTaskList
]
=
useState
(
TASK_DATA
)
const
{
icons
,
commonTxt
,
doTxt
,
jumpType
,
browseTime
,
showTaskType
,
browseType
,
orderType
}
=
TASK_CONFIG
useDidShow
(()
=>
{
if
(
app
.
isFlashTask
)
{
app
.
isFlashTask
=
false
if
(
preBrowseTime
.
current
&&
((
Date
.
now
()
-
preBrowseTime
.
current
)
/
1000
)
>=
browseTime
&&
currentTaskType
!==
'browseGoods'
)
{
doCompleteTaskHandle
(
currentTaskType
,
true
)
preBrowseTime
.
current
=
null
}
else
if
(
preBrowseTime
.
current
&&
((
Date
.
now
()
-
preBrowseTime
.
current
)
/
1000
)
<
browseTime
)
{
commonToast
(
`未达到
${
browseTime
}
秒~`
)
preBrowseTime
.
current
=
null
}
else
{
fetchTaskList
()
}
}
})
useEffect
(()
=>
{
if
(
showTaskType
===
2
&&
taskFlag
)
{
fetchTaskList
()
}
else
if
(
showTaskType
===
1
){
fetchTaskList
()
}
},[
taskFlag
])
const
fetchTaskList
=
async
()
=>
{
const
isVip
=
await
checkIsMember
()
const
{
success
,
data
}
=
await
API
.
getTaskList
({
isVip
})
if
(
success
&&
data
)
{
const
{
list
=
[]
}
=
data
// setTaskList(list)
}
}
const
handleTapItem
=
useThrottle
(
async
(
item
)
=>
{
const
{
status
,
taskType
}
=
item
const
tapFn
=
{
[
TASK_STATUS
.
WAIT_RECEIVE
]:
async
()
=>
{
const
{
success
,
data
}
=
await
API
.
receiveTaskRewards
({
taskType
,
rewardsKey
:
'totalHotValue'
})
if
(
success
&&
data
)
{
const
{
rewards
}
=
data
commonToast
(
`领取成功,奖励值+
${
rewards
}
`
)
fetchTaskList
()
onUpdate
&&
onUpdate
()
}
},
[
TASK_STATUS
.
WAIT_DO
]:
()
=>
goToComplete
(
item
)
}
tapFn
[
status
]
&&
tapFn
[
status
]()
})
const
goToComplete
=
async
(
item
)
=>
{
const
{
taskType
,
url
,
itemIds
,
keepTime
}
=
item
setCurrentTaskType
(
taskType
)
const
completeFn
=
{
member
:
()
=>
setMemberShopVisible
(
true
),
invites
:
()
=>
showSharePanel
(),
follow
:
async
()
=>
{
const
isFollow
=
await
favorShop
(
config
.
sellerId
)
if
(
isFollow
)
{
doCompleteTaskHandle
(
taskType
)
}
},
// 跳转任务 https://www.feizhu.com
jumpLink
:
async
()
=>
{
navigateToOutside
(
url
)
if
(
jumpType
===
2
)
{
doCompleteTaskHandle
(
taskType
)
}
else
{
app
.
isFlashTask
=
true
preBrowseTime
.
current
=
Date
.
now
()
}
// await API.addStat({ type: 'BROWSE_LIVE'})
},
browseGoods
:
async
()
=>
{
app
.
isFlashTask
=
true
if
(
browseType
===
BROSE_GOOD_TYPE
.
PAGE
)
preBrowseTime
.
current
=
Date
.
now
()
navigateTo
(
`/pages/packageGood/browseGoods/browseGoods?itemIds=
${
itemIds
}
&keepTime=
${
keepTime
}
`
)
},
orderGoods
:
async
()
=>
{
app
.
isFlashTask
=
true
if
(
orderType
===
ORDER_GOOD_TYPE
.
PAGE
)
{
navigateTo
(
`/pages/packageGood/orderGoods/orderGoods?itemIds=
${
itemIds
}
`
)
}
else
{
await
navigateToTaobaoPage
(
SHOP_ID
)
}
},
collectGoods
:
async
()
=>
{
app
.
isFlashTask
=
true
navigateTo
(
`/pages/packageGood/collectGoods/collectGoods?itemIds=
${
itemIds
}
`
)
},
sign
:
()
=>
doCompleteTaskHandle
(
taskType
),
share
:
()
=>
{
showSharePanel
();
setTimeout
(()
=>
{
doCompleteTaskHandle
(
taskType
)
},
2000
);
}
}
completeFn
[
taskType
]
&&
completeFn
[
taskType
]()
}
const
doCompleteTaskHandle
=
async
(
taskType
,
flag
)
=>
{
const
{
success
}
=
await
API
.
doCompleteTask
({
taskType
})
if
(
success
)
{
await
fetchTaskList
()
}
}
const
{
taskList
,
handleItem
,
fetchTaskList
}
=
useTasks
(
props
)
const
onCloseMemberModal
=
()
=>
{
setMemberShopVisible
(
false
)
...
...
@@ -145,7 +26,6 @@ export default function TasksModal(props) {
const
onCloseModal
=
()
=>
{
onClose
&&
onClose
()
}
return
(
<>
<
Popup
onClose=
{
onCloseModal
}
height=
'700rpx'
>
...
...
@@ -163,9 +43,9 @@ export default function TasksModal(props) {
</
View
>
<
View
className=
{
styles
[
'item__left-label'
]
}
>
<
View
className=
{
styles
[
'item__left-title'
]
}
>
{
item
.
title
}
</
View
>
<
View
className=
{
styles
[
'item__left-reward'
]
}
>
抽盒次数+
{
item
.
rewards
}
</
View
>
<
View
className=
{
styles
[
'item__left-reward'
]
}
>
{
rewardMsg
+
item
.
rewards
}
</
View
>
</
View
>
<
View
className=
{
`${styles['list-item__right']} ${styles['item__status-' + item.status]}`
}
onClick=
{
()
=>
handle
Tap
Item
(
item
)
}
>
<
View
className=
{
`${styles['list-item__right']} ${styles['item__status-' + item.status]}`
}
onClick=
{
()
=>
handleItem
(
item
)
}
>
{
item
.
status
===
TASK_STATUS
.
WAIT_DO
?
(
doTxt
[
item
.
taskType
]
||
'去完成'
)
:
commonTxt
[
item
.
status
]
}
...
...
c_client/src/config/config.js
View file @
824d386b
export
default
{
env
:
'test'
,
// 云函数环境 test 测试环境 online 线上环境
requestType
:
'cloud'
,
// cloud: 云函数, yapi: yapi 接口, ams: ams接口,tornadoAPI: 风驰台接口
cloudName
:
'
pkrqdb
'
,
// 主云函数项目名 CommonToC
cloudName
:
'
testNewS
'
,
// 主云函数项目名 CommonToC
sellerId
:
'2207644377875'
,
tornadoAPI
:
'https://tornado.duibadev.com.cn/tbServer/api?db=db3000000038851072&proxyIp=172.16.130.158'
,
// 新增:当requestType: 'tornadoAPI'时,找服务端提供地址
defaultActivityId
:
'61
1cd5f78e6a08bf202eeb7e
'
// 默认活动id
defaultActivityId
:
'61
0cff3f086e659a96b7336c
'
// 默认活动id
}
\ No newline at end of file
c_client/src/config/task.config.js
View file @
824d386b
...
...
@@ -21,6 +21,11 @@ export const ORDER_GOOD_TYPE = {
PAGE
:
1
,
// 集合页下单
SHOP
:
2
,
// 跳转店铺
}
// 任务展示形式
export
const
TASK_SHOW_TYPE
=
{
MODAL
:
1
,
// 弹窗
LIST
:
2
// 列表
}
export
const
TASK_CONFIG
=
{
icons
:
{
// 任务图标
follow
:
'//yun.duiba.com.cn/baicaoweiFarmer/follow.png'
,
...
...
@@ -31,7 +36,8 @@ export const TASK_CONFIG = {
orderGoods
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
,
collectGoods
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
,
sign
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
,
exchangeCredits
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
exchangeCredits
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
,
share
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
},
commonTxt
:
{
1
:
'去完成'
,
...
...
@@ -48,6 +54,9 @@ export const TASK_CONFIG = {
orderGoods
:
'去完成'
,
collectGoods
:
'去完成'
},
successMsg
:
'领取成功,奖励值+'
,
rewardMsg
:
'抽盒次数+'
,
isMock
:
false
,
// 是否使用mock数据
jumpType
:
1
,
// 1 跳转浏览15s 才算完成 2 跳转即算完成
browseTime
:
15
,
// 浏览时间
browseType
:
1
,
// 1 浏览15s 才算完成 2 点击就算完成任务 3 浏览指定商品详情页 15s
...
...
c_client/src/hooks/useLogin.js
View file @
824d386b
...
...
@@ -37,7 +37,7 @@ export function useLogin(callback = noopFn) {
avatar
,
inviteId
}
setLoginInfo
(
_loginInfo
)
setLoginInfo
(
{
...
_loginInfo
,
isLogin
:
true
}
)
setLoginStatus
(
true
)
console
.
log
(
'isLogin :>> '
,
true
)
callback
(
_loginInfo
)
...
...
c_client/src/hooks/useTasks.js
View file @
824d386b
import
API
from
'@/api'
import
{
useState
,
useEffect
}
from
'react'
import
{
useRequest
}
from
'./useRequest'
import
{
useThrottle
}
from
'@/hooks/useThrottle'
import
{
useState
,
useEffect
,
useRef
}
from
'react'
import
{
useDidShow
}
from
'@tarojs/taro'
import
{
useLoginInfoModel
}
from
'@/store'
import
{
checkIsMember
}
from
'tbcc-sdk-ts/lib/utils'
import
{
commonToast
,
navigateTo
,
favorShop
,
checkShopFavoredStatus
,
navigateToOutside
,
showSharePanel
,
navigateToTaobaoPage
}
from
'tbcc-sdk-ts/lib/core/tb'
import
{
TASK_DATA
}
from
'@/mock'
import
{
SHOP_ID
}
from
'@/const'
import
config
from
'@/config/config'
import
{
TASK_CONFIG
,
ORDER_GOOD_TYPE
,
BROSE_GOOD_TYPE
,
TASK_STATUS
,
TASK_SHOW_TYPE
}
from
'@/config/task.config'
export
function
useTasks
()
{
const
{
data
,
run
:
fetchTaskList
}
=
useRequest
(
API
.
getTaskList
,
{},
{
manual
:
false
})
const
{
jumpType
,
browseTime
,
showTaskType
,
browseType
,
orderType
,
successMsg
,
isMock
=
false
}
=
TASK_CONFIG
export
function
useTasks
(
props
)
{
const
{
onUpdate
}
=
props
const
app
=
getApp
()
const
{
loginInfo
}
=
useLoginInfoModel
()
const
[
taskList
,
setTaskList
]
=
useState
(
isMock
?
TASK_DATA
:
[])
const
[
currentTaskType
,
setCurrentTaskType
]
=
useState
(
''
)
const
preBrowseTime
=
useRef
(
null
)
// 页面显示
useDidShow
(()
=>
{
if
(
app
.
isFlashTask
)
{
app
.
isFlashTask
=
false
if
(
preBrowseTime
.
current
&&
((
Date
.
now
()
-
preBrowseTime
.
current
)
/
1000
)
>=
browseTime
&&
currentTaskType
!==
'browseGoods'
)
{
doCompleteTaskHandle
(
currentTaskType
,
true
)
preBrowseTime
.
current
=
null
}
else
if
(
preBrowseTime
.
current
&&
((
Date
.
now
()
-
preBrowseTime
.
current
)
/
1000
)
<
browseTime
)
{
commonToast
(
`未达到
${
browseTime
}
秒~`
)
preBrowseTime
.
current
=
null
}
else
{
fetchTaskList
()
}
}
})
// 数据初始化
useEffect
(()
=>
{
if
(
showTaskType
===
TASK_SHOW_TYPE
.
LIST
&&
loginInfo
.
isLogin
)
{
fetchTaskList
()
}
else
if
(
showTaskType
===
TASK_SHOW_TYPE
.
MODAL
){
fetchTaskList
()
}
},[
loginInfo
])
// 任务数据获取
const
fetchTaskList
=
async
()
=>
{
const
isVip
=
await
checkIsMember
()
const
{
success
,
data
}
=
await
API
.
getTaskList
({
isVip
})
if
(
success
&&
data
)
{
const
{
list
=
[]
}
=
data
setTaskList
(
list
)
}
}
// 点击任务项
const
handleItem
=
useThrottle
(
async
(
item
)
=>
{
const
{
status
,
taskType
}
=
item
const
tapFn
=
{
[
TASK_STATUS
.
WAIT_RECEIVE
]:
async
()
=>
{
const
{
success
,
data
}
=
await
API
.
receiveTask
({
key
:
taskType
,
rewardsKey
:
'totalHotValue'
})
if
(
success
&&
data
)
{
const
{
rewards
}
=
data
commonToast
(
`
${
successMsg
}${
rewards
}
`
)
fetchTaskList
()
onUpdate
&&
onUpdate
()
}
},
[
TASK_STATUS
.
WAIT_DO
]:
()
=>
completeTask
(
item
)
}
tapFn
[
status
]
&&
tapFn
[
status
]()
})
// 完成任务处理
const
completeTask
=
async
(
item
)
=>
{
const
{
taskType
,
url
,
itemIds
,
keepTime
}
=
item
setCurrentTaskType
(
taskType
)
const
completeFn
=
{
member
:
()
=>
setMemberShopVisible
(
true
),
invites
:
()
=>
showSharePanel
(),
follow
:
async
()
=>
{
// 已关注店铺直接完成任务
const
isFollow
=
await
checkShopFavoredStatus
(
config
.
sellerId
)
if
(
isFollow
)
{
doCompleteTaskHandle
(
taskType
)
return
;
}
// 未关注店铺直接关注并完成任务
const
checkFollow
=
await
favorShop
(
config
.
sellerId
)
if
(
checkFollow
)
{
doCompleteTaskHandle
(
taskType
)
return
;
}
},
// 跳转任务 https://www.feizhu.com
jumpLink
:
async
()
=>
{
navigateToOutside
(
url
)
if
(
jumpType
===
2
)
{
doCompleteTaskHandle
(
taskType
)
}
else
{
app
.
isFlashTask
=
true
preBrowseTime
.
current
=
Date
.
now
()
}
// await API.addStat({ type: 'BROWSE_LIVE'})
},
browseGoods
:
async
()
=>
{
app
.
isFlashTask
=
true
if
(
browseType
===
BROSE_GOOD_TYPE
.
PAGE
)
preBrowseTime
.
current
=
Date
.
now
()
navigateTo
(
`/pages/packageGood/browseGoods/browseGoods?itemIds=
${
itemIds
}
&keepTime=
${
keepTime
}
`
)
},
orderGoods
:
async
()
=>
{
app
.
isFlashTask
=
true
if
(
orderType
===
ORDER_GOOD_TYPE
.
PAGE
)
{
navigateTo
(
`/pages/packageGood/orderGoods/orderGoods?itemIds=
${
itemIds
}
`
)
}
else
{
await
navigateToTaobaoPage
(
SHOP_ID
)
}
},
collectGoods
:
async
()
=>
{
app
.
isFlashTask
=
true
navigateTo
(
`/pages/packageGood/collectGoods/collectGoods?itemIds=
${
itemIds
}
`
)
},
sign
:
()
=>
doCompleteTaskHandle
(
taskType
),
share
:
()
=>
{
showSharePanel
();
setTimeout
(()
=>
{
doCompleteTaskHandle
(
taskType
)
},
2000
);
}
}
completeFn
[
taskType
]
&&
completeFn
[
taskType
]()
}
// 完成任务接口调用
const
doCompleteTaskHandle
=
async
(
taskType
)
=>
{
const
{
success
}
=
await
API
.
completeTask
({
key
:
taskType
})
if
(
success
)
{
await
fetchTaskList
()
}
}
return
{
taskList
:
data
?.
list
||
[],
taskList
,
handleItem
,
fetchTaskList
}
}
c_client/src/pages/index/index.jsx
View file @
824d386b
...
...
@@ -37,7 +37,6 @@ function Index() {
const
[
doHelpModalVisible
,
setDoHelpModalVisible
]
=
useState
(
false
)
const
[
ruleModalVisible
,
setRuleModalVisible
]
=
useState
(
false
)
const
[
tasksModalVisible
,
setTasksModalVisible
]
=
useState
(
false
)
const
[
updateFlag
,
setUpdateFlag
]
=
useState
(
1
)
// 分享图
const
SHARE_IMG
=
useRef
(
''
)
// 助力弹窗类型
...
...
@@ -77,10 +76,7 @@ function Index() {
},[])
// 授权登录完成
useLogin
(
async
(
info
)
=>
{
console
.
warn
(
info
)
console
.
warn
(
loginInfo
)
handleVisibleModal
(
info
)
// setUpdateFlag(1)
})
// 查看是否有助力信息
const
getShareInfo
=
async
()
=>
{
...
...
@@ -132,7 +128,6 @@ function Index() {
handleVisibleModal
(
loginInfo
)
}
if
(
helpType
===
HELP_MODAL_TYPE
.
REWARDS
)
{
setUpdateFlag
(
HELP_MODAL_TYPE
.
REWARDS
)
fetchUserInfo
()
}
}
...
...
@@ -164,7 +159,7 @@ function Index() {
{
tasksModalVisible
&&
<
TasksModal
onUpdate=
{
()
=>
{}
}
onUpdate=
{
()
=>
{
console
.
warn
(
'任务数据更新了'
)
}
}
onClose=
{
()
=>
setTasksModalVisible
(
false
)
}
/>
}
...
...
c_client/src/pages/packageGood/browseGoods/browseGoods.jsx
View file @
824d386b
...
...
@@ -66,7 +66,7 @@ function BrowseGoodsPage() {
})
// 浏览记录
const
onCompleteTask
=
async
(
itemId
)
=>
{
const
{
success
}
=
await
API
.
doCompleteTask
({
taskType
:
BROWSE_CONFIG
.
taskType
,
itemId
:
currentItemId
.
current
})
const
{
success
}
=
await
API
.
completeTask
({
key
:
BROWSE_CONFIG
.
taskType
,
itemId
:
currentItemId
.
current
})
if
(
success
)
{
getGoodsList
()
commonToast
(
'浏览成功'
)
...
...
c_client/src/pages/packageGood/cartGoods/cartGoods.jsx
View file @
824d386b
...
...
@@ -39,7 +39,7 @@ function CartGoodsPage() {
}
const
{
status
,
quantity
}
=
await
showSkuModal
(
String
(
itemId
))
if
(
status
==
"addCartSuccess"
)
{
const
{
success
}
=
await
API
.
doCompleteTask
({
taskType
:
CART_CONFIG
.
taskType
,
itemId
,
count
:
quantity
})
const
{
success
}
=
await
API
.
completeTask
({
key
:
CART_CONFIG
.
taskType
,
itemId
,
count
:
quantity
})
if
(
success
)
{
collectflag
.
current
=
true
getGoodsList
()
...
...
c_client/src/pages/packageGood/collectGoods/collectGoods.jsx
View file @
824d386b
...
...
@@ -29,7 +29,7 @@ function CollectGoodsPage() {
const
onCompleteTask
=
useThrottle
(
async
(
itemId
,
collected
)
=>
{
const
collectFn
=
async
()
=>
{
const
{
success
}
=
await
API
.
doCompleteTask
({
taskType
,
itemId
})
const
{
success
}
=
await
API
.
completeTask
({
key
:
taskType
,
itemId
})
if
(
success
)
{
collectFlag
.
current
=
true
getGoodsList
()
...
...
c_client/src/pages/packagePrize/myPrize/myPrize.jsx
View file @
824d386b
...
...
@@ -9,10 +9,11 @@ import { useThrottle } from '@/hooks/useThrottle'
import
{
checkIsMember
}
from
'tbcc-sdk-ts/lib/utils'
import
{
dateFormatter
}
from
'@/utils/date'
import
styles
from
'./myPrize.module.less'
import
{
getApp
}
from
'@tarojs/taro'
import
{
useDidHide
,
getApp
}
from
'@tarojs/taro'
import
{
receiveEnamePrize
,
receiveObjectPrize
,
receiveMemberEname
}
from
'@/utils/util'
import
config
from
'@/config/config'
import
{
PRIZE_CONFIG
,
DRAW_STATUS
,
PRIZE_TYPE
,
BENEFIT_TYPE
}
from
'@/config/myPrize.config'
const
{
objectStatus
:
_objectStatus
,
enameStatus
:
_enameStatus
,
orderStatus
,
commonStatus
}
=
PRIZE_CONFIG
const
objectStatus
=
{
...
_objectStatus
,
...
commonStatus
}
const
enameStatus
=
{
...
_enameStatus
,
...
commonStatus
}
...
...
@@ -38,6 +39,7 @@ function MyPrizeList() {
useEffect
(()
=>
{
fetchMyPriceList
()
},
[])
async
function
fetchMyPriceList
()
{
const
res
=
await
getMyPrizeList
()
if
(
res
.
success
&&
res
?.
data
?.
list
?.
length
)
{
...
...
c_client/src/store/loginInfo.js
View file @
824d386b
...
...
@@ -3,6 +3,7 @@ import { createModel } from 'hox'
function
useLoginInfo
()
{
const
[
loginInfo
,
setLoginInfo
]
=
useState
({
isLogin
:
false
,
newUser
:
''
,
openId
:
''
,
firstLoginToday
:
''
,
...
...
c_client/src/utils/util.js
View file @
824d386b
...
...
@@ -199,4 +199,37 @@ export const getGrade = (sellerId) => {
});
})
}
// 查询商家会员等级
export
const
checkShopFavoredStatus
=
(
sellerId
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
my
.
tb
.
checkShopFavoredStatus
({
id
:
sellerId
,
success
:
(
res
)
=>
{
console
.
warn
(
res
)
my
.
alert
({
content
:
JSON
.
stringify
(
res
)
})
resolve
(
res
.
isFavor
)
},
fail
:
(
res
)
=>
{
my
.
alert
({
content
:
JSON
.
stringify
(
res
)
})
}
})
})
}
// 查询商家会员等级
export
const
favorShop
=
(
sellerId
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
my
.
tb
.
favorShop
({
id
:
+
sellerId
,
success
:
(
res
)
=>
{
console
.
warn
(
res
)
my
.
alert
({
content
:
JSON
.
stringify
(
res
)
})
resolve
(
res
)
},
fail
:
(
res
)
=>
{
my
.
alert
({
content
:
JSON
.
stringify
(
res
)
})
}
})
})
}
c_client/yarn.lock
View file @
824d386b
...
...
@@ -13894,10 +13894,10 @@ taro-ui@^3.0.0-alpha.3:
lodash "^4.17.10"
prop-types "^15.7.2"
tbcc-sdk-ts@^1.0.
6
:
version "1.0.
6
"
resolved "https://registry.yarnpkg.com/tbcc-sdk-ts/-/tbcc-sdk-ts-1.0.
6.tgz#cfc38b6dbb4193c165a15a581b24f94a301b4f4c
"
integrity sha512-
CR4XHPHIof6krOBS2BKWpfQUUWIIuPVqMQ1cisllz4rkOSYYzwllbCY/MoPpRiPvMFRu4UdnxAIEGp7TJeDN2Q
==
tbcc-sdk-ts@^1.0.
7
:
version "1.0.
7
"
resolved "https://registry.yarnpkg.com/tbcc-sdk-ts/-/tbcc-sdk-ts-1.0.
7.tgz#17da833f4de75d01898485c2634623108e1519cd
"
integrity sha512-
bPoL2BEBhx45+4u+zjhCz9otAK5KjLEcu9RoyoRhfr5lxLUohU8Cy6d/JEvg4+E/ArmWEc1fs5/Z0LNKtzPt/w
==
optionalDependencies:
"@types/lodash" "^4.14.160"
"@types/node" "^14.6.0"
...
...
@@ -14861,10 +14861,8 @@ watchpack@^1.7.4:
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.7.5.tgz#1267e6c55e0b9b5be44c2023aed5437a2c26c453"
integrity sha512-9P3MWk6SrKjHsGkLT2KHXdQ/9SNkyoJbabxnKOoJepsvJjJG8uYTR3yTPxPQvNDI3w4Nz1xnE0TLHK4RIVe/MQ==
dependencies:
chokidar "^3.4.1"
graceful-fs "^4.1.2"
neo-async "^2.5.0"
watchpack-chokidar2 "^2.0.1"
optionalDependencies:
chokidar "^3.4.1"
watchpack-chokidar2 "^2.0.1"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment