Skip to content
Permalink
Browse files

Merge pull request #59 from treadpit/develop

周日历新增enableArea功能 #58
  • Loading branch information...
treadpit committed Oct 26, 2018
2 parents f45aedc + 765443a commit d684d2e94f06159e14bcbd35c27b3f8a85b696de
@@ -5,29 +5,20 @@ module.exports = {
sourceType: 'module'
},
env: {
browser: true,
es6: true,
node: true
},
extends: 'standard',
extends: ['standard', 'prettier', 'prettier/standard'],
plugins: ['prettier', 'standard'],
rules: {
'semi': [2, 'always', { 'omitLastInOneLineBlock': true }],
'comma-dangle': [2, 'only-multiline'],
'prefer-promise-reject-errors': 0,
'space-before-function-paren': 0,
'arrow-parens': 0,
"no-tabs": 0
'prettier/prettier': 1
},
globals: {
App: true,
Page: true,
getApp: true,
getCurrentPages: true,
wx: true,
location: true,
WebSocket: true,
window: true,
alert: true,
Location: true,
my: true,
Image: true
},
}
wx: true
}
};
@@ -6,14 +6,20 @@
"devDependencies": {
"babel-eslint": "^8.2.1",
"eslint": "^4.17.0",
"eslint-config-prettier": "^3.1.0",
"eslint-config-standard": "^11.0.0-beta.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^6.0.0",
"eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-debug": "^3.2.0",
"husky": "^1.1.2",
"lint-staged": "^7.3.0",
"prettier": "^1.14.3",
"stylelint": "^8.4.0",
"stylelint-config-prettier": "^4.0.0",
"stylelint-config-standard": "^18.0.0",
"stylelint-config-wxss": "^2.4.0",
"stylelint-no-z-index": "^1.1.2"
@@ -24,6 +30,17 @@
"lint": "eslint src && stylelint \"src/**/*.wxss\"",
"fix": "eslint src --fix && stylelint \"src/**/*.wxss\" --fix"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,css}": [
"prettier --single-quote --write",
"git add"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/treadpit/wx_calendar.git"
@@ -0,0 +1,3 @@
module.exports = {
singleQuote: true
};
@@ -1,5 +1,3 @@
App({
onLaunch: function () {

},
onLaunch: function() {}
});
@@ -1,4 +1,3 @@

let chooseYear = null;
let chooseMonth = null;
const conf = {
@@ -10,7 +9,7 @@ const conf = {
const date = new Date();
const curYear = date.getFullYear();
const curMonth = date.getMonth() + 1;
const weeksCh = [ '', '', '', '', '', '', '' ];
const weeksCh = ['', '', '', '', '', '', ''];
this.calculateEmptyGrids(curYear, curMonth);
this.calculateDays(curYear, curMonth);
this.setData({
@@ -98,9 +97,9 @@ const conf = {
tapDayItem(e) {
const idx = e.currentTarget.dataset.idx;
const days = this.data.days;
days[ idx ].choosed = !days[ idx ].choosed;
days[idx].choosed = !days[idx].choosed;
this.setData({
days,
days
});
},
chooseYearAndMonth() {
@@ -117,10 +116,10 @@ const conf = {
const idxYear = pickerYear.indexOf(curYear);
const idxMonth = pickerMonth.indexOf(curMonth);
this.setData({
pickerValue: [ idxYear, idxMonth ],
pickerValue: [idxYear, idxMonth],
pickerYear,
pickerMonth,
showPicker: true,
showPicker: true
});
},
pickerChange(e) {
@@ -131,7 +130,7 @@ const conf = {
tapPickerBtn(e) {
const type = e.currentTarget.dataset.type;
const o = {
showPicker: false,
showPicker: false
};
if (type === 'confirm') {
o.curYear = chooseYear;
@@ -196,7 +196,7 @@ page {
}

.right-triangle::after {
content: "";
content: '';
display: block;
width: 0;
height: 0;
@@ -208,7 +208,7 @@ page {
}

.left-triangle::before {
content: "";
content: '';
display: block;
width: 0;
height: 0;
@@ -288,4 +288,4 @@ page {
.picker-view {
color: #ff7ca0;
text-align: center;
}
}
@@ -1,4 +1,10 @@
import initCalendar, { getSelectedDay, setTodoLabels, disableDay } from '../../template/calendar/index';
import initCalendar, {
getSelectedDay,
setTodoLabels,
disableDay,
switchView,
enableArea
} from '../../template/calendar/index';
const conf = {
onShow: function() {
initCalendar({
@@ -13,7 +19,10 @@ const conf = {
afterTapDay: (currentSelect, allSelectedDays) => {
console.log('===============================');
console.log('当前点击的日期', currentSelect);
console.log('当前点击的日期是否有事件标记: ', currentSelect.hasTodo || false);
console.log(
'当前点击的日期是否有事件标记: ',
currentSelect.hasTodo || false
);
allSelectedDays && console.log('选择的所有日期', allSelectedDays);
console.log('getSelectedDay方法', getSelectedDay());
},
@@ -34,26 +43,37 @@ const conf = {
* 日历初次渲染完成后触发事件,如设置事件标记
*/
afterCalendarRender() {
const data = [{
year: '2018',
month: '8',
day: '15',
}, {
year: 2018,
month: 8,
day: 18,
}];
const data = [
{
year: '2018',
month: '8',
day: '15'
},
{
year: 2018,
month: 8,
day: 18
}
];
// 异步请求
setTimeout(() => {
setTodoLabels({
pos: 'bottom',
dotColor: '#40',
days: data,
days: data
});
disableDay(1);
}, 1000);
},
enableArea(['2018-10-7', '2018-10-28']);
}
});
},
switchView() {
if (!this.weekMode) {
switchView('week');
} else {
switchView();
}
}
};
Page(conf);
@@ -8,4 +8,4 @@
.switchView {
width: 300rpx;
margin-top: 50rpx;
}
}
@@ -1,4 +1,7 @@
import initDatepicker, { getSelectedDay, jumpToToday } from '../../template/datepicker/index';
import initDatepicker, {
getSelectedDay,
jumpToToday
} from '../../template/datepicker/index';
const conf = {
onShow: function() {
initDatepicker({
@@ -10,10 +13,10 @@ const conf = {
* 点击日期后执行的事件
* @param { object } currentSelect 当前点击的日期
*/
afterTapDay: (currentSelect) => {
afterTapDay: currentSelect => {
console.log('当前点击的日期', currentSelect);
console.log('getSelectedDay方法', getSelectedDay());
},
}
/**
* 日期点击事件(此事件会完全接管点击事件)
* @param { object } currentSelect 当前点击的日期
@@ -6,4 +6,4 @@

button {
margin-top: 100rpx;
}
}
@@ -30,4 +30,4 @@ text {
background-color: #f40;
color: #fff;
margin-bottom: 20rpx;
}
}

0 comments on commit d684d2e

Please sign in to comment.
You can’t perform that action at this time.