Browse Source

优化学期计算逻辑/优化课表名称默认值写入逻辑

zhuth 6 years ago
parent
commit
8eff302dc7

+ 11 - 3
frontend/pc-web/app/view/Interaction/timetable/Detail.js

@@ -133,9 +133,17 @@ Ext.define('school.view.interaction.timetable.Detail', {
                     data: [['第一学期'], ['第二学期']]
                 }),
                 defaultValue: (function() {
-                    let now = new Date();
-                    let month = now.getMonth() + 1;
-                    return (month < 9) ? '第一学期' : '第二学期'
+                    let now = new Date(),
+                    month = now.getMonth() + 1,
+                    date = now.getDate(),
+                    term;
+
+                    if((month > 2 && month < 8) || (month == 2 && date > 15) || (month == 8 && date < 15)) {
+                        term = '第二学期';
+                    }else {
+                        term = '第一学期'
+                    }
+                    return term;
                 })()
             }, {
                 xtype: "textfield",

+ 2 - 2
frontend/pc-web/app/view/Interaction/timetable/DetailModel.js

@@ -11,8 +11,8 @@ Ext.define('school.view.interaction.timetable.DetailModel', {
             text;
 
             if(!!gradeName && !!clazzName && !!termPart && !!termName) {
-                text =  gradeName + clazzName + termPart.split('-')[0].substring(2, 4) + '年' + termName + '课表';
-                this.set('name', text);
+                text =  gradeName + clazzName + termPart.split('-')[0] + '年' + termName + '课表';
+                // this.set('name', text);
             }else if(!gradeName) {
                 text = '请选择年级';
             }else if(!clazzName) {

+ 11 - 3
frontend/pc-web/app/view/Interaction/timetable/List.js

@@ -96,9 +96,17 @@ Ext.define('school.view.interaction.timetable.List', {
                     data: [['第一学期'], ['第二学期']]
                 }),
                 value: (function() {
-                    let now = new Date();
-                    let month = now.getMonth() + 1;
-                    return (month < 9) ? '第一学期' : '第二学期'
+                    let now = new Date(),
+                    month = now.getMonth() + 1,
+                    date = now.getDate(),
+                    term;
+
+                    if((month > 2 && month < 8) || (month == 2 && date > 15) || (month == 8 && date < 15)) {
+                        term = '第二学期';
+                    }else {
+                        term = '第一学期'
+                    }
+                    return term;
                 })()
             }, {
                 xtype: 'combobox',