Browse Source

学校通知、作业发布

zhuth 6 years ago
parent
commit
7c890b270f

+ 10 - 6
frontend/pc-web/app/view/Interaction/homework/List.js

@@ -33,7 +33,7 @@ Ext.define('school.view.interaction.homework.List', {
                 fieldLabel: '发布状态',
                 displayField: 'name',
                 valueField: 'value',
-                editable: false,
+                editable: true,
                 store: Ext.create('Ext.data.ArrayStore', {
                     fields: ['name', 'value'],
                     data: [
@@ -45,7 +45,7 @@ Ext.define('school.view.interaction.homework.List', {
                 queryMode: 'local'
             }, {
                 xtype: 'condatefield',
-                name: 'start_date',
+                name: 'publish_date',
                 fieldLabel: '发布时间',
                 columnWidth: 0.5
             }],
@@ -116,10 +116,10 @@ Ext.define('school.view.interaction.homework.List', {
                     hidden: true
                 }, {
                     text: '年级',
-                    dataIndex: 'nj'
+                    dataIndex: 'grade_name'
                 }, {
                     text: '班级',
-                    dataIndex: 'bj'
+                    dataIndex: 'classz_name'
                 }, {
                     text: '标题',
                     dataIndex: 'task_title',
@@ -143,10 +143,14 @@ Ext.define('school.view.interaction.homework.List', {
                     width: 150
                 }, {
                     text: '发布状态',
-                    dataIndex: 'zt'
+                    dataIndex: 'task_status',
+                    width: 120,
+                    renderer: function(v) {
+                        return !!v ? (v == 2 ? '未发布' : '已发布') : '未发布'
+                    }
                 }, {
                     text: '发布时间',
-                    dataIndex: 'start_date',
+                    dataIndex: 'publish_date',
                     width: 120
                 }, ]
             },

+ 24 - 30
frontend/pc-web/app/view/Interaction/homework/Release.js

@@ -31,21 +31,11 @@ Ext.define('school.view.interaction.homework.Release', {
                 columnWidth: 0.5
             }, {
                 xtype: 'textfield',
-                name: 'njid',
-                fieldLabel: '年级id',
-                hidden: true
-            }, {
-                xtype: 'textfield',
-                name: 'nj',
+                name: 'grade_name',
                 fieldLabel: '年级'
             }, {
                 xtype: 'textfield',
-                name: 'bjid',
-                fieldLabel: '班级id',
-                hidden: true
-            }, {
-                xtype: 'textfield',
-                name: 'bj',
+                name: 'classz_name',
                 fieldLabel: '班级'
             }, {
                 xtype: 'datefield',
@@ -63,6 +53,27 @@ Ext.define('school.view.interaction.homework.Release', {
                 name: "task_title",
                 fieldLabel: "标题",
                 columnWidth: 1
+            }, {
+                xtype: 'combobox',
+                name: 'task_status',
+                fieldLabel: '发布状态',
+                displayField: 'name',
+                valueField: 'value',
+                editable: false,
+                readOnly: true,
+                defaultValue: 2,
+                store: Ext.create('Ext.data.ArrayStore', {
+                    fields: ['name', 'value'],
+                    data: [['未发布', 2], ['已发布', 1]]
+                }),
+                minChars: 0,
+                queryMode: 'local'
+            }, {
+                xtype: 'datefield',
+                name: 'publish_date',
+                fieldLabel: '发布时间',
+                readOnly: true,
+                format: 'Y-m-d H:i:s'
             }, {
                 xtype: "textareafield",
                 name: 'task_context',
@@ -80,24 +91,7 @@ Ext.define('school.view.interaction.homework.Release', {
                 bind: {
                     hidden: '{!task_id}'
                 },
-                handler: function() {
-                    let id = me.getViewModel().data.task_id;
-                    me.setLoading(true);
-                    school.util.BaseUtil.request({
-                        url: '/api/school/homework/publish/' + id,
-                        method: 'POST'
-                    })
-                    .then(function() {
-                        me.setLoading(false);
-                        school.util.BaseUtil.showSuccessToast('发布成功');
-                        me.getViewModel().set('notify_status', 1);
-                        me.clearDirty();
-                    })
-                    .catch(function(e) {
-                        me.setLoading(false);
-                        school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
-                    });
-                }
+                handler: 'onPublish'
             }]
         });
         this.callParent();

+ 22 - 0
frontend/pc-web/app/view/Interaction/homework/ReleaseController.js

@@ -18,4 +18,26 @@ Ext.define('school.view.interaction.homework.ReleaseController', {
             school.util.BaseUtil.refreshTabTitle(newId, newTitle);
         });
     },
+
+    onPublish: function() {
+        let me = this,
+        view = me.getView(),
+        viewModel = me.getViewModel(),
+        id = viewModel.data.task_id;
+        view.setLoading(true);
+        school.util.BaseUtil.request({
+            url: '/api/school/homework/publish/' + id,
+            method: 'POST'
+        })
+        .then(function() {
+            view.setLoading(false);
+            school.util.BaseUtil.showSuccessToast('发布成功');
+            viewModel.set('task_status', 1);
+            me.refresh();
+        })
+        .catch(function(e) {
+            view.setLoading(false);
+            school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
+        });
+    }
 });

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

@@ -29,7 +29,7 @@ Ext.define('school.view.interaction.notice.List', {
                 fieldLabel: '发布状态',
                 displayField: 'name',
                 valueField: 'value',
-                editable: false,
+                editable: true,
                 store: Ext.create('Ext.data.ArrayStore', {
                     fields: ['name', 'value'],
                     data: [['已发布', 1], ['未发布', 2]]
@@ -38,7 +38,7 @@ Ext.define('school.view.interaction.notice.List', {
                 queryMode: 'local'
             }, {
                 xtype: 'condatefield',
-                name: 'create_date',
+                name: 'publish_date',
                 fieldLabel: '发布时间',
                 columnWidth: 0.5
             }],
@@ -140,7 +140,7 @@ Ext.define('school.view.interaction.notice.List', {
                     xtype: 'datecolumn',
                     formate: 'Y-m-d H:i:s',
                     text: '发布时间',
-                    dataIndex: 'create_date',
+                    dataIndex: 'publish_date',
                     width: 120
                 }]
             },

+ 4 - 21
frontend/pc-web/app/view/Interaction/notice/SchoolNotice.js

@@ -46,10 +46,10 @@ Ext.define('school.view.interaction.notice.SchoolNotice', {
                 queryMode: 'local'
             }, {
                 xtype: 'datefield',
-                name: 'create_date',
+                name: 'publish_date',
                 fieldLabel: '发布时间',
-                columnWidth: 0.5,
-                formatter: 'Y-m-d H:i:s'
+                readOnly: true,
+                format: 'Y-m-d H:i:s'
             }, {
                 xtype: "textfield",
                 name: "notify_title",
@@ -72,24 +72,7 @@ Ext.define('school.view.interaction.notice.SchoolNotice', {
                 bind: {
                     hidden: '{!notify_id}'
                 },
-                handler: function() {
-                    let id = me.getViewModel().data.notify_id;
-                    me.setLoading(true);
-                    school.util.BaseUtil.request({
-                        url: '/api/school/notice/publish/' + id,
-                        method: 'POST'
-                    })
-                    .then(function() {
-                        me.setLoading(false);
-                        school.util.BaseUtil.showSuccessToast('发布成功');
-                        me.getViewModel().set('notify_status', 1);
-                        me.clearDirty();
-                    })
-                    .catch(function(e) {
-                        me.setLoading(false);
-                        school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
-                    });
-                }
+                handler: 'onPublish'
             }]
         });
         this.callParent();

+ 22 - 0
frontend/pc-web/app/view/Interaction/notice/SchoolNoticeController.js

@@ -18,4 +18,26 @@ Ext.define('school.view.interaction.notice.SchoolNoticeController', {
             school.util.BaseUtil.refreshTabTitle(newId, newTitle);
         });
     },
+
+    onPublish: function() {
+        let me = this,
+        view = me.getView(),
+        viewModel = me.getViewModel(),
+        id = viewModel.data.notify_id;
+        view.setLoading(true);
+        school.util.BaseUtil.request({
+            url: '/api/school/notice/publish/' + id,
+            method: 'POST'
+        })
+        .then(function() {
+            view.setLoading(false);
+            school.util.BaseUtil.showSuccessToast('发布成功');
+            viewModel.set('notify_status', 1);
+            me.refresh();
+        })
+        .catch(function(e) {
+            view.setLoading(false);
+            school.util.BaseUtil.showErrorToast('发布失败: ' + e.message);
+        });
+    }
 });