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
4e0093ac
Commit
4e0093ac
authored
Sep 04, 2019
by
高淑倩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tab
parent
8c08fb5f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
32 deletions
+97
-32
bottomTabs.js
src/component/bottomTabs/bottomTabs.js
+60
-19
bottomTabs.wxml
src/component/bottomTabs/bottomTabs.wxml
+34
-10
userCenter.wxml
src/pages/userCenter/userCenter.wxml
+1
-1
subPage.wxml
src/subPackage/page/pages/subPage/subPage.wxml
+2
-2
No files found.
src/component/bottomTabs/bottomTabs.js
View file @
4e0093ac
...
...
@@ -9,6 +9,10 @@ Component({
* 组件的属性列表
*/
properties
:
{
currentHasUserInfo
:{
type
:
Boolean
,
type
:
false
},
tabBar
:{
type
:
Object
,
value
:
null
...
...
@@ -18,9 +22,6 @@ Component({
value
:
''
}
},
attached
()
{
},
ready
()
{
this
.
setData
({
currentRoute
:
`/
${
utils
.
getCurrentPageUrl
()}
`
...
...
@@ -38,30 +39,70 @@ Component({
* 组件的方法列表
*/
methods
:
{
_getUserInfo
(
res
=
{})
{
const
userInfo
=
res
.
detail
||
{}
console
.
log
(
'userInfo'
,
userInfo
)
// 先授权再领卡
if
(
res
.
detail
.
userInfo
)
{
utils
.
getUserInfoByBtn
(
userInfo
).
then
(
(
data
=
{}
)
=>
{
const
{
token
}
=
data
wx
.
setStorageSync
(
'_accreditUserInfo'
,
userInfo
)
wx
.
hideNavigationBarLoading
()
if
(
token
)
{
wx
.
setStorageSync
(
'token'
,
token
)
}
else
{
wx
.
setStorageSync
(
'token'
,
''
)
}
wx
.
setStorageSync
(
'_baseUserInfo'
,
data
)
// 缓存用户信息
this
.
setUserInfo
()
// 判断有无开卡
}).
catch
(
err
=>
{
if
(
err
)
{
wx
.
showToast
({
title
:
`会员系统异常请稍后重试!`
,
icon
:
'none'
})
}
})
}
},
setUserInfo
()
{
const
userInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
// 新用户去激活领卡
if
(
userInfo
&&
userInfo
.
member
&&
!
userInfo
.
member
.
mobile
)
{
console
.
log
(
'去开'
)
wxService
.
openCard
()
return
false
}
else
{
console
.
log
(
'已开'
)
}
// 跳转
const
urls
=
getCurrentPages
()
setTimeout
(()
=>
{
const
item
=
urls
[
0
].
options
if
(
item
.
route
)
{
try
{
const
options
=
JSON
.
parse
(
item
.
options
)
wxService
.
router
(
`/
${
item
.
route
}
`
).
search
(
options
).
replace
()
}
catch
(
e
)
{
wxService
.
router
(
'/pages/userCenter/userCenter'
).
replace
()
}
}
else
{
wxService
.
router
(
'/pages/userCenter/userCenter'
).
replace
()
}
},
200
)
},
handelToPage
(
event
){
const
ev
=
event
.
currentTarget
.
dataset
;
let
curItemType
=
ev
.
item
const
userInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
const
userInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
// link row
if
(
curItemType
.
link
)
{
let
currentClickType
=
app
.
globalData
.
commonFunc
.
getLink
(
curItemType
.
link
.
type
,
curItemType
)
if
(
curItemType
.
link
.
type
==
1
)
{
// 触发父组件更新页面 外部小程序
this
.
setData
({
isAuthorization
:
false
})
return
false
}
else
if
(
!
userInfo
)
{
this
.
setData
({
isAuthorization
:
true
})
return
false
}
else
if
(
userInfo
&&
userInfo
.
member
&&
!
userInfo
.
member
.
mobile
)
{
wxService
.
openCard
()
return
false
}
if
(
curItemType
.
link
.
type
==
2
)
{
}
else
if
(
curItemType
.
link
.
type
==
2
)
{
// 触发父组件更新页面
wxService
.
nextTick
(()
=>
{
this
.
triggerEvent
(
'updatePage'
,
{
pageId
:
currentClickType
.
url
})
...
...
src/component/bottomTabs/bottomTabs.wxml
View file @
4e0093ac
<!--component/bottomTabs/bottomTabs.wxml-->
{{currentHasUserInfo}}
<view class='bgc fixed-bottom0' style="background-color:#FFF;background-image:url({{tabBar.num == 4 ? '': '/assets/imgs/7_1_0/bg.png'}});{{tabBar.num == 4 ? 'height: 108rpx':'height: 144rpx'}}" wx:if="{{tabBar.num == 4}}">
<block wx:for="{{tabBar.images}}" wx:key="{{index}}" wx:for-item="tab">
<view
class="tab"
data-item="{{tab}}"
bindtap="handelToPage"
>
<image class='tab-img' wx:if="{{currHomePageId == tab.redirectId}}" src='{{tab.activeImageUrl}}' />
<image class='tab-img' wx:else src='{{tab.imageUrl}}' />
<block wx:for="{{tabBar.images}}" wx:key="{{index}}" wx:for-item="tab">
<view class="tab" data-item="{{tab}}" bindtap="handelToPage">
<!-- <view wx:if="{{tab.desc == '个人中心'}}">
<view wx:if="{{!currentHasUserInfo}}">
<button
bindgetuserinfo="_getUserInfo"
data-jflag="false"
open-type='getUserInfo'
class='btn btn-primary'
hover-class="btn-hover"
>
<image class='tab-img' src='{{currHomePageId == tab.redirectId ? "{{tab.activeImageUrl}}": "{{tab.imageUrl}}"}}' />
</button>
</view>
<view wx:else>3</view>
</view>
<view wx:else>
22
</view>-->
<button wx:if="{{currHomePageId == tab.redirectId}}">
<image class='tab-img' src='{{tab.activeImageUrl}}' />
</button>
<button wx:else>
<image class='tab-img' src='{{tab.imageUrl}}' />
</button>
</view>
</block>
</view>
<view class="bottom-tab fixed-bottom0" style="height: 108rpx;" wx:if="{{tabBar.num == 5}}">
<block wx:for="{{tabs}}" wx:key="{{index}}" wx:for-item="tab">
<view class="tab" data-item="{{tab}}" bindtap="handelToPage">
<image class='tab-img' wx:if="{{currHomePageId == tab.redirectId}}" src='{{tab.activeImageUrl}}' />
<image class='tab-img' wx:else src='{{tab.imageUrl}}' />
<button wx:if="{{currHomePageId == tab.redirectId}}">
<image class='tab-img' src='{{tab.activeImageUrl}}' />
</button>
<button wx:else>
<image class='tab-img' src='{{tab.imageUrl}}' />
</button>
</view>
</block>
</view>
src/pages/userCenter/userCenter.wxml
View file @
4e0093ac
...
...
@@ -15,7 +15,7 @@
<bottom bottom="{{pItem.bottom}}" />
</view>
<view class="" wx:if="{{pItem.type == 5}}">
<bottom-tabs tab-bar="{{pItem.tabBar}}" bind:updatePage="updatePage"/>
<bottom-tabs
currHomePageId="{{currHomePageId}}" currentHasUserInfo="{{currentHasUserInfo}}"
tab-bar="{{pItem.tabBar}}" bind:updatePage="updatePage"/>
</view>
<view class="" wx:if="{{pItem.type == 6}}">
<announcement notice="{{pItem.notice}}" />
...
...
src/subPackage/page/pages/subPage/subPage.wxml
View file @
4e0093ac
...
...
@@ -15,7 +15,7 @@
<bottom bottom="{{pItem.bottom}}" />
</view>
<view class="" wx:if="{{pItem.type == 5}}">
<bottom-tabs
tab-bar="{{pItem.tabBar}}"
/>
<bottom-tabs
currHomePageId="{{currHomePageId}}" currentHasUserInfo="{{currentHasUserInfo}}" tab-bar="{{pItem.tabBar}}" bind:updatePage="updatePage"
/>
</view>
<view class="" wx:if="{{pItem.type == 6}}">
<announcement notice="{{pItem.notice}}" />
...
...
@@ -27,7 +27,7 @@
<attention focus-wx="{{pItem.focusWx}}" />
</view>
<view class="" wx:if="{{pItem.type == 9}}">
<plus sku-list="{{pItem.plus}}" />
<plus sku-list="{{pItem.plus}}"
plus-bgi="{{pItem.plus}}" currentHasUserInfo="{{currentHasUserInfo}}"
/>
</view>
</block>
<!--goHome-->
...
...
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