日历签到 java_微信小程序签到 日历 每日签到积分加1
signIn.json
{
"navigationBarTitleText": "签到",
"usingComponents": {
}
}
signIn.wxss
/* 签到顶部背景信息 */
.signBkImg{
width: 100%;
height: 241rpx;
position: relative;
}
.signBkImg>image{
width: 100%;
height: 100%;
}
.sign-con{
width: 92%;
height: 213rpx;
padding: 0 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
position: absolute;
top: 0;
}
.sign-con>navigator{
width: 167rpx;
height: 67rpx;
line-height: 67rpx;
text-align: center;
border-radius: 34rpx;
color: #33998C;
background-color: #fff;
font-size: 30rpx;
}
.headNews-left{
display: flex;
align-items: center;
flex-wrap: nowrap;
}
.headNews-left>image{
width: 133rpx;
height: 133rpx;
border: 6rpx solid rgb(255,255,255);
border-radius: 50%;
}
.nikeNme{
color: rgb(254,254,254);
margin-left: 26rpx;
}
.nikeNme>view:nth-child(1){
font-size: 40rpx;
font-weight: bold;
}
.nikeNme>view:nth-child(2){
font-size: 26rpx;
margin-top: 12rpx;
}
/* 积分,积分明细 */
.points-con{
margin: 50rpx 0;
display: flex;
}
.points-con>view,.points-con>navigator{
width: 50%;
height: 61rpx;
line-height: 61rpx;
text-align: center;
color: rgb(119,119,119);
font-size: 30rpx;
}
.points-con>view{
border-right: 2rpx solid rgb(235,235,235);
}
.points-num{
font-size: 38rpx;
color: #33998C;
}
/* 日历签到 */
/**index.wxss**/
.t_red{
color: red;
}
.t_blue{
color: royalblue;
}
.calendar{
background-color: white;
box-shadow: 2px 2px 5px 2px #e6e6e6;
padding:30rpx;
width: 85%;
margin-left: 4%;
border-radius: 50rpx;
display: block
}
.time{
padding: 16rpx 20rpx;
background-color: wheat;
display: flex;
}
.time{
font-family: '黑体';
font-size: 40rpx;
color: white;
text-align: center;
padding: 16rpx 20rpx;
height:80rpx;
line-height:80rpx;
border-radius:12rpx;
background-color: #f9634b;
display: flex;
margin-bottom: 29rpx;
}
.time view{
flex: 1;
font-size: 30rpx;
}
.time view text{
font-size: 38rpx;
}
.weekName{
font-size: 36rpx;
color: #333;
width: 100%;
display: flex;
padding: 16rpx 0;
}
.weekName view{
flex: 1;
text-align: center;
}
.sunday,.saturday{
color: #33998C;
}
.week{
width: 100%;
}
.week view{
width: 14.2%;
height: 90rpx;
line-height: 80rpx;
display: inline-block;
margin: 10rpx 0;
font-size: 34rpx;
text-align: center;
}
.week view text{
width: 100%;
height: 100%;
display: inline-block;
}
.calendarSign{
margin: 40rpx auto;
}
.selDate{
font-size: 28rpx;
border-bottom: 1px solid #33998C;
}
.selDateItem{
color:#33998C;
font-weight: bold;
font-size:22rpx;
border-radius: 50%;
}
/* 前后时间 */
.preNext-path{
margin: 28rpx 0;
display: flex;
align-items: center;
justify-content: center;
}
.preNext-path>image{
width: 11rpx;
height: 21rpx;
}
.preNext-path>text{
color: #33998C;
font-size: 28rpx;
margin: 0 54rpx;
}
/* 签到按钮 */
.signInBtn{
width: 235rpx;
height: 77rpx;
line-height: 77rpx;
text-align: center;
border-radius: 10rpx;
font-size: 34rpx;
color: #fff;
background:#33998C;
}
signIn.wxml
{{userInfo.nickname}}
本月已签到 {{calendarSignDay}} 天
兑换商品
我的积分:
{{userInfo.integral}}
积分明细 >
{{year}}年{{month}}月
日
一
二
三
四
五
六
\n
已签到
{{item+1}}
已签到
{{date}}
{{item+date+1}}
签到
今日已签到
signIn.js
js中导入了requestUtil 为请求工具类,改为自己的就行
import requestUtil from '../../../utils/requestUtil';
//获取应用实例
var calendarSignData = [];
var date;
Page({
data: {
calendarSignData: [],
calendarSignDay:'',
month: "",
year: "",
userInfo: '',
show: false
},
onShow: function () {
this.a();
this.getUserByOpenid();
},
//获取用户
getUserByOpenid: function () {
var that = this;
var openId = wx.getStorageSync("openId");
if (openId) {
var url = "integral/getUserByOpenid";
requestUtil._get_param(url, {
openid: openId
}, function (res) {
console.log(res);
if (res.data.status == 200) {
var d = res.data.data;
var currentDate = new Date();
if (d.calendarSignDay > 0) {
var a = new Date(d.calendarSignTime);
var day = a.getDate();
if (currentDate.getDate() == day) {
calendarSignData[day] = day;
}
}
that.setData({
userInfo: d
// calendarSignData: calendarSignData
})
}
})
} else {
this.setData({
show: true
})
}
},
a(){
var openId = wx.getStorageSync("openId");
//过去签到过的天数
var that = this;
var url = "integral/queryUserMonthSign";
requestUtil._get_param(url, {
openid:openId
}, function (res) {
console.log(res);
if (res.data.status == 200) {
that.setData({
calendarSignData: res.data.data.calendarSignData,
calendarSignDay:res.data.data.calendarSignDay,
})
}else{
wx.showToast({
title: '查询本月签到的数据失败',
icon: 'none',
})
}
})
},
//事件处理函数
calendarSign: function () {
var openId = wx.getStorageSync("openId");
console.log(openId)
if (openId) {
var that = this;
var id = this.data.userInfo.id
var url = "integral/sign";
requestUtil._get_param(url, {
openid:openId
}, function (res) {
console.log(res);
if (res.data.status == 200) {
wx.showToast({
title: '签到成功',
icon: 'success',
duration: 2000
})
that.onShow();
}else{
wx.showToast({
title: '今日已签到,请勿重复签到',
icon: 'none',
})
}
})
} else {
this.setData({
show: true
})
}
},
sign_prev: function () {
var year = this.data.year;
var month = this.data.month;
if (month == "1") {
var month = "12";
var year = parseInt(this.data.year) - 1;
} else {
var month = parseInt(this.data.month) - 1;
var showYear = this.data.year;
}
this.setData({
month: month,
year: year
})
},
sign_next: function () {
var year = this.data.year;
var month = this.data.month;
if (month == "12") {
var month = "1";
var year = parseInt(this.data.year) + 1;
} else {
var month = parseInt(this.data.month) + 1;
var showYear = this.data.year;
}
this.setData({
month: month,
year: year
})
},
onLoad: function () {
var mydate = new Date();
var year = mydate.getFullYear();
var month = mydate.getMonth() + 1;
date = mydate.getDate();
console.log("date", date)
var day = mydate.getDay();
var nbsp;
if ((date - day) <= 0) {
nbsp = day - date + 1;
} else {
nbsp = 7 - ((date - day) % 7) + 1;
}
console.log("nbsp" + nbsp);
console.log(day)
var monthDaySize;
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
monthDaySize = 31;
} else if (month == 4 || month == 6 || month == 9 || month == 11) {
monthDaySize = 30;
} else if (month == 2) {
// 计算是否是闰年,如果是二月份则是29天
if ((year - 2000) % 4 == 0) {
monthDaySize = 29;
} else {
monthDaySize = 28;
}
};
this.setData({
year: year,
month: month,
nbsp: nbsp,
monthDaySize: monthDaySize,
date: date,
calendarSignData: calendarSignData
})
}
})
后台 Java代码
/**
* 根据用户openid获取用户签到信息(月签到信息)
* @param openid
* @return
*/
@RequestMapping("queryUserMonthSign")
public ShopResult queryUserMonthSign(String openid,String data) {
MapretMap = new ConcurrentHashMap<>();
ListintegralDetails = shopIntegralDetailService.queryUserMonthSign(openid,data);
//获取本月的天数
int monthDay = DateUtils.getCurrentMonthDay();
int[] i = new int[monthDay+1];
int calendarSignDay = 0;
for (int j = 0; j < monthDay; j++) {
for (ShopIntegralDetail shopIntegralDetail:
integralDetails) {
int day = Integer.valueOf(DateUtils.formatDate(shopIntegralDetail.getCreateDate(),"dd"));
if(j==day){
i[j] = day;
calendarSignDay += 1 ;
}
}
}
retMap.put("calendarSignData", i);//本月签到天数
retMap.put("calendarSignDay", calendarSignDay);//本月签到数据 为数组【0,1,2,3】
System.out.println(i);
return ShopResult.ok(retMap);
}
我这边是每次积分签到成功之后在积分记录表中添加一条信息,所以在积分详情表中查用户签到信息
SELECT
FROM shop_integral_detail a
where
a.openid = #{openid}
AND
DATE_FORMAT(a.create_date,'%Y-%m') = DATE_FORMAT(NOW(),'%Y-%m')
AND
a.integral_type=4
shop_integral_detail表 字段
idvarchar32
integralvarchar20积分
integral_typechar 类型0:系统赠送,1:购物送,2:邀请好友送,3:消费 4签到
openidvarchar64 微信openid
create_datedatetime时间
日历签到 java_微信小程序签到 日历 每日签到积分加1相关推荐
- 基于安卓/android/微信小程序的学生考勤签到APP-#计算机毕业设计
X项目介绍 目前高校大学生上课考勤管理都是任课老师上课点名,然后用纸质版考勤表来记录学生上课出勤情况,学期末再根据所有上课出勤表及作业登记表对学生平时成绩打分,最后把出勤数据整理上交到各院系,而学生请 ...
- 如何做一个基于微信小程序的打卡签到
要做一个基于微信小程序的打卡签到系统,可以按照以下步骤进行: 创建小程序:在微信公众平台上注册小程序账号,创建一个新的小程序. 设计打卡签到功能:根据需求,设计打卡签到的功能模块,包括签到按钮.签到时 ...
- android日历小程序,微信小程序实现日历功能
本文实例为大家分享了微信小程序实现日历功能的具体代码,供大家参考,具体内容如下 效果图: 代码: {{year}}年{{month}}月 {{item}} {{item}} data: { year: ...
- 微信小程序自定义日历组件
微信小程序自定义日历组件 wxml <view class="maskWrap" bindtap="close"></view>< ...
- 微信小程序 引入日历组件
GitHub - treadpit/wx_calendar: 微信小程序-日历组件
- php微信小程序向下滑动,微信小程序功能实现:上滑加载下拉刷新
本篇文章给大家带来的内容是关于微信小程序功能实现:上滑加载下拉刷新,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 之前谈到文章列表的数据加载,是一次性全部加载,这样是不友好的.这章介 ...
- 微信小程序开发之scroll-view上拉加载数据实现
微信小程序开发之scroll-view上拉加载数据实现 一.开发思路 1.使用小程序的scroll-view组件中提供了一个bindscrolltolower属性监听组件的滑动到了底部 https:/ ...
- [Web] [微信小程序-云开发] 商城 无服务器 加后台管理
[Web] [微信小程序-云开发] 商城 无服务器 加后台管理 说明: 目前云开发仅针对认证后的公众号使用(每年300的费用那个) wxapp-mall-clouddb 前言 如何使用 更多说明 功能 ...
- 微信小程序开发实录——每日速递
微信小程序开发实录--每日速递 选题简介 工具使用心得 选题简介 新闻版块 创建项目 数据来源(知乎日报) 基本页编写 详情页编写 数据获取 WxParse 样式表转换 转换方法 样式文件的引用 天气 ...
最新文章
- JDBF读取DBF文件
- 双向链表的(CRUD)
- 腾讯第一季度总收入1353亿元 净利润478亿元
- full outer join 与full join的区别_基础小白的SQL的JOIN语法解析
- Linux基础知识之包管理工具
- CSS Sprite精灵图如何缩放大小
- 力扣-面试题 10.05 稀疏数组搜索
- vc2008编译libjpeg
- 为civil3D2018 添加snoop DB工具
- phython入门基础
- 3.9 编写程序,模拟石头剪刀布游戏。程序随机产生一个数,这个数为2、1或0,分别表示石头剪刀和布。
- 传统企业互联网转型升级
- 导数求函数的单调性与极值习题
- 第一期vue项目实践问题与收获总结
- Python基础——循环语句
- 今天电面阿里飞猪的惨烈教训
- Learning Texture Transformer Network for Image Super-Resolution(全译文+大量名词链接)读论文记录①
- 地下城与勇士(DNF)安特贝鲁峡谷副本(根特外围、根特东门、根特南门、根特北门、根特防御战、夜间袭击战、补给线阻断战、追击歼灭战、决战哈尔特山)(童年的回忆)
- 【Linux命令】mount / umount命令、查看文件的挂载情况(lsblk)
- OpenStack中magnum组件安装
热门文章
- 目标检测模型的评估指标mAP详解(附代码)
- android 10 添加系统服务步骤
- 超分算法DRCN:Deeply-Recursive Convolutional Network for Image Super-Resolution超分辨率重建
- 曝光 兼职达人(深圳市青木网络科技)无耻、恶心
- [GYCTF2020]Ezsqli --BUUCTF
- 规划咨询服务先行示范——2021深城交典型项目盘点
- maven白小白(二)生命周期complie,package,install
- pip更新超时失败之解法
- Spring Security +Spring Session Redis+JJWT
- 葵花宝典(转自:https://blog.csdn.net/binbin594738977/article/details/79429301 )