@@ -6,7 +6,13 @@ App({ | |||||
newArr:[],//存放分享二维进入消息信息 | newArr:[],//存放分享二维进入消息信息 | ||||
}, | }, | ||||
onLaunch: function(options) { | onLaunch: function(options) { | ||||
wx.hideTabBar({ | |||||
fail: function () { | |||||
setTimeout(function () { // 做了个延时重试一次,作为保底。 | |||||
wx.hideTabBar() | |||||
}, 500) | |||||
} | |||||
}); | |||||
}, | }, | ||||
onShow:function(options){ | onShow:function(options){ | ||||
@@ -1,13 +1,16 @@ | |||||
const imgurl = require("../../utils/imgurl"); | const imgurl = require("../../utils/imgurl"); | ||||
const util = require("../../utils/util"); | |||||
const Http = require("../../utils/HttpBasics"); | |||||
const config = require("../../config/config"); | |||||
Component({ | Component({ | ||||
/** | /** | ||||
* 组件的属性列表 | * 组件的属性列表 | ||||
*/ | */ | ||||
properties: { | properties: { | ||||
activityStyle: String, | activityStyle: String, | ||||
allFlag:Boolean, | |||||
allFlag: Boolean, | |||||
childUrl: String, | |||||
}, | }, | ||||
/** | /** | ||||
* 组件的初始数据 | * 组件的初始数据 | ||||
*/ | */ | ||||
@@ -16,24 +19,72 @@ Component({ | |||||
dateLsit: [], | dateLsit: [], | ||||
year: new Date().getFullYear(), | year: new Date().getFullYear(), | ||||
month: new Date().getMonth() + 1, | month: new Date().getMonth() + 1, | ||||
yearFlgh: new Date().getFullYear(),//当前年 | |||||
monthFlgh: new Date().getMonth() + 1,//当前月 | |||||
yearFlgh: new Date().getFullYear(), //当前年 | |||||
monthFlgh: new Date().getMonth() + 1, //当前月 | |||||
dey: new Date().getDate(), | dey: new Date().getDate(), | ||||
thendata: [], //当前这一周的数组 | thendata: [], //当前这一周的数组 | ||||
xiala: imgurl.concealBnt.url, | xiala: imgurl.concealBnt.url, | ||||
switchFlag:true, | |||||
switchFlag: true, | |||||
activityDateList: [] | |||||
}, | }, | ||||
/** | /** | ||||
* 组件的方法列表 | * 组件的方法列表 | ||||
*/ | */ | ||||
methods: { | methods: { | ||||
switchs(){ | |||||
itiActivityLst() { //初始哈活动列表 | |||||
let tempDateLsit = this.data.dateLsit | |||||
let tempThenData = this.data.thendata | |||||
this.data.activityDateList.map(item0 => { //初始化当月 标记 | |||||
tempDateLsit.map(item1 => { | |||||
if (item0.yyyy == item1.y && item0.mm == item1.m && item0.dd == item1.value) { | |||||
item1.act = 1 | |||||
} | |||||
}) | |||||
}) | |||||
this.data.activityDateList.map(item0 => { //初始化 当周标记 | |||||
tempThenData.map(item1 => { | |||||
if (item0.yyyy == item1.y && item0.mm == item1.m && item0.dd == item1.value) { | |||||
item1.act = 1 | |||||
} | |||||
}) | |||||
}) | |||||
this.setData({ | |||||
dateLsit: tempDateLsit, | |||||
thendata: tempThenData | |||||
}) | |||||
}, | |||||
getDey() { //查询当月标记日期 | |||||
let tempMonth = this.data.month | |||||
let tempDey = this.getDays(this.data.year, this.data.month) //获取每月有多少天 | |||||
if (tempMonth < 10) { | |||||
tempMonth = '0' + (tempMonth + '') | |||||
} | |||||
let param = { | |||||
startDate: this.data.year + '-' + tempMonth + "-01" + " 00:00:00", | |||||
endDate: this.data.year + "-" + tempMonth + "-" + tempDey + " 23:59:59" | |||||
} | |||||
Http.get({ | |||||
url: this.data.childUrl, | |||||
data: param | |||||
}).then(res => { | |||||
let { | |||||
code, | |||||
data | |||||
} = res | |||||
if (code == 200) { | |||||
this.setData({ | |||||
activityDateList: data | |||||
}) | |||||
this.showDate(this.data.year, this.data.month) | |||||
} | |||||
}) | |||||
}, | |||||
switchs() { | |||||
let temp = this.data.switchFlag | let temp = this.data.switchFlag | ||||
this.setData({ | this.setData({ | ||||
switchFlag:!temp | |||||
switchFlag: !temp | |||||
}) | }) | ||||
console.log(this.data.switchFlag) | |||||
}, | }, | ||||
showDate(year, month) { //刷新日历 | showDate(year, month) { //刷新日历 | ||||
let thenDey = this.getThenWeek(year, month) //每个月第一天星期几 | let thenDey = this.getThenWeek(year, month) //每个月第一天星期几 | ||||
@@ -48,7 +99,7 @@ Component({ | |||||
tmepArr.splice(i, 0, { | tmepArr.splice(i, 0, { | ||||
style: "0", | style: "0", | ||||
value: i + 1, | value: i + 1, | ||||
y:year, | |||||
y: year, | |||||
m: month | m: month | ||||
}) | }) | ||||
} | } | ||||
@@ -58,7 +109,7 @@ Component({ | |||||
style: "1", | style: "1", | ||||
value: lastMonth - (thenDey - 1), | value: lastMonth - (thenDey - 1), | ||||
y: year, | y: year, | ||||
m: month-1 | |||||
m: month - 1 | |||||
}) | }) | ||||
lastMonth++ | lastMonth++ | ||||
} | } | ||||
@@ -67,22 +118,28 @@ Component({ | |||||
style: "2", | style: "2", | ||||
value: i + 1, | value: i + 1, | ||||
y: year, | y: year, | ||||
m: month+1 | |||||
m: month + 1 | |||||
}) | }) | ||||
} | } | ||||
this.setData({ | this.setData({ | ||||
dateLsit: tempDey | dateLsit: tempDey | ||||
}) | }) | ||||
console.log(tempDey,"?") | |||||
this.itiActivityLst() | |||||
}, | }, | ||||
handle(e) { //点击号数 | handle(e) { //点击号数 | ||||
let item = e.currentTarget.dataset.item | let item = e.currentTarget.dataset.item | ||||
console.log(item) | |||||
if (item.style == '1') { | |||||
this.front() | |||||
} else if (item.style == '2') { | |||||
this.behind() | |||||
} | |||||
// if (item.style == '1') { | |||||
// this.front() | |||||
// } else if (item.style == '2') { | |||||
// this.behind() | |||||
// } | |||||
this.triggerEvent("setDate", { | |||||
y: this.data.year, | |||||
m: this.data.month, | |||||
value:item.value | |||||
}) | |||||
}, | }, | ||||
getDays(year, month) { //获取每月有多少天 | getDays(year, month) { //获取每月有多少天 | ||||
let tempDateArr = [] | let tempDateArr = [] | ||||
@@ -113,7 +170,31 @@ Component({ | |||||
date.setDate(1) | date.setDate(1) | ||||
return date.getDay() | return date.getDay() | ||||
}, | }, | ||||
getactivityDate(year, month, mode) { //mode == 0 查询当月 mode == 1 查询当天 | |||||
let tempMonth = month | |||||
let tempDey = this.getDays(year, month) //获取每月有多少天 | |||||
if (tempMonth < 10) { | |||||
tempMonth = '0' + (tempMonth + '') | |||||
} | |||||
let param = { | |||||
startDate: year + '-' + tempMonth + "-01" + " 00:00:00", | |||||
endDate: year + "-" + tempMonth + "-" + tempDey + " 23:59:59" | |||||
} | |||||
Http.get({ | |||||
url: this.data.childUrl, | |||||
data: param | |||||
}).then(res => { | |||||
let { | |||||
code, | |||||
data | |||||
} = res | |||||
if (code == 200) { | |||||
this.setData({ | |||||
activityDateList: data | |||||
}) | |||||
} | |||||
}) | |||||
}, | |||||
front() { //前面 | front() { //前面 | ||||
if (this.data.month == 1) { | if (this.data.month == 1) { | ||||
let temp = this.data.switchFlag | let temp = this.data.switchFlag | ||||
@@ -124,15 +205,18 @@ Component({ | |||||
year: this.data.year - 1, | year: this.data.year - 1, | ||||
month: 12 | month: 12 | ||||
}) | }) | ||||
this.showDate(this.data.year, this.data.month) | |||||
} else { | } else { | ||||
this.setData({ | this.setData({ | ||||
month: this.data.month - 1 | month: this.data.month - 1 | ||||
}) | }) | ||||
this.showDate(this.data.year, this.data.month) | |||||
} | } | ||||
this.triggerEvent("setDate", { | |||||
y: this.data.year, | |||||
m: this.data.month | |||||
}) //第一个是自定义事件名,第二个是要传递的值(可以为空) | |||||
this.getDey() | |||||
}, | }, | ||||
behind() { //后面 | behind() { //后面 | ||||
let temp = this.data.switchFlag | let temp = this.data.switchFlag | ||||
this.setData({ | this.setData({ | ||||
@@ -150,49 +234,62 @@ Component({ | |||||
}) | }) | ||||
this.showDate(this.data.year, this.data.month) | this.showDate(this.data.year, this.data.month) | ||||
} | } | ||||
this.getDey() | |||||
this.triggerEvent("setDate", { | |||||
y: this.data.year, | |||||
m: this.data.month | |||||
}) //第一个是自定义事件名,第二个是要传递的值(可以为空) | |||||
}, | }, | ||||
}, | }, | ||||
lifetimes: { | lifetimes: { | ||||
attached: function() { | attached: function() { | ||||
// 在组件实例进入页面节点树时执行 | |||||
this.getDey() //查询当月活动 | |||||
// 设置单周数组 | |||||
let thenDey = new Date().getDay() //今天是周几 | let thenDey = new Date().getDay() //今天是周几 | ||||
let thenDate = new Date().getDate() //今天是多少号 | let thenDate = new Date().getDate() //今天是多少号 | ||||
let tempArr = [] | let tempArr = [] | ||||
if (thenDey == 0) { | if (thenDey == 0) { | ||||
for (let i = 0; i < 7; i++) { | for (let i = 0; i < 7; i++) { | ||||
tempArr.splice(i, 1, { | tempArr.splice(i, 1, { | ||||
thenFalg: "1", | thenFalg: "1", | ||||
value: thenDate, | value: thenDate, | ||||
style:"0", | |||||
style: "0", | |||||
y: this.data.year, | y: this.data.year, | ||||
m:this.data.month | |||||
m: this.data.month | |||||
}) | }) | ||||
thenDate++ | thenDate++ | ||||
} | } | ||||
} else { | } else { | ||||
let temp = new Date().getDay() //今天是周几 | let temp = new Date().getDay() //今天是周几 | ||||
let tmpeDey = new Date().getDate() //今天是多少号 | let tmpeDey = new Date().getDate() //今天是多少号 | ||||
for (let i = 0; i <= temp; i++) { | for (let i = 0; i <= temp; i++) { | ||||
tempArr.splice(i, 0, { | tempArr.splice(i, 0, { | ||||
style: "0", value: thenDate - thenDey, y: this.data.year, | |||||
m: this.data.month} ) | |||||
style: "0", | |||||
value: thenDate - thenDey, | |||||
y: this.data.year, | |||||
m: this.data.month | |||||
}) | |||||
thenDey-- | thenDey-- | ||||
} | } | ||||
for (let i = temp + 1; i < 7; i++) { | for (let i = temp + 1; i < 7; i++) { | ||||
tmpeDey++ | tmpeDey++ | ||||
tempArr.splice(i, 0, { | tempArr.splice(i, 0, { | ||||
style: "0", value: tmpeDey, y: this.data.year, | |||||
m: this.data.month} ) | |||||
style: "0", | |||||
value: tmpeDey, | |||||
y: this.data.year, | |||||
m: this.data.month | |||||
}) | |||||
} | } | ||||
} | } | ||||
this.setData({ | this.setData({ | ||||
thendata: tempArr | thendata: tempArr | ||||
}) | }) | ||||
console.log(this.data.thendata, "?????") | |||||
this.showDate(this.data.year, this.data.month) | |||||
// 设置单周数组 | |||||
// setTimeout(() => { | |||||
// this.showDate(this.data.year, this.data.month) | |||||
// }, 300) | |||||
}, | }, | ||||
detached: function() { | detached: function() { | ||||
// 在组件实例被从页面节点树移除时执行 | // 在组件实例被从页面节点树移除时执行 | ||||
@@ -5,10 +5,10 @@ | |||||
<view class="dateAdd" bindtap="behind">{{'>'}}</view> | <view class="dateAdd" bindtap="behind">{{'>'}}</view> | ||||
</view> | </view> | ||||
<view class="weekBox"> | <view class="weekBox"> | ||||
<view class="weekItme" wx:for="{{week}}">{{item}}</view> | |||||
<view class="{{(item.value==dey&&monthFlgh==item.m&&item.y==yearFlgh)?'today':(item.style == '0'?'weekItme':'noThen')}}" wx:for="{{allFlag?(switchFlag? thendata:dateLsit):dateLsit}}" bindtap="handle" data-item="{{item}}" style="{{activityStyle}}">{{ (item.value==dey&&monthFlgh==item.m&&item.y==yearFlgh)?'':item.value }}</view> | |||||
<view class="weekItme" wx:for="{{week}}" wx:key="index">{{item}}</view> | |||||
<view class="{{(item.value==dey&&monthFlgh==item.m&&item.y==yearFlgh)?'today':(item.style == '0'?'weekItme':'noThen')}}" wx:for="{{allFlag?(switchFlag? thendata:dateLsit):dateLsit}}" wx:key="index" bindtap="handle" data-item="{{item}}" style="{{item.act==1?activityStyle:''}}">{{ (item.value==dey&&monthFlgh==item.m&&item.y==yearFlgh)?'':item.value }}</view> | |||||
</view> | </view> | ||||
<view class="concealBnt" bindtap="switchs" wx:if="{{allFlag}}"> | |||||
<view class="concealBnt" bindtap="switchs" wx:if="{{allFlag&&yearFlgh==year&&month==monthFlgh}}"> | |||||
<image class="concealBnt" src="{{xiala}}"></image> | <image class="concealBnt" src="{{xiala}}"></image> | ||||
</view> | </view> | ||||
</view> | </view> |
@@ -9,6 +9,12 @@ var config = { | |||||
/* | /* | ||||
*记录微信订阅 | *记录微信订阅 | ||||
*/ | */ | ||||
activityDey:"/wxActivity/listStatus",//活动日历日期 | |||||
activityCalendar:'/wxActivity/list',//活动日历列表 | |||||
signDey:"/userSign/listStatus",//签到日期列表 | |||||
continuousDye:"/userSign/signInStatus",//连续签到天数 | |||||
userSign:"/userSign/signIn",//签到 | |||||
signRule:"/credit/credit_rules",//签到规则 | |||||
wxMsg: '/user/updateMsg', | wxMsg: '/user/updateMsg', | ||||
/** | /** | ||||
* 微信消息推送获取模板id | * 微信消息推送获取模板id | ||||
@@ -177,6 +177,8 @@ Component({ | |||||
}, | }, | ||||
getTemplateId() { | getTemplateId() { | ||||
// console.log("隐藏") | |||||
// wx.hideTabBar() | |||||
Http.get({ | Http.get({ | ||||
url: config.api.templateId, | url: config.api.templateId, | ||||
data: { | data: { | ||||
@@ -88,7 +88,18 @@ Page({ | |||||
}, | }, | ||||
//获取当前广场名 | //获取当前广场名 | ||||
//跳转到每日签到 | |||||
goSign(){ | |||||
wx.navigateTo({ | |||||
url: '/pages/activityCalendar/activityCalendar', | |||||
}) | |||||
}, | |||||
//活动日历 | |||||
goCalendar(){ | |||||
wx.navigateTo({ | |||||
url: '/pages/dateLsit/dateLsit', | |||||
}) | |||||
}, | |||||
//跳转到其他广场列表 | //跳转到其他广场列表 | ||||
goSquareList() { | goSquareList() { | ||||
wx.navigateTo({ | wx.navigateTo({ | ||||
@@ -41,28 +41,42 @@ | |||||
<view class='channelBox' wx:if="{{ifStoreApp!=1}}" style="{{typeLsit.sy_mbg.styleClass}}"> | <view class='channelBox' wx:if="{{ifStoreApp!=1}}" style="{{typeLsit.sy_mbg.styleClass}}"> | ||||
<view class='kjBox' bindtap='gotoBargain'> | <view class='kjBox' bindtap='gotoBargain'> | ||||
<image src='{{typeLsit.sy_kj.icon}}' mode='aspectFill'></image> | <image src='{{typeLsit.sy_kj.icon}}' mode='aspectFill'></image> | ||||
<text>砍价</text> | |||||
<view class="text">砍价</view> | |||||
</view> | </view> | ||||
<view class='kjBox' bindtap='gotoSpellGroup'> | <view class='kjBox' bindtap='gotoSpellGroup'> | ||||
<image src='{{typeLsit.sy_pt.icon}}' mode='aspectFill'></image> | <image src='{{typeLsit.sy_pt.icon}}' mode='aspectFill'></image> | ||||
<text>拼团</text> | |||||
</view> | |||||
<view class='kjBox' bindtap='goLive' wx:if="{{liveFlag}}"> | |||||
<image src='{{typeLsit.sy_zbt.icon}}' mode='aspectFill'></image> | |||||
<text>直播厅</text> | |||||
<view class="text">拼团</view> | |||||
</view> | </view> | ||||
<view class='kjBox' bindtap='gotoCard'> | <view class='kjBox' bindtap='gotoCard'> | ||||
<image src='{{typeLsit.sy_xfk.icon}}' mode='aspectFill'></image> | <image src='{{typeLsit.sy_xfk.icon}}' mode='aspectFill'></image> | ||||
<text>消费卡</text> | |||||
<view class="text">消费卡</view> | |||||
</view> | |||||
<view class='kjBox' bindtap='goLive' wx:if="{{liveFlag}}"> | |||||
<image src='{{typeLsit.sy_zbt.icon}}' mode='aspectFill'></image> | |||||
<view class="text">直播厅</view> | |||||
</view> | </view> | ||||
<!-- <view class='kjBox' bindtap='gotogame'> | <!-- <view class='kjBox' bindtap='gotogame'> | ||||
<image src='{{xingyun}}' mode='aspectFill' bindtap=''></image> | <image src='{{xingyun}}' mode='aspectFill' bindtap=''></image> | ||||
<text>游戏频道</text> | |||||
<view>游戏频道</view> | |||||
</view> --> | </view> --> | ||||
<view class='kjBox' bindtap='goSign'> | |||||
<image src='{{typeLsit.sy_jfsc.icon}}' mode='aspectFill'></image> | |||||
<view class="text">每日签到</view> | |||||
</view> | |||||
<view class='kjBox' bindtap='goCalendar'> | |||||
<image src='{{typeLsit.sy_jfsc.icon}}' mode='aspectFill'></image> | |||||
<view class="text">活动日历</view> | |||||
</view> | |||||
<view class='kjBox' bindtap='gotoJfsc'> | |||||
<image src='{{typeLsit.sy_jfsc.icon}}' mode='aspectFill'></image> | |||||
<view class="text">积分商城</view> | |||||
</view> | |||||
<view class='kjBox' bindtap='gotoJfsc'> | <view class='kjBox' bindtap='gotoJfsc'> | ||||
<image src='{{typeLsit.sy_jfsc.icon}}' mode='aspectFill'></image> | <image src='{{typeLsit.sy_jfsc.icon}}' mode='aspectFill'></image> | ||||
<text>积分商城</text> | |||||
<view class="text">游戏</view> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<!-- 频道 --> | <!-- 频道 --> | ||||
<view class='channelBox' wx:if="{{ifStoreApp==1}}" style="width:525rpx;"> | <view class='channelBox' wx:if="{{ifStoreApp==1}}" style="width:525rpx;"> | ||||
@@ -417,14 +417,15 @@ progress{ | |||||
} | } | ||||
.channelBox{ | .channelBox{ | ||||
width:688rpx; | width:688rpx; | ||||
height: 220rpx; | |||||
/* height: 220rpx; */ | |||||
margin:0 auto; | margin:0 auto; | ||||
display: flex; | display: flex; | ||||
flex-wrap:wrap; | |||||
justify-content: space-between; | justify-content: space-between; | ||||
background: #F4F5F9; | background: #F4F5F9; | ||||
} | } | ||||
.kjBox{ | .kjBox{ | ||||
width: 104rpx; | |||||
width: 25%; | |||||
height: 148rpx; | height: 148rpx; | ||||
font-size: 24rpx; | font-size: 24rpx; | ||||
color: #A6A6A6; | color: #A6A6A6; | ||||
@@ -434,6 +435,10 @@ progress{ | |||||
.kjBox image{ | .kjBox image{ | ||||
width: 104rpx; | width: 104rpx; | ||||
height: 104rpx; | height: 104rpx; | ||||
margin: auto | |||||
} | |||||
.text{ | |||||
margin: 0 auto | |||||
} | } | ||||
.toutiao{ | .toutiao{ | ||||
width:710rpx; | width:710rpx; | ||||
@@ -11,19 +11,76 @@ Page({ | |||||
navigationBarHeight, | navigationBarHeight, | ||||
activityStyle: '',//选中当前日历样式 | activityStyle: '',//选中当前日历样式 | ||||
hideFlag:false,//遮罩成 | hideFlag:false,//遮罩成 | ||||
childUrl: config.api.signDey, | |||||
continueSign:'',//连续签到天数 | |||||
signInDay:'',//0能签到 1是不能签到 | |||||
rules:[],//积分规则 | |||||
}, | |||||
getSignRule(){//查询签到规则 | |||||
Http.get({ | |||||
url: config.api.signRule | |||||
}).then(res=>{ | |||||
let {code ,data}=res | |||||
if(code==200){ | |||||
let tempArr = [] | |||||
JSON.parse(data.rules).map(item=>{ | |||||
if (item.id == 17 || item.id == 18 || item.id == 19 || item.id == 20){ | |||||
tempArr.push(item) | |||||
} | |||||
if (this.data.continueSign>7){ | |||||
tempArr[1].activity=1 | |||||
if (this.data.continueSign > 14){ | |||||
tempArr[2].activity = 1 | |||||
if (tempArr[1].activity = 28){ | |||||
tempArr[3].activity = 1 | |||||
} | |||||
} | |||||
} | |||||
}) | |||||
this.setData({ | |||||
rules: tempArr | |||||
}) | |||||
} | |||||
}) | |||||
}, | |||||
setContinuousDye(){//获取连续签到天数 | |||||
Http.get({ | |||||
url: config.api.continuousDye | |||||
}).then(res=>{ | |||||
let{code ,data}=res | |||||
if(code==200){ | |||||
this.setData({ | |||||
continueSign: data.continueSign, | |||||
signInDay: data.signInDay | |||||
}) | |||||
} | |||||
}) | |||||
}, | }, | ||||
setHide(){//设置遮罩成 | setHide(){//设置遮罩成 | ||||
this.setData({ | this.setData({ | ||||
hideFlag:!this.data.hideFlag | hideFlag:!this.data.hideFlag | ||||
}) | }) | ||||
}, | }, | ||||
setSign(){//点击签到 | |||||
Http.post({ | |||||
url: config.api.userSign, | |||||
data:{type:"1"} | |||||
}).then(res=>{ | |||||
let{code}=res | |||||
if(code==200){ | |||||
this.setContinuousDye() | |||||
this.setHide() | |||||
} | |||||
}) | |||||
}, | |||||
/** | /** | ||||
* 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
*/ | */ | ||||
onLoad: function (options) { | onLoad: function (options) { | ||||
this.setContinuousDye() | |||||
this.getSignRule() | |||||
}, | }, | ||||
/** | /** | ||||
@@ -1,36 +1,15 @@ | |||||
<navbar back home text="每日签到" background='#fff'></navbar> | <navbar back home text="每日签到" background='#fff'></navbar> | ||||
<view style="height:{{navigationBarHeight}} "></view> | <view style="height:{{navigationBarHeight}} "></view> | ||||
<view class="signDyeBox"> | <view class="signDyeBox"> | ||||
<view class="signDye">您已连续签到:2天 </view> | |||||
<view class="signDye">您已连续签到:{{continueSign}}天 </view> | |||||
</view> | </view> | ||||
<detelsit allFlag="{{false}}"></detelsit> | |||||
<view class="singBtn" bindtap="setHide" wx:if="{{!hideFlag}}">签到领取积分</view> | |||||
<view class="guanSingBtn" wx:if="{{hideFlag}}">签到领取积分</view> | |||||
<view class="singvAwardBox"> | |||||
<detelsit allFlag="{{false}}" childUrl="{{childUrl}}" activityStyle=" color:#ff6600"></detelsit> | |||||
<view class="singBtn" bindtap="setSign" wx:if="{{signInDay==0}}">签到领取积分</view> | |||||
<view class="guanSingBtn" wx:if="{{signInDay==1}}">签到领取积分</view> | |||||
<view class="singvAwardBox" wx:for="{{rules}}" wx:key="index"> | |||||
<view class="singvLsit"> | <view class="singvLsit"> | ||||
<view class="singvLsit_item_l"> 每日签到</view> | |||||
<view class="singvLsit_item_r"> 10积分</view> | |||||
<view class="getBtn">已领取</view> | |||||
<view class="singvLsit_item_l"> {{item.desc}}</view> | |||||
<view class="singvLsit_item_r"> {{score}}积分</view> | |||||
<view class="getBtn" wx:if="{{(index==0&&signInDay==1) || item.activity==1&&index!=0}}">已领取</view> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class="singvAwardBox"> | |||||
<view class="singvLsit"> | |||||
<view class="singvLsit_item_l"> 每日签到</view> | |||||
<view class="singvLsit_item_r"> 10积分</view> | |||||
<view class="getBtn">已领取</view> | |||||
</view> | |||||
</view> | |||||
<view class="singvAwardBox"> | |||||
<view class="singvLsit"> | |||||
<view class="singvLsit_item_l"> 每日签到</view> | |||||
<view class="singvLsit_item_r"> 10积分</view> | |||||
<view class="getBtn">已领取</view> | |||||
</view> | |||||
</view> | |||||
<view class="shadeBox" catchtouchmove="true" wx:if="{{hideFlag}}"> | |||||
<view class="shade"> | |||||
<view class="shadeTitle">签到成功</view> | |||||
<view class="shadeNum">恭喜您已领取10积分</view> | |||||
<view class="shadeBtn" bindtap="setHide">开心收下</view> | |||||
</view> | |||||
</view> |
@@ -2,6 +2,7 @@ | |||||
const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' | const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' | ||||
const Http = require("../../utils/HttpBasics"); | const Http = require("../../utils/HttpBasics"); | ||||
const config = require("../../config/config"); | const config = require("../../config/config"); | ||||
const util = require("../../utils/util"); | |||||
let app = getApp(); | let app = getApp(); | ||||
Page({ | Page({ | ||||
@@ -10,62 +11,138 @@ Page({ | |||||
*/ | */ | ||||
data: { | data: { | ||||
navigationBarHeight, | navigationBarHeight, | ||||
activityStyle:'',//选中当前日历样式 | |||||
activityStyle: '', //选中当前日历样式 | |||||
pageNum: 1, | |||||
pageSize: 6, | |||||
list: [], | |||||
childUrl: config.api.activityDey, | |||||
startDate:'', | |||||
endDate:'' | |||||
}, | |||||
getDays(year, month) { //获取每月有多少天 | |||||
let tempDateArr = [] | |||||
let thenDate = new Date(year, month, 0).getDate() | |||||
return thenDate | |||||
}, | |||||
getDate(e) { | |||||
let startDate="" | |||||
let endDate="" | |||||
let { | |||||
y, | |||||
m, | |||||
value | |||||
} = e.detail | |||||
let tempDey = this.getDays(y, m) //获取每月有多少天 | |||||
if (m < 10) { | |||||
m = "0" + (m + "") | |||||
} | |||||
this.setData({ | |||||
pageNum: 1, | |||||
list: [] | |||||
}) | |||||
if (value){ | |||||
if(value<10){ | |||||
value="0"+(value+"") | |||||
} | |||||
startDate = y + "-" + m + "-" + value + " 00:00:00" | |||||
endDate = y + "-" + m + "-" + value + " 23:59:59" | |||||
}else{ | |||||
startDate = y + "-" + m + "-" + "01" + " 00:00:00" | |||||
endDate = y + "-" + m + "-" + tempDey + " 23:59:59" | |||||
} | |||||
this.setData({ | |||||
startDate: startDate, | |||||
endDate: endDate | |||||
}) | |||||
this.setActivityCalendar(this.data.startDate, this.data.endDate) | |||||
}, | |||||
setActivityCalendar(startDate = '', endDate = '') { //活动列表 | |||||
Http.get({ | |||||
url: config.api.activityCalendar, | |||||
data: { | |||||
pageNum: this.data.pageNum, | |||||
pageSize: this.data.pageSize, | |||||
startDate: startDate, | |||||
endDate: endDate | |||||
} | |||||
}).then(res => { | |||||
if (res.code == 200) { | |||||
//util.formatTime(res.data.validStartDate, "yyyy-MM-dd"), | |||||
if (res.data.list.length == 0) { | |||||
return | |||||
} else { | |||||
let tempArr = this.data.list | |||||
tempArr.push(...res.data.list) | |||||
tempArr.map(item => { | |||||
item.activityEndTime = util.formatTime(item.activityEndTime, "yyyy-MM-dd") | |||||
item.activityStartTime = util.formatTime(item.activityStartTime, "yyyy-MM-dd") | |||||
item.startTime = util.formatTime(item.startTime, "yyyy-MM-dd") | |||||
item.endTime = util.formatTime(item.endTime, "yyyy-MM-dd") | |||||
}) | |||||
this.setData({ | |||||
list: tempArr, | |||||
}) | |||||
} | |||||
} | |||||
}) | |||||
}, | }, | ||||
/** | /** | ||||
* 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
*/ | */ | ||||
onLoad: function (options) { | |||||
onLoad: function(options) { | |||||
this.setActivityCalendar(this.data.startDate, this.data.endDate) | |||||
}, | }, | ||||
/** | /** | ||||
* 生命周期函数--监听页面初次渲染完成 | * 生命周期函数--监听页面初次渲染完成 | ||||
*/ | */ | ||||
onReady: function () { | |||||
onReady: function() { | |||||
}, | }, | ||||
/** | /** | ||||
* 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
*/ | */ | ||||
onShow: function () { | |||||
onShow: function() { | |||||
}, | }, | ||||
/** | /** | ||||
* 生命周期函数--监听页面隐藏 | * 生命周期函数--监听页面隐藏 | ||||
*/ | */ | ||||
onHide: function () { | |||||
onHide: function() { | |||||
}, | }, | ||||
/** | /** | ||||
* 生命周期函数--监听页面卸载 | * 生命周期函数--监听页面卸载 | ||||
*/ | */ | ||||
onUnload: function () { | |||||
onUnload: function() { | |||||
}, | }, | ||||
/** | /** | ||||
* 页面相关事件处理函数--监听用户下拉动作 | * 页面相关事件处理函数--监听用户下拉动作 | ||||
*/ | */ | ||||
onPullDownRefresh: function () { | |||||
onPullDownRefresh: function() { | |||||
}, | }, | ||||
/** | /** | ||||
* 页面上拉触底事件的处理函数 | * 页面上拉触底事件的处理函数 | ||||
*/ | */ | ||||
onReachBottom: function () { | |||||
onReachBottom: function() { | |||||
this.setData({ | |||||
pageNum: this.data.pageNum+1 | |||||
}) | |||||
this.setActivityCalendar(this.data.startDate, this.data.endDate) | |||||
}, | }, | ||||
/** | /** | ||||
* 用户点击右上角分享 | * 用户点击右上角分享 | ||||
*/ | */ | ||||
onShareAppMessage: function () { | |||||
onShareAppMessage: function() { | |||||
} | } | ||||
}) | }) |
@@ -1,10 +1,11 @@ | |||||
<navbar back home text="活动日历" background='#fff'></navbar> | <navbar back home text="活动日历" background='#fff'></navbar> | ||||
<view style="height:{{navigationBarHeight}} "></view> | <view style="height:{{navigationBarHeight}} "></view> | ||||
<!-- <detelsit activityStyle=" background-image: url('https://formall.oss-accelerate.aliyuncs.com/cimg/jinri.png');background-size: 50rpx 50rpx;background-repeat: no-repeat;background-position: 50% 50%;"></detelsit> --> | |||||
<detelsit allFlag="true"></detelsit> | |||||
<view class="activityBox "> | |||||
<image class="activity"></image> | |||||
<view class="title">专题名称或活动报名名称</view> | |||||
<view class="text">报名时间:活动报名时间(如是专题,则不展示)</view> | |||||
<view class="text">活动时间:专题时间或活动报名时间</view> | |||||
<detelsit allFlag="true" bind:setDate="getDate" childUrl="{{childUrl}}" activityStyle=" color:red"></detelsit> | |||||
<view class="activityBox" wx:for="{{list}}" wx:key="index"> | |||||
<image class="activity" src="{{item.coverImg}}"></image> | |||||
<view class="title">{{item.title}}</view> | |||||
<view class="text">报名时间:{{item.startTime}}至{{item.endTime}}</view> | |||||
<view class="text">活动时间:{{item.activityStartTime}}至{{item.activityEndTime}}</view> | |||||
</view> | </view> | ||||
<view class="noData" wx:if="{{list.length==0}}">当月商场为设置活动,敬请期待!</view> | |||||
<view class="loading" wx:if="{{list.length!=0}}">到底了!</view> |
@@ -37,3 +37,17 @@ | |||||
word-wrap: break-word; | word-wrap: break-word; | ||||
color: rgba(0, 0, 0, 0.3) | color: rgba(0, 0, 0, 0.3) | ||||
} | } | ||||
.noData{ | |||||
text-align: center; | |||||
height: 60rpx; | |||||
line-height: 60rpx; | |||||
margin-top: 60rpx; | |||||
color:rgba(0, 0, 0, 0.3); | |||||
} | |||||
.loading{ | |||||
text-align: center; | |||||
height: 60rpx; | |||||
line-height: 60rpx; | |||||
color:rgba(0, 0, 0, 0.3); | |||||
} |
@@ -63,7 +63,7 @@ | |||||
"list": [ | "list": [ | ||||
{ | { | ||||
"id": 0, | "id": 0, | ||||
"name": "pages/activityCalendar/activityCalendar", | |||||
"name": "签到", | |||||
"pathName": "pages/activityCalendar/activityCalendar", | "pathName": "pages/activityCalendar/activityCalendar", | ||||
"query": "", | "query": "", | ||||
"scene": null | "scene": null | ||||
@@ -102,6 +102,13 @@ | |||||
"pathName": "pages/main/index", | "pathName": "pages/main/index", | ||||
"query": "type=cd&couponChannelId=489599575725629440", | "query": "type=cd&couponChannelId=489599575725629440", | ||||
"scene": null | "scene": null | ||||
}, | |||||
{ | |||||
"id": -1, | |||||
"name": "活动日历", | |||||
"pathName": "pages/dateLsit/dateLsit", | |||||
"query": "", | |||||
"scene": null | |||||
} | } | ||||
] | ] | ||||
} | } | ||||