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
43f76188
Commit
43f76188
authored
Sep 14, 2021
by
mqf_0707
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
授权逻辑更改
parent
ea5c1696
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
4482 additions
and
21810 deletions
+4482
-21810
package-lock.json
c_client/package-lock.json
+4289
-21733
package.json
c_client/package.json
+2
-2
Auth.jsx
c_client/src/components/_tb_modal/Auth/Auth.jsx
+22
-0
Auth.less
c_client/src/components/_tb_modal/Auth/Auth.less
+62
-0
DoHelpModal.jsx
...ient/src/components/_tb_modal/DoHelpModal/DoHelpModal.jsx
+6
-6
useAuth.js
c_client/src/hooks/useAuth.js
+44
-11
useLogin.js
c_client/src/hooks/useLogin.js
+2
-2
useReceive.js
c_client/src/hooks/useReceive.js
+2
-2
useTasks.js
c_client/src/hooks/useTasks.js
+5
-5
index.jsx
c_client/src/pages/index/index.jsx
+7
-5
game.jsx
c_client/src/pages/packageGame/game/game.jsx
+1
-3
browseGoods.jsx
c_client/src/pages/packageGood/browseGoods/browseGoods.jsx
+6
-7
cartGoods.jsx
c_client/src/pages/packageGood/cartGoods/cartGoods.jsx
+7
-7
collectGoods.jsx
c_client/src/pages/packageGood/collectGoods/collectGoods.jsx
+7
-7
orderGoods.jsx
c_client/src/pages/packageGood/orderGoods/orderGoods.jsx
+1
-1
myPrize.jsx
c_client/src/pages/packagePrize/myPrize/myPrize.jsx
+5
-5
util.js
c_client/src/utils/util.js
+10
-10
yarn.lock
c_client/yarn.lock
+4
-4
No files found.
c_client/package-lock.json
View file @
43f76188
This source diff could not be displayed because it is too large. You can
view the blob
instead.
c_client/package.json
View file @
43f76188
...
...
@@ -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.
7
"
"tbcc-sdk-ts"
:
"^1.0.
9
"
},
"devDependencies"
:
{
"@babel/core"
:
"^7.8.0"
,
...
...
c_client/src/components/_tb_modal/Auth/Auth.jsx
0 → 100644
View file @
43f76188
import
React
,
{
useState
}
from
'react'
import
{
View
,
Text
}
from
'@tarojs/components'
import
Taro
from
'@tarojs/taro'
import
classnames
from
'classnames'
import
'./Auth.less'
const
clspreFix
=
'auth-page'
function
Auth
(
props
)
{
const
{
clickAuthBtn
=
()
=>
{}
}
=
props
return
(
<
View
className=
{
`${clspreFix}`
}
>
<
View
className=
{
`${clspreFix}__content`
}
>
<
View
className=
{
`${clspreFix}__img`
}
></
View
>
<
View
className=
{
`${clspreFix}__title`
}
>
开启授权继续使用
</
View
>
<
Text
className=
{
`${clspreFix}__subTitle`
}
>
{
`申请获取你的淘宝昵称及头像\n用于会员身份的核实及认证`
}
</
Text
>
<
View
className=
{
`${clspreFix}__btn`
}
onClick=
{
clickAuthBtn
}
>
立即授权
</
View
>
<
View
className=
{
`${clspreFix}__exct`
}
onClick=
{
()
=>
Taro
.
exit
()
}
>
退出程序
</
View
>
</
View
>
</
View
>
)
}
export
default
Auth
\ No newline at end of file
c_client/src/components/_tb_modal/Auth/Auth.less
0 → 100644
View file @
43f76188
.auth-page{
width: 100vw;
height: 100vh;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 20;
background-color: #eee; // f1ebdd
display: flex;
justify-content: center;
align-items: center;
&__content {
width: 520px;
margin: 0 auto;
}
&__img {
width: 168px;
height: 168px;
margin: 0 auto 75px;
background-image: url('https://yun.dui88.com/dbad8bde-b2d5-41a8-ba62-94a9d42d624c.png');
.image-property(cover, center center);
background-repeat: no-repeat;
}
&__title{
color: #111111;
font-size: 32px;
margin: 0 auto 24px;
text-align: center;
}
&__subTitle {
display: block;
line-height: 48px;
color: #757575;
font-size: 32px;
margin: 0 auto 70px;
text-align: center;
}
&__btn {
width: 496px;
height: 110px;
line-height: 110px;
border-radius: 60px;
color: #e1e1e1;
background-color: rgb(17, 17, 17);
text-align: center;
font-size: 28px;
}
&__exct {
width: 496px;
height: 110px;
line-height: 110px;
border-radius: 60px;
color: #e1e1e1;
background-color: rgb(17, 17, 17);
text-align: center;
font-size: 28px;
margin-top: 20px;
}
}
\ No newline at end of file
c_client/src/components/_tb_modal/DoHelpModal/DoHelpModal.jsx
View file @
43f76188
...
...
@@ -6,7 +6,7 @@ import styles from './DoHelpModal.module.less'
import
API
from
'@/api'
import
{
useLoginInfoModel
,
useActivityInfoModel
}
from
'@/store'
import
{
checkIsMember
}
from
'tbcc-sdk-ts/lib/utils'
import
{
commonToast
}
from
'tbcc-sdk-ts/lib/core/tb
'
import
{
showToast
}
from
'@tarojs/taro
'
import
{
HELP_MODAL_TYPE
,
HELP_CONFIG
}
from
'@/config/help.config'
export
default
function
DoHelpModal
(
props
)
{
...
...
@@ -20,9 +20,9 @@ export default function DoHelpModal(props) {
const
isVip
=
await
checkIsMember
()
const
helpRes
=
await
API
.
completeTask
({
key
:
HELP_CONFIG
.
KEY
,
inviteId
,
isVip
})
if
(
helpRes
?.
success
)
{
commonToast
(
'助力成功'
)
showToast
({
title
:
'助力成功'
}
)
}
else
{
commonToast
(
helpRes
?.
message
)
showToast
({
title
:
helpRes
?.
message
}
)
}
onClose
()
setMemberModalVisible
(
false
)
...
...
@@ -41,9 +41,9 @@ export default function DoHelpModal(props) {
const
helpRes
=
await
API
.
completeTask
({
key
:
HELP_CONFIG
.
KEY
,
inviteId
,
isVip
})
if
(
helpRes
?.
success
)
{
commonToast
(
'助力成功'
)
showToast
({
title
:
'助力成功'
}
)
}
else
{
commonToast
(
helpRes
?.
message
)
showToast
({
title
:
helpRes
?.
message
}
)
}
onClose
()
}
...
...
@@ -51,7 +51,7 @@ export default function DoHelpModal(props) {
const
isVip
=
await
checkIsMember
()
// 已经是会员
if
(
isVip
)
{
commonToast
(
'新会员才能助力哦~'
)
showToast
({
title
:
'新会员才能助力哦~'
}
)
}
else
{
// 还不是会员,弹出会员弹窗
setMemberModalVisible
(
true
)
...
...
c_client/src/hooks/useAuth.js
View file @
43f76188
import
{
getAuthUserInfo
}
from
'tbcc-sdk-ts/lib/core/tbFn
'
import
{
useEffect
}
from
'react
'
import
{
commonToast
}
from
'tbcc-sdk-ts/lib/core/tb'
import
{
useEffect
,
useRef
,
useState
}
from
'react
'
import
Taro
,
{
useDidShow
,
showToast
}
from
'@tarojs/taro
'
import
{
getSetting
,
openSetting
,
authorize
,
getAuthUserInfo
}
from
'tbcc-sdk-ts/lib/core/tb'
// 授权
export
function
useAuth
(
callback
=
noopFn
)
{
const
authUserInfo
=
async
()
=>
{
const
info
=
await
getAuthUserInfo
().
catch
(
err
=>
{
console
.
log
(
'未授权成功'
,
err
)
commonToast
(
'点击右上角,打开授权开关,重进活动即可参与'
)
export
function
useAuth
(
authSuccess
=
()
=>
{})
{
const
[
visible
,
setVisible
]
=
useState
(
false
)
const
goToOpenSetting
=
useRef
(
false
)
// 获取授权信息
const
getSettingFn
=
async
()
=>
{
const
res
=
await
getSetting
()
if
(
!
res
.
authSetting
?.
userInfo
)
{
const
authResult
=
await
authorize
().
catch
(
err
=>
{
setVisible
(
true
)
showToast
({
title
:
'请先授权,授权成功后才可参与活动'
})
})
if
(
authResult
)
{
authUserInfo
()
}
}
else
{
authUserInfo
()
}
}
// 打开授权设置
const
openSettingFn
=
async
()
=>
{
goToOpenSetting
.
current
=
true
showToast
({
title
:
'打开授权开关,授权成功后才可参与活动'
,
duration
:
1000
,
success
:
()
=>
openSetting
()
})
}
// 获取用户授权信息
const
authUserInfo
=
async
()
=>
{
const
info
=
await
getAuthUserInfo
()
if
(
info
)
{
callback
(
info
)
authSuccess
(
info
)
setVisible
&&
setVisible
(
false
)
}
}
useEffect
(()
=>
{
authUserInfo
()
getSettingFn
()
},
[])
return
{}
useDidShow
(()
=>
{
if
(
goToOpenSetting
.
current
)
{
// 重新授权
getSettingFn
()
goToOpenSetting
.
current
=
false
}
})
return
{
visible
,
getSettingFn
,
openSettingFn
}
}
\ No newline at end of file
c_client/src/hooks/useLogin.js
View file @
43f76188
...
...
@@ -43,11 +43,11 @@ export function useLogin(callback = noopFn) {
callback
(
_loginInfo
)
}
}
useAuth
((
authInfo
)
=>
{
const
authInfo
=
useAuth
((
authInfo
)
=>
{
console
.
warn
(
'authInfo :>>'
+
authInfo
)
doLogin
(
authInfo
)
})
return
{
isLogin
}
return
{
isLogin
,
authInfo
}
}
export
function
useLoginFromShare
(
callback
=
noopFn
)
{
...
...
c_client/src/hooks/useReceive.js
View file @
43f76188
import
{
useCallback
}
from
'react'
import
{
checkIsMember
}
from
'tbcc-sdk-ts/lib/utils'
import
{
commonToast
}
from
'tbcc-sdk-ts/lib/core/tb
'
import
{
showToast
}
from
'@tarojs/taro
'
import
API
from
'@/api'
import
{
receiveEnamePrize
,
receiveMemberEname
,
receiveObjectPrize
}
from
'tbcc-sdk-ts/lib/request/capiFn'
import
{
PRIZE_TYPE
,
BENEFIT_TYPE
}
from
'@/config/myPrize.config'
...
...
@@ -16,7 +16,7 @@ const useReceive = (props) => {
if
(
type
===
PRIZE_TYPE
.
CREDITS
||
(
type
===
PRIZE_TYPE
.
ENAME
&&
benefitType
===
BENEFIT_TYPE
.
MEMBER
))
{
const
isVip
=
await
checkIsMember
()
if
(
!
isVip
)
{
commonToast
(
'需加入会员才能领取成功哦'
,
1000
,
()
=>
{
callbackObj
.
vipCallback
&&
callbackObj
.
vipCallback
()
})
showToast
({
title
:
'需加入会员才能领取成功哦'
,
duration
:
1000
,
success
:
()
=>
{
callbackObj
.
vipCallback
&&
callbackObj
.
vipCallback
()}
})
return
;
}
}
...
...
c_client/src/hooks/useTasks.js
View file @
43f76188
import
API
from
'@/api'
import
{
useThrottle
}
from
'@/hooks/useThrottle'
import
{
useState
,
useEffect
,
useRef
}
from
'react'
import
{
useDidShow
}
from
'@tarojs/taro'
import
{
useDidShow
,
showToast
}
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
{
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'
...
...
@@ -27,7 +27,7 @@ export function useTasks(props) {
doCompleteTaskHandle
(
currentTaskType
)
preBrowseTime
.
current
=
null
}
else
if
(
preBrowseTime
.
current
&&
((
Date
.
now
()
-
preBrowseTime
.
current
)
/
1000
)
<
browseTime
)
{
commonToast
(
`未达到
${
browseTime
}
秒~`
)
showToast
({
title
:
`未达到
${
browseTime
}
秒~`
}
)
preBrowseTime
.
current
=
null
}
else
{
fetchTaskList
()
...
...
@@ -68,7 +68,7 @@ export function useTasks(props) {
const
{
success
,
data
}
=
await
API
.
receiveTask
({
key
,
rewardsKey
:
TASK_CONFIG
.
rewardsKey
})
if
(
success
&&
data
)
{
const
{
rewards
}
=
data
commonToast
(
`
${
successMsg
}${
rewards
}
`
)
showToast
({
title
:
`
${
successMsg
}${
rewards
}
`
}
)
fetchTaskList
()
onUpdate
&&
onUpdate
()
}
...
...
@@ -149,7 +149,7 @@ export function useTasks(props) {
}
// 完成任务接口调用
const
doCompleteTaskHandle
=
async
(
key
,
isVip
)
=>
{
const
{
success
}
=
await
API
.
completeTask
({
key
,
isVip
})
const
{
success
}
=
await
API
.
completeTask
({
key
,
taskType
:
key
,
isVip
})
if
(
success
)
{
await
fetchTaskList
()
}
...
...
c_client/src/pages/index/index.jsx
View file @
43f76188
import
React
,
{
useRef
,
useState
,
useEffect
}
from
'react'
import
{
View
,
Image
}
from
'@tarojs/components'
import
Taro
,
{
useShareAppMessage
,
useDidShow
,
getApp
}
from
'@tarojs/taro'
import
{
useShareAppMessage
,
useDidShow
,
getApp
,
showToast
}
from
'@tarojs/taro'
import
classnames
from
'classnames'
import
{
SHARE_CONFIG
}
from
'@/const.js'
import
{
HELP_MODAL_TYPE
}
from
'@/config/help.config'
...
...
@@ -12,6 +12,7 @@ import RuleModal from '@/components/_tb_modal/RuleModal/RuleModal'
import
DoHelpModal
from
'@/components/_tb_modal/DoHelpModal/DoHelpModal'
import
TasksModal
from
'@/components/_tb_modal/TasksModal/TasksModal'
import
JackpotModal
from
'@/components/_tb_modal/JackpotModal'
import
Auth
from
'@/components/_tb_modal/Auth/Auth'
import
styles
from
'./index.module.less'
import
tbcc
from
'tbcc-sdk-ts'
const
{
navigateTo
,
openDetail
,
showSharePanel
}
=
tbcc
.
tb
...
...
@@ -21,8 +22,6 @@ import {useAudio} from '@/hooks/useAudio'
import
{
CLOUD_OBJ
,
BGMUSIC_URL
}
from
'@/const'
import
{
commonToast
}
from
'tbcc-sdk-ts/lib/core/tb'
const
INDEX_CONFIG
=
{
bg
:
''
,
// 背景 cloud://C4015B7CEC23CF013A78247E2852524F//火箭待机小球抖动.json
ruleButton
:
''
,
// 规则按钮
...
...
@@ -52,6 +51,8 @@ function Index() {
const
SHARE_IMG
=
useRef
(
''
)
// 助力弹窗类型
const
[
helpType
,
setHelpType
]
=
useState
(
HELP_MODAL_TYPE
.
HELP
)
// 助力弹窗类型
const
[
helpInfo
,
setHelpInfo
]
=
useState
({})
// 助力弹窗标识
const
showHelp
=
useRef
(
false
)
...
...
@@ -76,7 +77,7 @@ function Index() {
// })
},[])
// 授权登录完成
useLogin
(
async
(
info
)
=>
{
const
{
isLogin
,
authInfo
}
=
useLogin
(
async
(
info
)
=>
{
handleVisibleModal
(
info
)
})
// 查看是否有助力信息
...
...
@@ -145,7 +146,7 @@ function Index() {
navigateTo
(
'/pages/packagePrize/myPrize/myPrize'
)
},
'game'
:
()
=>
navigateTo
(
'/pages/packageGame/game/game'
),
'comps'
:
()
=>
{
'comps'
:
async
()
=>
{
navigateTo
(
'/pages/packageComs/comsTest/comsTest'
)
}
}
...
...
@@ -209,6 +210,7 @@ function Index() {
/>
}
{
<
member
-
modal
expend=
{
memberVisible
}
onClose=
{
onClose
}
onAuthFail=
{
onAuthFail
}
onAuthSuccess=
{
onAuthSuccess
}
/>
}
{
authInfo
?.
visible
&&
<
Auth
clickAuthBtn=
{
authInfo
.
openSettingFn
}
/>
}
{
false
&&
<
canvas
-
comp
/>
}
</>
)
...
...
c_client/src/pages/packageGame/game/game.jsx
View file @
43f76188
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
View
}
from
'@tarojs/components'
import
{
useDidShow
,
useRouter
,
useDidHide
,
getApp
}
from
'@tarojs/taro'
import
{
useDidShow
,
useRouter
,
useDidHide
,
getApp
,
showToast
}
from
'@tarojs/taro'
import
API
from
'@/api'
import
{
useLogin
,
useLoginFromShare
}
from
'@/hooks/useLogin'
import
{
useActivityInfoModel
,
useLoginInfoModel
}
from
'@/store'
import
{
commonToast
,
getSystemInfo
,
navigateToOutside
,
navigateBack
,
...
...
@@ -123,7 +122,6 @@ function GamePage(props) {
setMemberVisible
(
true
)
break
;
}
// commonToast(JSON.stringify(data))
setUpdateFlag
(
Math
.
floor
(
Math
.
random
()
*
1000
))
setCanvasData
(
data
)
}
else
{
...
...
c_client/src/pages/packageGood/browseGoods/browseGoods.jsx
View file @
43f76188
...
...
@@ -4,9 +4,8 @@ import ContainerFit from '@/components/_base/ContainerFit/ContainerFit'
import
GoodsTitle
from
'@/components/_tb_comps/TitleImg/TitleImg'
import
GoodsList
from
'@/components/_tb_comps/GoodsList/GoodsList'
import
BrowserLoading
from
'@/components/_tb_comps/BrowserLoading/BrowserLoading'
import
{
useDidShow
,
useRouter
,
useDidHide
}
from
'@tarojs/taro'
import
{
useDidShow
,
useRouter
,
useDidHide
,
showToast
}
from
'@tarojs/taro'
import
API
from
'@/api'
import
{
commonToast
}
from
'tbcc-sdk-ts/lib/core/tb'
import
styles
from
'./browseGoods.module.less'
import
{
TASK_CONFIG
,
BROSE_GOOD_TYPE
}
from
'@/config/task.config'
import
{
BROWSE_CONFIG
}
from
'@/config/browse.config'
...
...
@@ -37,7 +36,7 @@ function BrowseGoodsPage() {
},[
goodsList
])
// 获取商品列表
const
getGoodsList
=
async
()
=>
{
const
{
success
,
data
}
=
await
API
.
getCollectGoods
({
key
:
BROWSE_CONFIG
.
taskType
,
itemIds
})
const
{
success
,
data
}
=
await
API
.
getCollectGoods
({
key
:
BROWSE_CONFIG
.
taskType
,
itemIds
,
taskType
:
BROWSE_CONFIG
.
taskType
})
if
(
success
&&
!
BROWSE_CONFIG
.
isMock
)
{
setGoodsList
(
data
?.
list
||
[])
}
...
...
@@ -54,7 +53,7 @@ function BrowseGoodsPage() {
currentItemId
.
current
=
''
preBrowseTime
.
current
=
null
}
else
if
(
preBrowseTime
.
current
)
{
commonToast
(
`未达到
${
browseTime
}
秒~`
)
showToast
({
title
:
`未达到
${
browseTime
}
秒~`
}
)
currentItemId
.
current
=
''
preBrowseTime
.
current
=
null
}
...
...
@@ -68,10 +67,10 @@ function BrowseGoodsPage() {
})
// 浏览记录
const
onCompleteTask
=
async
(
itemId
)
=>
{
const
{
success
}
=
await
API
.
completeTask
({
key
:
BROWSE_CONFIG
.
taskType
,
itemId
:
currentItemId
.
current
})
const
{
success
}
=
await
API
.
completeTask
({
key
:
BROWSE_CONFIG
.
taskType
,
itemId
:
currentItemId
.
current
,
taskType
:
BROWSE_CONFIG
.
taskType
})
if
(
success
)
{
getGoodsList
()
commonToast
(
'浏览成功'
)
showToast
({
title
:
'浏览成功'
}
)
}
}
// 点击商品 跳转时处理
...
...
@@ -88,7 +87,7 @@ function BrowseGoodsPage() {
},
[
BROSE_GOOD_TYPE
.
DETAIL
]:
()
=>
{
if
(
collected
)
{
commonToast
(
'该商品已经浏览过了'
)
showToast
({
title
:
'该商品已经浏览过了'
}
)
return
;
}
preBrowseTime
.
current
=
Date
.
now
()
...
...
c_client/src/pages/packageGood/cartGoods/cartGoods.jsx
View file @
43f76188
...
...
@@ -3,7 +3,7 @@ import { View } from '@tarojs/components'
import
ContainerFit
from
'@/components/_base/ContainerFit/ContainerFit'
import
TitleImg
from
'@/components/_tb_comps/TitleImg/TitleImg'
import
GoodsList
from
'@/components/_tb_comps/GoodsList/GoodsList'
import
{
useRouter
}
from
'@tarojs/taro'
import
{
useRouter
,
showToast
}
from
'@tarojs/taro'
import
tbccTs
from
'tbcc-sdk-ts'
import
API
from
'@/api'
import
{
useThrottle
}
from
'@/hooks/useThrottle'
...
...
@@ -11,7 +11,7 @@ import styles from './cartGoods.module.less'
import
{
CART_CONFIG
,
CART_TYPE
}
from
'@/config/cart.config'
import
{
GOOD_LIST
}
from
'@/mock'
const
{
commonToast
,
showSkuModal
}
=
tbccTs
.
tb
const
{
showSkuModal
}
=
tbccTs
.
tb
function
CartGoodsPage
()
{
const
router
=
useRouter
()
...
...
@@ -25,26 +25,26 @@ function CartGoodsPage() {
},
[])
const
getGoodsList
=
async
()
=>
{
const
{
data
}
=
await
API
.
getCollectGoods
({
key
:
CART_CONFIG
.
taskType
,
itemIds
})
const
{
data
}
=
await
API
.
getCollectGoods
({
key
:
CART_CONFIG
.
taskType
,
taskType
:
CART_CONFIG
.
taskType
,
itemIds
})
data
?.
list
&&
setGoodsList
(
data
?.
list
||
[])
}
// 加入购物车 // 对应itemId为 574141925233 skuId为4018047819826 数量为4
const
onCompleteTask
=
useThrottle
(
async
(
itemId
,
collected
)
=>
{
console
.
log
(
itemId
)
if
(
collected
&&
CART_CONFIG
.
type
===
CART_TYPE
.
ONE
)
{
commonToast
(
'您已加购过该商品了'
)
showToast
({
title
:
'您已加购过该商品了'
}
)
return
;
}
if
(
collectflag
.
current
&&
CART_CONFIG
.
type
===
CART_TYPE
.
ONE
)
{
commonToast
(
'该任务今天已完成,明天再来吧~'
)
showToast
({
title
:
'该任务今天已完成,明天再来吧~'
}
)
}
const
{
status
,
quantity
}
=
await
showSkuModal
(
String
(
itemId
))
if
(
status
==
"addCartSuccess"
)
{
const
{
success
}
=
await
API
.
completeTask
({
key
:
CART_CONFIG
.
taskType
,
itemId
,
count
:
quantity
})
const
{
success
}
=
await
API
.
completeTask
({
key
:
CART_CONFIG
.
taskType
,
taskType
:
CART_CONFIG
.
taskType
,
itemId
,
count
:
quantity
})
if
(
success
)
{
collectflag
.
current
=
true
getGoodsList
()
commonToast
(
'加购成功'
)
showToast
({
title
:
'加购成功'
}
)
}
}
},
2000
);
...
...
c_client/src/pages/packageGood/collectGoods/collectGoods.jsx
View file @
43f76188
...
...
@@ -3,11 +3,11 @@ import { View } from '@tarojs/components'
import
ContainerFit
from
'@/components/_base/ContainerFit/ContainerFit'
import
TitleImg
from
'@/components/_tb_comps/TitleImg/TitleImg'
import
GoodsList
from
'@/components/_tb_comps/GoodsList/GoodsList'
import
{
useRouter
}
from
'@tarojs/taro'
import
{
useRouter
,
showToast
}
from
'@tarojs/taro'
import
tbccTs
from
'tbcc-sdk-ts'
import
API
from
'@/api'
import
{
useThrottle
}
from
'@/hooks/useThrottle'
const
{
c
ommonToast
,
c
heckGoodsCollectedStatus
,
collectGoods
}
=
tbccTs
.
tb
const
{
checkGoodsCollectedStatus
,
collectGoods
}
=
tbccTs
.
tb
import
styles
from
'./collectGoods.module.less'
import
COLLECT_CONFIG
from
'@/config/collect.config'
import
{
GOOD_LIST
}
from
'@/mock'
...
...
@@ -24,26 +24,26 @@ function CollectGoodsPage() {
},
[])
const
getGoodsList
=
async
()
=>
{
const
{
data
}
=
await
API
.
getCollectGoods
({
key
:
COLLECT_CONFIG
.
taskType
,
itemIds
})
const
{
data
}
=
await
API
.
getCollectGoods
({
key
:
COLLECT_CONFIG
.
taskType
,
itemIds
,
taskType
:
COLLECT_CONFIG
.
taskType
})
data
?.
list
&&
setGoodsList
(
data
?.
list
||
[])
}
const
onCompleteTask
=
useThrottle
(
async
(
itemId
,
collected
)
=>
{
const
collectFn
=
async
()
=>
{
const
{
success
}
=
await
API
.
completeTask
({
key
:
COLLECT_CONFIG
.
taskType
,
itemId
})
const
{
success
}
=
await
API
.
completeTask
({
key
:
COLLECT_CONFIG
.
taskType
,
itemId
,
taskType
:
COLLECT_CONFIG
.
taskType
})
if
(
success
)
{
collectFlag
.
current
=
true
getGoodsList
()
commonToast
(
'收藏成功'
)
showToast
({
title
:
'收藏成功'
}
)
}
}
// 今日是否已收藏过
if
(
collectFlag
.
current
)
{
commonToast
(
'任务已完成,请明日再来'
)
showToast
({
title
:
'任务已完成,请明日再来'
}
)
return
;
}
if
(
collected
)
{
commonToast
(
'您已收藏过该商品了'
)
showToast
({
title
:
'您已收藏过该商品了'
}
)
return
;
}
// 判断是否活动外已收藏商品
...
...
c_client/src/pages/packageGood/orderGoods/orderGoods.jsx
View file @
43f76188
...
...
@@ -12,7 +12,7 @@ import ORDER_CONFIG from '@/config/order.config'
function
OrderGoodsPage
()
{
const
router
=
useRouter
()
const
{
itemIds
}
=
router
?.
params
const
{
data
}
=
useRequest
(
API
.
getCollectGoods
,
{
key
:
ORDER_CONFIG
.
taskType
,
itemIds
})
const
{
data
}
=
useRequest
(
API
.
getCollectGoods
,
{
key
:
ORDER_CONFIG
.
taskType
,
itemIds
,
taskType
:
ORDER_CONFIG
.
taskType
})
return
(
<
ContainerFit
bg=
{
ORDER_CONFIG
.
bg
}
>
...
...
c_client/src/pages/packagePrize/myPrize/myPrize.jsx
View file @
43f76188
...
...
@@ -8,7 +8,7 @@ import tbccTs from 'tbcc-sdk-ts'
import
{
useThrottle
}
from
'@/hooks/useThrottle'
import
{
dateFormatter
}
from
'@/utils/date'
import
styles
from
'./myPrize.module.less'
import
{
useDidHide
,
useDidShow
,
getApp
}
from
'@tarojs/taro'
import
{
showToast
,
useDidShow
,
getApp
}
from
'@tarojs/taro'
import
useReceive
from
'@/hooks/useReceive'
import
{
PRIZE_CONFIG
,
DRAW_STATUS
,
PRIZE_TYPE
}
from
'@/config/myPrize.config'
...
...
@@ -16,7 +16,7 @@ const { objectStatus: _objectStatus, enameStatus: _enameStatus, orderStatus, com
const
objectStatus
=
{
...
_objectStatus
,
...
commonStatus
}
const
enameStatus
=
{
...
_enameStatus
,
...
commonStatus
}
const
{
commonToast
,
navigateToOutside
,
setClipboard
,
openDetail
}
=
tbccTs
.
tb
const
{
navigateToOutside
,
setClipboard
,
openDetail
}
=
tbccTs
.
tb
function
Empty
(
blankTxt
)
{
return
<
View
className=
{
styles
[
'my-prize-item__empty'
]
}
>
{
blankTxt
}
</
View
>
...
...
@@ -55,7 +55,7 @@ function MyPrizeList() {
// 复制编码
const
handleCopyId
=
async
(
text
)
=>
{
await
setClipboard
(
text
)
commonToast
(
'复制成功'
)
showToast
({
title
:
'复制成功'
}
)
}
// 领取奖品
const
handleClick
=
useThrottle
(
async
(
item
)
=>
{
...
...
@@ -110,8 +110,8 @@ function MyPrizeList() {
const
{
type
,
itemId
,
drawStatus
,
useUrl
=
''
}
=
itm
if
(
itemId
&&
hasGoodPrize
)
return
orderStatus
[
drawStatus
]
if
(
type
===
PRIZE_TYPE
.
OBJECT
)
return
objectStatus
[
drawStatus
]
if
(
type
===
PRIZE_TYPE
.
ENAME
&&
drawStatus
===
DRAW_STATUS
.
SUCCESS
&&
!
useUrl
)
return
PRIZE_CONFIG
.
receiveBtn
if
(
type
===
PRIZE_TYPE
.
ENAME
)
return
enameStatus
[
drawStatus
]
if
(
type
!==
PRIZE_TYPE
.
OBJECT
&&
drawStatus
===
DRAW_STATUS
.
SUCCESS
&&
!
useUrl
)
return
PRIZE_CONFIG
.
receiveBtn
if
(
type
!==
PRIZE_TYPE
.
OBJECT
)
return
enameStatus
[
drawStatus
]
}
return
(
...
...
c_client/src/utils/util.js
View file @
43f76188
...
...
@@ -6,7 +6,7 @@ export const noopFn = () => { }
// 领取实物
const
getUerAddressParam
=
async
()
=>
{
const
userAddress
=
await
getUserAddress
().
catch
(
err
=>
{
commonToast
(
err
.
errorMessage
);
commonToast
(
{
content
:
err
.
errorMessage
}
);
});
if
(
!
userAddress
)
return
false
const
{
name
,
telNumber
,
provinceName
,
cityName
,
cityCode
,
countyName
,
detailInfo
,
streetName
}
=
userAddress
||
{};
...
...
@@ -58,10 +58,10 @@ export const receiveObjectPrize = async (data) => {
}
const
{
success
,
data
,
message
}
=
await
API
.
receiveObjectPrize
({
...
params
,
...
_params
})
if
(
success
)
{
commonToast
(
successMsg
)
commonToast
(
{
content
:
successMsg
}
)
resolve
(
true
)
}
else
{
commonToast
(
errorMsg
||
message
)
commonToast
(
{
content
:
errorMsg
||
message
}
)
resolve
(
false
)
}
})
...
...
@@ -71,14 +71,14 @@ export const receiveEnamePrize = async (data) => {
const
{
params
,
successMsg
,
errorMsg
}
=
data
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
const
{
success
,
data
,
message
}
=
await
API
.
receiveEnamePrize
(
params
).
catch
(
res
=>
{
commonToast
(
successMsg
||
res
.
message
)
commonToast
(
{
content
:
successMsg
||
res
.
message
}
)
resolve
(
false
)
});
if
(
success
)
{
commonToast
(
successMsg
)
commonToast
(
{
content
:
successMsg
}
)
resolve
(
true
)
}
else
{
commonToast
(
errorMsg
||
message
)
commonToast
(
{
content
:
errorMsg
||
message
}
)
resolve
(
false
)
}
})
...
...
@@ -113,14 +113,14 @@ export const receiveMemberEname = async(data) => {
if
(
result
.
businessSuccess
)
{
const
{
success
,
data
,
message
}
=
await
API
.
updateEnamePrizeReceived
({
...
ext
})
if
(
success
)
{
commonToast
(
successMsg
||
'奖品发放成功,请前往我的奖品处进行使用'
)
commonToast
(
{
content
:
successMsg
||
'奖品发放成功,请前往我的奖品处进行使用'
}
)
resolve
(
true
)
}
else
{
commonToast
(
errorMsg
||
message
)
commonToast
(
{
content
:
errorMsg
||
message
}
)
resolve
(
false
)
}
}
else
{
commonToast
(
result
.
errorMsg
)
commonToast
(
{
content
:
result
.
errorMsg
}
)
resolve
(
false
)
}
})
...
...
@@ -129,7 +129,7 @@ export const receiveMemberEname = async(data) => {
export
const
addStat
=
async
(
activityId
,
type
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
const
result
=
await
API
.
addStat
({
activityId
,
type
}).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
);
commonToast
(
{
content
:
res
&&
res
.
message
}
);
});
if
(
result
&&
result
.
success
)
{
resolve
(
true
)
...
...
c_client/yarn.lock
View file @
43f76188
...
...
@@ -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.
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==
tbcc-sdk-ts@^1.0.
9
:
version "1.0.
9
"
resolved "https://registry.yarnpkg.com/tbcc-sdk-ts/-/tbcc-sdk-ts-1.0.
9.tgz#36eedaa5f2d164c5e431cfe027dd8241d7622576
"
integrity sha512-
g4Rr6thIurH+fWlgaF4y8/aXu0ViVYoAzrZG7Rji5CguzDuZ2L8lH/uXCAzYtNXBmnB7IvtkR2i11xxe1YI8D
w==
optionalDependencies:
"@types/lodash" "^4.14.160"
"@types/node" "^14.6.0"
...
...
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