瀏覽代碼

添加了 格式化日期,任务看板

dusenyao 4 年之前
父節點
當前提交
d20e903252
共有 9 個文件被更改,包括 132 次插入45 次删除
  1. 1 3
      .eslintrc.js
  2. 7 4
      src/api/table.js
  3. 3 3
      src/api/user.js
  4. 1 0
      src/layouts/index.vue
  5. 11 0
      src/utils/index.js
  6. 9 0
      src/utils/request.js
  7. 60 14
      src/views/teacher/main/TaskKanban.vue
  8. 24 20
      src/views/teacher/main/index.vue
  9. 16 1
      vue.config.js

+ 1 - 3
.eslintrc.js

@@ -149,9 +149,7 @@ module.exports = {
     'accessor-pairs': 0,
     'block-scoped-var': 0,
     'brace-style': [1, '1tbs'],
-    camelcase: {
-      properties: 'never'
-    },
+    camelcase: 0,
     'comma-dangle': [2, 'never'],
     'comma-spacing': 0,
     'comma-style': [2, 'last'],

+ 7 - 4
src/api/table.js

@@ -2,11 +2,14 @@ import request from '@/utils/request';
 
 export function getMyCsItemsDateTeacher(Parameter) {
   return request({
-    url: '/GCLSLearnWebSI/ServiceInterface',
+    url: '/api/ServiceInterface',
     method: 'post',
-    data: {
-      MethodName: 'eaching-cs_item_manager-GetMyCSItems_Date_Teacher',
-      Parameter: Parameter
+    params: {
+      MethodName: 'teaching-cs_item_manager-GetMyCSItems_Date_Teacher',
+      Parameter: Parameter,
+      UserCode: 'GCLS_SYS_LEARN_SERVER_USER',
+      UserType: 'TEACHER',
+      SessionID: 'GCLS_SYS_LEARN_SERVER'
     }
   });
 }

+ 3 - 3
src/api/user.js

@@ -1,9 +1,9 @@
 import request from '@/utils/request';
 
-export function login(data) {
+export function login(params) {
   return request({
-    url: '',
+    url: '/api/ServiceInterface',
     method: 'post',
-    data
+    params
   });
 }

+ 1 - 0
src/layouts/index.vue

@@ -33,6 +33,7 @@ export default {
   overflow: hidden;
   padding-top: $header-h;
   .app-main {
+    height: 100%;
     min-height: calc(100vh - #{$header-h});
     width: 100%;
     position: relative;

+ 11 - 0
src/utils/index.js

@@ -0,0 +1,11 @@
+/**
+ * 格式化 Date
+ * @param {Date} date
+ * @returns {String} yyyy-mm-dd
+ */
+export function formatDate(date) {
+  if (arguments.length <= 0 || !date) {
+    return null;
+  }
+  return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
+}

+ 9 - 0
src/utils/request.js

@@ -28,6 +28,15 @@ service.interceptors.response.use(
       return Promise.reject(new Error(res.message || 'Error'));
     }
 
+    // 返回数据失败
+    if (res.Status === 0) {
+      Message({
+        message: res.Error,
+        type: 'error',
+        duration: 3 * 1000
+      });
+      return Promise.reject(new Error(res.Error || 'Error'));
+    }
     return res;
   },
   error => {

+ 60 - 14
src/views/teacher/main/TaskKanban.vue

@@ -28,34 +28,60 @@
         </div>
       </div>
     </div>
-    <div class="right-container"></div>
+    <!-- 任务看板 -->
+    <div class="right-container">
+      <div
+        v-for="item in CSItemList"
+        class="cs-item"
+        :key="item.ID"
+        :style="{
+          'background-color':
+            item.Finish_Status === 0 ? '#E7F8E1' : item.Finish_Status === 1 ? '#FFFBD8' : '#F7DFDF'
+        }"
+      >
+        <el-row class="task-date">
+          <el-col :span="20">{{ item.Date_Stamp }}&nbsp;{{ item.Minute_Space }}</el-col>
+          <el-col :span="4" :style="{ 'text-align': 'right' }"
+            >任务{{
+              item.Finish_Status === 0 ? '未开始' : item.Finish_Status === 1 ? '已开始' : '已结束'
+            }}</el-col
+          >
+        </el-row>
+        <el-row class="task-name">
+          <el-col :span="24">{{ item.Name }}</el-col>
+        </el-row>
+        <el-row class="task-class-name">
+          <el-col :span="24">{{ item.Class_Name }}</el-col>
+        </el-row>
+      </div>
+    </div>
   </div>
 </template>
 
 <script>
 import { getMyCsItemsDateTeacher } from '@/api/table';
+import { formatDate } from '@/utils';
 
 export default {
   name: 'Taskkanban',
   data() {
     return {
-      date: new Date()
+      date: new Date(),
+      CSItemList: null
     };
   },
-  // created: {
-  //   getMyCSItem() {
-  //     getMyCsItemsDateTeacher({ Date_Stamp: this.date }).then(response => {
-  //       console.log(response.data);
-  //     });
-  //   }
-  // },
+  mounted() {
+    getMyCsItemsDateTeacher({ Date_Stamp: formatDate(this.date) }).then(response => {
+      console.log(response.CSItem_List);
+      this.CSItemList = response.CSItem_List;
+    });
+  },
   computed: {
     dateTime: {
       get: function () {
         return this.date;
       },
       set: function (newValue) {
-        // console.log(newValue.getTime());
         this.date = newValue;
       }
     }
@@ -90,17 +116,19 @@ export default {
 }
 
 $left-item-h: 322px;
+$right-w: 661px;
 
 .task-kanban {
   height: 100%;
   overflow: hidden;
+  padding: 40px 0 0 18vw;
+  display: flex;
   .left-container {
-    width: 37.5vw;
+    width: 341px;
     height: 100%;
-    display: inline-block;
     .panel {
       height: 100%;
-      padding: 8% 19px 175px 218px;
+      padding-right: 19px;
       .avatar {
         width: $left-item-h;
       }
@@ -131,8 +159,26 @@ $left-item-h: 322px;
       height: 122px;
     }
   }
+
   .right-container {
-    width: 72.5vw;
+    width: $right-w + 20px;
+    min-width: $right-w + 20px;
+    padding-right: 20px;
+    overflow-y: auto;
+    // 99px 是 顶部导航菜单高度 + 5px 底部距离
+    height: calc(100vh - #{$header-h} - 99px);
+    .cs-item {
+      margin-top: 24px;
+      width: $right-w;
+      height: 122px;
+      padding: 15px 30px;
+      .task-name {
+        padding: 20px 0;
+      }
+      .task-class-name {
+        color: #a4a4a4;
+      }
+    }
   }
 }
 </style>

+ 24 - 20
src/views/teacher/main/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div class="main-container">
     <div class="nav-menu">
       <span
         v-for="item in menu"
@@ -51,26 +51,30 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-.nav-menu {
-  width: 100%;
-  margin-top: 31px;
-  display: flex;
-  justify-content: center;
-  text-align: center;
+.main-container {
+  height: 100%;
 
-  .tab-menu {
-    display: inline-block;
-    width: 70px;
-    cursor: pointer;
-    padding-bottom: 4px;
-    &:first-child {
-      margin-right: 20px;
-    }
-    &:not(:first-child) {
-      margin-left: 20px;
-    }
-    &.active {
-      border-bottom: 1px solid black;
+  .nav-menu {
+    width: 100%;
+    margin-top: 31px;
+    display: flex;
+    justify-content: center;
+    text-align: center;
+
+    .tab-menu {
+      display: inline-block;
+      width: 70px;
+      cursor: pointer;
+      padding-bottom: 4px;
+      &:first-child {
+        margin-right: 20px;
+      }
+      &:not(:first-child) {
+        margin-left: 20px;
+      }
+      &.active {
+        border-bottom: 1px solid black;
+      }
     }
   }
 }

+ 16 - 1
vue.config.js

@@ -11,6 +11,20 @@ const NODE_ENV = process.env.NODE_ENV;
 
 const port = process.env.port || process.env.npm_config_port || 7878;
 
+let proxy = {};
+
+if (NODE_ENV === 'development') {
+  proxy = {
+    '/api': {
+      target: 'http://localhost:20088/GCLSLearnWebSI/',
+      changeOrigin: true,
+      pathRewrite: {
+        '^/api': ''
+      }
+    }
+  };
+}
+
 // 配置项说明 https://cli.vuejs.org/config/
 module.exports = {
   publicPath: NODE_ENV === 'development' ? '/' : './',
@@ -25,7 +39,8 @@ module.exports = {
     overlay: {
       warnings: false,
       errors: true
-    }
+    },
+    proxy: proxy
   },
   css: {
     loaderOptions: {