|
@@ -30,9 +30,11 @@
|
|
|
<script>
|
|
|
import NavBar from '@/layout/common/topInfo.vue';
|
|
|
import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
|
|
|
+var moment = require('moment');
|
|
|
const { mapActions: lesson } = createNamespacedHelpers('lesson');
|
|
|
const { mapActions: trainplan } = createNamespacedHelpers('trainplan');
|
|
|
const { mapActions: classes } = createNamespacedHelpers('classes');
|
|
|
+const { mapActions: setting } = createNamespacedHelpers('setting');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
@@ -59,15 +61,28 @@ export default {
|
|
|
...lesson({ lessionInfo: 'fetch', lessionlist: 'query' }),
|
|
|
...trainplan(['query']),
|
|
|
...classes({ classQuery: 'query' }),
|
|
|
+ ...setting({ settingFetch: 'fetch' }),
|
|
|
async search() {
|
|
|
- const planList = await this.query();
|
|
|
- this.$set(this, `planList`, planList.data);
|
|
|
+ const setting = await this.settingFetch();
|
|
|
+ if (setting.data.planid) {
|
|
|
+ this.toClass(setting.data.planid);
|
|
|
+ } else {
|
|
|
+ const planList = await this.query();
|
|
|
+ this.$set(this, `planList`, planList.data);
|
|
|
+ }
|
|
|
},
|
|
|
async toClass(planid) {
|
|
|
// index:计划id
|
|
|
this.display = false;
|
|
|
this.$set(this, `planId`, planid);
|
|
|
const classList = await this.classQuery({ planid: planid, headteacherid: this.user.userid });
|
|
|
+ const today = moment().format('YYYY-MM-DD');
|
|
|
+ for (const classes of classList.data) {
|
|
|
+ const isclass = moment(today).isBetween(classes.startdate, classes.enddate, null, '[]');
|
|
|
+ if (isclass) {
|
|
|
+ this.classBtn(classes.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
this.$set(this, `classList`, classList.data);
|
|
|
},
|
|
|
classBtn(index) {
|