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
4db5b92d
Commit
4db5b92d
authored
Apr 17, 2020
by
谢中龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
广告弹出框
parent
c7971084
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
248 additions
and
62 deletions
+248
-62
adDialog.js
src/component/adDialog/adDialog.js
+155
-3
adDialog.wxml
src/component/adDialog/adDialog.wxml
+37
-1
adDialog.wxss
src/component/adDialog/adDialog.wxss
+8
-1
cart.js
src/pages/cart/cart.js
+1
-31
confirmOrder.js
src/pages/confirmOrder/confirmOrder.js
+7
-7
my.js
src/pages/my/my.js
+8
-4
my.json
src/pages/my/my.json
+2
-0
my.wxml
src/pages/my/my.wxml
+4
-0
userCenter.js
src/pages/userCenter/userCenter.js
+6
-3
userCenter.wxml
src/pages/userCenter/userCenter.wxml
+1
-1
subPage.js
src/subPackage/page/pages/subPage/subPage.js
+12
-9
subPage.json
src/subPackage/page/pages/subPage/subPage.json
+2
-0
subPage.wxml
src/subPackage/page/pages/subPage/subPage.wxml
+5
-2
No files found.
src/component/adDialog/adDialog.js
View file @
4db5b92d
...
...
@@ -3,30 +3,182 @@ var app = getApp()
const
wxService
=
require
(
'../../utils/wxService'
)
const
utils
=
require
(
'../../utils/util'
)
const
envInfo
=
require
(
'../../config/index'
).
envInfo
const
utilLink
=
require
(
'../../utils/currentLinkRouter'
)
Component
({
/**
* 组件的属性列表
*/
properties
:
{
showDialog
:
{
type
:
Boolean
,
value
:
false
pageInfo
:
{
type
:
Object
,
value
:
{}
},
currentHasUserInfo
:
{
type
:
Boolean
,
type
:
false
},
},
observers
:{
pageInfo
(
val
){
this
.
handleAdDialog
(
val
);
}
},
/**
* 组件的初始数据
*/
data
:
{
showDialog
:
false
,
imageUrl
:
''
,
needAuth
:
false
,
dialogInfo
:
{},
},
lifetimes
:{
attached
(){
// console.log(this.data.pageInfo)
},
created
(){
}
},
/**
* 组件的方法列表
*/
methods
:
{
_getUserInfo
(
res
=
{})
{
this
.
triggerEvent
(
'getAuth'
,
res
);
},
//处理广告弹出层
handleAdDialog
(
page
){
if
(
!
page
){
this
.
data
.
showDialog
=
false
;
this
.
setData
({
showDialog
:
this
.
data
.
showDialog
});
return
;
}
if
(
!
page
.
hasDialog
){
this
.
data
.
showDialog
=
false
;
this
.
setData
({
showDialog
:
this
.
data
.
showDialog
});
return
;
}
//有弹框
this
.
data
.
showDialog
=
true
;
let
dialogInfo
=
page
.
dialogInfo
?
JSON
.
parse
(
page
.
dialogInfo
)
:
null
;
if
(
dialogInfo
){
this
.
data
.
imageUrl
=
dialogInfo
.
imageUrl
;
if
(
dialogInfo
.
link
)
{
if
(
dialogInfo
.
link
.
type
==
2
)
{
// 父组件 更新
const
urls
=
getCurrentPages
()
const
currentPath
=
urls
[
0
]
const
pageId
=
dialogInfo
.
link
.
url
dialogInfo
.
link
.
newPath
=
`/
${
currentPath
.
route
}
`
}
}
else
if
(
dialogInfo
.
row
)
{
newRow
=
JSON
.
parse
(
dialogInfo
.
row
)
if
(
newRow
.
type
==
8
)
{
newRow
.
newPath
=
'/pages/productDetail/productDetail'
}
else
if
(
newRow
.
type
==
9
)
{
newRow
.
newPath
=
'/subPackage/page/pages/categoryPro/categoryPro'
}
dialogInfo
.
row
=
newRow
}
let
checkUrl
=
''
;
if
(
dialogInfo
.
link
)
{
checkUrl
=
dialogInfo
.
link
.
newPath
?
dialogInfo
.
link
.
newPath
:
dialogInfo
.
link
.
url
}
else
if
(
dialogInfo
.
row
)
{
checkUrl
=
dialogInfo
.
row
.
newPath
?
dialogInfo
.
row
.
newPath
:
dialogInfo
.
row
.
url
}
dialogInfo
.
needAuth
=
false
;
wxService
.
NoLoginPage
(
checkUrl
).
then
(
res
=>
{
if
(
checkUrl
)
{
dialogInfo
.
needAuth
=
res
.
needAuth
;
this
.
setData
({
dialogInfo
:
dialogInfo
,
});
}
});
}
this
.
setData
({
imageUrl
:
this
.
data
.
imageUrl
,
showDialog
:
this
.
data
.
showDialog
&&
!
this
.
todayHasDialog
(),
dialogInfo
:
dialogInfo
,
});
},
//预览
preview
(
event
)
{
if
(
!
this
.
data
.
pageInfo
.
hasDialog
){
return
;
}
utilLink
.
currentLinkRouter
(
event
,
this
);
},
//设置弹出框本地弹出状态 //每天都弹出
setLocalDialogStatus
(){
let
currentRouter
=
getCurrentPages
()[
getCurrentPages
().
length
-
1
].
route
;
let
dialogInfo
=
wx
.
getStorageSync
(
'dialogInfo'
);
let
key
=
`
${
currentRouter
}
_d_
${
this
.
getCurrentYearMonDay
()}
`
;
if
(
!
dialogInfo
){
dialogInfo
=
{};
dialogInfo
[
key
]
=
true
;
wx
.
setStorageSync
(
'dialogInfo'
,
dialogInfo
);
}
else
{
//先设置进去
dialogInfo
[
key
]
=
true
;
wx
.
setStorageSync
(
'dialogInfo'
,
dialogInfo
);
//获取今天的当前也的key
let
expiredAllKey
=
[];
for
(
let
k
in
dialogInfo
){
let
expiredKey
=
k
.
split
(
'_d_'
)[
1
];
if
(
parseInt
(
expiredKey
)
<
parseInt
(
this
.
getCurrentYearMonDay
())){
expiredAllKey
.
push
(
k
);
}
}
//移除今天一起的过期key
expiredAllKey
.
forEach
(
item
=>
{
delete
dialogInfo
[
item
];
});
}
},
//获取今天是否已经弹出了
todayHasDialog
(){
let
currentRouter
=
getCurrentPages
()[
getCurrentPages
().
length
-
1
].
route
;
let
dialogInfo
=
wx
.
getStorageSync
(
'dialogInfo'
);
let
key
=
`
${
currentRouter
}
_d_
${
this
.
getCurrentYearMonDay
()}
`
;
if
(
!
dialogInfo
){
return
false
;
}
if
(
dialogInfo
[
key
]){
return
true
}
return
false
;
},
//获取当前年月日
getCurrentYearMonDay
(){
let
da
=
new
Date
();
return
`
${
da
.
getFullYear
()}${
da
.
getMonth
()}${
da
.
getDate
()}
`
;
},
//关闭
onTapClose
(){
this
.
setLocalDialogStatus
();
this
.
setData
({
showDialog
:
false
});
...
...
src/component/adDialog/adDialog.wxml
View file @
4db5b92d
<!--component/adDialog/adDialog.wxml-->
<view class="ad-modal-bg" wx:if="{{showDialog}}">
<view class="ad-modal-body">
<image mode="widthFix" src="https://hwimagecdn.ihotwind.cn/hotwind-activity/home_get_coupon.png"></image>
<view class="show-img">
<!-- 是否需要授权 -->
<view class="positionRe" wx:if="{{dialogInfo.needAuth}}">
<button
wx:if="{{!currentHasUserInfo}}"
bindgetuserinfo="_getUserInfo"
data-jflag="false"
open-type='getUserInfo'
class='positionAbs clear-btn'
hover-class="btn-hover">
<image mode="widthFix"
data-appid="{{dialogInfo.link.appid}}"
data-path="{{dialogInfo.link.url}}"
data-link="{{dialogInfo.link}}"
data-item="{{dialogInfo}}"
src="{{imageUrl}}"></image>
</button>
<!-- 已授权 -->
<image mode="widthFix"
wx:if="{{currentHasUserInfo}}"
data-appid="{{dialogInfo.link.appid}}"
data-path="{{dialogInfo.link.url}}"
data-link="{{dialogInfo.link}}"
data-item="{{dialogInfo}}"
bindtap='preview'
src="{{imageUrl}}"></image>
</view>
<!-- 不需要授权 -->
<image mode="widthFix"
wx:if="{{!dialogInfo.needAuth}}"
data-appid="{{dialogInfo.link.appid}}"
data-path="{{dialogInfo.link.url}}"
data-link="{{dialogInfo.link}}"
data-item="{{dialogInfo}}"
bindtap='preview'
src="{{imageUrl}}"></image>
</view>
<view class="close-dia">
<image src="/assets/imgs/close.png" mode="aspectFit" bindtap="onTapClose"></image>
</view>
...
...
src/component/adDialog/adDialog.wxss
View file @
4db5b92d
...
...
@@ -22,8 +22,15 @@
justify-content: center;
}
.ad-modal-bg .ad-modal-body image{
.ad-modal-bg .ad-modal-body .show-img{
width: 100%;
height: auto;
}
.ad-modal-bg .ad-modal-body .show-img image{
width: 100%;
height: auto;
}
.ad-modal-bg .ad-modal-body .close-dia{
...
...
src/pages/cart/cart.js
View file @
4db5b92d
...
...
@@ -258,37 +258,7 @@ wxService.page({
// 直接调支付
// this.handleGoBuy(skuIds)
},
handleGoBuy
(
parmas
)
{
// 下单
wx
.
showLoading
({
title
:
'加载中'
})
// 获取支付参数
wxService
.
post
(
`/sale/trade/buyer/create`
,
parmas
).
then
(
res
=>
{
if
(
!
res
)
return
false
;
const
{
result
,
data
}
=
res
&&
res
.
data
||
res
&&
res
.
result
if
(
result
==
0
)
{
delete
data
.
appId
let
amount
=
data
.
amount
||
0
wx
.
requestPayment
(
Object
.
assign
({
success
(
res
)
{
wx
.
hideLoading
()
// wx.showToast({
// title: '支付成功',
// icon: 'none',
// mask: true
// })
// 支付成功页面
wxService
.
router
(
`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=
${
amount
}
`
)
},
fail
(
res
)
{
wx
.
hideLoading
()
wxService
.
router
(
'/subPackage/page/pages/paymentStatus/paymentStatus?status=F'
)
}
},
data
))
}
})
},
// 调整商品 /trolley/add
editOk
(
cartPro
)
{
// count skuId
...
...
src/pages/confirmOrder/confirmOrder.js
View file @
4db5b92d
...
...
@@ -885,7 +885,7 @@ wxService.page({
let
tempArr
=
res
.
data
.
data
?
res
.
data
.
data
:
[];
let
currentType
=
_this
.
data
.
currentType
;
if
(
tempArr
.
length
==
0
)
{
wx
.
re
directTo
({
wx
.
re
Launch
({
url
:
`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=
${
amount
}
&type=
${
currentType
}
`
,
});
return
;
...
...
@@ -909,14 +909,14 @@ wxService.page({
}
},
complete
:
(
res
)
=>
{
wx
.
re
directTo
({
wx
.
re
Launch
({
url
:
`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=
${
amount
}
&type=
${
currentType
}
`
,
});
}
})
}).
catch
(
err
=>
{
let
currentType
=
_this
.
data
.
currentType
;
wx
.
re
directTo
({
wx
.
re
Launch
({
url
:
`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=
${
amount
}
&type=
${
currentType
}
`
,
});
})
...
...
@@ -928,11 +928,11 @@ wxService.page({
icon
:
'none'
});
if
(
_this
.
data
.
currentType
==
'delivery'
)
{
wx
.
re
directTo
({
wx
.
re
Launch
({
url
:
'/pages/order/order'
,
});
}
else
{
wx
.
re
directTo
({
wx
.
re
Launch
({
url
:
'/subPackage/page/pages/selfPickUpOrderList/selfPickUpOrderList'
,
});
}
...
...
@@ -940,11 +940,11 @@ wxService.page({
},
data
.
wxParams
));
}
else
{
if
(
_this
.
data
.
currentType
==
'delivery'
)
{
wx
.
re
directTo
({
wx
.
re
Launch
({
url
:
'/pages/order/order'
,
});
}
else
{
wx
.
re
directTo
({
wx
.
re
Launch
({
url
:
'/subPackage/page/pages/selfPickUpOrderList/selfPickUpOrderList'
,
});
}
...
...
src/pages/my/my.js
View file @
4db5b92d
...
...
@@ -32,7 +32,9 @@ wxService.page({
currHomePageId
:
''
,
skuVOList
:
[],
isQiye
:
false
,
contactUsModal
:
false
contactUsModal
:
false
,
//显示广告
pageInfo
:
null
,
},
/**
* 生命周期函数--监听页面加载
...
...
@@ -234,12 +236,14 @@ wxService.page({
// 动态设置title
wx
.
setNavigationBarTitle
({
title
:
data
.
page
.
title
})
});
this
.
data
.
pageInfo
=
data
.
page
;
// 首页 pageId
// data.page.pageId
this
.
setData
({
currHomePageId
:
data
.
page
.
pageId
})
currHomePageId
:
data
.
page
.
pageId
,
pageInfo
:
this
.
data
.
pageInfo
});
// 段落
const
products
=
data
.
paragraphs
...
...
src/pages/my/my.json
View file @
4db5b92d
...
...
@@ -15,6 +15,7 @@
"authorization-modal"
:
"/component/authorization-modal/authorization-modal"
,
"plus"
:
"/component/plus/plus"
,
"cell"
:
"plugin://contactPlugin/cell"
,
"ad-dialog"
:
"/component/adDialog/adDialog"
,
"contact-us-modal"
:
"/component/contactUsModal/contactUsModal"
}
}
\ No newline at end of file
src/pages/my/my.wxml
View file @
4db5b92d
...
...
@@ -51,3 +51,6 @@
<!-- 联系我点击成功之后的回调 -->
<contact-us-modal contactShow="{{contactUsModal}}"/>
<!-- 广告 -->
<ad-dialog pageInfo="{{pageInfo}}" currentHasUserInfo="{{currentHasUserInfo}}" bind:getAuth="_getUserInfo"/>
\ No newline at end of file
src/pages/userCenter/userCenter.js
View file @
4db5b92d
...
...
@@ -41,7 +41,7 @@ wxService.page({
contactUsModal
:
false
,
apiIsOk
:
true
,
//显示广告
showDialog
:
true
,
pageInfo
:
null
,
},
/**
* 生命周期函数--监听页面加载
...
...
@@ -285,6 +285,8 @@ wxService.page({
//把页面信息缓存到本地
//获取tabs
let
tabs
=
data
.
paragraphs
.
filter
(
item
=>
item
.
type
==
5
);
this
.
data
.
pageInfo
=
data
.
page
;
if
(
tabs
.
length
>
0
){
wx
.
setStorageSync
(
'navBars'
,
tabs
[
0
]);
}
...
...
@@ -302,8 +304,9 @@ wxService.page({
// 首页 pageId
// data.page.pageId
this
.
setData
({
currHomePageId
:
data
.
page
.
pageId
})
currHomePageId
:
data
.
page
.
pageId
,
pageInfo
:
this
.
data
.
pageInfo
});
// 段落
const
products
=
data
.
paragraphs
...
...
src/pages/userCenter/userCenter.wxml
View file @
4db5b92d
...
...
@@ -81,4 +81,4 @@
<exception wx:if="{{!apiIsOk}}" bind:reCall="onTapReCall"/>
<!-- 广告 -->
<
!-- <ad-dialog showDialog="{{showDialog}}"/> --
>
<
ad-dialog pageInfo="{{pageInfo}}" currentHasUserInfo="{{currentHasUserInfo}}" bind:getAuth="_getUserInfo"/
>
src/subPackage/page/pages/subPage/subPage.js
View file @
4db5b92d
...
...
@@ -32,7 +32,9 @@ wxService.page({
pageBackgroundColor
:
0
,
guidePageModalShow
:
false
,
currHomePageId
:
''
,
skuVOList
:[]
skuVOList
:[],
//显示广告
pageInfo
:
null
,
},
/**
* 生命周期函数--监听页面加载
...
...
@@ -225,23 +227,25 @@ wxService.page({
wxService
.
post
(
`/merchant/modelPage/getDetailById?pageId=
${
pageId
}
&brandId=
${
app
.
globalData
.
brandId
}
`
).
then
(
res
=>
{
// wxService.post(`/merchant/modelPage/mainSetting/mall?brandId=${app.globalData.brandId}`).then(res => {
if
(
!
res
)
return
false
const
{
result
,
data
}
=
res
.
data
console
.
log
(
data
.
page
.
backgroundColor
)
const
{
result
,
data
}
=
res
.
data
;
this
.
data
.
pageBackgroundColor
=
data
.
page
.
backgroundColor
?
data
.
page
.
backgroundColor
:
0
;
if
(
result
==
0
)
{
this
.
setData
({
pageBackgroundColor
:
this
.
data
.
pageBackgroundColor
})
})
;
// 动态设置title
wx
.
setNavigationBarTitle
({
title
:
data
.
page
.
title
})
});
this
.
data
.
pageInfo
=
data
.
page
;
// 首页 pageId
// data.page.pageId
this
.
setData
({
currHomePageId
:
data
.
page
.
pageId
})
currHomePageId
:
data
.
page
.
pageId
,
pageInfo
:
this
.
data
.
pageInfo
});
// 段落
const
products
=
data
.
paragraphs
const
filterResult
=
products
.
map
((
res
,
index
)
=>
{
...
...
@@ -262,7 +266,6 @@ wxService.page({
let
tabbar
=
products
.
filter
(
item
=>
item
.
type
==
5
);
let
plus
=
products
.
filter
(
item
=>
item
.
type
==
9
);
console
.
log
(
this
.
data
.
outoHeigth
)
if
(
plus
.
length
!=
0
)
{
this
.
setData
({
paddingBottom
:
'96rpx'
,
...
...
src/subPackage/page/pages/subPage/subPage.json
View file @
4db5b92d
...
...
@@ -14,6 +14,7 @@
"guide-page-modal"
:
"/component/guidePageModal/guidePageModal"
,
"bottom-tabs"
:
"/component/bottomTabs/bottomTabs"
,
"authorization-modal"
:
"/component/authorization-modal/authorization-modal"
,
"ad-dialog"
:
"/component/adDialog/adDialog"
,
"plus"
:
"/component/plus/plus"
}
}
\ No newline at end of file
src/subPackage/page/pages/subPage/subPage.wxml
View file @
4db5b92d
...
...
@@ -35,4 +35,7 @@
<guide-page-modal show="{{guidePageModalShow}}" />
<!-- 底部补充高度 防止被遮盖 -->
<view class="bottom-fixed" style="padding-bottom:{{paddingBottom}}"></view>
<go-guid/>
\ No newline at end of file
<go-guid/>
<!-- 广告 -->
<ad-dialog pageInfo="{{pageInfo}}" currentHasUserInfo="{{currentHasUserInfo}}" bind:getAuth="_getUserInfo"/>
\ 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