失业在家,开启一天一个应用的创作节奏,最近学了uniapp,特别想做点啥,正好家里小孩子要打印课程表,而且课程表还有调课的需求,就寻思做一个方便大家,到目前位置服务完全免费的,新鲜上线,先给大家看看效果
制作起来比较简单,因为我也不是老师,所以可能缺乏经验,课程表的设定上可能有出入,后面慢慢改进,先看看有多少人需要使用。
在线制作课程表http://kcb.toolxq.com/
左侧是设置课程,右侧选择课程即可,也可以直接填写,最后点击预览看效果
结果很简单明了
最后按照惯例分享一下代码:
delClass(index) {
this.classNum--;
localStorage.setItem('classNum', this.classNum);
let rows = this.selArr.length;
if (index < this.amClasses) {
this.amClasses--;
localStorage.setItem('amClasses', this.amClasses);
} else {
this.pmClasses--;
}
for (let i = 0; i < rows; i++) {
this.selArr[i].splice(index, 1);
localStorage.setItem('pmClasses', this.pmClasses);
}
},
updateValue(value, index) {
console.log(index)
this.list[index] = value; // 将用户的输入保存到列表的相应位置
localStorage.setItem('list', JSON.stringify(this.list));
},
addItem() {
if (this.newItem !== '') {
this.list.push(this.newItem);
localStorage.setItem('list', JSON.stringify(this.list));
this.newItem = '';
}
},
removeItem(index) {
this.list.splice(index, 1);
localStorage.setItem('list', JSON.stringify(this.list));
},
getList() {
console.log("ac");
if (localStorage.getItem('list')) {
this.list = JSON.parse(localStorage.getItem('list'));
} else {
}
if (localStorage.getItem('table_json')) {
this.selArr = JSON.parse(localStorage.getItem('table_json'));
} else {
}
},
bindPickerChange: function(day, clazz, event) {
console.log('picker发送选择改变,携带值为', event.detail.value)
this.selArr[day][clazz] = event.detail.value
},
saveTimeTable: function(value, day, clazz) {
console.log()
this.selArr[day][clazz] = value
localStorage.setItem('table_json', JSON.stringify(this.selArr));
},
numberToChinese(num) {
const chineseNumbers = {
1: '一',
2: '二',
3: '三',
4: '四',
5: '五',
};
return chineseNumbers[num];
},
preview() {
this.previewFlag = !this.previewFlag;
}