From a485b96a62f83d4f9df61540fe8bd3222ad904ed Mon Sep 17 00:00:00 2001 From: GL <954534408@qq.com> Date: Mon, 25 Jan 2021 17:04:37 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=B7=BB=E5=8A=A0=E6=96=B0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=91=E3=80=90=E6=B4=BB=E5=8A=A8=E6=97=A5=E5=8E=86?= =?UTF-8?q?=E3=80=91=E3=80=90=E7=AD=BE=E5=88=B0=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 4 +- components/dateLsit/dateLsit.js | 277 +++++++++++++------ components/dateLsit/dateLsit.json | 2 +- components/dateLsit/dateLsit.wxml | 10 +- components/dateLsit/dateLsit.wxss | 44 ++- pages/activityCalendar/activityCalendar.js | 77 ++++++ pages/activityCalendar/activityCalendar.json | 6 + pages/activityCalendar/activityCalendar.wxml | 36 +++ pages/activityCalendar/activityCalendar.wxss | 109 ++++++++ pages/dateLsit/dateLsit.js | 71 +++++ pages/dateLsit/dateLsit.json | 6 + pages/dateLsit/dateLsit.wxml | 10 + pages/dateLsit/dateLsit.wxss | 39 +++ project.config.json | 4 +- utils/imgurl.js | 4 + 15 files changed, 595 insertions(+), 104 deletions(-) create mode 100644 pages/activityCalendar/activityCalendar.js create mode 100644 pages/activityCalendar/activityCalendar.json create mode 100644 pages/activityCalendar/activityCalendar.wxml create mode 100644 pages/activityCalendar/activityCalendar.wxss create mode 100644 pages/dateLsit/dateLsit.js create mode 100644 pages/dateLsit/dateLsit.json create mode 100644 pages/dateLsit/dateLsit.wxml create mode 100644 pages/dateLsit/dateLsit.wxss diff --git a/app.json b/app.json index ea6cb14..7ef40c6 100644 --- a/app.json +++ b/app.json @@ -67,7 +67,9 @@ "pages/tcExplain/tcExplain", "pages/marketAtlas/marketAtlas", "pages/shareFriend/shareFriend", - "components/dateLsit/dateLsit" + "components/dateLsit/dateLsit", + "pages/dateLsit/dateLsit", + "pages/activityCalendar/activityCalendar" ], "subpackages": [ { diff --git a/components/dateLsit/dateLsit.js b/components/dateLsit/dateLsit.js index eb8e4e0..8a6d691 100644 --- a/components/dateLsit/dateLsit.js +++ b/components/dateLsit/dateLsit.js @@ -1,102 +1,201 @@ -// components/dateLsit/dateLsit.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - week:['日','一','二','三','四','五','六'], - dateLsit:[], - year: new Date().getFullYear(), - month: new Date().getMonth()+1, - }, - showDate(){//刷新日历 - let thenDey = this.getThenWeek() - - }, - - getDays(year, month){//获取每月有多少天 - let tempDateArr = [] - let thenDate = new Date(year, month, 0).getDate() - return thenDate - }, - getLastMonth(year, month){//上一个月最后一天是多少号 - if(month==1){ - month =12 - year = year-1 - }else{ - month = month-1 - } - let tempDateArr = [] - let thenDate = new Date(year, month, 0).getDate() - return thenDate - }, - getThenWeek(year, month){//获取每个月第一天是星期几 - if (month == 1) { - month = 12 - year = year - 1 - } else { - month = month - 1 - } - let date = new Date() - date.setFullYear(year) - date.setMonth(month) - date.setDate(1) - return date.getDay() - }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - console.log(this.getThenWeek(2021,3)) - }, - +const imgurl = require("../../utils/imgurl"); +Component({ /** - * 生命周期函数--监听页面初次渲染完成 + * 组件的属性列表 */ - onReady: function () { - + properties: { + activityStyle: String, + allFlag:Boolean, }, /** - * 生命周期函数--监听页面显示 + * 组件的初始数据 */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - + data: { + week: ['日', '一', '二', '三', '四', '五', '六'], + dateLsit: [], + year: new Date().getFullYear(), + month: new Date().getMonth() + 1, + yearFlgh: new Date().getFullYear(),//当前年 + monthFlgh: new Date().getMonth() + 1,//当前月 + dey: new Date().getDate(), + thendata: [], //当前这一周的数组 + xiala: imgurl.concealBnt.url, + switchFlag:true, }, /** - * 生命周期函数--监听页面卸载 + * 组件的方法列表 */ - onUnload: function () { - + methods: { + switchs(){ + let temp = this.data.switchFlag + this.setData({ + switchFlag:!temp + }) + console.log(this.data.switchFlag) + }, + showDate(year, month) { //刷新日历 + let thenDey = this.getThenWeek(year, month) //每个月第一天星期几 + let thenMonth = this.getDays(year, month) //获取每月有多少天 + let lastMonth = this.getLastMonth(year, month) //上月最后一天是多少天 + let tempDey = [] + let tmepArr = [] + for (let i = 0; i < 42; i++) { //初始化日历数组 + tempDey.splice(i, 0, "") + } + for (let i = 0; i < thenMonth; i++) { //获取当前选中月份天数 + tmepArr.splice(i, 0, { + style: "0", + value: i + 1, + y:year, + m: month + }) + } + tempDey.splice(thenDey, thenMonth, ...tmepArr) + for (let i = 0; i < thenDey; i++) { //添加上一个月的天数 + tempDey.splice(i, 1, { + style: "1", + value: lastMonth - (thenDey - 1), + y: year, + m: month-1 + }) + lastMonth++ + } + for (let i = 0; i < 42 - (thenDey + thenMonth); i++) { //设置下一个月 + tempDey.splice(thenDey + thenMonth + i, 1, { + style: "2", + value: i + 1, + y: year, + m: month+1 + }) + } + this.setData({ + dateLsit: tempDey + }) + console.log(tempDey,"?") + }, + handle(e) { //点击号数 + let item = e.currentTarget.dataset.item + console.log(item) + if (item.style == '1') { + this.front() + } else if (item.style == '2') { + this.behind() + } + }, + getDays(year, month) { //获取每月有多少天 + let tempDateArr = [] + let thenDate = new Date(year, month, 0).getDate() + return thenDate + }, + getLastMonth(year, month) { //上一个月最后一天是多少号 + if (month == 1) { + month = 12 + year = year - 1 + } else { + month = month - 1 + } + let tempDateArr = [] + let thenDate = new Date(year, month, 0).getDate() + return thenDate + }, + getThenWeek(year, month) { //获取每个月第一天是星期几 + if (month == 1) { + month = 12 + year = year - 1 + } else { + month = month - 1 + } + let date = new Date() + date.setFullYear(year) + date.setMonth(month) + date.setDate(1) + return date.getDay() + }, + + front() { //前面 + if (this.data.month == 1) { + let temp = this.data.switchFlag + this.setData({ + switchFlag: false + }) + this.setData({ + 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) + } + + }, + behind() { //后面 + let temp = this.data.switchFlag + this.setData({ + switchFlag: false + }) + if (this.data.month == 12) { + this.setData({ + year: this.data.year + 1, + month: 1 + }) + this.showDate(this.data.year, this.data.month) + } else { + this.setData({ + month: this.data.month + 1 + }) + this.showDate(this.data.year, this.data.month) + } + }, }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - + lifetimes: { + attached: function() { + // 在组件实例进入页面节点树时执行 + 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", + y: this.data.year, + 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} ) + 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} ) + + } + } + this.setData({ + thendata: tempArr + }) + console.log(this.data.thendata, "?????") + this.showDate(this.data.year, this.data.month) + }, + detached: function() { + // 在组件实例被从页面节点树移除时执行 + }, }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } }) \ No newline at end of file diff --git a/components/dateLsit/dateLsit.json b/components/dateLsit/dateLsit.json index 8835af0..32640e0 100644 --- a/components/dateLsit/dateLsit.json +++ b/components/dateLsit/dateLsit.json @@ -1,3 +1,3 @@ { - "usingComponents": {} + "component": true } \ No newline at end of file diff --git a/components/dateLsit/dateLsit.wxml b/components/dateLsit/dateLsit.wxml index 75727e1..c7f7f83 100644 --- a/components/dateLsit/dateLsit.wxml +++ b/components/dateLsit/dateLsit.wxml @@ -1,10 +1,14 @@ - {{'<'}} - 2021年1月 - {{'>'}} + {{'<'}} + {{year+'年 '+month+'月 '}} + {{'>'}} {{item}} + {{ (item.value==dey&&monthFlgh==item.m&&item.y==yearFlgh)?'':item.value }} + + + \ No newline at end of file diff --git a/components/dateLsit/dateLsit.wxss b/components/dateLsit/dateLsit.wxss index b000ecc..f714a55 100644 --- a/components/dateLsit/dateLsit.wxss +++ b/components/dateLsit/dateLsit.wxss @@ -1,6 +1,6 @@ .dateText_box{ width: 60%; - margin: 60rpx auto; + margin: 0 auto; overflow: hidden; text-align: center; } @@ -8,21 +8,21 @@ .dateMinus{ font-size: 36rpx; float: left; - line-height: 68rpx; + line-height: 60rpx; padding: 10rpx; - height: 68rpx; + height: 60rpx; margin-left: 100rpx; } .dateText{ float: left; padding: 10rpx; - line-height: 68rpx; - height: 68rpx; + line-height: 60rpx; + height: 60rpx; } .dateAdd{ padding: 10rpx; - line-height: 68rpx; - height: 68rpx; + line-height: 60rpx; + height: 60rpx; float: left; font-size: 36rpx; } @@ -40,5 +40,33 @@ float: left; /* background-color: red; border-radius: 50%; */ - +} +.noThen{ + height: 80rpx; + line-height: 80rpx; + width: 80rpx; + margin: 0 10rpx; + text-align: center; + float: left; + color: rgba(0, 0, 0, 0.1) +} +.today{ + height: 80rpx; + line-height: 80rpx; + width: 80rpx; + margin: 0 10rpx; + text-align: center; + float: left; + color: #fff; + /* background-color: rgba(50,177,252,1); */ + background-image: url('https://formall.oss-accelerate.aliyuncs.com/cimg/jinri.png'); + background-size: 50rpx 50rpx; + background-repeat: no-repeat; + background-position: 50% 50%; +} +.concealBnt{ + width: 60rpx; + height: 60rpx; + /* background-color: rebeccapurple; */ + margin: 0 auto; } diff --git a/pages/activityCalendar/activityCalendar.js b/pages/activityCalendar/activityCalendar.js new file mode 100644 index 0000000..65562b9 --- /dev/null +++ b/pages/activityCalendar/activityCalendar.js @@ -0,0 +1,77 @@ +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +const Http = require("../../utils/HttpBasics"); +const config = require("../../config/config"); +let app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + navigationBarHeight, + activityStyle: '',//选中当前日历样式 + hideFlag:false,//遮罩成 + + }, + setHide(){//设置遮罩成 + this.setData({ + hideFlag:!this.data.hideFlag + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/activityCalendar/activityCalendar.json b/pages/activityCalendar/activityCalendar.json new file mode 100644 index 0000000..e247eb8 --- /dev/null +++ b/pages/activityCalendar/activityCalendar.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "navbar": "../../../components/navbar/navbar", + "detelsit": "../../../components/dateLsit/dateLsit" + } +} \ No newline at end of file diff --git a/pages/activityCalendar/activityCalendar.wxml b/pages/activityCalendar/activityCalendar.wxml new file mode 100644 index 0000000..81e51eb --- /dev/null +++ b/pages/activityCalendar/activityCalendar.wxml @@ -0,0 +1,36 @@ + + + + 您已连续签到:2天 + + +签到领取积分 +签到领取积分 + + + 每日签到 + 10积分 + 已领取 + + + + + 每日签到 + 10积分 + 已领取 + + + + + 每日签到 + 10积分 + 已领取 + + + + + 签到成功 + 恭喜您已领取10积分 + 开心收下 + + \ No newline at end of file diff --git a/pages/activityCalendar/activityCalendar.wxss b/pages/activityCalendar/activityCalendar.wxss new file mode 100644 index 0000000..c193413 --- /dev/null +++ b/pages/activityCalendar/activityCalendar.wxss @@ -0,0 +1,109 @@ +.signDyeBox{ + width: 96%; + margin: 0 auto; +} +.signDye{ + width: 60%; + margin: 20rpx auto; + height: 100rpx; + line-height: 100rpx; + text-align: center; + border-radius: 20rpx; + background-image: linear-gradient(to bottom right, red, yellow); + color: #fff; +} +.singBtn{ + width: 66%; + height: 80rpx; + border-radius:12rpx; + text-align: center; + line-height: 80rpx; + color: #fff; + background-color: #ff6600; + margin: 40rpx auto; +} +.guanSingBtn{ + width: 66%; + height: 80rpx; + border-radius:12rpx; + text-align: center; + line-height: 80rpx; + color: #fff; + background-color: gray; + margin: 40rpx auto; +} +.singvAwardBox{ + text-align: center; +} +.singvLsit{ + width: 80%; + overflow: hidden; + margin: 20rpx auto; + background-color: #fff; + border-radius: 12rpx; +} +.singvLsit_item_l{ + width: 40%; + height: 80rpx; + border-radius: 12rpx; + line-height: 80rpx; + float: left; +} +.singvLsit_item_r{ + width: 40%; + height: 80rpx; + line-height: 80rpx; + border-radius: 12rpx; + float: left; +} +.getBtn{ + font-size: 28rpx; + width: 16%; + height: 60rpx; + line-height: 60rpx; + margin:10rpx 1%; + border-radius: 6rpx; + float: left; + color: #fff; + background-color: #ff6600; + +} +.shadeBox{ + height: 100vh; + width: 100%; + position: fixed; + top: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.2); + +} +.shade{ + width: 80%; + height: 400rpx; + background-color: #fff; + margin: 400rpx auto 0 auto; + overflow: hidden; + } + .shadeTitle{ + height: 80rpx; + line-height: 80rpx; + font-size: 36rpx; + font-weight: 700; + margin: 30rpx 0 ; + text-align: center; + } + .shadeNum{ + text-align: center; + height: 80rpx; + line-height: 80rpx; + } + .shadeBtn{ + width: 40%; + height: 70rpx; + line-height: 70rpx; + text-align: center; + color:#fff; + margin:60rpx auto 0 auto; + background-color: #ff6600; + border-radius: 10rpx; + } \ No newline at end of file diff --git a/pages/dateLsit/dateLsit.js b/pages/dateLsit/dateLsit.js new file mode 100644 index 0000000..d765e18 --- /dev/null +++ b/pages/dateLsit/dateLsit.js @@ -0,0 +1,71 @@ +// pages/dateLsit/dateLsit.js +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +const Http = require("../../utils/HttpBasics"); +const config = require("../../config/config"); +let app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + navigationBarHeight, + activityStyle:'',//选中当前日历样式 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/dateLsit/dateLsit.json b/pages/dateLsit/dateLsit.json new file mode 100644 index 0000000..8e3eb12 --- /dev/null +++ b/pages/dateLsit/dateLsit.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "navbar": "../../../components/navbar/navbar", + "detelsit": "../../../components/dateLsit/dateLsit" + } +} \ No newline at end of file diff --git a/pages/dateLsit/dateLsit.wxml b/pages/dateLsit/dateLsit.wxml new file mode 100644 index 0000000..f9540a0 --- /dev/null +++ b/pages/dateLsit/dateLsit.wxml @@ -0,0 +1,10 @@ + + + + + + + 专题名称或活动报名名称 + 报名时间:活动报名时间(如是专题,则不展示) + 活动时间:专题时间或活动报名时间 + diff --git a/pages/dateLsit/dateLsit.wxss b/pages/dateLsit/dateLsit.wxss new file mode 100644 index 0000000..df3b471 --- /dev/null +++ b/pages/dateLsit/dateLsit.wxss @@ -0,0 +1,39 @@ +.activityBox { + width: 96%; + margin: 20rpx auto; + text-align: center; +} + +.activity { + opacity: 1; + z-index: 10; + width: 640rpx; + height: 270rpx; + top: 11%; + background-color: dodgerblue; + border-radius: 20rpx; +} + +.title { + text-align: left; + font-size: 18px; + font-weight: 700; + margin-left: 40rpx; + height: 60rpx; + line-height: 60rpx; +} +.Box{ + background-image: linear-gradient(#cc9966, #F4F5F9); +} +.text { + line-height: 50rpx; + height: 50rpx; + text-align: left; + margin-left: 40rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + font-size: 26rpx; + word-wrap: break-word; + color: rgba(0, 0, 0, 0.3) +} diff --git a/project.config.json b/project.config.json index 305f0f0..e8fe630 100644 --- a/project.config.json +++ b/project.config.json @@ -63,8 +63,8 @@ "list": [ { "id": 0, - "name": "components/dateLsit/dateLsit", - "pathName": "components/dateLsit/dateLsit", + "name": "pages/activityCalendar/activityCalendar", + "pathName": "pages/activityCalendar/activityCalendar", "query": "", "scene": null }, diff --git a/utils/imgurl.js b/utils/imgurl.js index fa3ac49..a43179f 100644 --- a/utils/imgurl.js +++ b/utils/imgurl.js @@ -1,5 +1,9 @@ const baseUrl = 'https://formall.oss-accelerate.aliyuncs.com/cimg/' module.exports = { + 'concealBnt':{ + "url": baseUrl +'xiala.png', + "naem":'' + }, 'act': { 'url': baseUrl + 'act.png', 'name': ''