Commit 58c4ef7a authored by mqf_0707's avatar mqf_0707

优化加购y等页面

parent d42d5efd
export default {
hasCanvas: false, // 是否开启游戏模块自动注入dist
hasCanvas: true, // 是否开启游戏模块自动注入dist
defaultPlugins: [
[
'@pluve/taro-plugin-mars', // taro暂时未支持阿里小程序自定义插件 需要引用插件的页面需配置
......@@ -13,12 +13,12 @@ export default {
],
canvasPages: [
{'root': 'pages/packageGame/game/game.json', 'comRoot': 'components/_miniprogram/canvasComp/canvasComp'}, // 游戏组件
// {'root': 'pages/index/index.json', 'comRoot': 'components/_miniprogram/lottieAnimation/lottieAnimation'} // Lottie组件
{'root': 'pages/index/index.json', 'comRoot': 'components/_miniprogram/lottieAnimation/lottieAnimation'} // Lottie组件
],// 引入cavas组件页面(更改canvas引用路径)
canvasComps: [// 拷贝相关页面和依赖到dist目录
{ from: 'minigame/node_modules', to: 'dist/node_modules'},
{ from: 'src/components/_miniprogram/canvasComp', to: 'dist/components/_miniprogram/canvasComp'}, // 游戏组建引入
// { from: 'src/components/_miniprogram/lottieAnimation', to: 'dist/components/_miniprogram/lottieAnimation'}, // lottie 动画组件
// { from: 'src/lottie', to: 'dist/lottie'},// lottie json文件
{ from: 'src/components/_miniprogram/lottieAnimation', to: 'dist/components/_miniprogram/lottieAnimation'}, // lottie 动画组件
{ from: 'src/lottie', to: 'dist/lottie'},// lottie json文件
]
}
\ No newline at end of file
......@@ -42,7 +42,7 @@ const apiList = {
drawLottery: 'drawLottery',
getShareInfo: 'getShareInfo',
getCollectGoods: 'getCollectGoods',
updateEnamePrizeReceived: 'updateEnamePrizeReceived', // 会员权益领取
receiveMemberEname: 'receiveMemberEname', // 会员权益领取
getPrizeConfig: 'getPrizeConfig', // 获取奖品配置
drawRotatePrize:'drawLottery',//大转盘抽奖接口,暂未实现
exchangePrize: 'exchangePrize', // 兑换奖品
......
import cloud from '@tbmp/mp-cloud-sdk'
import { Component } from 'react'
import Taro from '@tarojs/taro'
import './app.less'
// 使用taro-ui 按需引入的组件样式
import './taro-ui.scss'
......
......@@ -4,7 +4,7 @@ import styles from './ContainerFit.module.less'
import { getSystemInfo } from 'tbcc-sdk-ts/lib/core/tb'
export default function ContainerFit(props) {
const { bg = '', hasFitPsd = false, fullScreenFit = false } = props
const { bg = '', hasFitPsd = false, fullScreenFit = false, minHeight = '100vh' } = props
const [ system, setSystem ] = useState(false)
const [statusBarHeight, setStatusBarHeight ] = useState(24)
useEffect(() => {
......@@ -19,8 +19,11 @@ export default function ContainerFit(props) {
return flag ? {
background: `url(${bg}) no-repeat`,
backgroundSize: '100% 100%',
paddingTop: (system === 'iOS' && fullScreenFit) && (statusBarHeight / 100 + 'rem')
} : {}
paddingTop: (system === 'iOS' && fullScreenFit) && (statusBarHeight / 100 + 'rem'),
minHeight: (minHeight === '100vh') ? minHeight : +minHeight / 100 + 'rem'
} : {
minHeight: (minHeight === '100vh') ? minHeight : +minHeight / 100 + 'rem'
}
}
return (
<View className={styles['page-container']} style={FitContainerStyle(!hasFitPsd)}>
......
......@@ -6,6 +6,7 @@
| --- | --- | --- |
|bg| String |背景图(1624px),非必填|
|hasFitPsd| Boolean |内容块是否对标设计稿(750px * 1624px),非必填|
|minHeight| string或number |内容块最小高度 (100vh 1416) |
#### 使用
``` jsx
......
......@@ -5,7 +5,7 @@
left: 0;
width: 100vw;
height: 100vh;
min-height: 100vh;
min-height: 1416px;
box-sizing: border-box;
overflow: hidden;
}
......
import * as fyge from "@/components/_miniprogram/canvasComp/node_modules/fyge"
import * as fyge from "fyge"
import lottieData from '/lottie/index.js'
Component({
......@@ -38,7 +38,7 @@ Component({
//兼容小程序
fyge.initedByCanvas(ccc)
var stage = this.stage = new fyge.Stage(ccc, 750, 1624, windowWidth, windowHeight);
var stage = this.stage = new fyge.Stage(ccc, 750, 1624, windowWidth, windowHeight,2);
//加载
console.warn(lottieData[type])
var l = stage.addChild(new fyge.Lottie(lottieData[type]))
......
......@@ -23,12 +23,12 @@ function GoodsList(props) {
} = props
const goToGoodsDetail = async(item) => {
const { taskType } = task
const { taskType, isGoToDetail = false } = task
const { itemId } = item
if (taskType === 'browse') {
onOpenDetail && onOpenDetail(itemId)
}
if(!isGoToDetail) return;
await openDetail(String(itemId))
}
// 收藏商品
......
......@@ -52,6 +52,14 @@
font-size: 24px;
margin-right: 2px;
}
.item__price-no-collect {
width: 30px;
height: 30px;
}
.item__price-no-collect image {
width: 100%;
height: 100%;
}
.item__price-collect {
width: 118px;
height: 31px;
......@@ -61,14 +69,6 @@
width: 100%;
height: 100%;
}
.item__price-no-collect {
width: 30px;
height: 30px;
}
.item__price-no-collect image {
width: 100%;
height: 100%;
}
.goods-modal-timer {
width: 147px;
height: 223px;
......
......@@ -13,6 +13,7 @@ export const BROWSE_CONFIG = {
color: '#181818',
countDown: '',
isMock: false, // 是否使用mock数据
isGoToDetail: true, // 是否允许跳转商品详情页
}
/*
浏览页倒计时标识
......
......@@ -12,7 +12,8 @@ export const CART_CONFIG = {
no_collect: '//yun.duiba.com.cn/taobaomini/clientCTest/collection_no_collect@2x.png',
},
color: '#181818',
hasCollectIcon: true //是否展示收藏icon
hasCollectIcon: true, //是否展示收藏icon
isGoToDetail: false, // 是否允许跳转商品详情页
}
// 任务完成类型
export const CART_TYPE = {
......
......@@ -12,5 +12,6 @@ export default {
no_collect: '//yun.duiba.com.cn/taobaomini/clientCTest/collection_no_collect@2x.png'
},
color: '#181818',
hasCollectIcon: true //是否展示收藏icon
hasCollectIcon: true, //是否展示收藏icon
isGoToDetail: false, // 是否允许跳转商品详情页
}
\ No newline at end of file
......@@ -10,5 +10,6 @@ export default {
image: {
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png'
},
color: '#181818'
color: '#181818',
isGoToDetail: true, // 是否允许跳转商品详情页
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ export function useAuth(authSuccess = () => {}) {
const [visible, setVisible ] = useState(false)
const goToOpenSetting = useRef(false)
// 获取授权信息
const getSettingFn = async () => {
const onHandleSetting = async () => {
const res = await getSetting()
if(!res.authSetting?.userInfo) {
const authResult = await authorize().catch(err => {
......@@ -22,7 +22,7 @@ export function useAuth(authSuccess = () => {}) {
}
}
// 打开授权设置
const openSettingFn = async () => {
const onOpenSetting = async () => {
goToOpenSetting.current = true
showToast({ title: '打开授权开关,授权成功后才可参与活动', duration: 1000, success: () => openSetting() })
}
......@@ -35,20 +35,20 @@ export function useAuth(authSuccess = () => {}) {
}
}
useEffect(() => {
getSettingFn()
onHandleSetting()
}, [])
useDidShow(() => {
if(goToOpenSetting.current) {
// 重新授权
getSettingFn()
onHandleSetting()
goToOpenSetting.current = false
}
})
return {
visible,
getSettingFn,
openSettingFn
onHandleSetting,
onOpenSetting
}
}
\ No newline at end of file
......@@ -2,8 +2,9 @@ import { useCallback } from 'react'
import { checkIsMember } from 'tbcc-sdk-ts/lib/utils'
import { showToast } from '@tarojs/taro'
import API from '@/api'
import {receiveEnamePrize, receiveMemberEname, receiveObjectPrize } from 'tbcc-sdk-ts/lib/request/capiFn'
import {receiveEnamePrize, receiveObjectPrize } from 'tbcc-sdk-ts/lib/request/capiFn'
import { PRIZE_TYPE, BENEFIT_TYPE, DRAW_STATUS } from '@/config/myPrize.config'
import { receiveMemberEname } from '@/utils/util'
import config from '@/config/config'
const useReceive = (props) => {
......
......@@ -211,7 +211,7 @@ function Index() {
/>
}
{<member-modal expend={memberVisible} onClose={onClose} onAuthFail={onAuthFail} onAuthSuccess={onAuthSuccess} />}
{authInfo?.visible && <Auth clickAuthBtn={authInfo.openSettingFn} /> }
{authInfo?.visible && <Auth clickAuthBtn={authInfo.onOpenSetting} /> }
{false && <canvas-comp />}
</>
)
......
......@@ -16,11 +16,12 @@ const { showSkuModal } = tbccTs.tb
function CartGoodsPage() {
const router = useRouter()
const [goodsList, setGoodsList] = useState([])
const [goodsList, setGoodsList] = useState(GOOD_LIST)
const { item } = router?.params
const { itemIds, todayCompleteTimes = 0, rateType, times, completeTimes = 0 } = JSON.parse(item)
const { itemIds, todayCompleteTimes, rateType, times, completeTimes = 0 } = JSON.parse(item)
// 加购状态
const collectFlag = useRef(rateType === TASK_RATE_TYPE.EVERYDAY? +todayCompleteTimes : +completeTimes)
const initCompleteTimes = rateType === TASK_RATE_TYPE.EVERYDAY? +(todayCompleteTimes || completeTimes) : +completeTimes
const collectFlag = useRef(initCompleteTimes)
useEffect(() => {
getGoodsList()
}, [])
......@@ -42,8 +43,8 @@ function CartGoodsPage() {
const { status, quantity } = await showSkuModal(String(itemId))
if (status == "addCartSuccess") {
const { success } = await API.completeTask({ key: CART_CONFIG.taskType, taskType: CART_CONFIG.taskType, itemId, count: quantity })
if (success) {
collectflag.current += 1
if (!success) {
collectFlag.current += 1
getGoodsList()
// showToast({ title: '加购成功'})
}
......
......@@ -15,11 +15,12 @@ import { GOOD_LIST } from '@/mock'
function CollectGoodsPage() {
const router = useRouter()
const [goodsList, setGoodsList] = useState(GOOD_LIST)
const [goodsList, setGoodsList] = useState([])
const { item } = router?.params
const { itemIds, todayCompleteTimes = 0, rateType, times, completeTimes = 0 } = JSON.parse(item)
// 加购状态
const collectFlag = useRef(rateType === TASK_RATE_TYPE.EVERYDAY? +todayCompleteTimes : +completeTimes)
const initCompleteTimes = rateType === TASK_RATE_TYPE.EVERYDAY? +(todayCompleteTimes || completeTimes) : +completeTimes
const collectFlag = useRef(initCompleteTimes)
useEffect(() => {
getGoodsList()
......
......@@ -40,7 +40,7 @@ const confirmAddress = async (address) => {
});
})
}
export const receiveObjectPrize = async (data) => {
export const receiveObjectPrize = async (api,data) => {
const { params, successMsg, errorMsg } = data
return new Promise(async (resolve,reject) => {
const userInfo = await getUerAddressParam()
......@@ -56,7 +56,7 @@ export const receiveObjectPrize = async (data) => {
resolve(false)
return;
}
const { success, data, message } = await API.receiveObjectPrize({ ...params, ..._params })
const { success, data, message } = await api({ ...params, ..._params })
if (success) {
showToast({ content: successMsg})
resolve(true)
......@@ -67,10 +67,10 @@ export const receiveObjectPrize = async (data) => {
})
}
// 领取权益
export const receiveEnamePrize = async (data) => {
export const receiveEnamePrize = async (api,data) => {
const { params, successMsg, errorMsg } = data
return new Promise(async (resolve,reject) => {
const { success, data, message } = await API.receiveEnamePrize(params).catch(res => {
const { success, data, message } = await api(params).catch(res => {
showToast({ content: successMsg || res.message})
resolve(false)
});
......@@ -97,13 +97,13 @@ const applyActivity = (sellerId, activityId) => {
resolve(result)
},
fail: (error) => {
console.warn('领取商家权益失败'+JSON.stringify(error.data))
resolve(error.data)
console.warn('领取商家权益失败'+JSON.stringify(error))
resolve(error)
}
});
})
}
export const receiveMemberEname = async(data) => {
export const receiveMemberEname = async(api,data) => {
const { params, successMsg, errorMsg } = data
const { sellerId, ename, ...ext } = params
if(!ename) return false
......@@ -111,7 +111,7 @@ export const receiveMemberEname = async(data) => {
const result = await applyActivity(sellerId,ename)
if(!result) resolve(false)
if(result.businessSuccess) {
const { success, data, message } = await API.updateEnamePrizeReceived({ ...ext })
const { success, data, message } = await api({ ...ext })
if(success) {
showToast({ content: successMsg || '奖品发放成功,请前往我的奖品处进行使用'})
resolve(true)
......
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