|
@@ -1,7 +1,7 @@
|
|
// pages/Components/selectDate/selectDate.js
|
|
// pages/Components/selectDate/selectDate.js
|
|
Component({
|
|
Component({
|
|
- lifetimes:{
|
|
|
|
- attached:function(){
|
|
|
|
|
|
+ lifetimes: {
|
|
|
|
+ attached: function () {
|
|
var date = new Date()
|
|
var date = new Date()
|
|
const year = date.getFullYear()
|
|
const year = date.getFullYear()
|
|
const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
|
|
const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
|
|
@@ -16,17 +16,22 @@ Component({
|
|
* 组件的属性列表
|
|
* 组件的属性列表
|
|
*/
|
|
*/
|
|
properties: {
|
|
properties: {
|
|
-
|
|
|
|
|
|
+ beginDate: {
|
|
|
|
+ type: String
|
|
|
|
+ },
|
|
|
|
+ endDate: {
|
|
|
|
+ type: String
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 组件的初始数据
|
|
* 组件的初始数据
|
|
*/
|
|
*/
|
|
data: {
|
|
data: {
|
|
- beginDate: '2000-01-01',
|
|
|
|
|
|
+ beginDate: '2020-01-01',
|
|
endDate: '2021-02-02',
|
|
endDate: '2021-02-02',
|
|
- initDate:'2000-01-01',
|
|
|
|
- lastDate:'',
|
|
|
|
|
|
+ initDate: '2020-01-01',
|
|
|
|
+ lastDate: '',
|
|
yFlag: false,
|
|
yFlag: false,
|
|
animationBox: {},
|
|
animationBox: {},
|
|
animationBg: {},
|
|
animationBg: {},
|
|
@@ -36,8 +41,8 @@ Component({
|
|
* 组件的方法列表
|
|
* 组件的方法列表
|
|
*/
|
|
*/
|
|
methods: {
|
|
methods: {
|
|
- bindBeginDateChange:function(e){
|
|
|
|
- if(e.detail.value > this.data.endDate){
|
|
|
|
|
|
+ bindBeginDateChange: function (e) {
|
|
|
|
+ if (e.detail.value > this.data.endDate) {
|
|
this.setData({
|
|
this.setData({
|
|
beginDate: this.data.endDate
|
|
beginDate: this.data.endDate
|
|
})
|
|
})
|
|
@@ -48,8 +53,8 @@ Component({
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
- bindEndDateChange:function(e){
|
|
|
|
- if(e.detail.value > this.data.endDate){
|
|
|
|
|
|
+ bindEndDateChange: function (e) {
|
|
|
|
+ if (e.detail.value > this.data.endDate) {
|
|
this.setData({
|
|
this.setData({
|
|
endDate: this.data.lastDate
|
|
endDate: this.data.lastDate
|
|
})
|
|
})
|
|
@@ -60,30 +65,30 @@ Component({
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
- resetDate:function(){
|
|
|
|
|
|
+ resetDate: function () {
|
|
this.setData({
|
|
this.setData({
|
|
beginDate: this.data.initDate,
|
|
beginDate: this.data.initDate,
|
|
endDate: this.data.lastDate
|
|
endDate: this.data.lastDate
|
|
})
|
|
})
|
|
- const dateArr = [this.data.initDate,this.data.lastDate];
|
|
|
|
- this.triggerEvent("getDates",dateArr);
|
|
|
|
|
|
+ const dateArr = [this.data.initDate, this.data.lastDate];
|
|
|
|
+ this.triggerEvent("getDates", dateArr);
|
|
this.showSelect()
|
|
this.showSelect()
|
|
},
|
|
},
|
|
|
|
|
|
- submitDate:function(){
|
|
|
|
- const dateArr = [this.data.beginDate,this.data.endDate];
|
|
|
|
- this.triggerEvent("getDates",dateArr);
|
|
|
|
|
|
+ submitDate: function () {
|
|
|
|
+ const dateArr = [this.data.beginDate, this.data.endDate];
|
|
|
|
+ this.triggerEvent("getDates", dateArr);
|
|
this.showSelect()
|
|
this.showSelect()
|
|
},
|
|
},
|
|
|
|
|
|
- showSelect:function(){
|
|
|
|
|
|
+ showSelect: function () {
|
|
var animation = wx.createAnimation({
|
|
var animation = wx.createAnimation({
|
|
timingFunction: 'linear',
|
|
timingFunction: 'linear',
|
|
})
|
|
})
|
|
this.animation = animation
|
|
this.animation = animation
|
|
var num = 0
|
|
var num = 0
|
|
var opacity = 0
|
|
var opacity = 0
|
|
- if(this.data.yFlag == false){
|
|
|
|
|
|
+ if (this.data.yFlag == false) {
|
|
num = 180
|
|
num = 180
|
|
opacity = 0.4
|
|
opacity = 0.4
|
|
this.setData({
|
|
this.setData({
|
|
@@ -98,19 +103,19 @@ Component({
|
|
}
|
|
}
|
|
animation.translateY(num).step()
|
|
animation.translateY(num).step()
|
|
this.setData({
|
|
this.setData({
|
|
- animationBox:animation.export()
|
|
|
|
|
|
+ animationBox: animation.export()
|
|
})
|
|
})
|
|
-
|
|
|
|
|
|
+
|
|
var animation2 = wx.createAnimation({
|
|
var animation2 = wx.createAnimation({
|
|
timingFunction: 'linear',
|
|
timingFunction: 'linear',
|
|
})
|
|
})
|
|
this.animation2 = animation2
|
|
this.animation2 = animation2
|
|
-
|
|
|
|
|
|
+
|
|
animation2.opacity(opacity).step()
|
|
animation2.opacity(opacity).step()
|
|
this.setData({
|
|
this.setData({
|
|
- animationBg:animation2.export()
|
|
|
|
|
|
+ animationBg: animation2.export()
|
|
})
|
|
})
|
|
-
|
|
|
|
|
|
+
|
|
},
|
|
},
|
|
}
|
|
}
|
|
})
|
|
})
|