Commit 53e12dca authored by 王能飞's avatar 王能飞

Merge branch 'c_client_taro-pack' into 'c_client_taro'

优化任务类型等

See merge request !42
parents 352ed039 ea5c1696
......@@ -67,7 +67,7 @@ const Barrage = props => {
useEffect(() => {
createData()
return () => {}
}, [])
}, [ dataList ])
return (
<View id='barrage_wrap' style={`width:${width / 100}rem`} className={styles['barrage-wrap']}>
......
......@@ -10,7 +10,7 @@ function GoodsList(props) {
goodsList = [],
task = {
itemId: '617724147979,617724563528,617300295119',
taskType: 'browseGoods',
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 === 'browseGoods') {
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>
......
......@@ -21,7 +21,7 @@ const ProgressNode = memo(props => {
const { maxLevel, nodeClassName } = useMemo(
() => useContext(ProgressContext),
ProgressContext
[ ProgressContext ]
)
const getNodeStyle = classnames(styles['defualt-progress-node'], {
......
......@@ -22,7 +22,7 @@ const Progress = memo(props => {
const LevelList = useMemo(() => {
return levelList
}, levelList)
}, [ levelList ])
// 合并全局配置
const mergeConfigToDefault = useCallback(config => {
......
export const BROWSE_CONFIG = {
taskType: 'browseGoods',
taskType: 'browse',
type: '01',
bg: '//yun.dui88.com/taobaomini/clientCTest/goods_bg@2x.png',
head: {
......
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 = {
......
export default {
taskType: 'collectGoods',
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
......@@ -11,7 +11,7 @@ export const HELP_MODAL_SHOW = {
}
// 助力配置
export const HELP_CONFIG = {
KEY: 'invites',
KEY: 'invite',
HELP: {
width: 639,
height: 730,
......
export default {
taskType: 'orderGoods',
taskType: 'order',
type: '01',
bg: '//yun.dui88.com/taobaomini/clientCTest/goods_bg@2x.png',
head: {
......
......@@ -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',
invites: '//yun.duiba.com.cn/baicaoweiFarmer/invites.png',
jumpLink: '//yun.duiba.com.cn/baicaoweiFarmer/browseGoodsLink.png',
browseGoods: '//yun.duiba.com.cn/baicaoweiFarmer/browseGoods.png',
orderGoods: '//yun.duiba.com.cn/baicaoweiFarmer/orderGoods.png',
collectGoods: '//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',
exchangeCredits: '//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: '立即关注',
invites: '去邀请',
invite: '去邀请',
member: '1秒入会',
sign: '立即签到',
jumpLink: '去完成',
browseGoods: '去完成',
orderGoods: '去完成',
collectGoods: '去完成'
jump: '去完成',
browse: '去完成',
order: '去完成',
collect: '去完成'
},
successMsg: '领取成功,奖励值+',
rewardMsg: '抽盒次数+',
rewardsKey: 'totalHotValue',
browseGoodType: 'browseGoods',// 临时使用 browse | browseGoods
browseGoodType: 'browse',// 临时使用 browse | browseGoods
isMock: false, // 是否使用mock数据
jumpType: 1, // 1 跳转浏览15s 才算完成 2 跳转即算完成
browseTime: 15, // 浏览时间
......
......@@ -90,7 +90,7 @@ export function useTasks(props) {
}
doCompleteTaskHandle(key,isVip)
},
invites: () => showSharePanel(),
invite: () => showSharePanel(),
follow: async () => {
// 已关注店铺直接完成任务
const isFollow = await checkShopFavoredStatus(config.sellerId)
......@@ -106,7 +106,7 @@ export function useTasks(props) {
}
},
// 跳转任务 https://www.feizhu.com
jumpLink: async() => {
jump: async() => {
navigateToOutside(url)
if (jumpType === 2) {
doCompleteTaskHandle(key)
......@@ -116,12 +116,12 @@ export function useTasks(props) {
}
// await API.addStat({ type: 'BROWSE_LIVE'})
},
browseGoods: 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}`)
},
orderGoods: 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)
}
},
collectGoods: 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();
......
......@@ -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} onOpenDetail={(itemId,collected) => onCompleteTask(itemId,collected)} />
<GoodsList goodsList={goodsList} task={CART_CONFIG} onCompleteTask={(itemId,collected) => onCompleteTask(itemId,collected)} />
</View>
</ContainerFit>
)
......
......@@ -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} onOpenDetail={(itemId,collected) => onCompleteTask(itemId,collected)} />
<GoodsList goodsList={goodsList} task={COLLECT_CONFIG} onCompleteTask={(itemId,collected) => onCompleteTask(itemId,collected)} />
</View>
</ContainerFit>
)
......
......@@ -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>
......
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