VUE 日历签到
- <style lang="scss">
- @import "../assets/css/px2rem.scss";
- .sign-box {
- width: %;
- min-height: %;
- background: #f5f5f5;
- position: relative;
- .top-box {
- padding: px2rem() px2rem() px2rem();
- background: #4bc7c7;
- }
- .person-box {
- display: flex;
- justify-content: space-around;
- align-items: center;
- }
- .sign-personInfor {
- display: flex;
- color: #fff;
- align-items: center;
- .headImg {
- position: relative;
- margin-right: px2rem();
- img {
- width: px2rem();
- height: px2rem();
- display: block;
- }
- }
- .nickname {
- p:first-child {
- font-size: px2rem();
- }
- p:last-child {
- font-size: px2rem();
- span {
- color: #f60;
- }
- }
- }
- }
- .sign-btn {
- font-size: px2rem();
- border: ;
- background: rgba(, , , 0.4);
- height: px2rem();
- line-height: px2rem();
- width: px2rem();
- border-radius: px2rem();
- color: #fff;
- }
- .integral-box {
- font-size: px2rem();
- color: #fff;
- display: flex;
- justify-content: space-around;
- margin-top: px2rem();
- font-size: px2rem();
- .sign-price {
- flex: %;
- p {
- text-align: center;
- height: px2rem();
- line-height: px2rem();
- img {
- width: px2rem();
- margin-right: px2rem();
- vertical-align: sub;
- }
- }
- }
- }
- .calender {
- background: #fff;
- width: %;
- border-radius: px2rem();
- box-shadow: px2rem() px2rem() rgba($color: #, $alpha: 0.2);
- .ui-datepicker-wrapper {
- width: %;
- font-size: px2rem();
- color: #;
- box-shadow: px2rem() px2rem() px2rem() px2rem() rgba(,,,.);
- &.ui-datepicker-wrapper-show {
- display: block;
- }
- .ui-datepicker-header {
- height: px2rem();
- line-height: px2rem();
- text-align: center;
- border-bottom: px2rem() solid #eaeaea;
- font-weight: bold;
- .ui-datepicker-curr-month {
- font-size: px2rem();
- }
- .ui-datepicker-btn {
- height: px2rem();
- width: px2rem();
- }
- .ui-datepicker-prev {
- background: url(../assets/img/arrow-l.png) no-repeat center center;
- background-size: px2rem() auto;
- float: left;
- }
- .ui-datepicker-next {
- background: url(../assets/img/arrow-r.png) no-repeat center center;
- background-size: px2rem() auto;
- float: right;
- }
- }
- .ui-datepicker-body {
- .datepicker-weekday {
- .weekday-head {
- display: flex;
- justify-content: space-around;
- border-bottom: px2rem() solid #;
- li {
- height: px2rem();
- line-height: px2rem();
- font-size: px2rem();
- font-weight: bold;
- }
- }
- .weekday-days {
- display: flex;
- justify-content: space-around;
- flex-wrap: wrap;
- li {
- flex: 14.2%;
- text-align: center;
- height: px2rem();
- line-height: px2rem();
- font-size: px2rem();
- &.active {
- background: url(../assets/img/right-mark.png) no-repeat center center;
- background-size: % auto;
- }
- &.ifDiabled {
- color: #DDD;
- visibility: hidden;
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
- <template>
- <div class="sign-box">
- <div class="top-box">
- <div class="person-box">
- <div class="sign-personInfor">
- <div class="headImg">
- <img src="../assets/img/head-img.png" alt="">
- </div>
- <div class="nickname">
- <p>我是大橙子</p>
- <p>您连续签到:<span>7天</span></p>
- </div>
- </div>
- <button class="sign-btn" @click="signIn">签到</button>
- </div>
- <div class="integral-box">
- <div class="sign-price">
- <p><img src="../assets/img/red-packet.png" alt="">红包:5.00</p>
- </div>
- <div class="sign-price">
- <p><img src="../assets/img/banshou.png" alt=""> 小扳手:</p>
- </div>
- </div>
- </div>
- <div class="calender">
- <div class="ui-datepicker-wrapper ui-datepicker-wrapper-show">
- <div class="ui-datepicker-header">
- <a href="javascript:;" class="ui-datepicker-btn ui-datepicker-prev" @click="getPrevMonth(1)"></a>
- <a href="javascript:;" class="ui-datepicker-btn ui-datepicker-next" @click="getNextMonth(2)"></a>
- <span class="ui-datepicker-curr-month">{{thisMonthDays.year}}年{{thisMonthDays.month}}月</span>
- </div>
- <div class="ui-datepicker-body">
- <div class="datepicker-weekday">
- <ul class="weekday-head">
- <li>日</li>
- <li>一</li>
- <li>二</li>
- <li>三</li>
- <li>四</li>
- <li>五</li>
- <li>六</li>
- </ul>
- <!-- active -->
- <ul class="weekday-days">
- <li v-for="item in this.thisMonthDays.days" :data-date="thisMonthDays.year+'-'+thisMonthDays.month+'-'+item.showDate" :key="item.id" :class="{active: item.hasMark ==thisMonthDays.year+'-'+thisMonthDays.month+'-'+item.showDate,ifDiabled: !item.ifThisMonthDays}">
- {{item.showDate}}
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import Hotcss from "hotcss";
- import qs from "qs";
- export default {
- name: "signIn",
- data: function() {
- return {
- ret: [],
- thisMonthDays: {},
- daysHtml: '',
- setYear: new Date().getFullYear(),
- setMonth: new Date().getMonth()+,
- uid: '',
- signMark: []
- };
- },
- created() {
- this.login();
- },
- mounted: function() {
- this.getMonthData(this.setYear,this.setMonth);
- this.getSignData(this.setMonth,this.setYear,this.setMonth);
- },
- methods: {
- login(){
- this.axios.get('http://app.lanbanshou.com/mpdemo/login/translate',{
- params: {
- openid: 'oFX2IwUkoxBLEmk999HaPrxCB79c'
- }
- }).then((response)=> {
- response = JSON.parse(response.data.obj);
- console.log(response)
- sessionStorage.setItem('uid',response.info.id)
- this.uid = response.info.id;
- }).catch((response)=>{
- console.log(response);
- })
- },
- signIn(){
- this.axios.get('http://192.168.2.88:8080/mpdemo/qiandao/qiandao',{
- params:{
- uid: this.uid
- }
- }).then((response)=>{
- console.log(response);
- alert(response.data.obj)
- }).catch((response)=>{
- console.log(response);
- })
- },
- fillZero(s) {
- return s < ? '' + s : s;
- },
- getNextMonth(mon){
- this.setMonth = this.setMonth + ;
- this.getSignData(this.setMonth,this.setYear,this.setMonth,mon)
- //this.getMonthData(this.setYear,this.setMonth)
- },
- getPrevMonth(mon){
- this.setMonth = this.setMonth - ;
- this.getSignData(this.setMonth,this.setYear,this.setMonth,mon)
- // this.getMonthData(this.setYear,this.setMonth)
- },
- getMonthData(year,month){
- if(!year || !month){
- var today = new Date();
- year = today.getFullYear();
- month = today.getMonth()+;
- }
- var firstDay = new Date(year,month - , );
- var firstDayWeekDay = firstDay.getDay();
- if(firstDayWeekDay === ) firstDayWeekDay = ;
- year = firstDay.getFullYear();
- month = firstDay.getMonth() + ;
- var lastDayOfLastMonth = new Date(year,month-,);
- var lastDateOfLastMonth = lastDayOfLastMonth.getDate();
- var preMonthDayCount = firstDayWeekDay - ;
- var lastDay = new Date(year,month,);
- var lastDate = lastDay.getDate();
- this.ret = [];
- for (var i = ; i < ; i++) {
- var date = i - preMonthDayCount;
- var showDate = date;
- var thisMonth = month;
- var ifThisMonthDays = true;
- if (date <= ) {
- //上一月
- thisMonth = month - ;
- showDate = lastDateOfLastMonth + date;
- ifThisMonthDays = false;
- } else if(date > lastDate){
- //下一月
- thisMonth = month + ;
- showDate = showDate -lastDate;
- ifThisMonthDays = false;
- }
- if (thisMonth === ) thisMonth = ;
- if (thisMonth === ) thisMonth = ;
- this.ret.push({
- month: thisMonth,
- date:date,
- showDate: this.fillZero(showDate),
- ifThisMonthDays: ifThisMonthDays
- });
- }
- this.signMark.map((obj1,index1)=>{
- var homologous1 = obj1.time.split(' ')[];
- this.ret.map((obj2,index2)=>{
- var mark1 = homologous1.split('-')[];
- // console.log(mark1);
- if(obj2.showDate == mark1){
- obj2.hasMark = homologous1;
- }
- })
- })
- this.thisMonthDays = {
- year: year,
- month: this.fillZero(month),
- days: this.ret
- }
- // return {
- // year: year,
- // month: month,
- // days: this.ret
- // };
- console.log({
- year: year,
- month: this.fillZero(month),
- days: this.ret
- });
- },
- getSignData(defaultDate,changeYear,changeMonth,mon){
- console.log(defaultDate,changeYear,changeMonth)
- this.axios.get('http://192.168.2.88:8080/mpdemo/qiandao/sign',{
- params : {
- uid: sessionStorage.getItem('uid'),
- time: defaultDate
- }
- }).then((response)=>{
- response = JSON.parse(response.data.obj);
- if(response.code == ){
- alert(response.msg)
- if(mon == ){
- this.setMonth = this.setMonth-;
- } else {
- this.setMonth = this.setMonth+;
- }
- //this.setMonth = new Date().getMonth()+1;
- return;
- }
- this.signMark = response.list;
- console.log(this.signMark)
- this.getMonthData(changeYear,changeMonth);
- }).catch((response)=>{
- console.log(response)
- })
- },
- }
- };
- </script>
VUE 日历签到的更多相关文章
- 使用 UICollectionView 实现日历签到功能
概述 在 App 中,日历通常与签到功能结合使用.是提高用户活跃度的一种方式,同时,签到数据中蕴含了丰富的极其有价值的信息.下面我们就来看看如何在 App 中实现日历签到功能. 效果图 ..... 思 ...
- 多功能版vue日历控件
下载地址:https://pan.baidu.com/s/1nvpx0tB5cIvvqHuApz_MpQ 之前写了一个简单的vue日历控件:https://www.cnblogs.com/mrzhu/ ...
- php+mysql+jquery日历签到
在网站开发过程中我们会经常用到签到功能来奖励用户积分,或者做一些其他活动.这次项目开发过程中做了日历签到,因为没有经验所有走了很多弯路,再次记录过程和步骤. 1.日历签到样式: 2.本次签到只记录本月 ...
- PHP实现日历签到,并实现累计积分功能
在网站开发过程中我们会经常用到签到功能来奖励用户积分,或者做一些其他活动.这次项目开发过程中做了日历签到,因为没有经验所有走了很多弯路,再次记录过程和步骤. 1.日历签到样式:使用的是calendar ...
- jquery日历签到控件的实现
calendar.js var calUtil = { //当前日历显示的年份 showYear:2015, //当前日历显示的月份 showMonth:1, //当前日历显示的天数 showDays ...
- vue 日历组件只显示本月和下个月 -- 多选日期
效果就是上图 代码贴出 1.在components > calander > index.vue <template> <div class="page&quo ...
- Vue日历
Vue生成日历,根据返回值将日期标红 HTML: <h1>CSS 日历</h1> <div id="calendar"> <div cla ...
- vue日历/日程提醒/html5本地缓存
先上图 功能: 1.上拉日历折叠,展示周 2.左右滑动切换月 2.“今天”回到今天:“+”添加日程 3.localStorage存储日程 index,html <body> <div ...
- vue 日历组件
Github 上很多点击弹出日历选择某个时间的组件,却没有找到单纯展示日历并且能点击获取时间的组件 npm i vue-calendar-component --save cnpm i vue-cal ...
随机推荐
- HttpUploader7-授权码配置
1.1. 七牛云存储 配置方式: 1.配置授权码 2.配置云存储 3.配置空间名称 4.配置上传地址 1.2. 阿里云存储 配置方式: 1.填写授权码 2.配置云存储为阿里云 ...
- 【Android学习】Android工程资源命名禁忌
在制作一个继续按钮时,将button的id设置为continue,发现报了错误,error: invalid symbol: 'continue' 一开始还以为是编码问题,后来百度之后才知道安卓And ...
- 关于同时查询父子名称的SQL查询语句的写法 id name parentId parentName .
parentid是1就是id为1的公司的子公司 如图 查询出所有的信息后 由于我要呈现的是parentName 不是parentId所以想问下SQL语句怎么写 谢谢啦~~:) 解法: SELECT s ...
- python之numpy文件操作
目录 numpy 中的文件操作总结 CVS文件 多维数据的存取 numpy 的便捷文件存取 numpy 中的文件操作总结 CVS文件 CSV (Comma‐Separated Value,逗号分隔值) ...
- HackSix 为ViewGroup的子视图添加悦目的动画效果
1.默认情况下他,添加到viewGrop的子视图是直接显示出来的.有一个比较简单的方法可以为这个过程增加动画效果. 2.知识点: 给子视图添加动画效果就用:LayoutAnimationCon ...
- Android 自定义ViewGroup,实现侧方位滑动菜单
侧方位滑动菜单 1.现在adnroid流行的应用当中很多都是用的侧方位滑动菜单如图:
- Redis 占用Windows系统盘空间23G
Redis常出现问题总结: 1.当出现修改--maxheap and --heapdir 在启动这两个版本时都会创建一个 RedisQFork.dat文件,我不确定 RedisQFork 文件是否变小 ...
- [转] SAAS, PAAS, IAAS
SaaS:软件即服务.如CRM.HRM.SCM等等,是可以直接使用的,所以是和多数用户接触最多的一个层面,典型的比如CRM类软件SalesForce. PaaS:平台即服务.如数据挖掘.系统管理.编程 ...
- owinAuthorize
Nuget包获取 Install-Package Microsoft.AspNet.WebApi.Owin -Version 5.1.2 Install-Package Microsoft.Owin. ...
- NPOI 2.1.3.1导入Excel
引入NPOI 2.1.3.1的包 项目引入 using NPOI.XSSF.UserModel;using NPOI.SS.UserModel; 控制器方法: public ActionResult ...