Commit 675b3a91 authored by qinhaitao's avatar qinhaitao

feat:formate

parent c8973039
export default {
navigationBarTitleText: '我的奖品',
navigationBarTitleText: '收藏商品',
enableSkia: 'true',
allowsBounceVertical: 'NO',
enableShareAppMessage: true
......
import React, { useEffect, useState } from 'react'
import React from 'react'
import { View } from '@tarojs/components'
import GoodsPage from '@/components/GoodsPage/GoodsPage'
import { useRequest } from '@/hooks/useRequest'
import { useDidShow, useRouter } from '@tarojs/taro'
import { useRouter } from '@tarojs/taro'
import tbccTs from '@/tbcc-sdk-ts'
import API from '@/api'
const { throttleHandle } = tbccTs.utils;
const { commonToast, favorShop, navigateTo, navigateToOutside, showSharePanel } = tbccTs.tb;
import { useThrottle } from '@/hooks/useThrottle'
const { commonToast } = tbccTs.tb
const browseConfig = {
taskType: 'collectGoods',
......@@ -17,33 +18,26 @@ const browseConfig = {
title: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_title@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',
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png',
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png'
},
color: '#181818'
}
function CollectGoodsPage() {
const [ goodsList, setGoodsList ] = useState([])
const router = useRouter()
const { itemIds } = router?.params
const { data, success } = useRequest(API.getCollectGoodsList,{ itemIds })
useEffect(() => {
success && setGoodsList(data?.list)
},[ success ])
const { data } = useRequest(API.getCollectGoodsList, { itemIds })
const onCompleteTask = async (taskType,itemId) => {
let { success, data } = await API.doCompleteTask({ taskType, itemId }).catch(res => {
res && commonToast(res.message)
}) || {}
if(success) {
const onCompleteTask = useThrottle(async(taskType, itemId) => {
const { success } = await API.doCompleteTask({ taskType, itemId })
if (success) {
commonToast('收藏成功')
}
}
})
return (
<View>
<GoodsPage goodsList={goodsList} task={browseConfig} onCompleteTask={() => onCompleteTask} />
<GoodsPage goodsList={data?.list || []} task={browseConfig} onCompleteTask={() => onCompleteTask} />
</View>
)
}
......
export default {
navigationBarTitleText: '我的奖品',
navigationBarTitleText: '下单商品',
enableSkia: 'true',
allowsBounceVertical: 'NO',
enableShareAppMessage: true
......
......@@ -2,11 +2,8 @@ import React, { useEffect, useState } from 'react'
import { View } from '@tarojs/components'
import GoodsPage from '@/components/GoodsPage/GoodsPage'
import { useRequest } from '@/hooks/useRequest'
import { useDidShow, useRouter } from '@tarojs/taro'
import tbccTs from '@/tbcc-sdk-ts'
import { useRouter } from '@tarojs/taro'
import API from '@/api'
const { throttleHandle } = tbccTs.utils;
const { commonToast, favorShop, navigateTo, navigateToOutside, showSharePanel } = tbccTs.tb;
const browseConfig = {
taskType: 'orderGoods',
......@@ -17,24 +14,19 @@ const browseConfig = {
title: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_title@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',
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png',
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png'
},
color: '#181818'
}
function OrderGoodsPage() {
const [ goodsList, setGoodsList ] = useState([])
const router = useRouter()
const { itemIds } = router?.params
const { data, success } = useRequest(API.getItemListByItemIds,{ itemIds })
useEffect(() => {
success && setGoodsList(data?.list)
},[ success ])
const { data } = useRequest(API.getItemListByItemIds, { itemIds })
return (
<View>
<GoodsPage goodsList={goodsList} task={browseConfig} />
<GoodsPage goodsList={data?.list || []} task={browseConfig} />
</View>
)
}
......
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