diff --git a/app.js b/app.js index 9d5ef39..51413e3 100644 --- a/app.js +++ b/app.js @@ -6,7 +6,13 @@ App({ newArr:[],//存放分享二维进入消息信息 }, onLaunch: function(options) { - + wx.hideTabBar({ + fail: function () { + setTimeout(function () { // 做了个延时重试一次,作为保底。 + wx.hideTabBar() + }, 500) + } + }); }, onShow:function(options){ diff --git a/components/dateLsit/dateLsit.js b/components/dateLsit/dateLsit.js index 8a6d691..67365b6 100644 --- a/components/dateLsit/dateLsit.js +++ b/components/dateLsit/dateLsit.js @@ -1,13 +1,16 @@ const imgurl = require("../../utils/imgurl"); +const util = require("../../utils/util"); +const Http = require("../../utils/HttpBasics"); +const config = require("../../config/config"); Component({ /** * 组件的属性列表 */ properties: { activityStyle: String, - allFlag:Boolean, + allFlag: Boolean, + childUrl: String, }, - /** * 组件的初始数据 */ @@ -16,24 +19,72 @@ Component({ dateLsit: [], year: new Date().getFullYear(), 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(), thendata: [], //当前这一周的数组 xiala: imgurl.concealBnt.url, - switchFlag:true, + switchFlag: true, + activityDateList: [] }, /** * 组件的方法列表 */ 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 this.setData({ - switchFlag:!temp + switchFlag: !temp }) - console.log(this.data.switchFlag) }, showDate(year, month) { //刷新日历 let thenDey = this.getThenWeek(year, month) //每个月第一天星期几 @@ -48,7 +99,7 @@ Component({ tmepArr.splice(i, 0, { style: "0", value: i + 1, - y:year, + y: year, m: month }) } @@ -58,7 +109,7 @@ Component({ style: "1", value: lastMonth - (thenDey - 1), y: year, - m: month-1 + m: month - 1 }) lastMonth++ } @@ -67,22 +118,28 @@ Component({ style: "2", value: i + 1, y: year, - m: month+1 + m: month + 1 }) } this.setData({ dateLsit: tempDey }) - console.log(tempDey,"?") + this.itiActivityLst() }, + handle(e) { //点击号数 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) { //获取每月有多少天 let tempDateArr = [] @@ -113,7 +170,31 @@ Component({ date.setDate(1) 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() { //前面 if (this.data.month == 1) { let temp = this.data.switchFlag @@ -124,15 +205,18 @@ Component({ year: this.data.year - 1, month: 12 }) - this.showDate(this.data.year, this.data.month) } else { this.setData({ 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() { //后面 let temp = this.data.switchFlag this.setData({ @@ -150,49 +234,62 @@ Component({ }) this.showDate(this.data.year, this.data.month) } + this.getDey() + this.triggerEvent("setDate", { + y: this.data.year, + m: this.data.month + }) //第一个是自定义事件名,第二个是要传递的值(可以为空) }, + }, lifetimes: { attached: function() { - // 在组件实例进入页面节点树时执行 + this.getDey() //查询当月活动 + // 设置单周数组 let thenDey = new Date().getDay() //今天是周几 let thenDate = new Date().getDate() //今天是多少号 let tempArr = [] - if (thenDey == 0) { for (let i = 0; i < 7; i++) { tempArr.splice(i, 1, { thenFalg: "1", value: thenDate, - style:"0", + style: "0", y: this.data.year, - m:this.data.month + m: this.data.month }) thenDate++ } - } else { let temp = new Date().getDay() //今天是周几 let tmpeDey = new Date().getDate() //今天是多少号 for (let i = 0; i <= temp; i++) { 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-- } for (let i = temp + 1; i < 7; i++) { tmpeDey++ 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({ 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() { // 在组件实例被从页面节点树移除时执行 diff --git a/components/dateLsit/dateLsit.wxml b/components/dateLsit/dateLsit.wxml index c7f7f83..91a9661 100644 --- a/components/dateLsit/dateLsit.wxml +++ b/components/dateLsit/dateLsit.wxml @@ -5,10 +5,10 @@ {{'>'}} - {{item}} - {{ (item.value==dey&&monthFlgh==item.m&&item.y==yearFlgh)?'':item.value }} + {{item}} + {{ (item.value==dey&&monthFlgh==item.m&&item.y==yearFlgh)?'':item.value }} - + \ No newline at end of file diff --git a/config/config.js b/config/config.js index d95ecaa..fcfd6e8 100755 --- a/config/config.js +++ b/config/config.js @@ -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', /** * 微信消息推送获取模板id diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index 91db12a..2558085 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -177,6 +177,8 @@ Component({ }, getTemplateId() { + // console.log("隐藏") + // wx.hideTabBar() Http.get({ url: config.api.templateId, data: { diff --git a/index/index.js b/index/index.js index 463f534..033fd43 100644 --- a/index/index.js +++ b/index/index.js @@ -88,7 +88,18 @@ Page({ }, //获取当前广场名 - + //跳转到每日签到 + goSign(){ + wx.navigateTo({ + url: '/pages/activityCalendar/activityCalendar', + }) + }, + //活动日历 + goCalendar(){ + wx.navigateTo({ + url: '/pages/dateLsit/dateLsit', + }) + }, //跳转到其他广场列表 goSquareList() { wx.navigateTo({ diff --git a/index/index.wxml b/index/index.wxml index 66703f7..c7e1e93 100644 --- a/index/index.wxml +++ b/index/index.wxml @@ -41,28 +41,42 @@ - 砍价 + 砍价 - 拼团 - - - - 直播厅 + 拼团 + - 消费卡 + 消费卡 + + + + 直播厅 + + + 每日签到 + + + + 活动日历 + + + + 积分商城 + - 积分商城 + 游戏 + diff --git a/index/index.wxss b/index/index.wxss index 260fd6c..3a57963 100644 --- a/index/index.wxss +++ b/index/index.wxss @@ -417,14 +417,15 @@ progress{ } .channelBox{ width:688rpx; - height: 220rpx; + /* height: 220rpx; */ margin:0 auto; display: flex; + flex-wrap:wrap; justify-content: space-between; background: #F4F5F9; } .kjBox{ - width: 104rpx; + width: 25%; height: 148rpx; font-size: 24rpx; color: #A6A6A6; @@ -434,6 +435,10 @@ progress{ .kjBox image{ width: 104rpx; height: 104rpx; + margin: auto +} +.text{ + margin: 0 auto } .toutiao{ width:710rpx; diff --git a/pages/activityCalendar/activityCalendar.js b/pages/activityCalendar/activityCalendar.js index 65562b9..a11130b 100644 --- a/pages/activityCalendar/activityCalendar.js +++ b/pages/activityCalendar/activityCalendar.js @@ -11,19 +11,76 @@ Page({ navigationBarHeight, activityStyle: '',//选中当前日历样式 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(){//设置遮罩成 this.setData({ 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) { - + this.setContinuousDye() + this.getSignRule() }, /** diff --git a/pages/activityCalendar/activityCalendar.wxml b/pages/activityCalendar/activityCalendar.wxml index 81e51eb..626a867 100644 --- a/pages/activityCalendar/activityCalendar.wxml +++ b/pages/activityCalendar/activityCalendar.wxml @@ -1,36 +1,15 @@ - 您已连续签到:2天 + 您已连续签到:{{continueSign}}天 - -签到领取积分 -签到领取积分 - + +签到领取积分 +签到领取积分 + - 每日签到 - 10积分 - 已领取 + {{item.desc}} + {{score}}积分 + 已领取 - - - 每日签到 - 10积分 - 已领取 - - - - - 每日签到 - 10积分 - 已领取 - - - - - 签到成功 - 恭喜您已领取10积分 - 开心收下 - - \ No newline at end of file diff --git a/pages/dateLsit/dateLsit.js b/pages/dateLsit/dateLsit.js index d765e18..e06b43d 100644 --- a/pages/dateLsit/dateLsit.js +++ b/pages/dateLsit/dateLsit.js @@ -2,6 +2,7 @@ const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' const Http = require("../../utils/HttpBasics"); const config = require("../../config/config"); +const util = require("../../utils/util"); let app = getApp(); Page({ @@ -10,62 +11,138 @@ Page({ */ data: { 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() { } }) \ No newline at end of file diff --git a/pages/dateLsit/dateLsit.wxml b/pages/dateLsit/dateLsit.wxml index f9540a0..dd836d3 100644 --- a/pages/dateLsit/dateLsit.wxml +++ b/pages/dateLsit/dateLsit.wxml @@ -1,10 +1,11 @@ - - - - - 专题名称或活动报名名称 - 报名时间:活动报名时间(如是专题,则不展示) - 活动时间:专题时间或活动报名时间 + + + + {{item.title}} + 报名时间:{{item.startTime}}至{{item.endTime}} + 活动时间:{{item.activityStartTime}}至{{item.activityEndTime}} + 当月商场为设置活动,敬请期待! + 到底了! diff --git a/pages/dateLsit/dateLsit.wxss b/pages/dateLsit/dateLsit.wxss index df3b471..fe2ba66 100644 --- a/pages/dateLsit/dateLsit.wxss +++ b/pages/dateLsit/dateLsit.wxss @@ -37,3 +37,17 @@ word-wrap: break-word; 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); +} diff --git a/project.config.json b/project.config.json index e8fe630..5ef8ae6 100644 --- a/project.config.json +++ b/project.config.json @@ -63,7 +63,7 @@ "list": [ { "id": 0, - "name": "pages/activityCalendar/activityCalendar", + "name": "签到", "pathName": "pages/activityCalendar/activityCalendar", "query": "", "scene": null @@ -102,6 +102,13 @@ "pathName": "pages/main/index", "query": "type=cd&couponChannelId=489599575725629440", "scene": null + }, + { + "id": -1, + "name": "活动日历", + "pathName": "pages/dateLsit/dateLsit", + "query": "", + "scene": null } ] }