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
4e1b3453
Commit
4e1b3453
authored
Sep 09, 2021
by
mqf_0707
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化任务类型等
parent
e64e572b
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
48 additions
and
40 deletions
+48
-40
GoodsList.jsx
c_client/src/components/_tb_comps/GoodsList/GoodsList.jsx
+7
-7
browse.config.js
c_client/src/config/browse.config.js
+1
-1
cart.config.js
c_client/src/config/cart.config.js
+3
-2
collect.config.js
c_client/src/config/collect.config.js
+3
-2
help.config.js
c_client/src/config/help.config.js
+1
-1
order.config.js
c_client/src/config/order.config.js
+1
-1
task.config.js
c_client/src/config/task.config.js
+12
-12
useTasks.js
c_client/src/hooks/useTasks.js
+9
-5
cartGoods.jsx
c_client/src/pages/packageGood/cartGoods/cartGoods.jsx
+3
-2
collectGoods.jsx
c_client/src/pages/packageGood/collectGoods/collectGoods.jsx
+7
-6
orderGoods.jsx
c_client/src/pages/packageGood/orderGoods/orderGoods.jsx
+1
-1
No files found.
c_client/src/components/_tb_comps/GoodsList/GoodsList.jsx
View file @
4e1b3453
...
...
@@ -10,7 +10,7 @@ function GoodsList(props) {
goodsList
=
[],
task
=
{
itemId
:
'617724147979,617724563528,617300295119'
,
taskType
:
'browse
Goods
'
,
taskType
:
'browse'
,
image
:
{
collect
:
'//yun.dui88.com/taobaomini/clientCTest/goods_collection@2x.png'
,
no_collect
:
'//yun.dui88.com/taobaomini/clientCTest/collection_no_collect@2x.png'
,
...
...
@@ -25,7 +25,7 @@ function GoodsList(props) {
const
goToGoodsDetail
=
async
(
item
)
=>
{
const
{
taskType
}
=
task
const
{
itemId
}
=
item
if
(
taskType
===
'browse
Goods
'
)
{
if
(
taskType
===
'browse'
)
{
onOpenDetail
&&
onOpenDetail
(
itemId
)
}
...
...
@@ -38,8 +38,8 @@ function GoodsList(props) {
}
// 收藏按钮
const
getCollectStyle
=
(
collected
)
=>
{
return
classnames
(
styles
[
'item__price-collect'
],{
[
`
${
styles
[
'item__price-
no-
collect'
]}
`
]:
collected
return
classnames
(
styles
[
'item__price-
no-
collect'
],{
[
`
${
styles
[
'item__price-collect'
]}
`
]:
collected
})
}
return
(
...
...
@@ -56,10 +56,10 @@ function GoodsList(props) {
<
View
className=
{
styles
[
'item__price'
]
}
>
<
View
className=
{
styles
[
'item__price-num'
]
}
><
text
>
¥
</
text
>
{
item
.
price
}
</
View
>
{
task
.
taskType
===
'collectGoods'
&&
task
?.
hasCollectIcon
&&
<
View
onClick=
{
()
=>
goToCollectGoods
(
item
)
}
className=
{
()
=>
getCollectStyle
(
item
.
collected
)
}
className=
{
getCollectStyle
(
item
.
collected
)
}
>
<
Image
mode=
'scaleToFill'
src=
{
item
.
collected
?
task
.
image
.
collect
:
task
.
image
.
no_collect
}
/>
</
View
>
...
...
c_client/src/config/browse.config.js
View file @
4e1b3453
export
const
BROWSE_CONFIG
=
{
taskType
:
'browse
Goods
'
,
taskType
:
'browse'
,
type
:
'01'
,
bg
:
'//yun.dui88.com/taobaomini/clientCTest/goods_bg@2x.png'
,
head
:
{
...
...
c_client/src/config/cart.config.js
View file @
4e1b3453
export
const
CART_CONFIG
=
{
taskType
:
'
cartGoods
'
,
taskType
:
'
addCart
'
,
type
:
1
,
// 1 单个商品可重复完成 2 单个商品只可完成一次
bg
:
'//yun.dui88.com/taobaomini/clientCTest/goods_bg@2x.png'
,
head
:
{
...
...
@@ -11,7 +11,8 @@ export const CART_CONFIG = {
collect
:
'//yun.duiba.com.cn/taobaomini/clientCTest/goods_collection@2x.png'
,
no_collect
:
'//yun.duiba.com.cn/taobaomini/clientCTest/collection_no_collect@2x.png'
,
},
color
:
'#181818'
color
:
'#181818'
,
hasCollectIcon
:
true
//是否展示收藏icon
}
// 任务完成类型
export
const
CART_TYPE
=
{
...
...
c_client/src/config/collect.config.js
View file @
4e1b3453
export
default
{
taskType
:
'collect
Goods
'
,
taskType
:
'collect'
,
type
:
'01'
,
bg
:
'//yun.dui88.com/taobaomini/clientCTest/goods_bg@2x.png'
,
head
:
{
...
...
@@ -11,5 +11,6 @@ export default {
collect
:
'//yun.duiba.com.cn/taobaomini/clientCTest/goods_collection@2x.png'
,
no_collect
:
'//yun.duiba.com.cn/taobaomini/clientCTest/collection_no_collect@2x.png'
},
color
:
'#181818'
color
:
'#181818'
,
hasCollectIcon
:
true
//是否展示收藏icon
}
\ No newline at end of file
c_client/src/config/help.config.js
View file @
4e1b3453
...
...
@@ -11,7 +11,7 @@ export const HELP_MODAL_SHOW = {
}
// 助力配置
export
const
HELP_CONFIG
=
{
KEY
:
'invite
s
'
,
KEY
:
'invite'
,
HELP
:
{
width
:
639
,
height
:
730
,
...
...
c_client/src/config/order.config.js
View file @
4e1b3453
export
default
{
taskType
:
'order
Goods
'
,
taskType
:
'order'
,
type
:
'01'
,
bg
:
'//yun.dui88.com/taobaomini/clientCTest/goods_bg@2x.png'
,
head
:
{
...
...
c_client/src/config/task.config.js
View file @
4e1b3453
...
...
@@ -30,13 +30,13 @@ export const TASK_CONFIG = {
icons
:
{
// 任务图标
follow
:
'//yun.duiba.com.cn/baicaoweiFarmer/follow.png'
,
member
:
'//yun.duiba.com.cn/baicaoweiFarmer/memberStar1.png'
,
invite
s
:
'//yun.duiba.com.cn/baicaoweiFarmer/invites.png'
,
jump
Link
:
'//yun.duiba.com.cn/baicaoweiFarmer/browseGoodsLink.png'
,
browse
Goods
:
'//yun.duiba.com.cn/baicaoweiFarmer/browseGoods.png'
,
order
Goods
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
,
collect
Goods
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
,
invite
:
'//yun.duiba.com.cn/baicaoweiFarmer/invites.png'
,
jump
:
'//yun.duiba.com.cn/baicaoweiFarmer/browseGoodsLink.png'
,
browse
:
'//yun.duiba.com.cn/baicaoweiFarmer/browseGoods.png'
,
order
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
,
collect
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
,
sign
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
,
exchange
Credits
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
,
exchange
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
,
share
:
'//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png'
},
commonTxt
:
{
...
...
@@ -46,18 +46,18 @@ export const TASK_CONFIG = {
},
doTxt
:
{
follow
:
'立即关注'
,
invite
s
:
'去邀请'
,
invite
:
'去邀请'
,
member
:
'1秒入会'
,
sign
:
'立即签到'
,
jump
Link
:
'去完成'
,
browse
Goods
:
'去完成'
,
order
Goods
:
'去完成'
,
collect
Goods
:
'去完成'
jump
:
'去完成'
,
browse
:
'去完成'
,
order
:
'去完成'
,
collect
:
'去完成'
},
successMsg
:
'领取成功,奖励值+'
,
rewardMsg
:
'抽盒次数+'
,
rewardsKey
:
'totalHotValue'
,
browseGoodType
:
'browse
Goods
'
,
// 临时使用 browse | browseGoods
browseGoodType
:
'browse'
,
// 临时使用 browse | browseGoods
isMock
:
false
,
// 是否使用mock数据
jumpType
:
1
,
// 1 跳转浏览15s 才算完成 2 跳转即算完成
browseTime
:
15
,
// 浏览时间
...
...
c_client/src/hooks/useTasks.js
View file @
4e1b3453
...
...
@@ -90,7 +90,7 @@ export function useTasks(props) {
}
doCompleteTaskHandle
(
key
,
isVip
)
},
invite
s
:
()
=>
showSharePanel
(),
invite
:
()
=>
showSharePanel
(),
follow
:
async
()
=>
{
// 已关注店铺直接完成任务
const
isFollow
=
await
checkShopFavoredStatus
(
config
.
sellerId
)
...
...
@@ -106,7 +106,7 @@ export function useTasks(props) {
}
},
// 跳转任务 https://www.feizhu.com
jump
Link
:
async
()
=>
{
jump
:
async
()
=>
{
navigateToOutside
(
url
)
if
(
jumpType
===
2
)
{
doCompleteTaskHandle
(
key
)
...
...
@@ -116,12 +116,12 @@ export function useTasks(props) {
}
// await API.addStat({ type: 'BROWSE_LIVE'})
},
browse
Goods
:
async
()
=>
{
browse
:
async
()
=>
{
app
.
isFlashTask
=
true
if
(
browseType
===
BROSE_GOOD_TYPE
.
PAGE
)
preBrowseTime
.
current
=
Date
.
now
()
navigateTo
(
`/pages/packageGood/browseGoods/browseGoods?itemIds=
${
itemIds
}
&keepTime=
${
keepTime
}
`
)
},
order
Goods
:
async
()
=>
{
order
:
async
()
=>
{
app
.
isFlashTask
=
true
if
(
orderType
===
ORDER_GOOD_TYPE
.
PAGE
)
{
navigateTo
(
`/pages/packageGood/orderGoods/orderGoods?itemIds=
${
itemIds
}
`
)
...
...
@@ -129,10 +129,14 @@ export function useTasks(props) {
await
navigateToTaobaoPage
(
SHOP_ID
)
}
},
collect
Goods
:
async
()
=>
{
collect
:
async
()
=>
{
app
.
isFlashTask
=
true
navigateTo
(
`/pages/packageGood/collectGoods/collectGoods?itemIds=
${
itemIds
}
`
)
},
addCart
:
async
()
=>
{
app
.
isFlashTask
=
true
navigateTo
(
`/pages/packageGood/cartGoods/cartGoods?itemIds=
${
itemIds
}
`
)
},
sign
:
()
=>
doCompleteTaskHandle
(
key
),
share
:
()
=>
{
showSharePanel
();
...
...
c_client/src/pages/packageGood/cartGoods/cartGoods.jsx
View file @
4e1b3453
...
...
@@ -9,6 +9,7 @@ import API from '@/api'
import
{
useThrottle
}
from
'@/hooks/useThrottle'
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
...
...
@@ -25,7 +26,7 @@ function CartGoodsPage() {
const
getGoodsList
=
async
()
=>
{
const
{
data
}
=
await
API
.
getCollectGoods
({
key
:
CART_CONFIG
.
taskType
,
itemIds
})
setGoodsList
(
data
?.
list
||
[])
data
?.
list
&&
setGoodsList
(
data
?.
list
||
[])
}
// 加入购物车 // 对应itemId为 574141925233 skuId为4018047819826 数量为4
const
onCompleteTask
=
useThrottle
(
async
(
itemId
,
collected
)
=>
{
...
...
@@ -54,7 +55,7 @@ function CartGoodsPage() {
<
TitleImg
config=
{
CART_CONFIG
.
head
}
/>
</
View
>
<
View
className=
{
styles
[
'page-content__list'
]
}
>
<
GoodsList
goodsList=
{
goodsList
}
task=
{
CART_CONFIG
}
on
OpenDetail
=
{
(
itemId
,
collected
)
=>
onCompleteTask
(
itemId
,
collected
)
}
/>
<
GoodsList
goodsList=
{
goodsList
}
task=
{
CART_CONFIG
}
on
CompleteTask
=
{
(
itemId
,
collected
)
=>
onCompleteTask
(
itemId
,
collected
)
}
/>
</
View
>
</
ContainerFit
>
)
...
...
c_client/src/pages/packageGood/collectGoods/collectGoods.jsx
View file @
4e1b3453
...
...
@@ -7,9 +7,10 @@ import { useRouter } from '@tarojs/taro'
import
tbccTs
from
'tbcc-sdk-ts'
import
API
from
'@/api'
import
{
useThrottle
}
from
'@/hooks/useThrottle'
const
{
commonToast
}
=
tbccTs
.
tb
const
{
commonToast
,
checkGoodsCollectedStatus
,
collectGoods
}
=
tbccTs
.
tb
import
styles
from
'./collectGoods.module.less'
import
COLLECT_CONFIG
from
'@/config/collect.config'
import
{
GOOD_LIST
}
from
'@/mock'
function
CollectGoodsPage
()
{
const
router
=
useRouter
()
...
...
@@ -24,12 +25,12 @@ function CollectGoodsPage() {
const
getGoodsList
=
async
()
=>
{
const
{
data
}
=
await
API
.
getCollectGoods
({
key
:
COLLECT_CONFIG
.
taskType
,
itemIds
})
setGoodsList
(
data
?.
list
||
[])
data
?.
list
&&
setGoodsList
(
data
?.
list
||
[])
}
const
onCompleteTask
=
useThrottle
(
async
(
itemId
,
collected
)
=>
{
const
collectFn
=
async
()
=>
{
const
{
success
}
=
await
API
.
completeTask
({
key
:
taskType
,
itemId
})
const
{
success
}
=
await
API
.
completeTask
({
key
:
COLLECT_CONFIG
.
taskType
,
itemId
})
if
(
success
)
{
collectFlag
.
current
=
true
getGoodsList
()
...
...
@@ -47,12 +48,12 @@ function CollectGoodsPage() {
}
// 判断是否活动外已收藏商品
const
isCollected
=
await
checkGoodsCollectedStatus
(
+
itemId
)
if
(
isCollected
)
{
if
(
String
(
isCollected
)
===
'true'
)
{
collectFn
()
return
;
}
const
result
=
await
collectGoods
(
+
itemId
)
if
(
result
)
{
if
(
result
&&
result
?.
success
)
{
collectFn
()
return
;
}
...
...
@@ -64,7 +65,7 @@ function CollectGoodsPage() {
<
TitleImg
config=
{
COLLECT_CONFIG
.
head
}
/>
</
View
>
<
View
className=
{
styles
[
'page-content__list'
]
}
>
<
GoodsList
goodsList=
{
goodsList
}
task=
{
COLLECT_CONFIG
}
on
OpenDetail
=
{
(
itemId
,
collected
)
=>
onCompleteTask
(
itemId
,
collected
)
}
/>
<
GoodsList
goodsList=
{
goodsList
}
task=
{
COLLECT_CONFIG
}
on
CompleteTask
=
{
(
itemId
,
collected
)
=>
onCompleteTask
(
itemId
,
collected
)
}
/>
</
View
>
</
ContainerFit
>
)
...
...
c_client/src/pages/packageGood/orderGoods/orderGoods.jsx
View file @
4e1b3453
...
...
@@ -20,7 +20,7 @@ function OrderGoodsPage() {
<
TitleImg
config=
{
ORDER_CONFIG
.
head
}
/>
</
View
>
<
View
className=
{
styles
[
'page-content__list'
]
}
>
<
GoodsList
goodsList=
{
data
?.
list
||
[]
}
task=
{
ORDER_CONFIG
}
onOpenDetail=
{
(
itemId
,
isBrowsed
)
=>
onOpenDetail
(
itemId
,
isBrowsed
)
}
/>
<
GoodsList
goodsList=
{
data
?.
list
||
[]
}
task=
{
ORDER_CONFIG
}
/>
</
View
>
</
ContainerFit
>
...
...
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