shareindex.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. Weeks:["周一","周二","周三","周四","周五","周六","周日"],
  7. List:[],
  8. ShowActivity:1,
  9. Info:{
  10. DayNumber:-1,
  11. },
  12. },
  13. onLoad: function (options) {
  14. var that = this;
  15. var date=common.formatTime(new Date(app.globalData.userInfo.CreateTime),"-",true);
  16. //console.log(date);
  17. if (app.globalData.userInfo.CreateTime>="2022-09-21"){
  18. that.setData({
  19. ShowActivity:0,
  20. });
  21. }
  22. that.setData({
  23. Containnerheight: main.getWindowHeight(),
  24. });
  25. that.init();
  26. },
  27. init:function(){
  28. var that = this;
  29. wx.showLoading({
  30. title: '读取中',
  31. });
  32. var url = 'GetHardworkingList?UserID=' + app.globalData.userInfo.UserID;
  33. main.getData(url, function (data) {
  34. wx.hideLoading();
  35. data.Today=common.formatDateCHS(common.formatTime(new Date()));
  36. data.Days=[];
  37. var days=that.getDays();
  38. for(var j=0;j<days.length;j++){
  39. var obj={};
  40. obj.Name=days[j];
  41. obj.BgColor="#f2f2f2";
  42. obj.Color="#9B9B9B";
  43. for(var i=0;i<data.CurrentMonth.length;i++){
  44. if (data.CurrentMonth[i].Day==days[j]){
  45. obj.BgColor="#d2d2d2";
  46. obj.Color="#4D4D4D";
  47. if (data.CurrentMonth[i].IsShare || data.CurrentMonth[i].Image || data.CurrentMonth[i].IsMilestone){
  48. obj.ID=data.CurrentMonth[i].ID;
  49. obj.HardworkingNumber=data.CurrentMonth[i].HardworkingNumber;
  50. if (data.CurrentMonth[i].Image){
  51. obj.Image=data.CurrentMonth[i].Image;
  52. obj.AphorismID=data.CurrentMonth[i].AphorismID;
  53. }
  54. else if (data.CurrentMonth[i].IsMilestone){
  55. obj.BgColor=data.CurrentMonth[i].Color1;
  56. obj.IsMilestone=data.CurrentMonth[i].IsMilestone;
  57. }
  58. else{
  59. obj.BgColor="#3D3D3D";
  60. }
  61. obj.Color="#FFFFFF";
  62. obj.IsShare=data.CurrentMonth[i].IsShare;
  63. obj.Name=data.CurrentMonth[i].Day;
  64. }
  65. break;
  66. }
  67. }
  68. data.Days.push(obj);
  69. }
  70. that.setData({
  71. Info:data,
  72. });
  73. if (data.SevenDays.length==0){
  74. wx.setNavigationBarColor({
  75. backgroundColor: '#ffffff',
  76. frontColor:"#000000",
  77. });
  78. }
  79. else{
  80. wx.setNavigationBarColor({
  81. backgroundColor: '#FFD66E',
  82. frontColor:"#000000",
  83. });
  84. }
  85. });
  86. },
  87. getDays:function(){
  88. var calendar= common.initMonthCalendar(common.formatTime(new Date(),"-",true));
  89. //console.log(calendar);
  90. return calendar;
  91. },
  92. goto: function (e) {
  93. var url=e.currentTarget.dataset.url;
  94. wx.navigateTo({
  95. url: url,
  96. });
  97. },
  98. gotoDetail:function(e){
  99. var id=e.currentTarget.dataset.id;
  100. var name=e.currentTarget.dataset.name;
  101. var ismilestone=e.currentTarget.dataset.ismilestone;
  102. var aphorismid=e.currentTarget.dataset.aphorismid;
  103. var isshare=e.currentTarget.dataset.isshare;
  104. if (ismilestone || aphorismid){
  105. wx.navigateTo({
  106. url: "./shareitem?TaskID="+id,
  107. });
  108. }
  109. else if (isshare){
  110. wx.navigateTo({
  111. url: "./shareitem?TaskID="+id+"&IsHistory=1",
  112. });
  113. }
  114. else if (name){
  115. if (Number(name)<=(new Date().getDate())){
  116. wx.showToast({
  117. title: '没有接力',
  118. image: "../images/icon_flag_2.png",
  119. });
  120. }
  121. else{
  122. wx.showToast({
  123. title: '未到时间',
  124. });
  125. }
  126. }
  127. },
  128. showHelpImage: function (e) {
  129. main.ShowHelpImage();
  130. },
  131. onShareAppMessage: function () {
  132. return {
  133. title: "勤勉接力",
  134. path: app.globalData.SharePath + '?type=shareIndex&UserID=' + app.globalData.userInfo.UserID,
  135. imageUrl: app.globalData.uploadImageUrl+"web/program_screenshot_qmjl.png",
  136. }
  137. },
  138. })