Commit 2dc09458 authored by mqf_0707's avatar mqf_0707

wnf

parent 1663c492
......@@ -20735,89 +20735,6 @@
"prop-types": "^15.7.2"
}
},
"tbcc-sdk-ts": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/tbcc-sdk-ts/-/tbcc-sdk-ts-1.0.6.tgz",
"integrity": "sha512-CR4XHPHIof6krOBS2BKWpfQUUWIIuPVqMQ1cisllz4rkOSYYzwllbCY/MoPpRiPvMFRu4UdnxAIEGp7TJeDN2Q==",
"requires": {
"@types/lodash": "^4.14.160",
"@types/node": "^14.6.0",
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"prettier": "^2.0.5"
},
"dependencies": {
"@typescript-eslint/experimental-utils": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz",
"integrity": "sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw==",
"optional": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/types": "3.10.1",
"@typescript-eslint/typescript-estree": "3.10.1",
"eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0"
}
},
"@typescript-eslint/parser": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.10.1.tgz",
"integrity": "sha512-Ug1RcWcrJP02hmtaXVS3axPPTTPnZjupqhgj+NnZ6BCkwSImWk/283347+x9wN+lqOdK9Eo3vsyiyDHgsmiEJw==",
"optional": true,
"requires": {
"@types/eslint-visitor-keys": "^1.0.0",
"@typescript-eslint/experimental-utils": "3.10.1",
"@typescript-eslint/types": "3.10.1",
"@typescript-eslint/typescript-estree": "3.10.1",
"eslint-visitor-keys": "^1.1.0"
}
},
"@typescript-eslint/typescript-estree": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz",
"integrity": "sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w==",
"optional": true,
"requires": {
"@typescript-eslint/types": "3.10.1",
"@typescript-eslint/visitor-keys": "3.10.1",
"debug": "^4.1.1",
"glob": "^7.1.6",
"is-glob": "^4.0.1",
"lodash": "^4.17.15",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
}
},
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"optional": true,
"requires": {
"yallist": "^4.0.0"
}
},
"prettier": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz",
"integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==",
"optional": true
},
"semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"optional": true,
"requires": {
"lru-cache": "^6.0.0"
}
}
}
},
"term-size": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz",
......
......@@ -20,40 +20,32 @@ const request = tbccRequest({
// api handle 列表
const apiList = {
...capi,
getActivityBaseInfoById: {
handle: 'getActivityBaseInfoById',
method: 'GET',
isShowLoading: false
},
login: 'login',
getTaskList: 'getTaskList',
completeTask: 'completeTask',
receiveTask: 'receiveTask',
addStat: 'addStat',
doHelp: 'doHelp',
drawLotteryPrize: 'drawLotteryPrize',
resetTest: 'resetTest',
getShareInfo: 'getShareInfo',
getVipInfo: 'getVipInfo',
getCollectGoodsList: 'getCollectGoodsList',
getItemListByItemIds: 'getItemListByItemIds',
updateEnamePrizeReceived: 'updateEnamePrizeReceived', // 会员权益领取
getMyPrizeList: 'getMyAwardsList',
receiveObjectPrize: {
handle: 'recieveObjectPrize',
handle: 'receiveObjectPrize',
method: 'GET',
isShowLoading: false,
toastError: false
},
receiveEnamePrize: {
handle: 'recieveEnamePrize',
handle: 'receiveEnamePrize',
method: 'GET',
isShowLoading: false,
toastError: false
},
getActivityBaseInfoById: {
handle: 'getActivityBaseInfoById',
method: 'GET',
isShowLoading: false
},
login: 'login',
addStat: 'addStat',
drawLottery: 'drawLottery',
getShareInfo: 'getShareInfo',
getCollectGoods: 'getCollectGoods',
updateEnamePrizeReceived: 'updateEnamePrizeReceived', // 会员权益领取
getRotatePrizeListInfo:'getRotatePrizeListInfo',//获取奖品列表接口,暂未实现
drawRotatePrize:'drawRotatePrize',//大转盘抽奖接口,暂未实现
exchangePrize: 'exchangePrize' // 兑换奖品
}
// 生成API
......
### 设计稿适配方案
#### 入参
| 参数 | 描述 |
| --- | --- | --- |
|bg|背景图(1624px),非必填|
|hasFitPsd|内容块是否对标设计稿(750px * 1624px),非必填|
#### 使用
``` jsx
import ContainerFit from '@/components/_base/ContainerFit/ContainerFit'
<ContainerFit hasFitPsd={true} bg={''}>
</ContainerFit>
```
\ No newline at end of file
import { View } from '@tarojs/components'
import React, { useState } from 'react'
import Overlay from '../Overlay/Overlay'
import styles from './modal.module.less'
import classnames from 'classnames'
export default function Modal(props) {
const { closePostion = 'top-right', onClose = () => { }, top = '40%', hideCloseButton = false, closeOnClickOverlay = false, closePos = { right: 0, top: -30 } } = props
......
import React, { useState, useEffect,useRef } from "react";
import React, { useState, useEffect,useRef, useMemo, useCallback } from "react";
import { View, Image, Text, Swiper, SwiperItem } from "@tarojs/components";
import './SwiperView.less'
import Taro,{showToast,redirectTo,navigateTo} from '@tarojs/taro'
// import {useCallbackState} from '@/hooks/useSyncState'
export const EASING_WAYS = {
'DEFAULT':'default',
'LINEAR':'linear',
......@@ -17,15 +19,14 @@ const SwiperView = (props) => {
*/
const {
swiperList=[],
isSpecial=true,
easingFunction=`${EASING_WAYS.LINEAR}`,
circular=true,
autoplay=true,
autoplay=false,
vertical=false,
duration=1000,
interval=1500,
disableTouch=false,
swiperGroup={width:300,height:300,overflow:''},
swiperGroup={width:300,height:300,overflow:'visible'},
swiperContent={width:250,height:300,backgroundColor:'#fff',backgroundImage:'',borderRadius:25},
imgContent={width:200,height:200},
textContent={width:200,height:60},
......@@ -34,27 +35,40 @@ const SwiperView = (props) => {
} = props;
const [currentIndex, setCurrentIndex] = useState(0);
const indexref = useRef(0)
// const index = useMemo(()=>{
// return currentIndex;
// },currentIndex)
/**
* @description onchange事件
* @param {*} e
*/
const swiperChange = e => {
// console.log("e", e);
console.log("e", e);
console.log('swiperChange-----currentindex',currentIndex,indexref.current,e.detail.current);
setCurrentIndex(e.detail.current);
};
const onTransition = (e) => {
// console.warn(e)
// setCurrentIndex(indexref.current);
}
/**
* @description 入场/出场动画
* @param {*} index 数组索引值
* @returns 返回类名
*/
const useCustomAni = (i) => {
const useCustomAni =((i) => {
return `${((currentIndex < i && ((i !== swiperList.length - 1)||currentIndex!==0)) || ((currentIndex === swiperList.length - 1) && i == 0 ))
? 'item_right'
:
(((currentIndex > i && (i !== 0 || currentIndex !== swiperList.length - 1)) || (currentIndex !== 0 && i !== swiperList.length - 1)) ? 'item_left' : 'item_middle')
}`
}
})
/**
* @description 获取当前卡片详情之类
......@@ -74,19 +88,31 @@ const SwiperView = (props) => {
* @description
*/
const turnRound = (type) => {
const turnRound = ((type) => {
const motion = {
[motionType.LEFT]:()=>{
setCurrentIndex(currentIndex==0 ? swiperList.length - 1 : (currentIndex - 1))
if(indexref.current === 0) {
setCurrentIndex(swiperList.length - 1)
indexref.current = swiperList.length - 1
return;
}
setCurrentIndex(indexref.current - 1)
indexref.current = indexref.current - 1
console.log('left----',currentIndex,indexref.current);
},
[motionType.RIGHT]:()=>{
setCurrentIndex(currentIndex == swiperList.length - 1 ? 0 : (currentIndex + 1))
setTimeout(() => {
setCurrentIndex((indexref.current == (swiperList.length - 1)) ? 0 : (indexref.current + 1))
indexref.current = (indexref.current == (swiperList.length - 1)) ? 0 : (indexref.current + 1)
console.log('right----',currentIndex,indexref.current);
}, 0);
}
}
motion[type]();
}
})
useEffect(()=>{
console.log('cur----',currentIndex);
......@@ -100,12 +126,13 @@ const SwiperView = (props) => {
overflow:'hidden'
}}
>
{/* <View className='left_btn' onTap={()=>turnRound('LEFT')}>&lt;&lt;</View> */}
<View className='left_btn' onTap={()=>turnRound('LEFT')}>&lt;&lt;</View>
<Swiper
className="swiper_group"
current={currentIndex}
easingFunction={easingFunction}
onChange={swiperChange}
onTransition={(e) => onTransition(e)}
circular={circular}
vertical={vertical}
autoplay={autoplay}
......@@ -122,7 +149,7 @@ const SwiperView = (props) => {
swiperList.map((item, i) => (
<SwiperItem>
<View
className={`scroll_item ${i === currentIndex && isSpecial ? "current_item" : ""} ${useCustomAni(i)}`}
className={`scroll_item ${i === currentIndex ? "current_item" : ""} ${useCustomAni(i)}`}
style={{
width:`${swiperContent.width/100}rem`,
height:`${swiperContent.height/100}rem`,
......@@ -167,7 +194,7 @@ const SwiperView = (props) => {
))}
</Swiper>
{/* <View className='right_btn' onTap={()=>turnRound('RIGHT')}>&gt;&gt;</View> */}
<View className='right_btn' onTap={()=>turnRound('RIGHT')}>&gt;&gt;</View>
</View>
);
};
......
.scroll_container{
// width: 450px;
// overflow: hidden;
margin: 0 auto;
// display: flex;
// justify-content: space-around;
// align-items: center;
// width: 450px;
// overflow: hidden;
margin: 0 auto;
// display: flex;
// justify-content: space-around;
// align-items: center;
.swiper_group {
margin: 0 auto;
position: relative;
.swiper_group {
margin: 0 auto;
position: relative;
swiper-item {
width: 300px;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
swiper-item {
width: 300px;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
.image-property(cover, center center);
.image-property(cover, center center);
border: 1px solid cyan;
box-sizing: border-box;
}
.scroll_item {
// width: 300px;
margin: 0 auto;
position: relative;
border-radius: 20px;
.image-property(cover, top center);
.checkPic {
width: 60px;
height: 60px;
border-radius: 50%;
position: absolute;
right: 40px;
top: 40px;
}
.scroll_item {
// width: 300px;
margin: 0 auto;
position: relative;
border-radius: 20px;
.image-property(cover, top center);
.checkPic {
width: 60px;
height: 60px;
border-radius: 50%;
position: absolute;
right: 40px;
top: 40px;
.item_img_content {
width: 100%;
.img {
margin: 20px auto 10px;
display: block;
border-radius: 20px;
background-repeat: no-repeat;
background-position: top center;
}
.item_img_content {
width: 100%;
.img {
margin: 20px auto 10px;
display: block;
border-radius: 20px;
background-repeat: no-repeat;
background-position: top center;
}
.text_content{
margin: 0 auto;
box-sizing: border-box;
.text_content{
margin: 0 auto;
box-sizing: border-box;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
text-overflow: ellipsis;
overflow: hidden;
.text{
color: #232323;
text-align: center;
line-height: 30px;
font-size: 24px;
}
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
text-overflow: ellipsis;
overflow: hidden;
.text{
color: #232323;
text-align: center;
line-height: 30px;
font-size: 24px;
}
}
&.current_item {
.item_img_content {
.img{}
.text_content{
.text{}
}
}
}
&.current_item {
.item_img_content {
.img{}
.text_content{
.text{}
}
}
}
// &.item_left{
// transform: translateX(-300px);
// transition: all 1s ease;
// &.item_left{
// transform: translateX(-300px);
// transition: all 1s ease;
// }
// &.move_right{
// transform: translateX(300px);
// transition: all 1s ease;
// }
// &.item_middle{
// transform: translateX(0px);
// transition: all 1s ease;
// }
}
// }
// &.move_right{
// transform: translateX(300px);
// transition: all 1s ease;
// }
// &.item_middle{
// transform: translateX(0px);
// transition: all 1s ease;
// }
}
}
}
@keyframes movein {
from {
transform: perspective(1000px) translate3d(0,0,0) rotate3d(0, 1, 0, 25deg) scale(0.85);
transform-style: preserve-3d;
transform-origin: 45% center;
}
50%{
transform: perspective(1000px) translate3d(0,20px,0) rotate3d(0, 1, 0, 25deg) scale(0.85);
transform-style: preserve-3d;
transform-origin: 45% center;
}
to {
transform: perspective(1100px) translate3d(0,0,0) rotate3d(0, 1, 0, 0deg) scale(1);
transform-origin: 45% center;
transform-style: preserve-3d;
}
}
from {
transform: perspective(1000px) translate3d(0,0,0) rotate3d(0, 1, 0, 25deg) scale(0.85);
transform-style: preserve-3d;
transform-origin: 45% center;
}
50%{
transform: perspective(1000px) translate3d(0,20px,0) rotate3d(0, 1, 0, 25deg) scale(0.85);
transform-style: preserve-3d;
transform-origin: 45% center;
}
to {
transform: perspective(1100px) translate3d(0,0,0) rotate3d(0, 1, 0, 0deg) scale(1);
transform-origin: 45% center;
transform-style: preserve-3d;
}
}
@keyframes moveout{
from {
transform: perspective(1000px) rotate3d(0, 1, 0, 0deg) scale(1);
transform-style: preserve-3d;
transform-origin: 45% center;
}
50%{
transform: perspective(1000px) rotate3d(0, 1, 0, 25deg) scale(1);
transform-style: preserve-3d;
transform-origin: 45% center;
}
to {
transform: perspective(1200px) rotate3d(0, 1, 0, 25deg) scale(0.85);
transform-origin: 45% center;
transform-style: preserve-3d;
}
from {
transform: perspective(1000px) rotate3d(0, 1, 0, 0deg) scale(1);
transform-style: preserve-3d;
transform-origin: 45% center;
}
50%{
transform: perspective(1000px) rotate3d(0, 1, 0, 25deg) scale(1);
transform-style: preserve-3d;
transform-origin: 45% center;
}
to {
transform: perspective(1200px) rotate3d(0, 1, 0, 25deg) scale(0.85);
transform-origin: 45% center;
transform-style: preserve-3d;
}
}
@keyframes scales {
from{
transform: scale(1,1);
transform-origin: center;
}
50%{
transform: scale(1.1,1.1);
transform-origin: center;
}
to{
transform: scale(1,1);
transform-origin: center;
}
from{
transform: scale(1,1);
transform-origin: center;
}
50%{
transform: scale(1.1,1.1);
transform-origin: center;
}
to{
transform: scale(1,1);
transform-origin: center;
}
}
\ No newline at end of file
......@@ -18,7 +18,7 @@ export default function DoHelpModal(props) {
const onAuthSuccess = async () => {
const isVip = await checkIsMember()
const helpRes = await API.doHelp({ inviteId, isVip })
const helpRes = await API.completeTask({ key: HELP_CONFIG.KEY, inviteId, isVip })
if (helpRes?.success) {
commonToast('助力成功')
} else {
......@@ -38,7 +38,7 @@ export default function DoHelpModal(props) {
[HELP_MODAL_TYPE.HELP]: async () => {
// 条件不是需要新会员的情况下,直接助力
if (!newVip) {
const helpRes = await API.doHelp({ inviteId, isVip })
const helpRes = await API.completeTask({ key: HELP_CONFIG.KEY, inviteId, isVip })
if (helpRes?.success) {
commonToast('助力成功')
......@@ -59,7 +59,7 @@ export default function DoHelpModal(props) {
},
[HELP_MODAL_TYPE.FAIL]: async () => onClose(type),
[HELP_MODAL_TYPE.REWARDS]: async () => {
const { success, data } = await API.receiveTask({ taskType: 'invites' })
const { success, data } = await API.receiveTask({ key: HELP_CONFIG.KEY })
if(success && data) {
onClose(type)
}
......@@ -92,12 +92,12 @@ export default function DoHelpModal(props) {
</View>
</Modal>
{
memberModalVisible &&
<member-modal
onClose={() => closeMemberModal()}
onAuthFail={onAuthFail}
onAuthSuccess={onAuthSuccess}
/>
<member-modal
expend={memberModalVisible}
onClose={() => closeMemberModal()}
onAuthFail={onAuthFail}
onAuthSuccess={onAuthSuccess}
/>
}
</View>
)
......
......@@ -2,7 +2,9 @@
.wh(570px,398px);
position: relative;
.image-property();
.flex-col-bottom();
display: flex;
justify-content: flex-end;
flex-direction: column;
align-items: center;
}
.pos-row-center() {
......
......@@ -11,7 +11,8 @@ export const BROWSE_CONFIG = {
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png'
},
color: '#181818',
countDown: ''
countDown: '',
isMock: false, // 是否使用mock数据
}
/*
浏览页倒计时标识
......
// 助力弹窗类型
export const HELP_MODAL_TYPE = {
HELP: 1, // 邀请助力
FAIL: 2, // 助力失败
REWARDS: 3, // 助力信息展示
HELP: 'HELP', // 邀请助力
FAIL: 'FAIL', // 助力失败
REWARDS: 'REWARDS', // 助力信息展示
}
// 助力弹窗是否已弹
export const HELP_MODAL_SHOW = {
......@@ -11,7 +11,8 @@ export const HELP_MODAL_SHOW = {
}
// 助力配置
export const HELP_CONFIG = {
1: {
KEY: 'invites',
HELP: {
width: 639,
height: 730,
bg: '//yun.dui88.com/taobaomini/pike_call/m_help_bg.png',
......@@ -19,7 +20,7 @@ export const HELP_CONFIG = {
title: '您的好友正在参与XXXX\n快来一起参与吧~',
marginBottom: 80
},
2: {
FAIL: {
width: 639,
height: 701,
bg: '//yun.dui88.com/taobaomini/pike_call/m_help_bg_02.png',
......@@ -27,7 +28,7 @@ export const HELP_CONFIG = {
title: '您已是会员',
marginBottom: 80
},
3: {
REWARDS: {
width: 639,
height: 800,
bg: '//yun.dui88.com/taobaomini/pike_call/m_help_bg_03.png',
......
import { getAuthUserInfo } from 'tbcc-sdk-ts/lib/core/tbFn'
import { useEffect } from 'react'
import { commonToast } 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('点击右上角,打开授权开关,重进活动即可参与')
})
if (info) {
callback(info)
......
......@@ -20,13 +20,7 @@ const { getImgShareUrl, checkIsMember, validateActivityStatus } = tbcc.utils
import {useAudio} from '@/hooks/useAudio'
import {CLOUD_OBJ, BGMUSIC_URL} from '@/const'
import ScrollXView from '@/components/_tb_comps/ScrollXView/ScrollXView'
import SwiperView from '@/components/_tb_comps/SwiperView/SwiperView'
import RotateWheel from '@/components/_tb_comps/RotateWheel/RotateWheel'
import {prizeList} from '@/const'
import { commonToast } from 'tbcc-sdk-ts/lib/core/tb'
const INDEX_CONFIG = {
bg: '', // 背景 cloud://C4015B7CEC23CF013A78247E2852524F//火箭待机小球抖动.json
......@@ -36,51 +30,6 @@ const INDEX_CONFIG = {
taskButton: '' // 任务按钮
}
const rotateConfig = {
bg: 'https://yun.duiba.com.cn/spark/assets/8b6e920ffd09fab8f9ac2de09f9154879f4d0607.png',
ratio: 0.65,
radius: 300,
circles: 4,
divideNum: 8,
duration: 5000,
timeFunction:'ease-in-out',
nodeInfo:{
width:100,
height:100
},
imgInfo:{width:80,height:80},
showWay:'negative',//positive/negative
isShowPrizeName:true,
prizeNameWidthRatio:1.2
}
const SCROLLXVIEW_CONFIG = {
prizeList: [],
containerWidth : 200,
containerHeight : 200,
imgWidth:120,
imgHeight:120,
isShowPrizeName:true,
prizeInCenterNum:3,
marginRight:26,
backgroundColor:'#E7E7EF',
backgroundImage:''
}
const swiper_config = {
easingFunction:`linear`,
circular:true,
autoplay:false,
vertical:false,
duration:1000,
interval:1500,
disableTouch:false,
swiperGroup:{width:300,height:300,overflow:''},
swiperContent:{width:250,height:300,backgroundColor:'#fff',backgroundImage:'',borderRadius:25},
imgContent:{width:200,height:200},
textContent:{width:240,height:60}
}
function Index() {
const app = getApp()
const { activityInfo, setActivityInfoAndStatus } = useActivityInfoModel()
......@@ -155,9 +104,10 @@ function Index() {
})
// 助力弹窗 -> 其他弹窗
const handleVisibleModal = async (info) => {
const { inviteId } = info
const isVip = await checkIsMember()
// 是否为助力弹窗
if(app.inviteId && !showHelp.current) {
if(inviteId && !showHelp.current) {
setDoHelpModalVisible(true)
setHelpType(isVip? HELP_MODAL_TYPE.FAIL: HELP_MODAL_TYPE.HELP)
showHelp.current = true
......@@ -246,7 +196,7 @@ function Index() {
width='500'
height='500'
top='45%'
newVip
newVip={false}
onClose={() => setDoHelpModalVisible(false)}
/>
}
......
......@@ -23,7 +23,7 @@ function BrowseGoodsPage() {
const [accumulateTime, setAccumulateTime] = useState(+keepTime || 15)
const browserTimer = useRef(null)
const [goodsList, setGoodsList] = useState(GOOD_LIST)
const [goodsList, setGoodsList] = useState(BROWSE_CONFIG.isMock?GOOD_LIST:[])
useEffect(() => {
getGoodsList()
......@@ -35,12 +35,14 @@ function BrowseGoodsPage() {
return () => browserTimer.current && clearInterval(browserTimer.current)
}
},[goodsList])
// 获取商品列表
const getGoodsList = async () => {
const { data } = await API.getItemListByItemIds({ itemIds })
setGoodsList(data?.list || [])
const { success, data } = await API.getCollectGoods({ key: BROWSE_CONFIG.taskType, itemIds })
if(success && !BROWSE_CONFIG.isMock ) {
setGoodsList(data?.list || [])
}
}
// 页面显示
useDidShow(() => {
// 重新回到页面开启倒计时
if(browseType === BROSE_GOOD_TYPE.PAGE && startTimer && usePercent.current < +browseTime) {
......
......@@ -24,7 +24,7 @@ function CartGoodsPage() {
}, [])
const getGoodsList = async () => {
const { data } = await API.getCollectGoodsList({ itemIds })
const { data } = await API.getCollectGoods({ key: CART_CONFIG.taskType, itemIds })
setGoodsList(data?.list || [])
}
// 加入购物车 // 对应itemId为 574141925233 skuId为4018047819826 数量为4
......
......@@ -23,7 +23,7 @@ function CollectGoodsPage() {
}, [])
const getGoodsList = async () => {
const { data } = await API.getCollectGoodsList({ itemIds })
const { data } = await API.getCollectGoods({ key: COLLECT_CONFIG.taskType, itemIds })
setGoodsList(data?.list || [])
}
......
......@@ -12,7 +12,7 @@ import ORDER_CONFIG from '@/config/order.config'
function OrderGoodsPage() {
const router = useRouter()
const { itemIds } = router?.params
const { data } = useRequest(API.getItemListByItemIds, { itemIds })
const { data } = useRequest(API.getCollectGoods, { key: ORDER_CONFIG.taskType, itemIds })
return (
<ContainerFit bg={ORDER_CONFIG.bg}>
......
......@@ -10,7 +10,7 @@ import { checkIsMember } from 'tbcc-sdk-ts/lib/utils'
import { dateFormatter } from '@/utils/date'
import styles from './myPrize.module.less'
import { useDidHide, getApp } from '@tarojs/taro'
import { receiveEnamePrize, receiveObjectPrize, receiveMemberEname } from '@/utils/util'
import { receiveEnamePrize, receiveObjectPrize, receiveMemberEname } from 'tbcc-sdk-ts/lib/request/capiFn'
import config from '@/config/config'
import { PRIZE_CONFIG, DRAW_STATUS, PRIZE_TYPE, BENEFIT_TYPE } from '@/config/myPrize.config'
......@@ -19,7 +19,6 @@ const objectStatus = { ..._objectStatus, ...commonStatus }
const enameStatus = { ..._enameStatus, ...commonStatus }
const { commonToast, navigateToOutside, setClipboard } = tbccTs.tb
const { getMyPrizeList } = API
import {useAudio} from '@/hooks/useAudio'
function Empty(blankTxt) {
......@@ -41,7 +40,7 @@ function MyPrizeList() {
}, [])
async function fetchMyPriceList() {
const res = await getMyPrizeList()
const res = await API.getMyAwardsList()
if (res.success && res?.data?.list?.length) {
setMyPrizeList(res?.data?.list)
}
......@@ -86,16 +85,16 @@ function MyPrizeList() {
'update': async () => fetchMyPriceList(),
[PRIZE_TYPE.ENAME]: async () => {
if(benefitType === BENEFIT_TYPE.MEMBER) {
await receiveMemberEname({params: { sellerId: config.sellerId, ename, id }, successMsg })
await receiveMemberEname(API.updateEnamePrizeReceived,{params: { sellerId: config.sellerId, ename, id }, successMsg })
}else {
await receiveEnamePrize({params: { activityId, id }, successMsg })
await receiveEnamePrize(API.receiveEnamePrize,{params: { activityId, id }, successMsg })
}
},
[PRIZE_TYPE.OBJECT]: async () => {
await receiveObjectPrize({params: { activityId, id }, successMsg })
await receiveObjectPrize(API.receiveObjectPrize,{params: { activityId, id }, successMsg })
},
[PRIZE_TYPE.CREDITS]: async () => {
await receiveEnamePrize({params: { activityId, id }, successMsg })
await receiveEnamePrize(API.receiveEnamePrize,{params: { activityId, id }, successMsg })
}
}
await receiveFn[type]()
......
......@@ -75,14 +75,14 @@ export default function PreComp(props) {
<View className={styles['scroll-view']}>
<ScrollXView prizeList={prizeList} />
</View>
<View className={styles['comp-view']}>
{/* 大转盘 */}
<RotateWheel />
</View>
<View className={styles['comp-view']}>
{/* swiper左右滑动 */}
<SwiperView swiperList={prizeList} />
</View>
<View className={styles['comp-view']}>
{/* 大转盘 */}
<RotateWheel />
</View>
</ContainerFit>
)
}
\ No newline at end of file
......@@ -48,14 +48,12 @@ export const getSystemInfo = () => {
let bgs = {
}
export const playBgMusic1 = async (isOn, src, callbackFn=()=>{}, loop=false) => {//待测试
for (let k in bgs) {
if (bgs[k].isOn) {
bgs[k].stop();
}
// bgs[k].isOn = false; /// TODO 自己记一个开关,因为淘宝的玩意stop之后虽然听不到,但还是在播放,会触发loop播放和onEnded事件
}
const key = src;
console.log('---------->>>>>>>>>>>>>ison',isOn);
if (isOn) {
......
......@@ -6,7 +6,6 @@
*/
export const dateFormatter = (date, format = 'yyyy/MM/dd') => {
if (!date) return '-'
date = new Date(
// eslint-disable-next-line no-restricted-globals
typeof date === 'string' && isNaN(date) ? date.replace(/-/g, '/') : date
......
......@@ -136,100 +136,4 @@ export const addStat = async(activityId, type)=> {
}
resolve(false)
})
}
export const createCanvas = async (canvasId) => {
return new Promise((resolve,reject) => {
my.createCanvas({
id: canvasId,
success: (ccc) => {
resolve(ccc)
}
})
})
}
// 查询商家权益活动
export const getActivity = (sellerId) => {
const memberBenefitPlugin = requirePlugin("memberBenefit")
if(!memberBenefitPlugin) return []
return new Promise(async (resolve,reject) => {
memberBenefitPlugin.getActivity({
data: {
sellerId,
},
success: (result) => {
resolve(result)
},
fail: (error) => {
console.log('获取失败'+JSON.stringify(error))
resolve(error)
}
});
})
}
/**
* 获取系统信息
* @returns {object} 小程序系统信息
*/
export const getSystemInfo = () => {
return new Promise((resolve, reject) => {
my.getSystemInfo({
success: res => { resolve(res); },
fail: err => { reject(err); }
});
});
};
// 查询商家会员等级
export const getGrade = (sellerId) => {
const memberBenefitPlugin = requirePlugin("memberBenefit")
if(!memberBenefitPlugin) return []
return new Promise(async (resolve,reject) => {
memberBenefitPlugin.getGrade({
data: {
sellerId
},
success: (result) => {
resolve(result)
},
fail: (error) => {
console.log('查询商家会员等级失败'+JSON.stringify(error))
resolve(error)
}
});
})
}
// 查询商家会员等级
export const checkShopFavoredStatus = (sellerId) => {
return new Promise(async (resolve,reject) => {
my.tb.checkShopFavoredStatus({
id: sellerId,
success: (res) => {
console.warn(res)
my.alert({ content: JSON.stringify(res) })
resolve(res.isFavor)
},
fail: (res) => {
my.alert({ content: JSON.stringify(res) })
}
})
})
}
// 查询商家会员等级
export const favorShop = (sellerId) => {
return new Promise(async (resolve,reject) => {
my.tb.favorShop({
id: +sellerId,
success: (res) => {
console.warn(res)
my.alert({ content: JSON.stringify(res) })
resolve(res)
},
fail: (res) => {
my.alert({ content: JSON.stringify(res) })
}
})
})
}
}
\ No newline at end of file
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