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
dd2a6785
Commit
dd2a6785
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
6dc65aaf
174d9601
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
229 additions
and
66 deletions
+229
-66
custom-tab-bar/index.js
+32
-16
custom-tab-bar/index.wxml
+4
-0
custom-tab-bar/index.wxss
+15
-0
src/App.vue
+1
-0
src/api/cart.js
+5
-2
src/main.js
+2
-0
src/pages/home/index.vue
+26
-47
src/pages/home/main.json
+3
-1
src/store/mutations.js
+3
-0
src/store/state.js
+2
-0
static/nativeComponents/PhotoGallery/index.js
+50
-0
static/nativeComponents/PhotoGallery/index.json
+5
-0
static/nativeComponents/PhotoGallery/index.wxml
+24
-0
static/nativeComponents/PhotoGallery/index.wxss
+57
-0
No files found.
custom-tab-bar/index.js
View file @
dd2a6785
...
...
@@ -69,7 +69,8 @@ Component({
show
:
true
,
mmm
:
false
,
mainColor
:
""
,
showFlag
:
"up"
showFlag
:
"up"
,
cartNum
:
0
},
ready
()
{
if
(
app
.
themeColor
[
"--main-color"
]
!=
"#ffffff"
)
{
...
...
@@ -92,35 +93,49 @@ Component({
}
this
.
setData
({
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
(
this
.
data
.
mmm
,
'ready'
)
});
console
.
log
(
Math
.
ceil
(
app
.
globalData
.
footerVal
.
componentData
.
list
.
length
/
2
-
1
),
this
.
data
.
selected
);
console
.
log
(
this
.
data
.
mmm
,
"ready"
);
},
attached
()
{
let
that
=
this
;
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
({
componentData
:
app
.
globalData
.
footerVal
.
componentData
,
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
{
console
.
log
(
73333381
)
console
.
log
(
73333381
)
;
app
.
footerCallBack
=
function
(
params
)
{
console
.
log
(
'back'
)
console
.
log
(
"back"
);
that
.
setData
({
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)
});
let
mm
=
(
Math
.
ceil
(
params
.
componentData
.
list
.
length
/
2
-
1
)
==
that
.
data
.
selected
&&
params
.
componentData
[
'styleSelectionNum'
]
==
1
)
console
.
log
(
'87777777'
,
mm
)
let
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({
//
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
:
{
init
()
{},
...
...
custom-tab-bar/index.wxml
View file @
dd2a6785
...
...
@@ -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">
{{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>
...
...
custom-tab-bar/index.wxss
View file @
dd2a6785
...
...
@@ -1492,3 +1492,17 @@
-ms-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/App.vue
View file @
dd2a6785
...
...
@@ -16,6 +16,7 @@ export default {
}
console
.
log
(
"1444444444"
,
extConfig
.
mixid
);
this
.
$store
.
commit
(
"setExtConfig"
,
extConfig
.
mixid
);
this
.
$store
.
commit
(
'setExtConfigInfo'
,
extConfig
)
// 调用API从本地缓存中获取数据
/*
* 平台 api 差异的处理方式: api 方法统一挂载到 mpvue 名称空间, 平台判断通过 mpvuePlatform 特征字符串
...
...
src/api/cart.js
View file @
dd2a6785
...
...
@@ -4,4 +4,7 @@ export default {
addCart
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/cart/add_item`
,
data
);
},
}
\ No newline at end of file
my_cart_count
()
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/cart/my_cart_count`
);
}
};
\ No newline at end of file
src/main.js
View file @
dd2a6785
...
...
@@ -6,6 +6,7 @@ import goodsApi from "./api/goods"
import
orderApi
from
"./api/order"
import
promoteApi
from
"./api/promote"
;
import
indexApi
from
'./api/index'
import
cartApi
from
'./api/cart'
import
{
DFSImg
}
from
"@/utils/index"
;
import
{
$themeToLink
,
$themeAddToCard
}
from
"@/utils/mayi"
;
import
shop
from
"./api/shop"
;
...
...
@@ -58,6 +59,7 @@ mpApp.goodsApi = goodsApi;
mpApp
.
orderApi
=
orderApi
;
mpApp
.
promoteApi
=
promoteApi
;
mpApp
.
indexApi
=
indexApi
;
mpApp
.
cartApi
=
cartApi
;
mpApp
.
DFSImg
=
DFSImg
;
mpApp
.
getThemePage
=
getThemePage
...
...
src/pages/home/index.vue
View file @
dd2a6785
...
...
@@ -66,6 +66,9 @@
<div
v-if=
"item.componentCode == 'official-account' && item.componentInfo.visible == 1"
>
<official-account></official-account>
</div>
<div
v-if=
"item.componentCode == 'photo-gallery' && item.componentInfo.visible == 1"
>
<photo-gallery
:datas=
"item"
></photo-gallery>
</div>
</div>
<bottomCont></bottomCont>
...
...
@@ -173,16 +176,19 @@ export default {
this
.
changeLocation
=
options
.
changeLocation
||
''
if
(
this
.
changeLocation
==
1
){
let
extConfig
=
wx
.
getExtConfigSync
?
wx
.
getExtConfigSync
()
:
{};
console
.
log
(
extConfig
,
"-----------extConfig"
);
if
(
process
.
env
.
NODE_ENV
==
"development"
||
JSON
.
stringify
(
extConfig
)
==
"{}"
)
{
extConfig
=
{
mixid
:
"antgood"
,
shopid
:
67
};
}
app
.
getShopInfo
(
extConfig
);
app
.
getThemePage
(
extConfig
);
// let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
// console.log(extConfig, "-----------extConfig");
// if (
// process.env.NODE_ENV == "development" ||
// JSON.stringify(extConfig) == "{}"
// ) {
// extConfig = { mixid: "antgood", shopid: 67 };
// }
console
.
log
(
'this.$store.state.extConfig'
,
this
.
$store
.
state
.
extConfig
)
app
.
getShopInfo
(
this
.
$store
.
state
.
extConfig
);
app
.
getThemePage
(
this
.
$store
.
state
.
extConfig
);
}
let
that
=
this
;
// 来源
...
...
@@ -222,32 +228,6 @@ export default {
this
.
$mp
.
page
.
onPageScroll
=
(
el
)
=>
{
this
.
scrolls
(
el
);
};
let
extConfig
=
wx
.
getExtConfigSync
?
wx
.
getExtConfigSync
()
:
{};
console
.
log
(
extConfig
,
"-----------extConfig"
);
if
(
process
.
env
.
NODE_ENV
==
"development"
||
JSON
.
stringify
(
extConfig
)
==
"{}"
)
{
extConfig
=
{
mixid
:
"antgood"
,
shopid
:
67
};
}
// console.log(wx.getStorageSync('changeAdr'),'changeAdr')
// if(wx.getStorageSync('changeAdr') == 'changeAdr'){
// Object.assign(this.$data, this.$options.data());
// app.getShopInfo(extConfig);
// // 页面配置信息
// app.getThemePage(extConfig);
// wx.removeStorageSync('changeAdr')
// }
},
methods
:
{
init
(
pageList
)
{
...
...
@@ -284,20 +264,19 @@ export default {
},
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
(){
let
extConfig
=
wx
.
getExtConfigSync
?
wx
.
getExtConfigSync
()
:
{};
console
.
log
(
extConfig
,
"-----------extConfig"
);
if
(
process
.
env
.
NODE_ENV
==
"development"
||
JSON
.
stringify
(
extConfig
)
==
"{}"
)
{
extConfig
=
{
mixid
:
"antgood"
,
shopid
:
67
};
}
console
.
log
(
'onPullDownRefresh'
)
app
.
getShopInfo
(
extConfig
);
app
.
getThemePage
(
extConfig
);
console
.
log
(
'onPullDownRefresh'
,
this
.
$store
.
state
.
extConfig
)
app
.
getShopInfo
(
this
.
$store
.
state
.
extConfig
);
app
.
getThemePage
(
this
.
$store
.
state
.
extConfig
);
}
...
...
src/pages/home/main.json
View file @
dd2a6785
...
...
@@ -13,7 +13,8 @@
"pop-up"
:
"/static/nativeComponents/PopUp/index"
,
"share-popup"
:
"/static/nativeComponents/SharePopup/index"
,
"speedy-nav"
:
"/static/nativeComponents/SpeedyNav/index"
,
"video-player"
:
"/static/nativeComponents/VideoPlayer/index"
"video-player"
:
"/static/nativeComponents/VideoPlayer/index"
,
"photo-gallery"
:
"/static/nativeComponents/PhotoGallery/index"
},
"enablePullDownRefresh"
:
true
}
\ No newline at end of file
src/store/mutations.js
View file @
dd2a6785
...
...
@@ -35,6 +35,9 @@ const mutations = {
},
setExtConfig
(
state
,
obj
){
state
.
mixid
=
obj
},
setExtConfigInfo
(
state
,
obj
){
state
.
extConfig
=
obj
}
};
...
...
src/store/state.js
View file @
dd2a6785
...
...
@@ -22,5 +22,6 @@ const state = {
userInfo
,
mixid
:
''
,
extConfig
:
{}
};
export
default
state
\ No newline at end of file
static/nativeComponents/PhotoGallery/index.js
0 → 100644
View file @
dd2a6785
// static/nativeComponents/PhotoGallery/index.js
let
app
=
getApp
()
Component
({
/**
* 组件的属性列表
*/
properties
:
{
datas
:
{
type
:
Object
}
},
/**
* 组件的初始数据
*/
data
:
{
getPaddingList
:
[{
'name'
:
'上'
,
'value'
:
0
},
{
'name'
:
'下'
,
'value'
:
0
},
{
'name'
:
'左'
,
'value'
:
0
},
{
'name'
:
'右'
,
'value'
:
0
}
],
},
ready
(){
console
.
log
(
this
.
data
.
datas
.
componentData
.
paddingList
,
'this.data.datas.componentData.paddingList'
)
if
(
this
.
data
.
datas
.
componentData
.
paddingList
){
this
.
setData
({
getPaddingList
:
this
.
data
.
datas
.
componentData
.
paddingList
})
}
},
/**
* 组件的方法列表
*/
methods
:
{
}
})
static/nativeComponents/PhotoGallery/index.json
0 → 100644
View file @
dd2a6785
{
"component"
:
true
,
"usingComponents"
:
{}
}
\ No newline at end of file
static/nativeComponents/PhotoGallery/index.wxml
0 → 100644
View file @
dd2a6785
<!--static/nativeComponents/PhotoGallery/index.wxml-->
<view class="photo-gallery" style="padding-top:{{getPaddingList[0]['value'] * 2}}rpx;padding-bottom:{{getPaddingList[1]['value'] * 2}}rpx;padding-left:{{getPaddingList[2]['value'] * 2}}rpx;padding-right:{{getPaddingList[3]['value'] * 2}}rpx">
<view wx:if="{{datas.componentData.titles!=''}}" style="font-size:{{datas.componentData.titleSize}}em;padding-bottom:{{datas.componentData.titlePadding * 2}}rpx" class="textH">
{{datas.componentData.titles}}
</view>
<view wx:if="{{datas.componentData.style==='list'}}">
<view class="imgcontent" wx:for="{{datas.componentData.imgList}}" wx:key="{{index}}" style="margin-bottom:{{datas.componentData.imgPadding * 2}}rpx">
<image src="{{item.imageUrl}}" lazy-load></image>
</view>
</view>
<view wx:elif="{{datas.componentData.style==='across' || datas.componentData.style==='tiled'}}" class="across">
<view class="prev-btn" wx:if="{{datas.componentData.style==='across'}}">
<i class="iconfont-common common-iconyoujiantou"></i>
</view>
<view class="next-btn" wx:if="datas.componentData.style==='across'">
<i class="iconfont-common common-iconyoujiantou"></i>
</view>
<view style="display:{{datas.componentData.style==='tiled' ? 'flex' : ''}}" class="ul">
<view wx:for="{{datas.componentData.imgList}}" wx:key="{{index}}" style="margin-right:{{index===(datas.componentData.imgList.length-1)? '' : datas.componentData.imgPadding * 2 + 'rpx'}};width:{{datas.componentData.style==='across' ? datas.componentData.acrossPer+'%' : ''}}" class="li">
<image src="{{item.imageUrl}}" lazy-load mode="widthFix"></image>
</view>
</view>
</view>
</view>
static/nativeComponents/PhotoGallery/index.wxss
0 → 100644
View file @
dd2a6785
/* static/nativeComponents/PhotoGallery/index.wxss */
@import "/static/font/common_icon.wxss";
.photo-gallery{
width: 100%;
font-size: 32rpx;
box-sizing: border-box;
}
.textH{
text-align: center;
font-weight: bold;
}
.imgcontent{
width: 100%;
text-align: center;
}
.imgcontent image{
width: 100%;
display: block;
}
.across {
position: relative;
}
.ul{
overflow-x: auto;
white-space: nowrap;
width: 100%;
}
.ul .li{
display: inline-block;
flex: 1
}
.ul .li image{
width: 100%;
vertical-align: middle;
}
.prev-btn,.next-btn{
width: 60rpx;
height: 60rpx;
position: absolute;
top: 50%;
margin-top: -30rpx;
z-index: 99;
opacity: .3;
}
.prev-btn i,.next-btn i {
font-size: 60rpx;
}
.next-btn{
right:10rpx;
}
.prev-btn{
left:10rpx;
-webkit-transform: rotate(180deg);
transform: rotate(180deg)
}
\ No newline at end of file
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