Commit 58c4ef7a authored by mqf_0707's avatar mqf_0707

优化加购y等页面

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