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 @@ ...@@ -111,6 +111,9 @@
<u-button :type="btnType" shape="circle" size="default" @click="btnFix()">确定</u-button> <u-button :type="btnType" shape="circle" size="default" @click="btnFix()">确定</u-button>
</view> </view>
</view> --> </view> -->
<view>
<u-toast ref="uToast" />
</view>
</view> </view>
<!-- </u-popup> --> <!-- </u-popup> -->
</template> </template>
...@@ -287,6 +290,11 @@ export default { ...@@ -287,6 +290,11 @@ export default {
return [] return []
}, },
}, },
// ture: 月和年切换不可超过本月;false: 不对月份限制,根据maxYear限制切换最大年份
currentMonthMax: {
type: Boolean,
default: true,
},
}, },
data() { data() {
return { return {
...@@ -427,13 +435,27 @@ export default { ...@@ -427,13 +435,27 @@ export default {
let date = new Date(`${year}/${month}/01 00:00:00`) let date = new Date(`${year}/${month}/01 00:00:00`)
return date.getDay() return date.getDay()
}, },
checkRange(year) { checkRange(year, month) {
let overstep = false let overstep = false
if (year < this.minYear || year > this.maxYear) { let now = new Date()
uni.showToast({ 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: '日期超出范围啦~', title: '日期超出范围啦~',
icon: 'none', type: 'warning',
duration: 1500,
}) })
// uni.showToast({
// title: '日期超出范围啦~',
// icon: 'none',
// })
overstep = true overstep = true
} }
return overstep return overstep
...@@ -442,7 +464,7 @@ export default { ...@@ -442,7 +464,7 @@ export default {
if (isAdd) { if (isAdd) {
let month = this.month + 1 let month = this.month + 1
let year = month > 12 ? this.year + 1 : this.year 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.month = month > 12 ? 1 : month
this.year = year this.year = year
this.changeData() this.changeData()
......
...@@ -83,16 +83,6 @@ ...@@ -83,16 +83,6 @@
"disableScroll": true "disableScroll": true
} }
}, },
{
"path": "answerBackup",
"name": "learnAnswerrBackup",
"style": {
"navigationBarTitleText": "答题-备份",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
},
{ {
"path": "selectCategory", "path": "selectCategory",
"name": "learnSelectCategory", "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