1. <style lang="scss">
  2. @import "../assets/css/px2rem.scss";
  3. .sign-box {
  4. width: %;
  5. min-height: %;
  6. background: #f5f5f5;
  7. position: relative;
  8. .top-box {
  9. padding: px2rem() px2rem() px2rem();
  10. background: #4bc7c7;
  11. }
  12. .person-box {
  13. display: flex;
  14. justify-content: space-around;
  15. align-items: center;
  16. }
  17. .sign-personInfor {
  18. display: flex;
  19. color: #fff;
  20. align-items: center;
  21. .headImg {
  22. position: relative;
  23. margin-right: px2rem();
  24. img {
  25. width: px2rem();
  26. height: px2rem();
  27. display: block;
  28. }
  29. }
  30. .nickname {
  31. p:first-child {
  32. font-size: px2rem();
  33. }
  34. p:last-child {
  35. font-size: px2rem();
  36. span {
  37. color: #f60;
  38. }
  39. }
  40. }
  41. }
  42. .sign-btn {
  43. font-size: px2rem();
  44. border: ;
  45. background: rgba(, , , 0.4);
  46. height: px2rem();
  47. line-height: px2rem();
  48. width: px2rem();
  49. border-radius: px2rem();
  50. color: #fff;
  51. }
  52. .integral-box {
  53. font-size: px2rem();
  54. color: #fff;
  55. display: flex;
  56. justify-content: space-around;
  57. margin-top: px2rem();
  58. font-size: px2rem();
  59. .sign-price {
  60. flex: %;
  61. p {
  62. text-align: center;
  63. height: px2rem();
  64. line-height: px2rem();
  65. img {
  66. width: px2rem();
  67. margin-right: px2rem();
  68. vertical-align: sub;
  69. }
  70. }
  71. }
  72. }
  73. .calender {
  74. background: #fff;
  75. width: %;
  76. border-radius: px2rem();
  77. box-shadow: px2rem() px2rem() rgba($color: #, $alpha: 0.2);
  78. .ui-datepicker-wrapper {
  79. width: %;
  80. font-size: px2rem();
  81. color: #;
  82. box-shadow: px2rem() px2rem() px2rem() px2rem() rgba(,,,.);
  83. &.ui-datepicker-wrapper-show {
  84. display: block;
  85. }
  86. .ui-datepicker-header {
  87. height: px2rem();
  88. line-height: px2rem();
  89. text-align: center;
  90. border-bottom: px2rem() solid #eaeaea;
  91. font-weight: bold;
  92. .ui-datepicker-curr-month {
  93. font-size: px2rem();
  94. }
  95. .ui-datepicker-btn {
  96. height: px2rem();
  97. width: px2rem();
  98. }
  99. .ui-datepicker-prev {
  100. background: url(../assets/img/arrow-l.png) no-repeat center center;
  101. background-size: px2rem() auto;
  102. float: left;
  103. }
  104. .ui-datepicker-next {
  105. background: url(../assets/img/arrow-r.png) no-repeat center center;
  106. background-size: px2rem() auto;
  107. float: right;
  108. }
  109. }
  110. .ui-datepicker-body {
  111. .datepicker-weekday {
  112. .weekday-head {
  113. display: flex;
  114. justify-content: space-around;
  115. border-bottom: px2rem() solid #;
  116. li {
  117. height: px2rem();
  118. line-height: px2rem();
  119. font-size: px2rem();
  120. font-weight: bold;
  121. }
  122. }
  123. .weekday-days {
  124. display: flex;
  125. justify-content: space-around;
  126. flex-wrap: wrap;
  127. li {
  128. flex: 14.2%;
  129. text-align: center;
  130. height: px2rem();
  131. line-height: px2rem();
  132. font-size: px2rem();
  133. &.active {
  134. background: url(../assets/img/right-mark.png) no-repeat center center;
  135. background-size: % auto;
  136. }
  137. &.ifDiabled {
  138. color: #DDD;
  139. visibility: hidden;
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. }
  147. }
  148. </style>
  149. <template>
  150. <div class="sign-box">
  151. <div class="top-box">
  152. <div class="person-box">
  153. <div class="sign-personInfor">
  154. <div class="headImg">
  155. <img src="../assets/img/head-img.png" alt="">
  156. </div>
  157. <div class="nickname">
  158. <p>我是大橙子</p>
  159. <p>您连续签到:<span>7天</span></p>
  160. </div>
  161. </div>
  162. <button class="sign-btn" @click="signIn">签到</button>
  163. </div>
  164. <div class="integral-box">
  165. <div class="sign-price">
  166. <p><img src="../assets/img/red-packet.png" alt="">红包:5.00</p>
  167. </div>
  168. <div class="sign-price">
  169. <p><img src="../assets/img/banshou.png" alt=""> 小扳手:</p>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="calender">
  174. <div class="ui-datepicker-wrapper ui-datepicker-wrapper-show">
  175. <div class="ui-datepicker-header">
  176. <a href="javascript:;" class="ui-datepicker-btn ui-datepicker-prev" @click="getPrevMonth(1)"></a>
  177. <a href="javascript:;" class="ui-datepicker-btn ui-datepicker-next" @click="getNextMonth(2)"></a>
  178. <span class="ui-datepicker-curr-month">{{thisMonthDays.year}}年{{thisMonthDays.month}}月</span>
  179. </div>
  180. <div class="ui-datepicker-body">
  181. <div class="datepicker-weekday">
  182. <ul class="weekday-head">
  183. <li></li>
  184. <li></li>
  185. <li></li>
  186. <li></li>
  187. <li></li>
  188. <li></li>
  189. <li></li>
  190. </ul>
  191. <!-- active -->
  192. <ul class="weekday-days">
  193. <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}">
  194. {{item.showDate}}
  195. </li>
  196. </ul>
  197. </div>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. </template>
  203. <script>
  204. import Hotcss from "hotcss";
  205. import qs from "qs";
  206. export default {
  207. name: "signIn",
  208. data: function() {
  209. return {
  210. ret: [],
  211. thisMonthDays: {},
  212. daysHtml: '',
  213. setYear: new Date().getFullYear(),
  214. setMonth: new Date().getMonth()+,
  215. uid: '',
  216. signMark: []
  217. };
  218. },
  219. created() {
  220. this.login();
  221. },
  222. mounted: function() {
  223. this.getMonthData(this.setYear,this.setMonth);
  224. this.getSignData(this.setMonth,this.setYear,this.setMonth);
  225. },
  226. methods: {
  227. login(){
  228. this.axios.get('http://app.lanbanshou.com/mpdemo/login/translate',{
  229. params: {
  230. openid: 'oFX2IwUkoxBLEmk999HaPrxCB79c'
  231. }
  232. }).then((response)=> {
  233. response = JSON.parse(response.data.obj);
  234. console.log(response)
  235. sessionStorage.setItem('uid',response.info.id)
  236. this.uid = response.info.id;
  237. }).catch((response)=>{
  238. console.log(response);
  239. })
  240. },
  241. signIn(){
  242. this.axios.get('http://192.168.2.88:8080/mpdemo/qiandao/qiandao',{
  243. params:{
  244. uid: this.uid
  245. }
  246. }).then((response)=>{
  247. console.log(response);
  248. alert(response.data.obj)
  249. }).catch((response)=>{
  250. console.log(response);
  251. })
  252. },
  253. fillZero(s) {
  254. return s < ? '' + s : s;
  255. },
  256. getNextMonth(mon){
  257. this.setMonth = this.setMonth + ;
  258. this.getSignData(this.setMonth,this.setYear,this.setMonth,mon)
  259. //this.getMonthData(this.setYear,this.setMonth)
  260. },
  261. getPrevMonth(mon){
  262. this.setMonth = this.setMonth - ;
  263. this.getSignData(this.setMonth,this.setYear,this.setMonth,mon)
  264.  
  265. // this.getMonthData(this.setYear,this.setMonth)
  266. },
  267. getMonthData(year,month){
  268. if(!year || !month){
  269. var today = new Date();
  270. year = today.getFullYear();
  271. month = today.getMonth()+;
  272. }
  273. var firstDay = new Date(year,month - , );
  274. var firstDayWeekDay = firstDay.getDay();
  275. if(firstDayWeekDay === ) firstDayWeekDay = ;
  276.  
  277. year = firstDay.getFullYear();
  278. month = firstDay.getMonth() + ;
  279.  
  280. var lastDayOfLastMonth = new Date(year,month-,);
  281. var lastDateOfLastMonth = lastDayOfLastMonth.getDate();
  282.  
  283. var preMonthDayCount = firstDayWeekDay - ;
  284.  
  285. var lastDay = new Date(year,month,);
  286. var lastDate = lastDay.getDate();
  287. this.ret = [];
  288. for (var i = ; i < ; i++) {
  289. var date = i - preMonthDayCount;
  290. var showDate = date;
  291. var thisMonth = month;
  292. var ifThisMonthDays = true;
  293.  
  294. if (date <= ) {
  295. //上一月
  296. thisMonth = month - ;
  297. showDate = lastDateOfLastMonth + date;
  298. ifThisMonthDays = false;
  299. } else if(date > lastDate){
  300. //下一月
  301. thisMonth = month + ;
  302. showDate = showDate -lastDate;
  303. ifThisMonthDays = false;
  304. }
  305. if (thisMonth === ) thisMonth = ;
  306. if (thisMonth === ) thisMonth = ;
  307. this.ret.push({
  308. month: thisMonth,
  309. date:date,
  310. showDate: this.fillZero(showDate),
  311. ifThisMonthDays: ifThisMonthDays
  312. });
  313. }
  314. this.signMark.map((obj1,index1)=>{
  315. var homologous1 = obj1.time.split(' ')[];
  316. this.ret.map((obj2,index2)=>{
  317. var mark1 = homologous1.split('-')[];
  318. // console.log(mark1);
  319. if(obj2.showDate == mark1){
  320. obj2.hasMark = homologous1;
  321. }
  322. })
  323. })
  324. this.thisMonthDays = {
  325. year: year,
  326. month: this.fillZero(month),
  327. days: this.ret
  328. }
  329. // return {
  330. // year: year,
  331. // month: month,
  332. // days: this.ret
  333. // };
  334. console.log({
  335. year: year,
  336. month: this.fillZero(month),
  337. days: this.ret
  338. });
  339. },
  340. getSignData(defaultDate,changeYear,changeMonth,mon){
  341. console.log(defaultDate,changeYear,changeMonth)
  342. this.axios.get('http://192.168.2.88:8080/mpdemo/qiandao/sign',{
  343. params : {
  344. uid: sessionStorage.getItem('uid'),
  345. time: defaultDate
  346. }
  347. }).then((response)=>{
  348. response = JSON.parse(response.data.obj);
  349. if(response.code == ){
  350. alert(response.msg)
  351. if(mon == ){
  352. this.setMonth = this.setMonth-;
  353. } else {
  354. this.setMonth = this.setMonth+;
  355. }
  356. //this.setMonth = new Date().getMonth()+1;
  357. return;
  358. }
  359. this.signMark = response.list;
  360. console.log(this.signMark)
  361. this.getMonthData(changeYear,changeMonth);
  362. }).catch((response)=>{
  363. console.log(response)
  364. })
  365. },
  366. }
  367. };
  368. </script>

VUE 日历签到的更多相关文章

  1. 使用 UICollectionView 实现日历签到功能

    概述 在 App 中,日历通常与签到功能结合使用.是提高用户活跃度的一种方式,同时,签到数据中蕴含了丰富的极其有价值的信息.下面我们就来看看如何在 App 中实现日历签到功能. 效果图 ..... 思 ...

  2. 多功能版vue日历控件

    下载地址:https://pan.baidu.com/s/1nvpx0tB5cIvvqHuApz_MpQ 之前写了一个简单的vue日历控件:https://www.cnblogs.com/mrzhu/ ...

  3. php+mysql+jquery日历签到

    在网站开发过程中我们会经常用到签到功能来奖励用户积分,或者做一些其他活动.这次项目开发过程中做了日历签到,因为没有经验所有走了很多弯路,再次记录过程和步骤. 1.日历签到样式: 2.本次签到只记录本月 ...

  4. PHP实现日历签到,并实现累计积分功能

    在网站开发过程中我们会经常用到签到功能来奖励用户积分,或者做一些其他活动.这次项目开发过程中做了日历签到,因为没有经验所有走了很多弯路,再次记录过程和步骤. 1.日历签到样式:使用的是calendar ...

  5. jquery日历签到控件的实现

    calendar.js var calUtil = { //当前日历显示的年份 showYear:2015, //当前日历显示的月份 showMonth:1, //当前日历显示的天数 showDays ...

  6. vue 日历组件只显示本月和下个月 -- 多选日期

    效果就是上图 代码贴出 1.在components > calander > index.vue <template> <div class="page&quo ...

  7. Vue日历

    Vue生成日历,根据返回值将日期标红 HTML: <h1>CSS 日历</h1> <div id="calendar"> <div cla ...

  8. vue日历/日程提醒/html5本地缓存

    先上图 功能: 1.上拉日历折叠,展示周 2.左右滑动切换月 2.“今天”回到今天:“+”添加日程 3.localStorage存储日程 index,html <body> <div ...

  9. vue 日历组件

    Github 上很多点击弹出日历选择某个时间的组件,却没有找到单纯展示日历并且能点击获取时间的组件 npm i vue-calendar-component --save cnpm i vue-cal ...

随机推荐

  1. HttpUploader7-授权码配置

    1.1. 七牛云存储 配置方式: 1.配置授权码   2.配置云存储   3.配置空间名称   4.配置上传地址   1.2. 阿里云存储 配置方式: 1.填写授权码   2.配置云存储为阿里云   ...

  2. 【Android学习】Android工程资源命名禁忌

    在制作一个继续按钮时,将button的id设置为continue,发现报了错误,error: invalid symbol: 'continue' 一开始还以为是编码问题,后来百度之后才知道安卓And ...

  3. 关于同时查询父子名称的SQL查询语句的写法 id name parentId parentName .

    parentid是1就是id为1的公司的子公司 如图 查询出所有的信息后 由于我要呈现的是parentName 不是parentId所以想问下SQL语句怎么写 谢谢啦~~:) 解法: SELECT s ...

  4. python之numpy文件操作

    目录 numpy 中的文件操作总结 CVS文件 多维数据的存取 numpy 的便捷文件存取 numpy 中的文件操作总结 CVS文件 CSV (Comma‐Separated Value,逗号分隔值) ...

  5. HackSix 为ViewGroup的子视图添加悦目的动画效果

    1.默认情况下他,添加到viewGrop的子视图是直接显示出来的.有一个比较简单的方法可以为这个过程增加动画效果. 2.知识点:     给子视图添加动画效果就用:LayoutAnimationCon ...

  6. Android 自定义ViewGroup,实现侧方位滑动菜单

    侧方位滑动菜单 1.现在adnroid流行的应用当中很多都是用的侧方位滑动菜单如图:

  7. Redis 占用Windows系统盘空间23G

    Redis常出现问题总结: 1.当出现修改--maxheap and --heapdir 在启动这两个版本时都会创建一个 RedisQFork.dat文件,我不确定 RedisQFork 文件是否变小 ...

  8. [转] SAAS, PAAS, IAAS

    SaaS:软件即服务.如CRM.HRM.SCM等等,是可以直接使用的,所以是和多数用户接触最多的一个层面,典型的比如CRM类软件SalesForce. PaaS:平台即服务.如数据挖掘.系统管理.编程 ...

  9. owinAuthorize

    Nuget包获取 Install-Package Microsoft.AspNet.WebApi.Owin -Version 5.1.2 Install-Package Microsoft.Owin. ...

  10. NPOI 2.1.3.1导入Excel

    引入NPOI 2.1.3.1的包 项目引入 using NPOI.XSSF.UserModel;using NPOI.SS.UserModel; 控制器方法: public ActionResult ...