//获取应用实例
var panSHuBian;
var windowWidth;
var huaSHu = 0;
var text = ""
Page({
data: {
shu:0,
date: ['日', '一', '二', '三', '四', '五', '六']
},
onLoad: function () {
this.riliRiQI()
},
/*************************************** */
riliRiQI:function(){
wx.getSystemInfo({
success: function (res) {
windowWidth = res.windowWidth
}
})
var myDate = new Date();
var year = myDate.getFullYear()
var month = myDate.getMonth() + 1
var day = myDate.getDate()
var XianhaoMiaoSHu = (new Date("" + year + "/" + month + "/" + day + "")).getTime();
var startWeek = new Date('' + year + ',' + month + ',' + day).getDay()
var xian0 = [];
for (let c = startWeek; c > 0; c--) {
var dayJai = day - c
var monthJai
var yearJai
if (dayJai < 1) {
monthJai = month - 1
if (monthJai < 1) {
monthJai = 12
yearJai = year - 1
let dayNumS = new Date(yearJai, monthJai, 0).getDate();
dayJai = dayJai + dayNumS
}
else {
let dayNumS = new Date(year, monthJai, 0).getDate();
dayJai = dayJai + dayNumS
}
}
else {
monthJai = month
dayJai = dayJai
yearJai = year
}
let thishaoMiaoSHu = (new Date("" + yearJai + "/" + monthJai + "/" + dayJai + "")).getTime();
var obj = {
year: yearJai,
month: monthJai,
day: dayJai,
thishaoMiaoSHu: thishaoMiaoSHu
}
xian0.push(obj)
}
for (let x = 0; x < 7 - startWeek; x++) {
var dayJai = day + x
var monthJai
let dayNumT = new Date(year, month, 0).getDate();
if (dayJai > dayNumT) {
monthJai = month + 1
dayJai = 0 + (dayJai - dayNumT)
if (monthJai > 12) {
var shuLiang = monthJai - 12
monthJai = shuLiang
yearJai = year + 1
}
}
else {
monthJai = month
dayJai = dayJai
yearJai = year
}
let thishaoMiaoSHu = (new Date("" + yearJai + "/" + monthJai + "/" + dayJai + "")).getTime();
var obj1 = {
year: yearJai,
month: monthJai,
day: dayJai,
thishaoMiaoSHu: thishaoMiaoSHu
}
xian0.push(obj1)
}
console.log('xian0', xian0)
var xian_1 = [];
for (let c = 7; c > 0; c--) {
var dayJai = xian0[0].day - c
var monthJai = xian0[0].month
var yearJai = xian0[0].year
if (dayJai < 1) {
monthJai = month - 1
if (monthJai < 1) {
monthJai = 12
yearJai = year - 1
let dayNumS = new Date(yearJai, monthJai, 0).getDate();
dayJai = dayJai + dayNumS
}
else {
let dayNumS = new Date(yearJai, monthJai, 0).getDate();
dayJai = dayJai + dayNumS
}
}
else {
monthJai = monthJai
dayJai = dayJai
yearJai = yearJai
}
let thishaoMiaoSHu = (new Date("" + yearJai + "/" + monthJai + "/" + dayJai + "")).getTime();
var obj = {
year: yearJai,
month: monthJai,
day: dayJai,
thishaoMiaoSHu: thishaoMiaoSHu
}
xian_1.push(obj)
}
console.log('xian_1', xian_1)
var xian1 = []
for (let c = 0; c < 7; c++) {
var dayJai = xian0[6].day + c + 1
var monthJai = xian0[6].month
var yearJai = xian0[6].year
let dayNumT = new Date(yearJai, monthJai, 0).getDate();
if (dayJai > dayNumT) {
monthJai = monthJai + 1
dayJai = 0 + (dayJai - dayNumT)
if (monthJai > 12) {
var shuLiang = monthJai - 12
monthJai = shuLiang
yearJai = yearJai + 1
}
}
else {
monthJai = month
dayJai = dayJai
yearJai = year
}
let thishaoMiaoSHu = (new Date("" + yearJai + "/" + monthJai + "/" + dayJai + "")).getTime();
var obj1 = {
year: yearJai,
month: monthJai,
day: dayJai,
thishaoMiaoSHu: thishaoMiaoSHu
}
xian1.push(obj1)
}
console.log('xian1', xian1)
this.setData({
xian_1: xian_1,
xian0: xian0,
xian1: xian1,
XianhaoMiaoSHu: XianhaoMiaoSHu
})
},
//滑动中
handletouchmove: function (event) {
var animation = wx.createAnimation({
transformOrigin: "50% 50%",
duration: 0,
timingFunction: "ease",
delay: 0
})
var currentX = event.touches[0].pageX
var tx = currentX - this.data.lastX
if (tx > windowWidth) {
tx = windowWidth
}
if (tx < -windowWidth) {
tx = -windowWidth
}
if (tx < 0){
text = "向左滑动"
if (this.data.shu != 1){
animation.translateX(tx).step()
}
}
else if (tx > 0){
text = "向右滑动"
if (this.data.shu != -1) {
animation.translateX(tx).step()
}
}
panSHuBian=tx;
this.setData({
animationData:animation.export()
});
},
//滑动开始
handletouchtart: function (event) {
this.setData({
lastX: event.touches[0].pageX
})
},
//滑动结束事件
handletouchend: function (event) {
var that=this
var shu = that.data.shu
var animation = wx.createAnimation({
transformOrigin: "50% 50%",
duration: 500,
timingFunction: "ease",
delay: 0
})
if (text == "向左滑动") {
if (panSHuBian < -(windowWidth*0.6)){
panSHuBian = 0;
if (huaSHu - windowWidth < (-windowWidth)){
animation.translateX(-windowWidth).step()
huaSHu = -windowWidth
}
else{
animation.translateX(huaSHu - windowWidth).step()
huaSHu = huaSHu - windowWidth
shu = shu+1
if (shu == 1) {
animation = wx.createAnimation({
duration: -1
})
console.log('asda')
let xian0 = this.data.xian1
console.log('xian0左',xian0)
let xian_1 = [];
for (let c = 7; c > 0; c--) {
var dayJai = xian0[0].day - c
console.log(dayJai)
var monthJai = xian0[0].month
var yearJai = xian0[0].year
if (dayJai < 1) {
monthJai = monthJai - 1
console.log(monthJai)
if (monthJai < 1) {
monthJai = 12
yearJai = yearJai - 1
let dayNumS = new Date(yearJai, monthJai, 0).getDate();
dayJai = dayJai + dayNumS
}
else {
let dayNumS = new Date(yearJai, monthJai, 0).getDate();
dayJai = dayJai + dayNumS
}
}
else {
monthJai = monthJai
dayJai = dayJai
yearJai = yearJai
}
let thishaoMiaoSHu = (new Date("" + yearJai + "/" + monthJai + "/" + dayJai + "")).getTime();
var obj = {
year: yearJai,
month: monthJai,
day: dayJai,
thishaoMiaoSHu: thishaoMiaoSHu
}
xian_1.push(obj)
}
console.log('xian_1左', xian_1)
var xian1 = []
for (let c = 0; c < 7; c++) {
var dayJai = xian0[6].day + c + 1
var monthJai = xian0[6].month
var yearJai = xian0[6].year
let dayNumT = new Date(yearJai, monthJai, 0).getDate();
if (dayJai > dayNumT) {
monthJai = monthJai + 1
dayJai = 0 + (dayJai - dayNumT)
console.log(dayJai)
if (monthJai > 12) {
var shuLiang = monthJai - 12
monthJai = shuLiang
yearJai = yearJai + 1
}
}
else {
monthJai = monthJai
寒墨茗殇
- 粉丝: 145
- 资源: 19
最新资源
- 19 工资发放明细表-可视化图表.xlsx
- 27 员工工资表(图表分析).xlsx
- 23 财务报告工资数据图表模板.xlsx
- 22 财务报告工资数据图表模板.xlsx
- 24 工资表-年度薪资可视化图表.xlsx
- 26 财务分析部门工资支出图表.xlsx
- Python爬虫技术详解:从基础到实战.zip
- 25 工资费用支出表-可视化图表.xlsx
- 30公司各部门工资支出数据图表1.xlsx
- 29 员工月度工资支出数据图表.xlsx
- 28 工资表(自动计算,图表显示).xlsx
- 31 财务分析工资年度开支图表.xlsx
- 33 年度工资预算表(可视化看板).xlsx
- 32 公司年度工资成本数据图表.xlsx
- 34 年度工资汇总-数据可视化看板.xlsx
- 36 财务报表新年度部门工资预算表.xlsx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