| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- const app = getApp();
- Page({
- data: {
- Weeks:["周一","周二","周三","周四","周五","周六","周日"],
- List:[],
- ShowActivity:1,
- Info:{
- DayNumber:-1,
- },
- },
- onLoad: function (options) {
- var that = this;
-
- var date=common.formatTime(new Date(app.globalData.userInfo.CreateTime),"-",true);
- //console.log(date);
- if (app.globalData.userInfo.CreateTime>="2022-09-21"){
- that.setData({
- ShowActivity:0,
- });
- }
- that.setData({
- Containnerheight: main.getWindowHeight(),
- });
- that.init();
- },
- init:function(){
- var that = this;
- wx.showLoading({
- title: '读取中',
- });
- var url = 'GetHardworkingList?UserID=' + app.globalData.userInfo.UserID;
- main.getData(url, function (data) {
- wx.hideLoading();
- data.Today=common.formatDateCHS(common.formatTime(new Date()));
- data.Days=[];
- var days=that.getDays();
- for(var j=0;j<days.length;j++){
- var obj={};
- obj.Name=days[j];
- obj.BgColor="#f2f2f2";
- obj.Color="#9B9B9B";
- for(var i=0;i<data.CurrentMonth.length;i++){
- if (data.CurrentMonth[i].Day==days[j]){
- obj.BgColor="#d2d2d2";
- obj.Color="#4D4D4D";
- if (data.CurrentMonth[i].IsShare || data.CurrentMonth[i].Image || data.CurrentMonth[i].IsMilestone){
- obj.ID=data.CurrentMonth[i].ID;
- obj.HardworkingNumber=data.CurrentMonth[i].HardworkingNumber;
-
- if (data.CurrentMonth[i].Image){
- obj.Image=data.CurrentMonth[i].Image;
- obj.AphorismID=data.CurrentMonth[i].AphorismID;
- }
- else if (data.CurrentMonth[i].IsMilestone){
- obj.BgColor=data.CurrentMonth[i].Color1;
- obj.IsMilestone=data.CurrentMonth[i].IsMilestone;
- }
- else{
- obj.BgColor="#3D3D3D";
- }
- obj.Color="#FFFFFF";
- obj.IsShare=data.CurrentMonth[i].IsShare;
- obj.Name=data.CurrentMonth[i].Day;
- }
-
- break;
- }
- }
- data.Days.push(obj);
- }
- that.setData({
- Info:data,
- });
-
- if (data.SevenDays.length==0){
- wx.setNavigationBarColor({
- backgroundColor: '#ffffff',
- frontColor:"#000000",
- });
- }
- else{
- wx.setNavigationBarColor({
- backgroundColor: '#FFD66E',
- frontColor:"#000000",
- });
- }
- });
- },
- getDays:function(){
- var calendar= common.initMonthCalendar(common.formatTime(new Date(),"-",true));
- //console.log(calendar);
- return calendar;
- },
- goto: function (e) {
- var url=e.currentTarget.dataset.url;
- wx.navigateTo({
- url: url,
- });
- },
- gotoDetail:function(e){
- var id=e.currentTarget.dataset.id;
- var name=e.currentTarget.dataset.name;
- var ismilestone=e.currentTarget.dataset.ismilestone;
- var aphorismid=e.currentTarget.dataset.aphorismid;
- var isshare=e.currentTarget.dataset.isshare;
- if (ismilestone || aphorismid){
- wx.navigateTo({
- url: "./shareitem?TaskID="+id,
- });
- }
- else if (isshare){
- wx.navigateTo({
- url: "./shareitem?TaskID="+id+"&IsHistory=1",
- });
- }
- else if (name){
- if (Number(name)<=(new Date().getDate())){
- wx.showToast({
- title: '没有接力',
- image: "../images/icon_flag_2.png",
- });
- }
- else{
- wx.showToast({
- title: '未到时间',
- });
- }
- }
- },
- showHelpImage: function (e) {
- main.ShowHelpImage();
- },
- onShareAppMessage: function () {
- return {
- title: "勤勉接力",
- path: app.globalData.SharePath + '?type=shareIndex&UserID=' + app.globalData.userInfo.UserID,
- imageUrl: app.globalData.uploadImageUrl+"web/program_screenshot_qmjl.png",
- }
- },
- })
|