diff --git a/pages/index/index.js b/pages/index/index.js
index bfadf57..1dca489 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -33,14 +33,45 @@ Page({
otherPlat: null,
activeBannerIndex: 0,
smBannerIndex: 0,
- indexSeason: {}
+ indexSeason: {},
+ startList: [], // 启动页广告
+ alertSwipeList: [], //弹窗广告
+ showAdv: false, //弹窗开关
+ showFullAdv: true, //全屏广告开关
+ time: 5 //全屏广告剩余时间
},
onLoad: function (options) {
+ //全屏广告
+ wx.hideTabBar() //这里隐藏了底部导航栏
+ commonApi._post("adv/getAdv", {
+ position: 2,
+ type_id: 5
+ }).then(res => {
+ if (res.data.length > 0) {
+ let timer = setInterval(() => {
+ this.setData({
+ time: this.data.time - 1
+ })
+ if (this.data.time == 0) {
+ timer = null
+ this.setData({
+ showFullAdv: false
+ })
+ if (!this.data.alertSwipeList>0)
+ wx.showTabBar() //倒计时结束清楚定时器显示导航栏
+ }
+ }, 1000)
+ this.setData({
+ startList: res.data || []
+ })
+ }
+ })
if (options.from) {
app.globalData.from = options.from;
}
- let systemInfo = wx.getSystemInfoSync(), rect = wx.getMenuButtonBoundingClientRect();
+ let systemInfo = wx.getSystemInfoSync(),
+ rect = wx.getMenuButtonBoundingClientRect();
let height = (rect.top - systemInfo.statusBarHeight) * 2 + rect.height;
wx.getLocation({
type: 'gcj02',
@@ -147,6 +178,39 @@ Page({
xiaobanner: res.data || []
})
})
+ //弹窗广告
+ commonApi._post("adv/getAdv", {
+ position: 3,
+ type_id: 5
+ }).then(res => {
+ if (res.data.length > 0) {
+ this.setData({
+ alertSwipeList: res.data || [],
+ showAdv: true
+ })
+ }
+ })
+
+ },
+ //关闭弹窗广告
+ closeAdv: function () {
+ this.setData({
+ showAdv: false
+ })
+ wx.showTabBar({
+ animation: true,
+ })
+ },
+ //关闭全屏广告
+ closeFullAdv:function(){
+ this.setData({
+ showFullAdv:false
+ })
+ if (!this.data.alertSwipeList.length>0) {
+ wx.showTabBar({
+ animation: true,
+ })
+ }
},
getWeather: function () {
commonApi._post('pbservice/Ztfw/getWeather').then(res => {
@@ -156,8 +220,7 @@ Page({
})
})
},
- saleDetail: function () {
- },
+ saleDetail: function () {},
getTwoProduct: function () {
// 获取首页限时特惠
commonApi._post('act/fast_sale_now', {
@@ -209,17 +272,18 @@ Page({
})
},
getFourProduct: function () {
- let item = this.data.indexHot[this.data.hotIndex], service = "product/get_product_by_tag", data = {
- tag_id: item.id,
- offset: 0,
- limit: 4,
- sort: 'weight',
- order: 'desc'
- };
+ let item = this.data.indexHot[this.data.hotIndex],
+ service = "product/get_product_by_tag",
+ data = {
+ tag_id: item.id,
+ offset: 0,
+ limit: 4,
+ sort: 'weight',
+ order: 'desc'
+ };
if (item.type == 'scene') {
service = "scene/get_scene_by_tag";
- }
- else if (item.type == 'movie') {
+ } else if (item.type == 'movie') {
service = "Cinema/getHotMovieList";
data = {
page: 1,
@@ -238,8 +302,7 @@ Page({
wx.navigateTo({
url: '/pages/list/movieticket/list/info/index?id=' + item.third_id + '&title=' + item.title,
})
- }
- else {
+ } else {
util.gotoDetail(item)
}
},
@@ -248,9 +311,11 @@ Page({
util.gotoDetail(item)
},
gotoPath: function (e) {
- console.log(e)
+ console.log(e)
if (e.currentTarget.dataset.event) {
- this.pagePoint({ event: e.currentTarget.dataset.event }, 1)
+ this.pagePoint({
+ event: e.currentTarget.dataset.event
+ }, 1)
}
if (e.currentTarget.dataset.title == '书香借阅') {
wx.navigateToMiniProgram({
@@ -258,7 +323,7 @@ Page({
path: 'pages/home/home'
})
return;
- }else if (e.currentTarget.dataset.title == '12348') {
+ } else if (e.currentTarget.dataset.title == '12348') {
wx.navigateToMiniProgram({
appId: 'wxcdfd45c001466ba3',
path: 'pages/index/index'
@@ -280,7 +345,9 @@ Page({
},
gotoUrl: function (e) {
if (e.currentTarget.dataset.event) {
- this.pagePoint({ event: e.currentTarget.dataset.event }, 1)
+ this.pagePoint({
+ event: e.currentTarget.dataset.event
+ }, 1)
}
let url = e.currentTarget.dataset.url;
app.globalData.weburl = url;
@@ -289,7 +356,8 @@ Page({
})
},
gotoMini: function (e) {
- let appid = e.currentTarget.dataset.appid, path = e.currentTarget.dataset.path
+ let appid = e.currentTarget.dataset.appid,
+ path = e.currentTarget.dataset.path
wx.navigateToMiniProgram({
appId: appid,
path: path
@@ -334,8 +402,7 @@ Page({
res.data.map(item => {
if (item.ext.display_tags) {
item.ext.display_tags = item.ext.display_tags.split(",").splice(0, 2)
- }
- else {
+ } else {
item.ext.display_tags = []
}
})
@@ -366,8 +433,7 @@ Page({
wx.navigateTo({
url: '/pages/info/strategyInfo/index?id=' + item.s_id,
})
- }
- else {
+ } else {
util.gotoDetail(item.ext);
}
},
@@ -407,24 +473,22 @@ Page({
wx.navigateTo({
url: "/pages/pbService/web/index"
})
- }
- else {
+ } else {
let page = item.tdata.split("/");
page = page[page.length - 1].split("?")
console.log(page[0])
let url = this.data.urltopage[page[0]];
if (url && url.indexOf('map') != -1) {
- let types = ['', 'scenic', 'venue', 'post', 'restaurant', 'relic', 'tenscenic', 'cinema', 'academes'], type = page[1] ? page[1].split("=") : [];
+ let types = ['', 'scenic', 'venue', 'post', 'restaurant', 'relic', 'tenscenic', 'cinema', 'academes'],
+ type = page[1] ? page[1].split("=") : [];
wx.reLaunch({
url: url + "?type=" + (type[1] ? types.findIndex(t => t == type[1]) : null)
})
- }
- else if (url) {
+ } else if (url) {
wx.navigateTo({
url: url,
})
- }
- else {
+ } else {
app.globalData.weburl = item.tdata;
wx.navigateTo({
url: "/pages/pbService/web/index"
@@ -439,8 +503,7 @@ Page({
let weburl = item.tdata.page
if (weburl.indexOf('?') != -1) {
weburl += '&authCode=' + res.data;
- }
- else {
+ } else {
weburl += '?authCode=' + res.data
}
wx.navigateToMiniProgram({
@@ -453,8 +516,7 @@ Page({
path: item.tdata.page
})
})
- }
- else {
+ } else {
wx.navigateToMiniProgram({
appId: item.tdata.appid,
path: item.tdata.page
@@ -476,19 +538,16 @@ Page({
appId: info[0],
path: info[1]
})
- }
- else if (item.href.indexOf('map/index') != -1) {
+ } else if (item.href.indexOf('map/index') != -1) {
wx.reLaunch({
url: item.href
})
- }
- else {
+ } else {
wx.navigateTo({
url: item.href,
})
}
- }
- else if (item.action == "web") {
+ } else if (item.action == "web") {
app.globalData.weburl = item.href;
wx.navigateTo({
url: "/pages/pbService/web/index",
@@ -541,6 +600,92 @@ Page({
}
})
},
+ bannerJumpNew(item) {
+ let that = this
+ item = item.currentTarget.dataset.item
+ console.log(item);
+
+ if (item.tdata == '') return
+ that.pagePoint({
+ event: "banner_click",
+ type: 'banner'
+ }, 1)
+ switch (item.jump_type) {
+ case 0:
+ break;
+ case 1:
+ util.gotoDetail(item.product_model)
+ break;
+ case 2:
+ if (item.front_model && item.front_model.mini) {
+ wx.navigateTo({
+ url: "/" + item.front_model.mini
+ })
+ }
+ break;
+ case 3:
+ if ((item.tdata.indexOf('http://') != -1 || item.tdata.indexOf('https://') != -1) && item.tdata.indexOf('m.cloud.sz-trip.com') == -1) {
+ // 外部h5
+ console.log(item.tdata)
+ app.globalData.weburl = item.tdata;
+ wx.navigateTo({
+ url: "/pages/pbService/web/index"
+ })
+ } else {
+ let page = item.tdata.split("/");
+ page = page[page.length - 1].split("?")
+ console.log(page[0])
+ let url = this.data.urltopage[page[0]];
+ if (url && url.indexOf('map') != -1) {
+ let types = ['', 'scenic', 'venue', 'post', 'restaurant', 'relic', 'tenscenic', 'cinema', 'academes'],
+ type = page[1] ? page[1].split("=") : [];
+ wx.reLaunch({
+ url: url + "?type=" + (type[1] ? types.findIndex(t => t == type[1]) : null)
+ })
+ } else if (url) {
+ wx.navigateTo({
+ url: url,
+ })
+ } else {
+ app.globalData.weburl = item.tdata;
+ wx.navigateTo({
+ url: "/pages/pbService/web/index"
+ })
+ }
+ }
+ break;
+ case 4:
+ if (item.tdata.appid == 'wxe5ca0f71e918e352' && wx.getStorageSync('jstrip_userid')) {
+ // 如果是苏心游的小程序 直接把authCode带过去
+ userApi.user_post("user/getJumpThirdAppCode", {}).then(res => {
+ let weburl = item.tdata.page
+ if (weburl.indexOf('?') != -1) {
+ weburl += '&authCode=' + res.data;
+ } else {
+ weburl += '?authCode=' + res.data
+ }
+ wx.navigateToMiniProgram({
+ appId: item.tdata.appid,
+ path: weburl
+ })
+ }).catch(err => {
+ wx.navigateToMiniProgram({
+ appId: item.tdata.appid,
+ path: item.tdata.page
+ })
+ })
+ } else {
+ wx.navigateToMiniProgram({
+ appId: item.tdata.appid,
+ path: item.tdata.page
+ })
+ }
+ break;
+ default:
+ break;
+ }
+ return
+ },
onReady: function () {
if (app.globalData.configJson) {
this.setData({
@@ -551,8 +696,7 @@ Page({
})
console.log(app.globalData.configJson)
this.getFourProduct()
- }
- else {
+ } else {
setTimeout(() => {
this.onReady()
}, 300)
@@ -565,14 +709,12 @@ Page({
wx.navigateTo({
url: "/pages/pbService/web/index"
})
- }
- else if (item.type == 'mini') {
+ } else if (item.type == 'mini') {
wx.navigateToMiniProgram({
appId: item.appid,
path: item.path
})
- }
- else if (item.type == 'page') {
+ } else if (item.type == 'page') {
wx.navigateTo({
url: item.page,
})
@@ -582,7 +724,9 @@ Page({
util.pagePoint(e, type)
},
onShow: function () {
- this.pagePoint({ event: 'home_view' }, 1)
+ this.pagePoint({
+ event: 'home_view'
+ }, 1)
},
/**
@@ -591,4 +735,4 @@ Page({
onShareAppMessage: function () {
}
-})
+})
\ No newline at end of file
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index b56ae75..81de7b7 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -20,7 +20,7 @@
搜索想要的旅游产品或服务
-
+
@@ -197,8 +197,8 @@
-
- 文博会
+
+ 云上文博会
@@ -411,4 +411,27 @@
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+跳过 {{time}}
+
+
+
+
+
+
+
+
diff --git a/pages/index/index.wxss b/pages/index/index.wxss
index 0472f6f..a70741b 100644
--- a/pages/index/index.wxss
+++ b/pages/index/index.wxss
@@ -669,4 +669,57 @@
width: 20rpx;
height: 7rpx;
border-radius: 3rpx;
+}
+/* 弹窗广告 */
+.zzc{
+ background: gray;
+ position: fixed;
+ left: 0px;
+ top: 0px;
+ width:100%;
+ height: 100%;
+ z-index: 998;
+ filter: alpha(opacity=80);
+ opacity: 0.8 !important;
+}
+.alertavd{
+ width: 500rpx;
+ height: 500rpx;
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ transform: translate(-250rpx,-150rpx);
+ z-index: 999;
+
+}
+.alertsp{
+ width: 100%;
+ height: 100%;
+ z-index: 1000;
+}
+.fullavd{
+ position: fixed;
+ left: 0px;
+ top: 0px;
+ width:100%;
+ height: 100%;
+ z-index: 1001;
+ background-color: #fff;
+}
+.fullsp{
+ width: 100%;
+ height: 100%;
+}
+.time{
+ width: 150rpx;
+ height: 60rpx;
+ background-color: #999999;
+ color: #fff;
+ position: absolute;
+ right: 20rpx;
+ top: 200rpx;
+ border-radius:6rpx ;
+ text-align: center;
+ line-height: 60rpx;
+ z-index: 1002;
}
\ No newline at end of file