wolyshaw 4 years ago
parent
commit
5e2902e2d0
2 changed files with 49 additions and 10 deletions
  1. 46 7
      src/views/teamDetail/components/modals/classroom-setting-item.vue
  2. 3 3
      vue.config.js

+ 46 - 7
src/views/teamDetail/components/modals/classroom-setting-item.vue

@@ -365,16 +365,23 @@ export default {
       return num
     },
     updateEndTime(row) {
-      if (row.dayOfWeek && row.startDate && typeof row.holiday === 'boolean') {
-          const num = this.addData(row.startDate, row.dayOfWeek)
-          const exp = Math.max(row.expectCourseNum - 1, 0)
-          let end = dayjs(row.startDate).add(num + (exp*7), 'day')
+        if (row.dayOfWeek && row.startDate && typeof row.holiday === 'boolean') {
+          // const num = this.addData(row.startDate, row.dayOfWeek)
+          // const week = dayjs(row.startDate).get('day') == 0 ? 7 : dayjs(row.startDate).get('day')
+          const selectWeek = row.dayOfWeek == 7 ? 0 : row.dayOfWeek
+          let exp = Math.max(row.expectCourseNum - 1, 0)
+          let end = dayjs(row.startDate)
+          console.log(selectWeek, end.get('day'))
           if (row.holiday) {
-            for (const d of this.holidays) {
-              if (dayjs(d).isBetween(row.startDate, end.format('YYYY-MM-DD'), null, '[]')) {
-                end = end.add(1, 'day')
+            while (exp > 0) {
+              console.log(selectWeek, dayjs(row.startDate).get('day'), end.get('day'), !this.holidays.includes(end.format('YYYY-MM-DD')))
+              if (selectWeek == end.get('day') && !this.holidays.includes(end.format('YYYY-MM-DD'))) {
+                exp--
               }
+              end = end.add(1, 'day')
             }
+          } else {
+            end = dayjs(row.startDate).add((exp*7), 'day')
           }
           const enumd = this.addData(end.format('YYYY-MM-DD'), row.dayOfWeek)
           end = end.add(enumd, 'day')
@@ -390,6 +397,38 @@ export default {
           ''
         );
       }
+
+
+
+
+
+      // if (row.dayOfWeek && row.startDate && typeof row.holiday === 'boolean') {
+      //     // const num = this.addData(row.startDate, row.dayOfWeek)
+      //     const week = dayjs(row.startDate).get('day') == 0 ? 7 : dayjs(row.startDate).get('day')
+      //     const selectWeek = row.dayOfWeek
+      //     const exp = Math.max(row.expectCourseNum - (selectWeek >= week ? 1 : 0), 0)
+      //     let end = dayjs(row.startDate).add((exp*7), 'day')
+      //     if (row.holiday) {
+      //       for (const d of this.holidays) {
+      //         if (dayjs(d).isBetween(row.startDate, end.format('YYYY-MM-DD'), null, '[]') && row.dayOfWeek - 1 == dayjs(d).get('day')) {
+      //           end = end.add(7, 'day')
+      //         }
+      //       }
+      //     }
+      //     const enumd = this.addData(end.format('YYYY-MM-DD'), row.dayOfWeek)
+      //     end = end.add(enumd, 'day')
+      //     this.$set(
+      //     row,
+      //     "endDate",
+      //     end.format('YYYY-MM-DD')
+      //   );
+      // } else {
+      //   this.$set(
+      //     row,
+      //     "endDate",
+      //     ''
+      //   );
+      // }
     },
     changeStartDate(val, row) {
       this.updateEndTime(row)

+ 3 - 3
vue.config.js

@@ -16,11 +16,11 @@ const name = defaultSettings.title || '管乐迷后台管理系统' // page titl
 // const port = process.env.port || process.env.npm_config_port || 9528 // dev port
 // http://47.99.212.176:8000
 // //  https://online.dayaedu.com
-// let target = 'https://online.dayaedu.com' //线上
+let target = 'https://online.dayaedu.com' //线上
 // let target = 'http://192.168.3.139:8000' // 箭河
 // let target = 'http://192.168.3.38:8000' //邹璇
 // let target = 'http://192.168.3.57:8000' //勇哥
-let target = 'http://dev.dayaedu.com' // 测试服
+// let target = 'http://dev.dayaedu.com' // 测试服
 // let target = 'http://47.114.176.40:8000' //开发环境
 // let target = 'http://192.168.3.134' // 乔
 // All configuration item explanations can be find in https://cli.vuejs.org/config/
@@ -64,7 +64,7 @@ module.exports = {
       // http://192.168.3.134
       // http://47.114.176.40:8000
       '/api-auth': {
-        target: 'http://dev.dayaedu.com',
+        target: 'https://online.dayaedu.com',
         changeOrigin: true,
         pathRewrite: {
           '^api-auth': ''