Commit 4e1b3453 authored by mqf_0707's avatar mqf_0707

优化任务类型等

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