Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高淑倩
7-Eleven
Commits
01957995
Commit
01957995
authored
Sep 18, 2019
by
高淑倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
轮播图授权
parent
ddc0b8c2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
23 deletions
+106
-23
bottomTabs.js
src/component/bottomTabs/bottomTabs.js
+4
-6
imageSwiper.js
src/component/imageSwiper/imageSwiper.js
+49
-0
imageSwiper.wxml
src/component/imageSwiper/imageSwiper.wxml
+48
-10
picNav.js
src/component/picNav/picNav.js
+1
-3
userCenter.wxml
src/pages/userCenter/userCenter.wxml
+1
-1
subPage.wxml
src/subPackage/page/pages/subPage/subPage.wxml
+3
-3
No files found.
src/component/bottomTabs/bottomTabs.js
View file @
01957995
...
...
@@ -48,15 +48,13 @@ Component({
newRow
.
newPath
=
'/pages/productDetail/productDetail'
}
else
if
(
newRow
.
type
==
9
)
{
newRow
.
newPath
=
'/subPackage/page/pages/categoryPro/categoryPro'
}
else
{
newRow
.
newPath
=
''
}
}
item
.
row
=
newRow
}
})
// 当前匹配路径是否需要授权 true 需要 false 不需要
tabBar
.
images
.
forEach
(
item
=>
{
currentTab
.
forEach
(
item
=>
{
let
checkUrl
=
''
if
(
item
.
link
)
{
checkUrl
=
item
.
link
.
newPath
?
item
.
link
.
newPath
:
item
.
link
.
url
...
...
@@ -64,8 +62,8 @@ Component({
checkUrl
=
item
.
row
.
newPath
?
item
.
row
.
newPath
:
item
.
row
.
url
}
wxService
.
NoLoginPage
(
checkUrl
).
then
(
res
=>
{
item
.
needAuth
=
res
.
needAuth
this
.
setData
({
tabBarList
:
tabBar
.
images
})
i
f
(
checkUrl
)
i
tem
.
needAuth
=
res
.
needAuth
this
.
setData
({
tabBarList
:
currentTab
})
})
})
},
...
...
src/component/imageSwiper/imageSwiper.js
View file @
01957995
...
...
@@ -11,6 +11,10 @@ Component({
* 组件的属性列表
*/
properties
:
{
currentHasUserInfo
:
{
type
:
Boolean
,
type
:
false
},
imageData
:
{
type
:
Array
,
value
:
[],
...
...
@@ -20,6 +24,47 @@ Component({
this
.
setData
({
baseImgUrl
:
app
.
globalData
.
imageUrl
})
const
{
imageData
}
=
this
.
data
console
.
log
(
'imageData'
,
imageData
)
let
currentTab
=
imageData
currentTab
.
forEach
(
item
=>
{
// 存在 row 处理数据 8 商品 9 分类
let
newRow
=
null
if
(
item
.
link
)
{
if
(
item
.
link
.
type
==
2
)
{
// 父组件 更新
const
urls
=
getCurrentPages
()
const
currentPath
=
urls
[
0
]
const
pageId
=
item
.
link
.
url
item
.
link
.
newPath
=
`/
${
currentPath
.
route
}
`
}
return
}
else
if
(
item
.
row
)
{
newRow
=
JSON
.
parse
(
item
.
row
)
if
(
newRow
.
type
==
8
)
{
newRow
.
newPath
=
'/pages/productDetail/productDetail'
}
else
if
(
newRow
.
type
==
9
)
{
newRow
.
newPath
=
'/subPackage/page/pages/categoryPro/categoryPro'
}
item
.
row
=
newRow
}
})
// 当前匹配路径是否需要授权 true 需要 false 不需要
currentTab
.
forEach
(
item
=>
{
let
checkUrl
=
''
if
(
item
.
link
)
{
checkUrl
=
item
.
link
.
newPath
?
item
.
link
.
newPath
:
item
.
link
.
url
}
else
if
(
item
.
row
)
{
checkUrl
=
item
.
row
.
newPath
?
item
.
row
.
newPath
:
item
.
row
.
url
}
wxService
.
NoLoginPage
(
checkUrl
).
then
(
res
=>
{
if
(
checkUrl
)
item
.
needAuth
=
res
.
needAuth
this
.
setData
({
imageList
:
currentTab
})
})
})
},
/**
* 组件的初始数据
...
...
@@ -36,6 +81,7 @@ Component({
padding
:
0
,
heights
:
[],
imageHeights
:
{},
// 记录所有图片的实际高度
imageList
:
[]
},
observers
:
{
heights
:
function
(
heights
)
{
...
...
@@ -59,6 +105,9 @@ Component({
* 组件的方法列表
*/
methods
:
{
_getUserInfo
(
res
=
{})
{
this
.
triggerEvent
(
'getAuth'
,
res
);
},
imageLoad
:
function
(
e
)
{
// 图片加载完成回调
let
heights
=
this
.
data
.
heights
...
...
src/component/imageSwiper/imageSwiper.wxml
View file @
01957995
<!--component/imageSwiper/imageSwiper.wxml-->
<wxs src="../../wxs/utils.wxs" module="utils" />
<swiper
class="image-swiper"
indicator-dots="{{indicatorDots}}"
...
...
@@ -9,17 +10,54 @@
duration="{{duration}}"
style="height: {{maxHeight}}px;"
>
<block wx:for="{{imageData}}" wx:key="{{index}}" wx:for-item="item">
<block wx:for="{{imageList}}" wx:key="{{index}}" wx:for-item="item">
<swiper-item class="swiper-item">
<view
wx:if="{{baseImgUrl}}"
data-appid="{{item.link.appid}}"
data-path="{{item.link.url}}"
data-link="{{item.link}}"
data-item="{{item}}"
bindtap='preview'
>
<image bindload="imageLoad" src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}" id="swiperImg{{index}}" mode="widthFix" class="slide-image" />
<view wx:if="{{item.needAuth}}">
<view wx:if="{{!currentHasUserInfo}}">
<image
bindload="imageLoad"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
id="swiperImg{{index}}"
mode="widthFix"
class="slide-image"
/>
</view>
<view wx:else>
<view
data-appid="{{item.link.appid}}"
data-path="{{item.link.url}}"
data-link="{{item.link}}"
data-item="{{item}}"
bindtap='preview'
>
<image
bindload="imageLoad"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
id="swiperImg{{index}}"
mode="widthFix"
class="slide-image"
/>
</view>
</view>
</view>
<view wx:else>
<view
data-appid="{{item.link.appid}}"
data-path="{{item.link.url}}"
data-link="{{item.link}}"
data-item="{{item}}"
bindtap='preview'
>
<image
bindload="imageLoad"
src="{{utils.formateUrl(item.imageUrl,baseImgUrl)}}"
id="swiperImg{{index}}"
mode="widthFix"
class="slide-image"
/>
</view>
</view>
</swiper-item>
</block>
...
...
src/component/picNav/picNav.js
View file @
01957995
...
...
@@ -47,8 +47,6 @@ Component({
newRow
.
newPath
=
'/pages/productDetail/productDetail'
}
else
if
(
newRow
.
type
==
9
)
{
newRow
.
newPath
=
'/subPackage/page/pages/categoryPro/categoryPro'
}
else
{
newRow
.
newPath
=
''
}
item
.
row
=
newRow
}
...
...
@@ -63,7 +61,7 @@ Component({
checkUrl
=
item
.
row
.
newPath
?
item
.
row
.
newPath
:
item
.
row
.
url
}
wxService
.
NoLoginPage
(
checkUrl
).
then
(
res
=>
{
item
.
needAuth
=
res
.
needAuth
i
f
(
checkUrl
)
i
tem
.
needAuth
=
res
.
needAuth
this
.
setData
({
newPicNav
:
picNav
})
})
})
...
...
src/pages/userCenter/userCenter.wxml
View file @
01957995
...
...
@@ -3,7 +3,7 @@
<!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)-->
<block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem">
<view wx:if="{{pItem.type == 1}}">
<image-swiper image-data="{{pItem.rotationchart.images}}" />
<image-swiper image-data="{{pItem.rotationchart.images}}"
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"
/>
</view>
<view class="" wx:if="{{pItem.type == 2}}">
<person-center bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}" person-data="{{pItem.customer}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
...
...
src/subPackage/page/pages/subPage/subPage.wxml
View file @
01957995
...
...
@@ -3,7 +3,7 @@
<!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)-->
<block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem">
<view wx:if="{{pItem.type == 1}}">
<image-swiper image-data="{{pItem.rotationchart.images}}" />
<image-swiper image-data="{{pItem.rotationchart.images}}"
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"
/>
</view>
<view class="" wx:if="{{pItem.type == 2}}">
<person-center bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}" person-data="{{pItem.customer}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
...
...
@@ -21,13 +21,13 @@
<announcement notice="{{pItem.notice}}"/>
</view>
<view class="" wx:if="{{pItem.type == 7}}">
<tab-sort category-type="{{pItem.categoryType}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" />
<tab-sort category-type="{{pItem.categoryType}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"
bind:updatePage="updatePage"
/>
</view>
<view class="" wx:if="{{pItem.type == 8}}">
<attention focus-wx="{{pItem.focusWx}}" />
</view>
<view class="" wx:if="{{pItem.type == 9}}">
<plus sku-list="{{skuVOList}}" plus-bgi="{{pItem.plus}}" currentHasUserInfo="{{currentHasUserInfo}}"/>
<plus sku-list="{{skuVOList}}" plus-bgi="{{pItem.plus}}" currentHasUserInfo="{{currentHasUserInfo}}"
bind:updatePage="updatePage"
/>
</view>
</block>
</view>
...
...
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