Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
58c4ef7a
Commit
58c4ef7a
authored
Sep 27, 2021
by
mqf_0707
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化加购y等页面
parent
d42d5efd
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
59 additions
and
47 deletions
+59
-47
default.js
c_client/config/default.js
+4
-4
api.js
c_client/src/api.js
+1
-1
app.js
c_client/src/app.js
+1
-0
ContainerFit.jsx
c_client/src/components/_base/ContainerFit/ContainerFit.jsx
+6
-3
ContainerFit.md
c_client/src/components/_base/ContainerFit/ContainerFit.md
+1
-0
ContainerFit.module.less
...rc/components/_base/ContainerFit/ContainerFit.module.less
+1
-1
lottieAnimation.js
...omponents/_miniprogram/lottieAnimation/lottieAnimation.js
+2
-2
GoodsList.jsx
c_client/src/components/_tb_comps/GoodsList/GoodsList.jsx
+2
-2
GoodsList.module.less
.../src/components/_tb_comps/GoodsList/GoodsList.module.less
+8
-8
browse.config.js
c_client/src/config/browse.config.js
+1
-0
cart.config.js
c_client/src/config/cart.config.js
+2
-1
collect.config.js
c_client/src/config/collect.config.js
+2
-1
order.config.js
c_client/src/config/order.config.js
+2
-1
useAuth.js
c_client/src/hooks/useAuth.js
+6
-6
useReceive.js
c_client/src/hooks/useReceive.js
+2
-1
index.jsx
c_client/src/pages/index/index.jsx
+1
-1
cartGoods.jsx
c_client/src/pages/packageGood/cartGoods/cartGoods.jsx
+6
-5
collectGoods.jsx
c_client/src/pages/packageGood/collectGoods/collectGoods.jsx
+3
-2
util.js
c_client/src/utils/util.js
+8
-8
No files found.
c_client/config/default.js
View file @
58c4ef7a
export
default
{
hasCanvas
:
fals
e
,
// 是否开启游戏模块自动注入dist
hasCanvas
:
tru
e
,
// 是否开启游戏模块自动注入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
c_client/src/api.js
View file @
58c4ef7a
...
...
@@ -42,7 +42,7 @@ const apiList = {
drawLottery
:
'drawLottery'
,
getShareInfo
:
'getShareInfo'
,
getCollectGoods
:
'getCollectGoods'
,
updateEnamePrizeReceived
:
'updateEnamePrizeReceived
'
,
// 会员权益领取
receiveMemberEname
:
'receiveMemberEname
'
,
// 会员权益领取
getPrizeConfig
:
'getPrizeConfig'
,
// 获取奖品配置
drawRotatePrize
:
'drawLottery'
,
//大转盘抽奖接口,暂未实现
exchangePrize
:
'exchangePrize'
,
// 兑换奖品
...
...
c_client/src/app.js
View file @
58c4ef7a
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'
...
...
c_client/src/components/_base/ContainerFit/ContainerFit.jsx
View file @
58c4ef7a
...
...
@@ -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
)
}
>
...
...
c_client/src/components/_base/ContainerFit/ContainerFit.md
View file @
58c4ef7a
...
...
@@ -6,6 +6,7 @@
| --- | --- | --- |
|bg| String |背景图(1624px),非必填|
|hasFitPsd| Boolean |内容块是否对标设计稿(750px
*
1624px),非必填|
|minHeight| string或number |内容块最小高度 (100vh 1416) |
#### 使用
```
jsx
...
...
c_client/src/components/_base/ContainerFit/ContainerFit.module.less
View file @
58c4ef7a
...
...
@@ -5,7 +5,7 @@
left: 0;
width: 100vw;
height: 100vh;
min-height: 1
00vh
;
min-height: 1
416px
;
box-sizing: border-box;
overflow: hidden;
}
...
...
c_client/src/components/_miniprogram/lottieAnimation/lottieAnimation.js
View file @
58c4ef7a
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
]))
...
...
c_client/src/components/_tb_comps/GoodsList/GoodsList.jsx
View file @
58c4ef7a
...
...
@@ -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
))
}
// 收藏商品
...
...
c_client/src/components/_tb_comps/GoodsList/GoodsList.module.less
View file @
58c4ef7a
...
...
@@ -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;
...
...
c_client/src/config/browse.config.js
View file @
58c4ef7a
...
...
@@ -13,6 +13,7 @@ export const BROWSE_CONFIG = {
color
:
'#181818'
,
countDown
:
''
,
isMock
:
false
,
// 是否使用mock数据
isGoToDetail
:
true
,
// 是否允许跳转商品详情页
}
/*
浏览页倒计时标识
...
...
c_client/src/config/cart.config.js
View file @
58c4ef7a
...
...
@@ -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
=
{
...
...
c_client/src/config/collect.config.js
View file @
58c4ef7a
...
...
@@ -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
c_client/src/config/order.config.js
View file @
58c4ef7a
...
...
@@ -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
c_client/src/hooks/useAuth.js
View file @
58c4ef7a
...
...
@@ -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
o
penSettingFn
=
async
()
=>
{
const
o
nOpenSetting
=
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
,
o
penSettingFn
onHandleSetting
,
o
nOpenSetting
}
}
\ No newline at end of file
c_client/src/hooks/useReceive.js
View file @
58c4ef7a
...
...
@@ -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
,
receive
MemberEname
,
receive
ObjectPrize
}
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
)
=>
{
...
...
c_client/src/pages/index/index.jsx
View file @
58c4ef7a
...
...
@@ -211,7 +211,7 @@ function Index() {
/>
}
{
<
member
-
modal
expend=
{
memberVisible
}
onClose=
{
onClose
}
onAuthFail=
{
onAuthFail
}
onAuthSuccess=
{
onAuthSuccess
}
/>
}
{
authInfo
?.
visible
&&
<
Auth
clickAuthBtn=
{
authInfo
.
o
penSettingFn
}
/>
}
{
authInfo
?.
visible
&&
<
Auth
clickAuthBtn=
{
authInfo
.
o
nOpenSetting
}
/>
}
{
false
&&
<
canvas
-
comp
/>
}
</>
)
...
...
c_client/src/pages/packageGood/cartGoods/cartGoods.jsx
View file @
58c4ef7a
...
...
@@ -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
)
{
collect
f
lag
.
current
+=
1
if
(
!
success
)
{
collect
F
lag
.
current
+=
1
getGoodsList
()
// showToast({ title: '加购成功'})
}
...
...
c_client/src/pages/packageGood/collectGoods/collectGoods.jsx
View file @
58c4ef7a
...
...
@@ -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
()
...
...
c_client/src/utils/util.js
View file @
58c4ef7a
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment