finish personal_class

This commit is contained in:
RainSun 2020-05-31 17:04:41 +08:00
parent 30d0655b8f
commit 579b9239ee
15 changed files with 1383 additions and 353 deletions

17
src/lib/getStore.js Normal file
View File

@ -0,0 +1,17 @@
// 刷新本页vuex
export function replaceState() {
let state = {}
for(let key of Object.keys(this.$store.state)) {
let content = JSON.parse(localStorage.getItem("cherry_" + key))
if(key == 'user_info' && content == null) content = {}
if(key == 'personal_class' && content == null) content = {}
if(key == 'drawer_state' && content == null) content = false
state[key] = content
}
this.$store.replaceState(
Object.assign(
this.$store.state,
state
)
);
}

View File

@ -21,11 +21,12 @@ export function manageSchedule(all_lesson) {
}
}
}
cache = JSON.parse(JSON.stringify(cache))
if(cache.length !== 0) {
// 里边有课程
after_process_lesson = cache[0]
cache.shift()
after_process_lesson.hide = cache
after_process_lesson['hide'] = cache
}
after_process[week][day].push(after_process_lesson)
}

View File

@ -85,4 +85,4 @@ export function getGameInitData() {
}]
}
export var interceptTime = 1590584094308
export var interceptTime = 1590914481754

View File

