Commit b21898fc authored by Damon's avatar Damon

Merge branch 'dev-v1.0.0' of git.banshouhui.com:wuzhenzhe/study into dev-v1.0.0

parents 5a5f2724 d5e73eca
......@@ -111,6 +111,9 @@
<u-button :type="btnType" shape="circle" size="default" @click="btnFix()">确定</u-button>
</view>
</view> -->
<view>
<u-toast ref="uToast" />
</view>
</view>
<!-- </u-popup> -->
</template>
......@@ -287,6 +290,11 @@ export default {
return []
},
},
// ture: 月和年切换不可超过本月;false: 不对月份限制,根据maxYear限制切换最大年份
currentMonthMax: {
type: Boolean,
default: true,
},
},
data() {
return {
......@@ -427,13 +435,27 @@ export default {
let date = new Date(`${year}/${month}/01 00:00:00`)
return date.getDay()
},
checkRange(year) {
checkRange(year, month) {
let overstep = false
if (year < this.minYear || year > this.maxYear) {
uni.showToast({
let now = new Date()
let mYear = this.currentMonthMax ? now.getFullYear() : this.maxYear // ture: 月和年切换不可超过本月;false: 不对月份限制,根据maxYear限制切换最大年份
if (
year < this.minYear ||
year > mYear ||
(this.currentMonthMax &&
year == mYear &&
month &&
month > now.getMonth() + 1)
) {
this.$refs.uToast.show({
title: '日期超出范围啦~',
icon: 'none',
type: 'warning',
duration: 1500,
})
// uni.showToast({
// title: '日期超出范围啦~',
// icon: 'none',
// })
overstep = true
}
return overstep
......@@ -442,7 +464,7 @@ export default {
if (isAdd) {
let month = this.month + 1
let year = month > 12 ? this.year + 1 : this.year
if (!this.checkRange(year)) {
if (!this.checkRange(year, month > 12 ? 1 : month)) {
this.month = month > 12 ? 1 : month
this.year = year
this.changeData()
......
......@@ -83,16 +83,6 @@
"disableScroll": true
}
},
{
"path": "answerBackup",
"name": "learnAnswerrBackup",
"style": {
"navigationBarTitleText": "答题-备份",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
},
{
"path": "selectCategory",
"name": "learnSelectCategory",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment