Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
174d9601
Commit
174d9601
authored
Feb 25, 2021
by
程智春
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'nativehome_tst' of
http://code.mayi888.com/chengmo/mayi-mp-shop
into nativehome_tst
parents
6e5a02e3
49d9c61b
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
18 deletions
+65
-18
custom-tab-bar/index.js
+32
-16
custom-tab-bar/index.wxml
+4
-0
custom-tab-bar/index.wxss
+15
-0
src/api/cart.js
+5
-2
src/main.js
+2
-0
src/pages/home/index.vue
+7
-0
No files found.
custom-tab-bar/index.js
View file @
174d9601
...
@@ -69,7 +69,8 @@ Component({
...
@@ -69,7 +69,8 @@ Component({
show
:
true
,
show
:
true
,
mmm
:
false
,
mmm
:
false
,
mainColor
:
""
,
mainColor
:
""
,
showFlag
:
"up"
showFlag
:
"up"
,
cartNum
:
0
},
},
ready
()
{
ready
()
{
if
(
app
.
themeColor
[
"--main-color"
]
!=
"#ffffff"
)
{
if
(
app
.
themeColor
[
"--main-color"
]
!=
"#ffffff"
)
{
...
@@ -92,35 +93,49 @@ Component({
...
@@ -92,35 +93,49 @@ Component({
}
}
this
.
setData
({
this
.
setData
({
mmm
:
Math
.
ceil
(
app
.
globalData
.
footerVal
.
componentData
.
list
.
length
/
2
-
1
)
mmm
:
Math
.
ceil
(
app
.
globalData
.
footerVal
.
componentData
.
list
.
length
/
2
-
1
)
})
});
console
.
log
(
Math
.
ceil
(
app
.
globalData
.
footerVal
.
componentData
.
list
.
length
/
2
-
1
),
this
.
data
.
selected
)
console
.
log
(
console
.
log
(
this
.
data
.
mmm
,
'ready'
)
Math
.
ceil
(
app
.
globalData
.
footerVal
.
componentData
.
list
.
length
/
2
-
1
),
this
.
data
.
selected
);
console
.
log
(
this
.
data
.
mmm
,
"ready"
);
},
},
attached
()
{
attached
()
{
let
that
=
this
;
let
that
=
this
;
if
(
app
.
globalData
.
footerVal
)
{
if
(
app
.
globalData
.
footerVal
)
{
let
mm
=
(
Math
.
ceil
(
app
.
globalData
.
footerVal
.
componentData
.
list
.
length
/
2
-
1
)
==
that
.
data
.
selected
&&
app
.
globalData
.
footerVal
.
componentData
[
'styleSelectionNum'
]
==
1
)
let
mm
=
Math
.
ceil
(
app
.
globalData
.
footerVal
.
componentData
.
list
.
length
/
2
-
1
)
==
that
.
data
.
selected
&&
app
.
globalData
.
footerVal
.
componentData
[
"styleSelectionNum"
]
==
1
;
console
.
log
(
733333
,
mm
)
console
.
log
(
733333
,
mm
);
that
.
setData
({
that
.
setData
({
componentData
:
app
.
globalData
.
footerVal
.
componentData
,
componentData
:
app
.
globalData
.
footerVal
.
componentData
,
list
:
app
.
globalData
.
footerVal
.
componentData
.
list
,
list
:
app
.
globalData
.
footerVal
.
componentData
.
list
,
mm
:
mm
mm
:
mm
});
});
console
.
log
(
'777777'
,
Math
.
ceil
(
this
.
data
.
list
.
length
/
2
-
1
),
this
.
data
.
selected
,
this
.
data
.
componentData
[
'styleSelectionNum'
])
console
.
log
(
"777777"
,
Math
.
ceil
(
this
.
data
.
list
.
length
/
2
-
1
),
this
.
data
.
selected
,
this
.
data
.
componentData
[
"styleSelectionNum"
]
);
}
else
{
}
else
{
console
.
log
(
73333381
)
console
.
log
(
73333381
)
;
app
.
footerCallBack
=
function
(
params
)
{
app
.
footerCallBack
=
function
(
params
)
{
console
.
log
(
'back'
)
console
.
log
(
"back"
);
that
.
setData
({
that
.
setData
({
componentData
:
params
.
componentData
,
componentData
:
params
.
componentData
,
list
:
params
.
componentData
.
list
,
list
:
params
.
componentData
.
list
// mm:(Math.ceil(params.componentData.list.length/2-1)==that.data.selected&¶ms.componentData['styleSelectionNum']==1)
// mm:(Math.ceil(params.componentData.list.length/2-1)==that.data.selected&¶ms.componentData['styleSelectionNum']==1)
});
});
let
mm
=
(
Math
.
ceil
(
params
.
componentData
.
list
.
length
/
2
-
1
)
==
that
.
data
.
selected
&&
params
.
componentData
[
'styleSelectionNum'
]
==
1
)
let
mm
=
console
.
log
(
'87777777'
,
mm
)
Math
.
ceil
(
params
.
componentData
.
list
.
length
/
2
-
1
)
==
that
.
data
.
selected
&&
params
.
componentData
[
"styleSelectionNum"
]
==
1
;
console
.
log
(
"87777777"
,
mm
);
};
};
}
}
...
@@ -133,9 +148,10 @@ Component({
...
@@ -133,9 +148,10 @@ Component({
//
//
this
.
setData
({
this
.
setData
({
mm
:(
Math
.
ceil
(
this
.
data
.
list
.
length
/
2
-
1
)
==
this
.
data
.
selected
&&
this
.
data
.
componentData
[
'styleSelectionNum'
]
==
1
)
mm
:
})
Math
.
ceil
(
this
.
data
.
list
.
length
/
2
-
1
)
==
this
.
data
.
selected
&&
this
.
data
.
componentData
[
"styleSelectionNum"
]
==
1
});
},
},
methods
:
{
methods
:
{
init
()
{},
init
()
{},
...
...
custom-tab-bar/index.wxml
View file @
174d9601
...
@@ -31,6 +31,10 @@
...
@@ -31,6 +31,10 @@
<!-- 名称 -->
<!-- 名称 -->
<view class="text" style="color: {{selected === index ? componentData.selectTextColor : componentData.defaultTextColor}};font-size:{{selected === index ? componentData.selectionTextNum*2 : componentData.defaultTextNum*2}}rpx">
<view class="text" style="color: {{selected === index ? componentData.selectTextColor : componentData.defaultTextColor}};font-size:{{selected === index ? componentData.selectionTextNum*2 : componentData.defaultTextNum*2}}rpx">
{{item.title}}</view>
{{item.title}}</view>
<!-- 购物车商品数量 -->
<view class="isCart" wx:if="{{item.link&&item.link.link&&item.link.link=='/shopCart/shoppingCart'&&cartNum>0}}">
{{cartNum}}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
...
...
custom-tab-bar/index.wxss
View file @
174d9601
...
@@ -1492,3 +1492,17 @@
...
@@ -1492,3 +1492,17 @@
-ms-transform: translateY(0);
-ms-transform: translateY(0);
-o-transform: translateY(0);
-o-transform: translateY(0);
}
}
.isCart{
width: 36rpx;
height: 36rpx;
background: var(--main-color);
position: absolute;
right: -8rpx;
top: 0;
color: #fff;
border-radius: 50%;
font-size: 24rpx;
text-align: center;
line-height: 36rpx;
z-index: 999;
}
\ No newline at end of file
src/api/cart.js
View file @
174d9601
...
@@ -4,4 +4,7 @@ export default {
...
@@ -4,4 +4,7 @@ export default {
addCart
(
data
)
{
addCart
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/cart/add_item`
,
data
);
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/cart/add_item`
,
data
);
},
},
}
my_cart_count
()
{
\ No newline at end of file
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/cart/my_cart_count`
);
}
};
\ No newline at end of file
src/main.js
View file @
174d9601
...
@@ -6,6 +6,7 @@ import goodsApi from "./api/goods"
...
@@ -6,6 +6,7 @@ import goodsApi from "./api/goods"
import
orderApi
from
"./api/order"
import
orderApi
from
"./api/order"
import
promoteApi
from
"./api/promote"
;
import
promoteApi
from
"./api/promote"
;
import
indexApi
from
'./api/index'
import
indexApi
from
'./api/index'
import
cartApi
from
'./api/cart'
import
{
DFSImg
}
from
"@/utils/index"
;
import
{
DFSImg
}
from
"@/utils/index"
;
import
{
$themeToLink
,
$themeAddToCard
}
from
"@/utils/mayi"
;
import
{
$themeToLink
,
$themeAddToCard
}
from
"@/utils/mayi"
;
import
shop
from
"./api/shop"
;
import
shop
from
"./api/shop"
;
...
@@ -58,6 +59,7 @@ mpApp.goodsApi = goodsApi;
...
@@ -58,6 +59,7 @@ mpApp.goodsApi = goodsApi;
mpApp
.
orderApi
=
orderApi
;
mpApp
.
orderApi
=
orderApi
;
mpApp
.
promoteApi
=
promoteApi
;
mpApp
.
promoteApi
=
promoteApi
;
mpApp
.
indexApi
=
indexApi
;
mpApp
.
indexApi
=
indexApi
;
mpApp
.
cartApi
=
cartApi
;
mpApp
.
DFSImg
=
DFSImg
;
mpApp
.
DFSImg
=
DFSImg
;
mpApp
.
getThemePage
=
getThemePage
mpApp
.
getThemePage
=
getThemePage
...
...
src/pages/home/index.vue
View file @
174d9601
...
@@ -264,6 +264,13 @@ export default {
...
@@ -264,6 +264,13 @@ export default {
},
},
scrolltolower
(){
scrolltolower
(){
console
.
log
(
"scrolltolower"
)
console
.
log
(
"scrolltolower"
)
},
getCartNum
()
{
app
.
cartApi
.
my_cart_count
().
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
$mp
.
page
.
getTabBar
().
setData
({
"cartNum"
:
Number
(
res
.
data
.
data
)});
}
});
}
}
},
},
onPullDownRefresh
(){
onPullDownRefresh
(){
...
...
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