@ -51,6 +51,14 @@ const routes = [
keepAlive:false
},
},
{
path: '/addclass',
name: 'AddClass',
component: () => import(/* webpackChunkName: "addclass" */ '../views/AddClass/AddClass.vue'),
meta:{
keepAlive:false
},
},
{
path: '*', // 页面不存在的情况下会跳到schedule
redirect: '/schedule',

View File

@ -17,6 +17,10 @@ export default new Vuex.Store({
schedule_game: null,
// 展开抽屉
drawer_state: false,
// 自定义课程
personal_class: {},
// 源课表信息
row_lesson_info: null,
},
mutations: {
// 设置用户信息
@ -42,40 +46,65 @@ export default new Vuex.Store({
// 设置抽屉状态
SET_DRAWER_STATE(state, drawer_state) {
state.drawer_state = drawer_state
}
},
// 设置自定义课程
SET_PERSONAL_CLASS(state, personal_class) {
state.personal_class = personal_class
},
// 设置源课表信息
SET_ROW_LESSON_INFO(state, row_lesson_info) {
state.row_lesson_info = row_lesson_info
}
},
actions: {
// 设置用户信息
setUserInfo({ commit }, arg) {
commit('SET_USERINFO', arg[0]);
localStorage.setItem("cherry", JSON.stringify(arg[1].$store.state));
setItem.call(arg[1])
},
// 设置当前页面
setCurrentPage({ commit }, arg){
commit('SET_CURRENTPAGE', arg[0]);
localStorage.setItem("cherry", JSON.stringify(arg[1].$store.state));
setItem.call(arg[1])
},
// 设置成绩
setGrade({ commit }, arg){
commit('SET_GRADE',arg[0]);
localStorage.setItem("cherry", JSON.stringify(arg[1].$store.state));
setItem.call(arg[1])
},
// 设置课表
setSchedule({ commit }, arg){
commit('SET_SCHEDULE', arg[0]);
localStorage.setItem("cherry", JSON.stringify(arg[1].$store.state));
setItem.call(arg[1])
},
// 设置游戏
setScheduleGame({ commit }, arg) {
commit('SET_SCHEDULE_GAME', arg[0]);
localStorage.setItem("cherry", JSON.stringify(arg[1].$store.state));
setItem.call(arg[1])
},
// 设置抽屉状态
setDrawerState({ commit }, arg) {
commit('SET_DRAWER_STATE', arg[0]);
localStorage.setItem("cherry", JSON.stringify(arg[1].$store.state));
setItem.call(arg[1])
},
// 设置自定义课表
setPersonalClass({ commit }, arg) {
commit('SET_PERSONAL_CLASS', arg[0]);
setItem.call(arg[1])
},
// 设置课表源数据
setRowLessonInfo({ commit }, arg) {
commit('SET_ROW_LESSON_INFO', arg[0]);
setItem.call(arg[1])
},
},
modules: {
}
})
function setItem() {
let state = this.$store.state
for(let key of Object.keys(state)) {
localStorage.setItem("cherry_" + key , JSON.stringify(state[key]));
}
}

View File

@ -1 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1574137011982" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3828" data-spm-anchor-id="a313x.7781069.0.i45" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M792.4736 293.888H568.6272a108.032 108.032 0 0 1-69.9392-25.7024l-9.1136-7.7824a148.48 148.48 0 0 0-96.256-35.1232H266.24a108.032 108.032 0 0 0-108.3392 107.6224v258.2528a238.08 238.08 0 0 1 298.9056 229.888h335.6672a108.032 108.032 0 0 0 108.032-108.032V401.92A108.032 108.032 0 0 0 792.4736 293.888z m9.4208 392.192a162.5088 162.5088 0 0 1-39.8336 11.264 538.7264 538.7264 0 0 1-169.7792 0 162.6112 162.6112 0 0 1-39.936-11.264 34.816 34.816 0 0 1-23.4496-29.696A93.0816 93.0816 0 0 1 552.96 601.8048 128.1024 128.1024 0 0 1 612.1472 563.2a7.2704 7.2704 0 0 0 2.56-12.288 92.16 92.16 0 1 1 124.7232 0 7.2704 7.2704 0 0 0 2.4576 12.288 130.56 130.56 0 0 1 59.6992 38.6048 109.4656 109.4656 0 0 1 18.1248 29.5936 70.9632 70.9632 0 0 1 5.632 25.2928A34.816 34.816 0 0 1 801.8944 686.08z" fill="#40a9ff" p-id="3829" data-spm-anchor-id="a313x.7781069.0.i44" class=""></path><path d="M686.08 595.1488a7.5776 7.5776 0 0 1 0.9216-6.2464l3.072-4.7104a7.5776 7.5776 0 0 0 1.2288-4.5056v-0.6144a7.5776 7.5776 0 0 0-7.2704-7.168h-14.2336a7.5776 7.5776 0 0 0-7.2704 7.168v0.6144a7.5776 7.5776 0 0 0 1.2288 4.5056l3.1744 4.8128a7.5776 7.5776 0 0 1 1.024 6.0416l-14.7456 57.1392a7.5776 7.5776 0 0 0 2.9696 8.0896l17.6128 12.1856a7.5776 7.5776 0 0 0 8.6016 0l17.408-12.0832a7.5776 7.5776 0 0 0 2.9696-8.2944z" fill="#40a9ff" p-id="3830" data-spm-anchor-id="a313x.7781069.0.i46" class=""></path><path d="M218.8288 583.0656a238.1824 238.1824 0 0 0-61.44 7.9872v121.856a108.032 108.032 0 0 0 108.032 108.1344h191.3856a237.9776 237.9776 0 0 0-237.9776-237.9776z" fill="#1082FF" p-id="3831"></path><path d="M218.8288 583.0656a238.1824 238.1824 0 0 0-61.44 7.9872v121.856a108.032 108.032 0 0 0 108.032 108.1344h191.3856a237.9776 237.9776 0 0 0-237.9776-237.9776z" fill="#91d5ff" p-id="3832" data-spm-anchor-id="a313x.7781069.0.i47" class=""></path></svg>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1574137011982" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3828" data-spm-anchor-id="a313x.7781069.0.i45" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M792.4736 293.888H568.6272a108.032 108.032 0 0 1-69.9392-25.7024l-9.1136-7.7824a148.48 148.48 0 0 0-96.256-35.1232H266.24a108.032 108.032 0 0 0-108.3392 107.6224v258.2528a238.08 238.08 0 0 1 298.9056 229.888h335.6672a108.032 108.032 0 0 0 108.032-108.032V401.92A108.032 108.032 0 0 0 792.4736 293.888z m9.4208 392.192a162.5088 162.5088 0 0 1-39.8336 11.264 538.7264 538.7264 0 0 1-169.7792 0 162.6112 162.6112 0 0 1-39.936-11.264 34.816 34.816 0 0 1-23.4496-29.696A93.0816 93.0816 0 0 1 552.96 601.8048 128.1024 128.1024 0 0 1 612.1472 563.2a7.2704 7.2704 0 0 0 2.56-12.288 92.16 92.16 0 1 1 124.7232 0 7.2704 7.2704 0 0 0 2.4576 12.288 130.56 130.56 0 0 1 59.6992 38.6048 109.4656 109.4656 0 0 1 18.1248 29.5936 70.9632 70.9632 0 0 1 5.632 25.2928A34.816 34.816 0 0 1 801.8944 686.08z" fill="#ff776d" p-id="3829" data-spm-anchor-id="a313x.7781069.0.i44" class=""></path><path d="M686.08 595.1488a7.5776 7.5776 0 0 1 0.9216-6.2464l3.072-4.7104a7.5776 7.5776 0 0 0 1.2288-4.5056v-0.6144a7.5776 7.5776 0 0 0-7.2704-7.168h-14.2336a7.5776 7.5776 0 0 0-7.2704 7.168v0.6144a7.5776 7.5776 0 0 0 1.2288 4.5056l3.1744 4.8128a7.5776 7.5776 0 0 1 1.024 6.0416l-14.7456 57.1392a7.5776 7.5776 0 0 0 2.9696 8.0896l17.6128 12.1856a7.5776 7.5776 0 0 0 8.6016 0l17.408-12.0832a7.5776 7.5776 0 0 0 2.9696-8.2944z" fill="#ff776d" p-id="3830" data-spm-anchor-id="a313x.7781069.0.i46" class=""></path><path d="M218.8288 583.0656a238.1824 238.1824 0 0 0-61.44 7.9872v121.856a108.032 108.032 0 0 0 108.032 108.1344h191.3856a237.9776 237.9776 0 0 0-237.9776-237.9776z" fill="#ff4c2b" p-id="3831"></path><path d="M218.8288 583.0656a238.1824 238.1824 0 0 0-61.44 7.9872v121.856a108.032 108.032 0 0 0 108.032 108.1344h191.3856a237.9776 237.9776 0 0 0-237.9776-237.9776z" fill="#ffb5b8" p-id="3832" data-spm-anchor-id="a313x.7781069.0.i47" class=""></path></svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1574136962224" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3272" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M530.1248 534.7328v241.152a48.8448 48.8448 0 0 0 48.64 48.64c26.624-9.216 79.0528-27.8528 129.6384-50.176 13.1072-5.8368 26.0096-13.0048 51.2-27.3408a117.4528 117.4528 0 0 0 40.96-31.4368 89.6 89.6 0 0 0 13.2096-24.8832v-430.08a48.8448 48.8448 0 0 0-48.64-48.64c-10.24 1.7408-24.9856 4.608-42.5984 9.4208a230.5024 230.5024 0 0 1-192.4096 313.344zM252.928 747.008c25.7024 14.336 38.6048 21.6064 51.2 27.3408 50.5856 22.3232 103.0144 40.96 129.6384 50.176a48.8448 48.8448 0 0 0 48.64-48.64V534.3232a230.6048 230.6048 0 0 1-189.44-312.2176 454.9632 454.9632 0 0 0-46.2848-10.24 48.8448 48.8448 0 0 0-48.64 48.64v430.08a89.6 89.6 0 0 0 13.2096 24.8832 117.4528 117.4528 0 0 0 41.6768 31.5392z" fill="#40a9ff" p-id="3273" data-spm-anchor-id="a313x.7781069.0.i34" class=""></path><path d="M839.68 269.2096a47.9232 47.9232 0 0 1 0.9216 8.6016v430.08a89.7024 89.7024 0 0 1-13.2096 24.8832 117.3504 117.3504 0 0 1-40.96 31.4368c-24.7808 13.824-37.5808 20.992-50.2784 26.7264 13.5168 0 53.6576 0.8192 92.9792-1.8432a61.44 61.44 0 0 0 35.5328-12.1856A58.2656 58.2656 0 0 0 883.4048 747.52V317.44A48.64 48.64 0 0 0 839.68 269.2096zM152.3712 777.1136a61.44 61.44 0 0 0 35.5328 12.1856c39.3216 2.6624 79.4624 2.1504 92.9792 1.8432-12.6976-5.7344-25.4976-12.9024-50.2784-26.7264a117.3504 117.3504 0 0 1-40.96-31.4368 89.6 89.6 0 0 1-13.2096-24.8832v-430.08a47.9232 47.9232 0 0 1 0.9216-8.6016A48.64 48.64 0 0 0 133.632 317.44v430.08a58.2656 58.2656 0 0 0 18.7392 29.5936z" fill="#40a9ff" p-id="3274" data-spm-anchor-id="a313x.7781069.0.i35" class=""></path><path d="M544.3584 347.648a204.8 204.8 0 0 0-14.336 34.4064v152.6784a230.5024 230.5024 0 0 0 193.2288-313.6512c-55.6032 15.0528-138.0352 49.152-178.8928 126.5664z" fill="#FFBA00" p-id="3275"></path><path d="M544.3584 347.648a204.8 204.8 0 0 0-14.336 34.4064v152.6784a230.5024 230.5024 0 0 0 193.2288-313.6512c-55.6032 15.0528-138.0352 49.152-178.8928 126.5664z" fill="#91d5ff" p-id="3276" data-spm-anchor-id="a313x.7781069.0.i37" class="selected"></path><path d="M482.9184 534.3232V382.0544a204.8 204.8 0 0 0-14.336-34.4064c-39.936-75.6736-119.7056-109.9776-175.2064-125.5424a230.6048 230.6048 0 0 0 189.44 312.2176z" fill="#FFBA00" p-id="3277"></path><path d="M482.9184 534.3232V382.0544a204.8 204.8 0 0 0-14.336-34.4064c-39.936-75.6736-119.7056-109.9776-175.2064-125.5424a230.6048 230.6048 0 0 0 189.44 312.2176z" fill="#91d5ff" p-id="3278" data-spm-anchor-id="a313x.7781069.0.i36" class="selected"></path></svg>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1574136962224" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3272" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M530.1248 534.7328v241.152a48.8448 48.8448 0 0 0 48.64 48.64c26.624-9.216 79.0528-27.8528 129.6384-50.176 13.1072-5.8368 26.0096-13.0048 51.2-27.3408a117.4528 117.4528 0 0 0 40.96-31.4368 89.6 89.6 0 0 0 13.2096-24.8832v-430.08a48.8448 48.8448 0 0 0-48.64-48.64c-10.24 1.7408-24.9856 4.608-42.5984 9.4208a230.5024 230.5024 0 0 1-192.4096 313.344zM252.928 747.008c25.7024 14.336 38.6048 21.6064 51.2 27.3408 50.5856 22.3232 103.0144 40.96 129.6384 50.176a48.8448 48.8448 0 0 0 48.64-48.64V534.3232a230.6048 230.6048 0 0 1-189.44-312.2176 454.9632 454.9632 0 0 0-46.2848-10.24 48.8448 48.8448 0 0 0-48.64 48.64v430.08a89.6 89.6 0 0 0 13.2096 24.8832 117.4528 117.4528 0 0 0 41.6768 31.5392z" fill="#ff776d" p-id="3273" data-spm-anchor-id="a313x.7781069.0.i34" class=""></path><path d="M839.68 269.2096a47.9232 47.9232 0 0 1 0.9216 8.6016v430.08a89.7024 89.7024 0 0 1-13.2096 24.8832 117.3504 117.3504 0 0 1-40.96 31.4368c-24.7808 13.824-37.5808 20.992-50.2784 26.7264 13.5168 0 53.6576 0.8192 92.9792-1.8432a61.44 61.44 0 0 0 35.5328-12.1856A58.2656 58.2656 0 0 0 883.4048 747.52V317.44A48.64 48.64 0 0 0 839.68 269.2096zM152.3712 777.1136a61.44 61.44 0 0 0 35.5328 12.1856c39.3216 2.6624 79.4624 2.1504 92.9792 1.8432-12.6976-5.7344-25.4976-12.9024-50.2784-26.7264a117.3504 117.3504 0 0 1-40.96-31.4368 89.6 89.6 0 0 1-13.2096-24.8832v-430.08a47.9232 47.9232 0 0 1 0.9216-8.6016A48.64 48.64 0 0 0 133.632 317.44v430.08a58.2656 58.2656 0 0 0 18.7392 29.5936z" fill="#ff776d" p-id="3274" data-spm-anchor-id="a313x.7781069.0.i35" class=""></path><path d="M544.3584 347.648a204.8 204.8 0 0 0-14.336 34.4064v152.6784a230.5024 230.5024 0 0 0 193.2288-313.6512c-55.6032 15.0528-138.0352 49.152-178.8928 126.5664z" fill="#FFBA00" p-id="3275"></path><path d="M544.3584 347.648a204.8 204.8 0 0 0-14.336 34.4064v152.6784a230.5024 230.5024 0 0 0 193.2288-313.6512c-55.6032 15.0528-138.0352 49.152-178.8928 126.5664z" fill="#ffb5b8" p-id="3276" data-spm-anchor-id="a313x.7781069.0.i37" class="selected"></path><path d="M482.9184 534.3232V382.0544a204.8 204.8 0 0 0-14.336-34.4064c-39.936-75.6736-119.7056-109.9776-175.2064-125.5424a230.6048 230.6048 0 0 0 189.44 312.2176z" fill="#FFBA00" p-id="3277"></path><path d="M482.9184 534.3232V382.0544a204.8 204.8 0 0 0-14.336-34.4064c-39.936-75.6736-119.7056-109.9776-175.2064-125.5424a230.6048 230.6048 0 0 0 189.44 312.2176z" fill="#ffb5b8" p-id="3278" data-spm-anchor-id="a313x.7781069.0.i36" class="selected"></path></svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

1
src/svg/empty.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1590879429400" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9080" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M576 928c-6 0-11.9-1.7-17.1-5-9.3-5.9-14.9-16.1-14.9-27V554.3c0-12.4 7.1-23.6 18.3-28.9l288-136.1c9.9-4.7 21.5-4 30.8 1.9s14.9 16.1 14.9 27v341.7c0 12.4-7.1 23.6-18.3 28.9l-288 136.1c-4.4 2.1-9 3.1-13.7 3.1z m32-353.5v271l224-105.8v-271L608 574.5zM448 928c-4.7 0-9.3-1-13.7-3.1l-288-136.1c-11.2-5.3-18.3-16.6-18.3-28.9V418.2c0-11 5.6-21.2 14.9-27 9.3-5.9 20.9-6.6 30.8-1.9l288 136.1c11.2 5.3 18.3 16.6 18.3 28.9V896c0 11-5.6 21.2-14.9 27-5.2 3.3-11.1 5-17.1 5zM192 739.7l224 105.8v-271L192 468.7v271zM512 501.1c-4.7 0-9.4-1-13.8-3.1l-352-168.1c-11.2-5.4-18.3-16.7-18.2-29.2 0.1-12.4 7.4-23.7 18.8-28.8l352-159.9c8.4-3.8 18.1-3.8 26.5 0l352 159.9c11.3 5.1 18.6 16.4 18.8 28.8 0.1 12.4-7 23.8-18.2 29.2L525.8 498c-4.4 2-9.1 3.1-13.8 3.1zM235.8 301.7L512 433.6l276.2-131.9L512 176.2 235.8 301.7z" p-id="9081" fill="#ff776d"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1574136861318" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2251" data-spm-anchor-id="a313x.7781069.0.i18" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M850.7392 541.4912H741.376a18.5344 18.5344 0 0 1-18.5344-18.5344V419.84a55.7056 55.7056 0 0 0-20.48-43.3152l-74.9568-60.416A176.0256 176.0256 0 0 1 357.376 512v11.3664a18.5344 18.5344 0 0 1-18.5344 18.5344H229.4784a55.7056 55.7056 0 0 0-55.3984 55.296v223.8464a55.7056 55.7056 0 0 0 55.7056 55.7056h200.9088A37.0688 37.0688 0 0 0 467.8656 839.68v-58.6752a70.144 70.144 0 0 1 70.144-70.144 74.24 74.24 0 0 1 74.24 74.24V839.68a37.0688 37.0688 0 0 0 37.0688 37.0688h201.4208a55.7056 55.7056 0 0 0 55.7056-55.7056V597.1968a55.7056 55.7056 0 0 0-55.7056-55.7056zM545.5872 204.0832a9.216 9.216 0 0 1-5.5296-8.3968v-53.5552a9.216 9.216 0 0 1 3.4816-7.168 5.4272 5.4272 0 0 0-3.4816-1.3312 5.5296 5.5296 0 0 0-5.5296 5.4272v69.7344c3.6864 1.7408 7.3728 3.6864 10.9568 5.7344z" fill="#40a9ff" p-id="2252" data-spm-anchor-id="a313x.7781069.0.i15" class=""></path><path d="M545.5872 139.0592v65.024c14.2336 5.7344 51.2 18.944 65.3312 7.3728 12.0832-9.6256 39.424-6.4512 56.5248-3.2768a9.216 9.216 0 0 0 10.24-10.24 280.3712 280.3712 0 0 1 3.072-61.44 9.216 9.216 0 0 0-5.2224-9.728c-20.48-9.5232-61.952-4.9152-77.312 3.8912-11.5712 6.656-34.6112 4.3008-48.128 2.048a9.1136 9.1136 0 0 0-7.2704 1.9456 5.4272 5.4272 0 0 1 2.7648 4.4032z" fill="#40a9ff" p-id="2253" data-spm-anchor-id="a313x.7781069.0.i16" class=""></path><path d="M540.0576 142.1312v53.5552a9.216 9.216 0 0 0 5.5296 8.3968v-65.024a5.4272 5.4272 0 0 0-2.048-4.1984 9.216 9.216 0 0 0-3.4816 7.2704z" fill="#1082FF" p-id="2254"></path><path d="M540.0576 142.1312v53.5552a9.216 9.216 0 0 0 5.5296 8.3968v-65.024a5.4272 5.4272 0 0 0-2.048-4.1984 9.216 9.216 0 0 0-3.4816 7.2704z" fill="#1082FF" p-id="2255"></path><path d="M540.0576 430.4896m-50.9952 0a50.9952 50.9952 0 1 0 101.9904 0 50.9952 50.9952 0 1 0-101.9904 0Z" fill="#FFFFFF" p-id="2256"></path><path d="M627.0976 316.2112a176.4352 176.4352 0 0 0-81.92-101.6832v35.9424z" fill="#FFFFFF" p-id="2257"></path><path d="M634.88 367.616a175.9232 175.9232 0 0 0-7.68-51.2l-81.92-65.7408V215.04c-3.584-2.048-7.2704-3.9936-10.9568-5.7344v40.1408L377.856 376.6272a55.7056 55.7056 0 0 0-20.48 43.1104v92.16A176.0256 176.0256 0 0 0 634.88 367.616z m-94.6176 11.8784a51.2 51.2 0 1 1-51.2 51.2 51.2 51.2 0 0 1 50.9952-51.2z" fill="#1082FF" p-id="2258"></path><path d="M634.88 367.616a175.9232 175.9232 0 0 0-7.68-51.2l-81.92-65.7408V215.04c-3.584-2.048-7.2704-3.9936-10.9568-5.7344v40.1408L377.856 376.6272a55.7056 55.7056 0 0 0-20.48 43.1104v92.16A176.0256 176.0256 0 0 0 634.88 367.616z m-94.6176 11.8784a51.2 51.2 0 1 1-51.2 51.2 51.2 51.2 0 0 1 50.9952-51.2z" fill="#91d5ff" p-id="2259" data-spm-anchor-id="a313x.7781069.0.i17" class=""></path></svg>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1574136861318" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2251" data-spm-anchor-id="a313x.7781069.0.i18" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M850.7392 541.4912H741.376a18.5344 18.5344 0 0 1-18.5344-18.5344V419.84a55.7056 55.7056 0 0 0-20.48-43.3152l-74.9568-60.416A176.0256 176.0256 0 0 1 357.376 512v11.3664a18.5344 18.5344 0 0 1-18.5344 18.5344H229.4784a55.7056 55.7056 0 0 0-55.3984 55.296v223.8464a55.7056 55.7056 0 0 0 55.7056 55.7056h200.9088A37.0688 37.0688 0 0 0 467.8656 839.68v-58.6752a70.144 70.144 0 0 1 70.144-70.144 74.24 74.24 0 0 1 74.24 74.24V839.68a37.0688 37.0688 0 0 0 37.0688 37.0688h201.4208a55.7056 55.7056 0 0 0 55.7056-55.7056V597.1968a55.7056 55.7056 0 0 0-55.7056-55.7056zM545.5872 204.0832a9.216 9.216 0 0 1-5.5296-8.3968v-53.5552a9.216 9.216 0 0 1 3.4816-7.168 5.4272 5.4272 0 0 0-3.4816-1.3312 5.5296 5.5296 0 0 0-5.5296 5.4272v69.7344c3.6864 1.7408 7.3728 3.6864 10.9568 5.7344z" fill="#ff776d" p-id="2252" data-spm-anchor-id="a313x.7781069.0.i15" class=""></path><path d="M545.5872 139.0592v65.024c14.2336 5.7344 51.2 18.944 65.3312 7.3728 12.0832-9.6256 39.424-6.4512 56.5248-3.2768a9.216 9.216 0 0 0 10.24-10.24 280.3712 280.3712 0 0 1 3.072-61.44 9.216 9.216 0 0 0-5.2224-9.728c-20.48-9.5232-61.952-4.9152-77.312 3.8912-11.5712 6.656-34.6112 4.3008-48.128 2.048a9.1136 9.1136 0 0 0-7.2704 1.9456 5.4272 5.4272 0 0 1 2.7648 4.4032z" fill="#ff776d" p-id="2253" data-spm-anchor-id="a313x.7781069.0.i16" class=""></path><path d="M540.0576 142.1312v53.5552a9.216 9.216 0 0 0 5.5296 8.3968v-65.024a5.4272 5.4272 0 0 0-2.048-4.1984 9.216 9.216 0 0 0-3.4816 7.2704z" fill="#ff4c2b" p-id="2254"></path><path d="M540.0576 142.1312v53.5552a9.216 9.216 0 0 0 5.5296 8.3968v-65.024a5.4272 5.4272 0 0 0-2.048-4.1984 9.216 9.216 0 0 0-3.4816 7.2704z" fill="#ff4c2b" p-id="2255"></path><path d="M540.0576 430.4896m-50.9952 0a50.9952 50.9952 0 1 0 101.9904 0 50.9952 50.9952 0 1 0-101.9904 0Z" fill="#FFFFFF" p-id="2256"></path><path d="M627.0976 316.2112a176.4352 176.4352 0 0 0-81.92-101.6832v35.9424z" fill="#FFFFFF" p-id="2257"></path><path d="M634.88 367.616a175.9232 175.9232 0 0 0-7.68-51.2l-81.92-65.7408V215.04c-3.584-2.048-7.2704-3.9936-10.9568-5.7344v40.1408L377.856 376.6272a55.7056 55.7056 0 0 0-20.48 43.1104v92.16A176.0256 176.0256 0 0 0 634.88 367.616z m-94.6176 11.8784a51.2 51.2 0 1 1-51.2 51.2 51.2 51.2 0 0 1 50.9952-51.2z" fill="#ff4c2b" p-id="2258"></path><path d="M634.88 367.616a175.9232 175.9232 0 0 0-7.68-51.2l-81.92-65.7408V215.04c-3.584-2.048-7.2704-3.9936-10.9568-5.7344v40.1408L377.856 376.6272a55.7056 55.7056 0 0 0-20.48 43.1104v92.16A176.0256 176.0256 0 0 0 634.88 367.616z m-94.6176 11.8784a51.2 51.2 0 1 1-51.2 51.2 51.2 51.2 0 0 1 50.9952-51.2z" fill="#ffb5b8" p-id="2259" data-spm-anchor-id="a313x.7781069.0.i17" class=""></path></svg>

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,789 @@
<template>
<div class="schedule">
<header>
<div class="w">
<i class="el-icon-arrow-left back" @click="back"></i>
<p>自定义课程</p>
<i class="el-icon-plus plus" @click="openAddDialog"></i>
</div>
</header>
<div style="height: 1.2rem;"></div>
<div class="lesson" v-for="(lesson, index) in personal_class" :key="index">
<div class="left">
<p>课程名{{lesson.Lesson}}</p>
<p>上课地点{{lesson.Room}}</p>
<p>任课教师{{lesson.Teacher}}</p>
<p>上课周数{{lesson.Time}}</p>
<p>星期{{week_day_list[lesson.day_position]}}</p>
<p>时间{{lesson_list[lesson.lesson_position]}}</p>
</div>
<i class="el-icon-delete delete" @click="openConfirmDialog(lesson.id)"></i>
</div>
<div class="empty-box" v-if="Object.keys(personal_class).length == 0">
<icon name="empty" class="empty"></icon>
<p>空空如也呢~</p>
</div>
<div
class="dialog"
@click="closeConfirmDialog"
v-if="confirm_dialog_switch"
:class="confirm_dialog_opacity_class"
>
<div class="mask" @touchmove.prevent></div>
<div class="bottom-fixed" @click.stop>
<div class="confirm-dialog" :class="confirm_dialog_height_class">
<div class="dialog-header">删除课程</div>
<div class="dialog-detail">删除后将无法恢复是否确认删除</div>
<div class="dialog-active">
<div class="dialog-cancel" @click="closeConfirmDialog">取消</div>
<div class="dialog-confirm" @click="manageDelete">删除</div>
</div>
</div>
</div>
</div>
<div
class="dialog"
@click="closeAddDialog"
v-if="add_dialog_switch"
:class="add_dialog_opacity_class"
>
<div class="mask" @touchmove.prevent></div>
<div class="bottom-fixed" @click.stop>
<div class="add-dialog" :class="add_dialog_height_class">
<div class="dialog-header">课程详情</div>
<div class="input-box">
<icon name="collage" class="input-icon">课程名</icon>
<input type="text" placeholder="课程名*" v-model="name" />
</div>
<div class="input-box">
<icon name="school" class="input-icon">上课地点</icon>
<input type="text" placeholder="上课地点*" v-model="addr" />
</div>
<div class="input-box">
<icon name="cid" class="input-icon">任课教师</icon>
<input type="text" placeholder="任课教师*" v-model="tea" />
</div>
<div class="tip">小贴士课程名十个字以内为宜上课地点七个字以内为宜由于提交后不能修改只能删除请谨慎填写</div>
<div class="sub-title">日期选择</div>
<div class="list-box">
<div
class="list-item"
:class="select_day == index ? 'select' : ''"
v-for="(day, index) in week_day_list"
:key="index"
@click="dateSelect(index)"
>{{day}}</div>
</div>
<div class="sub-title">时间选择</div>
<div class="list-box">
<div
class="list-item"
:class="select_time == index ? 'select' : ''"
v-for="(lesson, index) in lesson_list"
:key="index"
@click="timeSelect(index)"
>{{lesson}}</div>
</div>
<div class="sub-title">星期选择<span @click="clearWeek">全不选</span><span @click="allWeek">全选</span><span @click="oddWeek">单周</span><span @click="evenWeek">双周</span></div>
<div class="list-box week-box">
<div
class="list-item"
:class="select_week[index+1] ? 'select' : ''"
v-for="(week, index) in 22"
:key="index"
@click="weekSelect(index)"
>{{week}}</div>
</div>
<div class="submit" :class="can_submit? 'select' : ''" @click="submit">确认提交</div>
</div>
</div>
</div>
<FooterSpace></FooterSpace>
</div>
</template>
<script>
// @ is an alias to /src
import FooterSpace from "@/components/FooterSpace.vue";
import { mapState, mapActions } from "vuex";
import { interceptTime } from "@/lib/utils.js";
import { manageSchedule } from "@/lib/schedule.js";
import { Loading } from "element-ui";
import { replaceState } from "@/lib/getStore.js";
export default {
name: "schedule",
data() {
return {
//
week_day_list: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
//
lesson_list: ["1-2节", "3-4节", "5-6节", "7-8节", "9-10节", "11-12节"],
//
select_day: null,
//
select_time: null,
//
select_week: null,
//
name: "",
//
tea: "",
//
addr: "",
//
can_submit: false,
// dialog
add_dialog_height_class: "",
// dialog
add_dialog_switch: false,
// dialog
add_dialog_opacity_class: "",
// dialog
confirm_dialog_height_class: "",
// dialog
confirm_dialog_switch: false,
// dialog
confirm_dialog_opacity_class: "",
// id
delete_id_cache: null
};
},
computed: {
...mapState([
"user_info",
"current_page",
"schedule",
"grade",
"personal_class",
"row_lesson_info"
])
},
methods: {
...mapActions([
"setUserInfo",
"setGrade",
"setSchedule",
"setCurrentPage",
"setDrawerState",
"setPersonalClass",
"setRowLessonInfo"
]),
//
init() {
// vuex
replaceState.call(this);
// footerNav
this.setCurrentPage(["None", this]);
console.log(this.$store.state);
//
if (Object.keys(this.user_info).length != 0) {
let now = new Date().getTime(); //
if (
now - this.user_info.login_time < 1000 * 60 * 60 * 24 * 7 &&
this.user_info.login_time > interceptTime
) {
// 7
//
let user_info = this.user_info;
user_info.login_time = new Date().getTime();
this.setUserInfo([user_info, this]);
console.log("用户登录时间刷新完成");
this.initData();
return;
}
}
localStorage.clear();
replaceState.call(this);
console.log("未登录拦截");
this.$router.replace("/login");
},
//
initData() {
this.select_day = null;
this.select_time = null;
this.select_week = new Array(23).fill(0);
this.name = "";
this.tea = "";
this.addr = "";
},
//
open(url) {
window.open(url);
},
//
dateSelect(index) {
this.select_day = index;
this.judge();
},
//
timeSelect(index) {
this.select_time = index;
this.judge();
},
//
weekSelect(index) {
this.select_week[index + 1] = this.select_week[index + 1] == 1 ? 0 : 1;
this.$forceUpdate();
this.judge();
},
//
judge() {
let flag = true;
if (!(this.name = this.name.trim())) {
flag = false;
}
if (!(this.tea = this.tea.trim())) {
flag = false;
}
if (!(this.addr = this.addr.trim())) {
flag = false;
}
if (!this.select_day && this.select_day !== 0) {
flag = false;
}
if (!this.select_time && this.select_time !== 0) {
flag = false;
}
if (this.select_week.indexOf(1) == -1) {
flag = false;
}
this.can_submit = flag;
},
openAddDialog() {
this.add_dialog_switch = true;
this.add_dialog_height_class = "higher-add-dialog";
this.add_dialog_opacity_class = "show-dialog";
this.initData();
},
closeAddDialog() {
this.add_dialog_height_class = "lower-add-dialog";
this.add_dialog_opacity_class = "hide-dialog";
setTimeout(() => {
this.add_dialog_switch = false;
this.initData();
}, 350);
},
openConfirmDialog(id) {
this.confirm_dialog_switch = true;
this.confirm_dialog_height_class = "higher-confirm-dialog";
this.confirm_dialog_opacity_class = "show-dialog";
this.delete_id_cache = id;
this.initData();
},
closeConfirmDialog() {
this.confirm_dialog_height_class = "lower-confirm-dialog";
this.confirm_dialog_opacity_class = "hide-dialog";
this.delete_id_cache = null;
setTimeout(() => {
this.confirm_dialog_switch = false;
this.initData();
}, 200);
},
//
manageDelete() {
let personal_class = this.personal_class
delete personal_class[this.delete_id_cache]
this.setPersonalClass([personal_class, this]);
console.log("自定义课程覆写完成");
//
this.refreshSchedule();
this.closeConfirmDialog();
this.$message.success("删除成功");
this.$forceUpdate();
},
//
submit() {
if(!this.can_submit) return
//
let cache = [];
for (let i in this.select_week) {
if (this.select_week[i]) {
cache.push(i);
}
}
let random =
new Date()
.getTime()
.toString()
.substring(7) + Math.floor(Math.random() * 10).toString();
let data = {
//
Lesson: this.name,
//
Room: this.addr,
//
Teacher: this.tea,
// 123
Time: cache.join(","),
//
color: 9,
//
id: random,
//
Time_split: this.select_week,
//
day_position: this.select_day,
//
lesson_position: this.select_time
};
//
let personal_class = this.personal_class;
if (!personal_class) personal_class = {};
personal_class[random] = data;
this.setPersonalClass([personal_class, this]);
console.log("自定义课程覆写完成");
//
this.refreshSchedule();
this.closeAddDialog();
this.$message.success("添加成功");
this.$forceUpdate();
},
//
refreshSchedule() {
//
let row_lesson_info = JSON.parse(JSON.stringify(this.row_lesson_info));
if (!row_lesson_info) {
//
row_lesson_info = [];
for (let i = 0; i < 7; i++) {
row_lesson_info.push([0, 0, 0, 0, 0, 0]);
}
}
//
for (let key in this.personal_class) {
let lesson = this.personal_class[key];
if (row_lesson_info[lesson.day_position][lesson.lesson_position] != 0) {
row_lesson_info[lesson.day_position][lesson.lesson_position].push(
lesson
);
} else {
row_lesson_info[lesson.day_position][lesson.lesson_position] = [
lesson
];
}
}
//
let schedule = this.schedule;
if (!schedule) {
//
schedule = {
cur_week: 0,
days_per_week: new Array(23).fill(0),
schedule_game: null
};
}
schedule.lesson = manageSchedule(row_lesson_info);
this.setSchedule([schedule, this]);
console.log("显示用课表覆写完成");
},
back() {
this.$router.go(-1);
},
//
oddWeek() {
this.select_week = new Array(23).fill(0)
this.select_week.forEach((item, index, arr)=> {
arr[index] = index % 2
})
this.judge();
},
//
evenWeek() {
this.select_week = new Array(23).fill(0)
this.select_week.forEach((item, index, arr)=> {
arr[index] = index % 2 == 0 ? 1 : 0
})
this.judge();
},
//
clearWeek() {
this.select_week = new Array(23).fill(0)
this.judge();
},
//
allWeek() {
this.select_week = new Array(23).fill(1)
this.judge();
}
},
created() {
this.init();
},
mounted() {},
activated() {},
watch: {
name: function() {
// console.log(this.name);
this.judge();
},
addr: function() {
// console.log(this.addr);
this.judge();
},
tea: function() {
// console.log(this.tea);
this.judge();
}
},
components: {
FooterSpace
}
};
</script>
<style scoped lang="scss" type="text/scss">
@import "../../style/main";
.schedule {
width: 100%;
max-width: 500px;
margin: 0 auto;
background-color: #fbfbfb;
min-height: 100%;
position: relative;
overflow: hidden;
header {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 1.2rem;
z-index: 100;
.w {
height: 1.2rem;
width: 100%;
max-width: 500px;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: center;
// background-image: linear-gradient(to right, #f0da4b, #ff005e);
background-image: $gradualLoginSubmit;
// background: #ffca9f;
color: #fff;
position: relative;
p {
font-size: 0.5rem;
}
.back {
font-size: 0.6rem;
position: absolute;
left: 0.3rem;
}
.plus {
font-size: 0.6rem;
position: absolute;
right: 0.3rem;
}
}
}
}
.lesson {
margin: 0.3rem 0.4rem;
font-size: 0.3rem;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.4rem;
box-sizing: border-box;
background: #fff;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
line-height: 0.6rem;
.delete {
font-size: 0.5rem;
color: $red;
}
}
.empty-box {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-top: 3rem;
.empty {
height: 2rem;
width: 2rem;
}
p {
font-size: .5rem;
margin-top: .3rem;
color: #ff382a;
letter-spacing:3px;
}
}
.add-dialog {
width: 100%;
max-width: 500px;
margin: 0 auto;
height: 14rem;
background: #fff;
border-top-right-radius: 0.4rem;
border-top-left-radius: 0.4rem;
overflow-y: scroll;
padding: 0.4rem;
box-sizing: border-box;
.dialog-header {
text-align: center;
font-size: 0.5rem;
margin-bottom: 0.5rem;
}
.input-box {
display: flex;
align-items: center;
justify-content: flex-start;
margin-bottom: 0.5rem;
input {
padding: 0 0.1rem;
height: 0.7rem;
border: none;
border-bottom: 1px solid #f2f2f2;
color: #202124;
font-size: 0.4rem;
line-height: 0.7rem;
margin-left: 0.3rem;
width: 100%;
}
input:focus {
outline: none;
}
.input-icon {
height: 0.7rem;
width: 0.7rem;
}
}
.tip {
font-size: 0.3rem;
color: #999;
}
.sub-title {
// color: #ff776d;
color: #ff382a;
font-size: 0.35rem;
margin-top: 0.3rem;
span {
float: right;
margin-left: .3rem;
}
}
.list-box {
width: 100%;
margin-top: 0.3rem;
display: flex;
align-items: center;
justify-content: space-between;
.list-item {
font-size: 0.3rem;
height: 0.6rem;
line-height: 0.6rem;
border-radius: 0.2rem;
// background: #ff776d;
// background: #ffb5b8;
// color: #ff776d;
background: #f5f5f5;
color: #bfbfbf;
padding: 0 0.3rem;
}
.select {
// background: #ff776d;
background: #ffe1e2;
color: #ff382a;
}
}
.week-box {
flex-wrap: wrap;
justify-content: flex-start;
.list-item {
margin-right: 0.24rem;
margin-bottom: 0.2rem;
width: 1rem;
text-align: center;
}
}
.submit {
height: 1rem;
line-height: 1rem;
width: 100%;
background: #f5f5f5;
color: #bfbfbf;
margin: 0.2rem auto;
font-size: 0.5rem;
text-align: center;
border-radius: 0.3rem;
}
.select {
background: #ffe1e2;
color: #ff382a;
}
}
.confirm-dialog {
width: 100%;
max-width: 500px;
margin: 0 auto;
height: 5rem;
background: #fff;
border-top-right-radius: 0.4rem;
border-top-left-radius: 0.4rem;
overflow-y: scroll;
padding: 0.4rem;
box-sizing: border-box;
.dialog-header {
text-align: center;
font-size: 0.5rem;
margin-bottom: 0.5rem;
}
.dialog-detail {
text-align: center;
font-size: 0.4rem;
color: #999;
}
.dialog-active {
display: flex;
align-items: center;
justify-content: space-between;
width: 75%;
margin: 0 auto;
margin-top: 1rem;
div {
height: 1rem;
width: 3rem;
font-size: 0.4rem;
text-align: center;
line-height: 1rem;
border-radius: 0.3rem;
}
.dialog-cancel {
background: #f5f5f5;
color: #bfbfbf;
}
.dialog-confirm {
background: #ffe1e2;
color: #ff382a;
}
}
}
.dialog {
position: fixed;
top: 0;
left: 0;
z-index: 101;
height: 100%;
width: 100%;
.mask {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.4);
z-index: 102;
}
.bottom-fixed {
position: absolute;
bottom: 0;
width: 100%;
z-index: 103;
}
}
.higher-add-dialog {
animation: addToHigh 0.5s ease;
animation-fill-mode: forwards;
}
.lower-add-dialog {
animation: addToLow 0.5s ease;
animation-fill-mode: forwards;
}
.higher-confirm-dialog {
animation: confirmToHigh 0.35s ease;
animation-fill-mode: forwards;
}
.lower-confirm-dialog {
animation: confirmToLow 0.35s ease;
animation-fill-mode: forwards;
}
.hide-dialog {
animation: toHide 0.5s ease;
animation-fill-mode: forwards;
}
.show-dialog {
animation: toShow 0.5s ease;
animation-fill-mode: forwards;
}
@keyframes addToHigh {
0% {
height: 0rem;
}
100% {
height: 14rem;
}
}
@keyframes addToLow {
0% {
height: 14rem;
}
100% {
height: 0rem;
}
}
@keyframes confirmToHigh {
0% {
height: 0rem;
}
100% {
height: 5rem;
}
}
@keyframes confirmToLow {
0% {
height: 5rem;
}
100% {
height: 0rem;
}
}
@keyframes toHide {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes toShow {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
</style>

View File

@ -150,6 +150,7 @@ import { mapState, mapActions } from "vuex";
import { rankGet, rankUpload } from "@/axios/api.js";
import { getGameInitData, interceptTime } from "@/lib/utils.js";
import { Loading } from "element-ui";
import { replaceState } from '@/lib/getStore.js'
export default {
name: "schedule",
@ -225,12 +226,7 @@ export default {
init() {
// vuex
this.$store.replaceState(
Object.assign(
this.$store.state,
JSON.parse(localStorage.getItem("cherry"))
)
);
replaceState.call(this)
// footerNav
this.setCurrentPage(["None", this]);
this.getGrade();
@ -248,8 +244,9 @@ export default {
return;
}
}
localStorage.clear();
replaceState.call(this);
console.log("未登录拦截");
this.setUserInfo([{}, this]);
this.$router.replace("/login");
},
//

View File

@ -123,6 +123,7 @@ import { interceptTime } from "@/lib/utils.js";
import { manageSchedule } from "@/lib/schedule.js";
import { Loading } from "element-ui";
import { login } from "@/axios/api.js";
import { replaceState } from "@/lib/getStore.js";
export default {
name: "grade",
@ -136,22 +137,30 @@ export default {
};
},
computed: {
...mapState(["grade", "user_info", "schedule"])
...mapState([
"grade",
"user_info",
"schedule",
"personal_class",
"row_lesson_info"
])
},
methods: {
...mapActions(["setUserInfo", "setGrade", "setSchedule", "setCurrentPage"]),
...mapActions([
"setUserInfo",
"setGrade",
"setSchedule",
"setCurrentPage",
"setRowLessonInfo",
"setPersonalClass"
]),
//
init(lock = false) {
//
if (this.init_lock) return;
this.init_lock = lock;
// vuex
this.$store.replaceState(
Object.assign(
this.$store.state,
JSON.parse(localStorage.getItem("cherry"))
)
);
replaceState.call(this);
// footerNav
this.setCurrentPage(["grade", this]);
//
@ -182,8 +191,9 @@ export default {
return;
}
}
localStorage.clear();
replaceState.call(this);
console.log("未登录拦截");
this.setUserInfo([{}, this]);
this.$router.replace("/login");
},
@ -237,13 +247,14 @@ export default {
user_info.login_time = new Date().getTime();
let grade = data.grade ? data.grade : this.grade;
let schedule = data.schedule ? data.schedule : this.schedule;
if(schedule) {
schedule.lesson = manageSchedule(schedule.lesson)
if (schedule) {
this.setRowLessonInfo([schedule.lesson, this]);
this.setSchedule([schedule, this]);
}
this.refreshSchedule();
// localStorage
this.setUserInfo([user_info, this]);
this.setGrade([grade, this]);
this.setSchedule([schedule, this]);
//
load.close();
this.$message({
@ -251,10 +262,47 @@ export default {
type: "success"
});
},
//
refreshSchedule() {
//
let row_lesson_info = JSON.parse(JSON.stringify(this.row_lesson_info));
if (!row_lesson_info) {
//
row_lesson_info = [];
for (let i = 0; i < 7; i++) {
row_lesson_info.push([0, 0, 0, 0, 0, 0]);
}
}
//
for (let key in this.personal_class) {
let lesson = this.personal_class[key];
if (row_lesson_info[lesson.day_position][lesson.lesson_position] != 0) {
row_lesson_info[lesson.day_position][lesson.lesson_position].push(
lesson
);
} else {
row_lesson_info[lesson.day_position][lesson.lesson_position] = [
lesson
];
}
}
//
let schedule = this.schedule;
if (!schedule) {
//
schedule = {
cur_week: 0,
days_per_week: new Array(23).fill(0),
schedule_game: null
};
}
schedule.lesson = manageSchedule(row_lesson_info);
this.setSchedule([schedule, this]);
console.log("显示用课表覆写完成");
},
//
open(url) {
window.open(url)
window.open(url);
}
},
created() {

View File

@ -1,313 +1,369 @@
<template>
<div class="login">
<div class="title-bg-box">
<div class="title-bg1 title-bg"></div>
<div class="title-bg2 title-bg"></div>
<div class="title-bg3 title-bg"></div>
</div>
<!-- <header><i class="el-icon-back" @click="turnToHome()"></i></header> -->
<div class="logo-box"><img src="../../assets/logo.png" alt class="logo" /></div>
<div class="login-box">
<div class="title">登录</div>
<div class="label">教务账号*</div>
<input type="text" name="cid" v-model.trim="cid" />
<div class="label">教务密码*</div>
<input type="password" name="pwd" v-model.trim="pwd" />
<div class="label">手机号码(非必填仅在登录失败时更新教务)</div>
<input type="password" name="phone" v-model.trim="phone" />
</div>
<div class="submit-box"><div class="submit" @click="submit()">登录</div></div>
<div class="copyRight">
<p>Version&nbsp;3.1</p>
<p>Inspire Studio</p>
<p>&copy;2020 All Rights Reserved.</p>
</div>
<FooterSpace></FooterSpace>
<el-dialog
title="服务器开小差了"
:visible.sync="net_error_dialog"
width="90%">
<span>{{net_error_dialog_content}}</span>
<span slot="footer" class="dialog-footer">
<el-button @click="net_error_dialog = false">狠心拒绝</el-button>
<el-button type="primary" @click="openQQ()">欣然接受</el-button>
</span>
</el-dialog>
</div>
<div class="login">
<div class="title-bg-box">
<div class="title-bg1 title-bg"></div>
<div class="title-bg2 title-bg"></div>
<div class="title-bg3 title-bg"></div>
</div>
<!-- <header><i class="el-icon-back" @click="turnToHome()"></i></header> -->
<div class="logo-box">
<img src="../../assets/logo.png" alt class="logo" />
</div>
<div class="login-box">
<div class="title">登录</div>
<div class="label">教务账号*</div>
<input type="text" name="cid" v-model.trim="cid" />
<div class="label">教务密码*</div>
<input type="password" name="pwd" v-model.trim="pwd" />
<div class="label">手机号码(非必填仅在登录失败时更新教务)</div>
<input type="password" name="phone" v-model.trim="phone" />
</div>
<div class="submit-box">
<div class="submit" @click="submit()">登录</div>
</div>
<div class="copyRight">
<p>版本更新内容新增自定义课表</p>
<p>Version&nbsp;3.1</p>
<p>Inspire Studio</p>
<p>&copy;2020 All Rights Reserved.</p>
</div>
<FooterSpace></FooterSpace>
<el-dialog title="服务器开小差了" :visible.sync="net_error_dialog" width="90%">
<span>{{net_error_dialog_content}}</span>
<span slot="footer" class="dialog-footer">
<el-button @click="net_error_dialog = false">狠心拒绝</el-button>
<el-button type="primary" @click="openQQ()">欣然接受</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
// @ is an alias to /src
import { mapState, mapActions } from 'vuex';
import { login } from '@/axios/api.js';
import { Loading } from 'element-ui';
import FooterSpace from '@/components/FooterSpace.vue';
import { encryptMainCode } from '@/lib/aes.js'
import { mapState, mapActions } from "vuex";
import { login } from "@/axios/api.js";
import { Loading } from "element-ui";
import FooterSpace from "@/components/FooterSpace.vue";
import { encryptMainCode } from "@/lib/aes.js";
import { manageSchedule } from "@/lib/schedule.js";
import { replaceState } from "@/lib/getStore.js";
export default {
name: 'login',
data() {
return {
cid: '',
pwd: '',
phone: '',
errmsg: '',
net_error_dialog: false,
net_error_dialog_content: ''
};
},
computed: {
...mapState(['grade', 'schedule'])
},
methods: {
...mapActions(['setUserInfo', 'setGrade', 'setSchedule', 'setCurrentPage']),
//
init() {
// vuex
this.$store.replaceState(Object.assign(this.$store.state,JSON.parse(localStorage.getItem("cherry"))));
// footerNav
this.setCurrentPage(["None", this]);
},
name: "login",
data() {
return {
cid: "",
pwd: "",
phone: "",
errmsg: "",
net_error_dialog: false,
net_error_dialog_content: ""
};
},
computed: {
...mapState(["grade", "schedule", "personal_class", "row_lesson_info"])
},
methods: {
...mapActions([
"setUserInfo",
"setGrade",
"setSchedule",
"setCurrentPage",
"setRowLessonInfo",
"setPersonalClass"
]),
//
init() {
// vuex
replaceState.call(this);
// footerNav
this.setCurrentPage(["None", this]);
},
// rushB
submit() {
if (this.cid && this.pwd) {
//
let load = Loading.service({
background: 'rgba(236,245,255,.7)',
target: document.querySelector('.login')
});
let data = {
cid: this.cid,
pwd: this.pwd,
phone: this.phone
};
login(data)
.then(res => {
// console.log(res)
this.manageRes(res.data, load);
})
.catch(error => {
console.log(error);
load.close();
if (error.code === 'ECONNABORTED' && error.message.indexOf('timeout') !== -1) {
//
this.net_error_dialog_content = '可能登陆人数过多,再试试吧,实在不行再加群问问。肥肠感谢!!!'
// dialog
this.net_error_dialog = true
return
}
if (error.response && error.response.status != 500) {
this.$message.error(`${error.response.status}: ${error.response.data}`);
} else {
this.$message.error("网络错误,请稍候重试");
}
});
} else {
//
this.$message.error('请输入完整的账号密码');
}
},
// rushB
submit() {
if (this.cid && this.pwd) {
//
let load = Loading.service({
background: "rgba(236,245,255,.7)",
target: document.querySelector(".login")
});
let data = {
cid: this.cid,
pwd: this.pwd,
phone: this.phone
};
login(data)
.then(res => {
// console.log(res)
this.manageRes(res.data, load);
})
.catch(error => {
console.log(error);
load.close();
if (
error.code === "ECONNABORTED" &&
error.message.indexOf("timeout") !== -1
) {
//
this.net_error_dialog_content =
"可能登陆人数过多,再试试吧,实在不行再加群问问。肥肠感谢!!!";
// dialog
this.net_error_dialog = true;
return;
}
if (error.response && error.response.status != 500) {
this.$message.error(
`${error.response.status}: ${error.response.data}`
);
} else {
this.$message.error("网络错误,请稍候重试");
}
});
} else {
//
this.$message.error("请输入完整的账号密码");
}
},
//
manageRes(data, load) {
//
let user_info = {
login_time: new Date().getTime(),
id: data.student_id,
name: data.student_name,
cid: this.cid,
pwd: encryptMainCode(this.pwd)
};
let grade = data.grade ? data.grade : this.grade
let schedule = data.schedule ? data.schedule : this.schedule
if(schedule) {
schedule.lesson = manageSchedule(schedule.lesson)
}
// localStorage
this.setUserInfo([user_info, this]);
this.setGrade([grade, this]);
this.setSchedule([schedule, this]);
//
load.close();
this.$message({
message: '信息获取成功',
type: 'success'
});
//
this.turnToHome();
},
//
turnToHome() {
this.$router.replace({path: '/', query: {from_login: true}});
},
//
manageRes(data, load) {
//
let user_info = {
login_time: new Date().getTime(),
id: data.student_id,
name: data.student_name,
cid: this.cid,
pwd: encryptMainCode(this.pwd)
};
let grade = data.grade ? data.grade : this.grade;
let schedule = data.schedule ? data.schedule : this.schedule;
if (schedule) {
this.setRowLessonInfo([schedule.lesson, this]);
this.setSchedule([schedule, this]);
}
this.refreshSchedule();
// localStorage
this.setUserInfo([user_info, this]);
this.setGrade([grade, this]);
//
load.close();
this.$message({
message: "信息获取成功",
type: "success"
});
//
this.turnToHome();
},
// qq
openQQ() {
window.open('https://jq.qq.com/?_wv=1027&k=5Jeoz9R');
}
},
created() {
this.init();
},
mounted() {},
activated() {},
components: {
FooterSpace
}
//
refreshSchedule() {
//
let row_lesson_info = JSON.parse(JSON.stringify(this.row_lesson_info));
if (!row_lesson_info) {
//
row_lesson_info = [];
for (let i = 0; i < 7; i++) {
row_lesson_info.push([0, 0, 0, 0, 0, 0]);
}
}
//
for (let key in this.personal_class) {
let lesson = this.personal_class[key];
if (row_lesson_info[lesson.day_position][lesson.lesson_position] != 0) {
row_lesson_info[lesson.day_position][lesson.lesson_position].push(
lesson
);
} else {
row_lesson_info[lesson.day_position][lesson.lesson_position] = [
lesson
];
}
}
//
let schedule = this.schedule;
if (!schedule) {
//
schedule = {
cur_week: 0,
days_per_week: new Array(23).fill(0),
schedule_game: null
};
}
schedule.lesson = manageSchedule(row_lesson_info);
this.setSchedule([schedule, this]);
console.log("显示用课表覆写完成");
},
//
turnToHome() {
this.$router.replace({ path: "/", query: { from_login: true } });
},
// qq
openQQ() {
window.open("https://jq.qq.com/?_wv=1027&k=5Jeoz9R");
}
},
created() {
this.init();
},
mounted() {},
activated() {},
components: {
FooterSpace
}
};
</script>
<style scoped lang="scss" type="text/scss">
@import '../../style/main';
@import "../../style/main";
.login {
width: 100%;
max-width: 500px;
margin: 0 auto;
background-color: #fefefe;
min-height: 100%;
position: relative;
overflow: hidden;
.title-bg-box {
position: absolute;
width: 120%;
transform: rotate(-30deg);
top: -2rem;
left: -3.2rem;
.title-bg {
width: 90%;
height: 6rem;
// background-image: linear-gradient(to bottom right, #17e7d7, #5d73e2);
background-image: $gradualLoginTitle;
border-radius: 1rem;
position: absolute;
}
.title-bg1 {
top: 0;
left: 0;
}
.title-bg2 {
top: 2rem;
left: 0rem;
// box-shadow: -.2rem 0 5px #a1dbe4;
// box-shadow: -0.2rem 0 5px #dde3a1;
}
.title-bg3 {
top: 3rem;
left: 1rem;
}
}
header {
width: 85%;
margin: 0 auto;
height: 1rem;
margin-top: 0.5rem;
color: #fff;
font-size: 0.8rem;
display: flex;
align-items: center;
position: relative;
z-index: 3;
}
.logo-box {
width: 2.7rem;
height: 2.7rem;
overflow: hidden;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.1);
margin: 0 auto;
margin-top: 2rem;
position: relative;
z-index: 1;
img {
width: 2.5rem;
height: 2.5rem;
border-radius: 50%;
}
}
.login-box {
width: 85%;
height: 9rem;
background: #fff;
margin: 0 auto;
margin-top: -1rem;
border-radius: 0.2rem;
padding: 0.6rem;
box-sizing: border-box;
display: flex;
flex-direction: column;
box-shadow: 0 5px 15px #e5e5e5;
position: relative;
.title {
color: #333;
font-size: 0.6rem;
font-weight: 600;
margin-top: 0.6rem;
}
.label {
font-size: 0.3rem;
margin: 0.5rem 0 0.3rem 0rem;
color: #909399;
}
input {
font-size: 0.4rem;
padding: 0.1rem;
border: none;
border-bottom: 2px #eee solid;
width: 100%;
box-sizing: border-box;
}
}
.submit-box {
height: 1.2rem;
width: 85%;
margin: 0.5rem auto;
position: relative;
.submit {
float: right;
height: 1.2rem;
width: 4rem;
// background-image: linear-gradient(to right, #1be5d2, #5e75e5);
background-image: $gradualLoginSubmit;
border-radius: 0.1rem;
font-size: 0.4rem;
color: #fff;
line-height: 1.2rem;
text-align: center;
position: relative;
z-index: 1;
}
.submit::before {
content: '';
display: block;
background: inherit;
filter: blur(0.1rem);
position: absolute;
width: 100%;
height: 100%;
top: 0.1rem;
left: 0.1rem;
opacity: 0.4;
transform-origin: 0 0;
border-radius: inherit;
transform: scale(1, 1);
z-index: -1;
}
}
.copyRight {
width: 100%;
display: flex;
align-items: center;
flex-direction: column;
margin-top: 1.5rem;
p {
font-size: 0.3rem;
color: #909399;
}
}
width: 100%;
max-width: 500px;
margin: 0 auto;
background-color: #fefefe;
min-height: 100%;
position: relative;
overflow: hidden;
.title-bg-box {
position: absolute;
width: 120%;
transform: rotate(-30deg);
top: -2rem;
left: -3.2rem;
.title-bg {
width: 90%;
height: 6rem;
// background-image: linear-gradient(to bottom right, #17e7d7, #5d73e2);
background-image: $gradualLoginTitle;
border-radius: 1rem;
position: absolute;
}
.title-bg1 {
top: 0;
left: 0;
}
.title-bg2 {
top: 2rem;
left: 0rem;
// box-shadow: -.2rem 0 5px #a1dbe4;
// box-shadow: -0.2rem 0 5px #dde3a1;
}
.title-bg3 {
top: 3rem;
left: 1rem;
}
}
header {
width: 85%;
margin: 0 auto;
height: 1rem;
margin-top: 0.5rem;
color: #fff;
font-size: 0.8rem;
display: flex;
align-items: center;
position: relative;
z-index: 3;
}
.logo-box {
width: 2.7rem;
height: 2.7rem;
overflow: hidden;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.1);
margin: 0 auto;
margin-top: 2rem;
position: relative;
z-index: 1;
img {
width: 2.5rem;
height: 2.5rem;
border-radius: 50%;
}
}
.login-box {
width: 85%;
height: 9rem;
background: #fff;
margin: 0 auto;
margin-top: -1rem;
border-radius: 0.2rem;
padding: 0.6rem;
box-sizing: border-box;
display: flex;
flex-direction: column;
box-shadow: 0 5px 15px #e5e5e5;
position: relative;
.title {
color: #333;
font-size: 0.6rem;
font-weight: 600;
margin-top: 0.6rem;
}
.label {
font-size: 0.3rem;
margin: 0.5rem 0 0.3rem 0rem;
color: #909399;
}
input {
font-size: 0.4rem;
padding: 0.1rem;
border: none;
border-bottom: 2px #eee solid;
width: 100%;
box-sizing: border-box;
}
}
.submit-box {
height: 1.2rem;
width: 85%;
margin: 0.5rem auto;
position: relative;
.submit {
float: right;
height: 1.2rem;
width: 4rem;
// background-image: linear-gradient(to right, #1be5d2, #5e75e5);
background-image: $gradualLoginSubmit;
border-radius: 0.1rem;
font-size: 0.4rem;
color: #fff;
line-height: 1.2rem;
text-align: center;
position: relative;
z-index: 1;
}
.submit::before {
content: "";
display: block;
background: inherit;
filter: blur(0.1rem);
position: absolute;
width: 100%;
height: 100%;
top: 0.1rem;
left: 0.1rem;
opacity: 0.4;
transform-origin: 0 0;
border-radius: inherit;
transform: scale(1, 1);
z-index: -1;
}
}
.copyRight {
width: 100%;
display: flex;
align-items: center;
flex-direction: column;
margin-top: 1.5rem;
p {
font-size: 0.3rem;
color: #909399;
}
}
}
</style>

View File

@ -4,7 +4,7 @@
<img src="../../assets/logo_nobg.png" alt="logo" />
<p>
Cherry
<span>v3.0</span>
<span>v3.1</span>
</p>
<div class="auth">By:Inspire Studio</div>
<!-- <img src="../assets/wave.gif" mode="scaleToFill" class="gif-wave"/> -->
@ -25,6 +25,13 @@
</div>
</div>
</div>
<div class="functions-box">
<div class="item" @click="goTo('/addclass')">
<i class="el-icon-paperclip first-function-icon"></i>
<p>自定义课程</p>
<i class="el-icon-arrow-right arrow-right"></i>
</div>
</div>
<div class="logout" @click="logout()" v-if="Object.keys(this.user_info).length != 0">退出登录</div>
<div class="logout" @click="goTo('/login')" v-else>立即登录</div>
<div class="qq">
@ -50,7 +57,7 @@
import FooterSpace from "@/components/FooterSpace.vue";
import { mapState, mapActions } from "vuex";
import { loginInterceptor } from "@/lib/utils.js";
import { replaceState } from '@/lib/getStore.js'
export default {
name: "myaccount",
data() {
@ -65,12 +72,7 @@ export default {
...mapActions(["setCurrentPage", "setGrade", "setSchedule", "setUserInfo"]),
init() {
// vuex
this.$store.replaceState(
Object.assign(
this.$store.state,
JSON.parse(localStorage.getItem("cherry"))
)
);
replaceState.call(this)
this.setCurrentPage(["myaccount", this]);
},
//
@ -139,17 +141,19 @@ export default {
}
p {
font-size: 0.5rem;
font-weight: 300;
span {
font-size: 0.4rem;
font-weight: 100;
font-weight: 700;
}
}
.auth {
font-size: 0.5rem;
margin-top: 0.3rem;
font-weight: 100;
font-weight: 300;
}
}
.user-box {
height: 2rem;
color: $grey;
@ -193,6 +197,32 @@ export default {
border-left: 1px #eee solid;
}
}
.functions-box {
width: 80%;
margin: .5rem auto;
background: #fff;
border-radius: .2rem;
color: #999;
.item {
display: flex;
position: relative;
align-items: center;
height: 1rem;
.first-function-icon {
font-size:.5rem;
margin-left: .3rem;
}
p {
font-size: .35rem;
margin-left: .3rem;
}
.arrow-right {
position: absolute;
right: .3rem;
font-size: .5rem;
}
}
}
.logout {
background-image: $gradualGreen;
color: #fff;

View File

@ -92,6 +92,10 @@
任课教师
<span>{{detail.Teacher}}</span>
</p>
<p>
自定义课程
<span>{{detail.color == 9 ? '是' : '否'}}</span>
</p>
<div class="more-box" v-for="(lesson, index) in detail.hide" :key="index">
<div class="line"></div>
<p>
@ -110,6 +114,10 @@
任课教师
<span>{{lesson.Teacher}}</span>
</p>
<p>
自定义课程
<span>{{lesson.color == 9 ? '是' : '否'}}</span>
</p>
</div>
</div>
</div>
@ -140,7 +148,7 @@ import { interceptTime } from "@/lib/utils.js";
import { manageSchedule } from "@/lib/schedule.js";
import { Loading } from "element-ui";
import { login } from "@/axios/api.js";
import { replaceState } from "@/lib/getStore.js";
export default {
name: "schedule",
data() {
@ -168,7 +176,8 @@ export default {
"ebd4ef",
"f9d7ea",
"ede1d9",
"48f350"
"fadbd9",
"e7ebee"
],
//
font_color: [
@ -181,7 +190,8 @@ export default {
"9c26b0",
"e03997",
"a5673f",
"48f350"
"e54d42",
"8799a3"
],
//
init_lock: false,
@ -190,7 +200,14 @@ export default {
};
},
computed: {
...mapState(["user_info", "current_page", "schedule", "grade"]),
...mapState([
"user_info",
"current_page",
"schedule",
"grade",
"personal_class",
"row_lesson_info"
]),
//
highlightWeek: function() {
if (this.show_week == this.current_week) {
@ -207,7 +224,9 @@ export default {
"setGrade",
"setSchedule",
"setCurrentPage",
"setDrawerState"
"setDrawerState",
"setRowLessonInfo",
"setPersonalClass"
]),
//
@ -219,12 +238,7 @@ export default {
lock = true;
}
// vuex
this.$store.replaceState(
Object.assign(
this.$store.state,
JSON.parse(localStorage.getItem("cherry"))
)
);
replaceState.call(this);
// footerNav
this.setCurrentPage(["schedule", this]);
//
@ -255,8 +269,9 @@ export default {
return;
}
}
localStorage.clear();
replaceState.call(this);
console.log("未登录拦截");
this.setUserInfo([{}, this]);
this.$router.replace("/login");
},
@ -382,12 +397,13 @@ export default {
let grade = data.grade ? data.grade : this.grade;
let schedule = data.schedule ? data.schedule : this.schedule;
if (schedule) {
schedule.lesson = manageSchedule(schedule.lesson);
this.setRowLessonInfo([schedule.lesson, this]);
this.setSchedule([schedule, this]);
}
this.refreshSchedule();
// localStorage
this.setUserInfo([user_info, this]);
this.setGrade([grade, this]);
this.setSchedule([schedule, this]);
//
load.close();
this.$message({
@ -395,6 +411,44 @@ export default {
type: "success"
});
},
//
refreshSchedule() {
//
let row_lesson_info = JSON.parse(JSON.stringify(this.row_lesson_info));
if (!row_lesson_info) {
//
row_lesson_info = [];
for (let i = 0; i < 7; i++) {
row_lesson_info.push([0, 0, 0, 0, 0, 0]);
}
}
//
for (let key in this.personal_class) {
let lesson = this.personal_class[key];
if (row_lesson_info[lesson.day_position][lesson.lesson_position] != 0) {
row_lesson_info[lesson.day_position][lesson.lesson_position].push(
lesson
);
} else {
row_lesson_info[lesson.day_position][lesson.lesson_position] = [
lesson
];
}
}
//
let schedule = this.schedule;
if (!schedule) {
//
schedule = {
cur_week: 0,
days_per_week: new Array(23).fill(0),
schedule_game: null
};
}
schedule.lesson = manageSchedule(row_lesson_info);
this.setSchedule([schedule, this]);
console.log("显示用课表覆写完成");
},
//
open(url) {
window.open(url);