|
|
@@ -1,6 +1,6 @@
|
|
|
const app = getApp();
|
|
|
import wxh from '../../utils/wxh.js';
|
|
|
-import { getIndexData, getCoupons, getTemlIds, getLiveList } from '../../api/api.js';
|
|
|
+import { getIndexData, getCoupons, getTemlIds, getLiveList, getNotifications } from '../../api/api.js';
|
|
|
import { CACHE_SUBSCRIBE_MESSAGE } from '../../config.js';
|
|
|
import { getCategoryList, getProductHot, getProductslist } from '../../api/store.js';
|
|
|
import { getCouponReceive} from '../../api/user.js';
|
|
|
@@ -16,20 +16,19 @@ Page({
|
|
|
logoUrl:'',
|
|
|
categoryOne:[],
|
|
|
banner: [],
|
|
|
- itemNew: [],
|
|
|
+ itemNew: [], // 跑马灯列表
|
|
|
menus: [],
|
|
|
- getCouponList:[],
|
|
|
+ getCouponList:[],//@deprecated
|
|
|
activity:[],
|
|
|
- timeList: [],
|
|
|
- killIndex: 0,//点击当前index值;
|
|
|
- seckillTimeIndex: 0, //当前秒杀index;
|
|
|
- killIndexTime: 0,//点击当前index值所对应的秒杀时间;
|
|
|
- killIndexLen: 0,//当前秒杀的产品列表长度
|
|
|
- seckillList:[],
|
|
|
- scrollLeft: 0,
|
|
|
- elementWidth:0,
|
|
|
- status:1,
|
|
|
- lovely: [],
|
|
|
+ timeList: [], //@deprecated
|
|
|
+ killIndex: 0,//@deprecated 点击当前index值;
|
|
|
+ seckillTimeIndex: 0, //@deprecated 当前秒杀index;
|
|
|
+ killIndexTime: 0,//@deprecated 点击当前index值所对应的秒杀时间;
|
|
|
+ killIndexLen: 0,//@deprecated 当前秒杀的产品列表长度
|
|
|
+ seckillList:[], //@deprecated
|
|
|
+ scrollLeft: 0, //@deprecated
|
|
|
+ status:1, //@deprecated
|
|
|
+ lovely: [], //@deprecated
|
|
|
info: {
|
|
|
fastList: [],
|
|
|
bastBanner: [],
|
|
|
@@ -40,9 +39,9 @@ Page({
|
|
|
likeInfo: [],
|
|
|
benefit:[],
|
|
|
hostProduct: [],
|
|
|
- indicatorDots: false,
|
|
|
+ indicatorDots: false, // 跑马灯轮播图不带点
|
|
|
circular: true,
|
|
|
- autoplay: true,
|
|
|
+ autoplay: true, // 跑马灯轮播图自动播放
|
|
|
intervalNew: 3500,
|
|
|
durationNew: 700,
|
|
|
parameter:{
|
|
|
@@ -78,9 +77,10 @@ Page({
|
|
|
countDownHour: "00",
|
|
|
countDownMinute: "00",
|
|
|
countDownSecond: "00",
|
|
|
- seckillCont:true,
|
|
|
- interval:null,
|
|
|
- newGoodsBananr: '',
|
|
|
+ seckillCont:true, //@deprecated
|
|
|
+ interval:null,
|
|
|
+ timerNotification: null,
|
|
|
+ newGoodsBananr: '', //@deprecated
|
|
|
liveList: [],
|
|
|
liveInfo: {}
|
|
|
},
|
|
|
@@ -154,6 +154,25 @@ Page({
|
|
|
// this.getCoupon();
|
|
|
this.getIndexConfig();
|
|
|
// this.getSeckillTime();
|
|
|
+
|
|
|
+ var that = this
|
|
|
+ this.setData({
|
|
|
+ timerNotification: setInterval(function(){
|
|
|
+ that.loadNotifications()
|
|
|
+ }, 1000 * 60 * 3)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 加载通知,目前只有跑马灯
|
|
|
+ loadNotifications: function() {
|
|
|
+ var that = this
|
|
|
+ getNotifications().then(res=>{
|
|
|
+ if(res.data.carousel.length > 0) {
|
|
|
+ that.setData({
|
|
|
+ itemNew: res.data.carousel
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
getIndexConfig:function(){
|
|
|
@@ -322,6 +341,7 @@ Page({
|
|
|
// });
|
|
|
// },
|
|
|
|
|
|
+ // 页面事件, 不再使用
|
|
|
setTime: function (e) {
|
|
|
var that = this, index = e.currentTarget.dataset.index;
|
|
|
that.setData({
|
|
|
@@ -331,6 +351,7 @@ Page({
|
|
|
that.getSeckillLists();
|
|
|
},
|
|
|
|
|
|
+ // 不再触发
|
|
|
getSeckillLists: function () {
|
|
|
let that = this;
|
|
|
let timeId = that.data.timeList[that.data.killIndex].id;
|
|
|
@@ -375,7 +396,7 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- /** 获取优惠券列表 */
|
|
|
+ /** 获取优惠券列表 不再触发*/
|
|
|
getCoupon: function () {
|
|
|
var that = this;
|
|
|
getCoupons({page: 1,limit: 6}).then(res => {
|
|
|
@@ -389,6 +410,7 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ // 页面回调,不再触发
|
|
|
receiveCoupon: function (e) {
|
|
|
if (!app.globalData.isLog) {
|
|
|
this.setData({
|
|
|
@@ -423,8 +445,15 @@ Page({
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function () {
|
|
|
+ console.log('onhide()');
|
|
|
this.setData({ window:false});
|
|
|
this.data.interval !== null && clearInterval(this.data.interval);
|
|
|
+ if (this.data.timerNotification != null) {
|
|
|
+ clearInterval(this.data.timerNotification);
|
|
|
+ this.setData({
|
|
|
+ timerNotification: null,
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/**
|