瀏覽代碼

更新修改样式

lex 2 年之前
父節點
當前提交
4207d96d4c

+ 1 - 0
src/school/approval-manage/course-adjust.tsx

@@ -241,6 +241,7 @@ export default defineComponent({
               list={state.calendarList}
               nextMonth={(date: Date) => getList(date)}
               prevMonth={(date: Date) => getList(date)}
+              toDayMonth={(date: Date) => getList(date)}
               onSelect={(date: any) => {
                 state.showPopoverTime = false
                 forms.classDate = dayjs(date).format('YYYY-MM-DD')

+ 29 - 6
src/school/orchestra/compontent/information.tsx

@@ -205,19 +205,23 @@ export default defineComponent({
     }
 
     onMounted(async () => {
-      const sysStartTime = dayjs(dayjs().year() + startTime.value).format('YYYY-MM-DD HH:mm:ss')
-      const sysEndTime = dayjs(dayjs().year() + endTime.value).format('YYYY-MM-DD HH:mm:ss')
+      const sysStartTime = dayjs(dayjs().year() + startTime.value).format('YYYY-MM-DD')
+      const sysEndTime = dayjs(dayjs().year() + endTime.value).format('YYYY-MM-DD')
       const nowTime = dayjs().format('YYYY-MM-DD')
-      const before = dayjs(nowTime).isSameOrBefore(dayjs(sysStartTime))
-      const after = dayjs(nowTime).isSameOrBefore(dayjs(sysEndTime))
+      console.log(nowTime, sysStartTime)
+      const before = dayjs(nowTime).isBefore(dayjs(sysStartTime))
+      const after = dayjs(nowTime).isBefore(dayjs(sysEndTime))
       const year = dayjs().year()
-      if (before) {
+      if (before && after) {
         state.currentData = [year - 1 + '']
         state.params.startTime = dayjs(year - 1 + startTime.value).format('YYYY-MM-DD HH:mm:ss')
         state.params.endTime = dayjs(dayjs().year() + endTime.value)
           .subtract(1, 'day')
           .format('YYYY-MM-DD HH:mm:ss')
-      } else if (after) {
+        // 上学期
+      }
+
+      if (!before && !after) {
         state.params.startTime = dayjs(dayjs().year() + startTime.value).format(
           'YYYY-MM-DD HH:mm:ss'
         )
@@ -225,6 +229,25 @@ export default defineComponent({
           .add(1, 'year')
           .subtract(1, 'day')
           .format('YYYY-MM-DD HH:mm:ss')
+        // 下一年的上学期
+      }
+
+      if (before && !after) {
+        state.params.startTime = dayjs(year + endTime.value).format('YYYY-MM-DD HH:mm:ss')
+        state.params.endTime = dayjs(year + startTime.value)
+          .subtract(1, 'day')
+          .format('YYYY-MM-DD HH:mm:ss')
+
+        // 下学期
+        state.actionTerm.forEach((item: any) => {
+          if (item.value === 'down') {
+            item.color = 'var(--van-primary-color)'
+            state.actionText = item.text
+            state.actionType = item.value
+          } else {
+            item.color = ''
+          }
+        })
       }
 
       await getDetails()

+ 24 - 2
src/school/orchestra/compontent/plan.tsx

@@ -156,13 +156,16 @@ export default defineComponent({
       const before = dayjs(nowTime).isSameOrBefore(dayjs(sysStartTime))
       const after = dayjs(nowTime).isSameOrBefore(dayjs(sysEndTime))
       const year = dayjs().year()
-      if (before) {
+      if (before && after) {
         state.currentData = [year - 1 + '']
         state.params.startTime = dayjs(year - 1 + startTime.value).format('YYYY-MM-DD HH:mm:ss')
         state.params.endTime = dayjs(dayjs().year() + endTime.value)
           .subtract(1, 'day')
           .format('YYYY-MM-DD HH:mm:ss')
-      } else if (after) {
+        // 上学期
+      }
+
+      if (!before && !after) {
         state.params.startTime = dayjs(dayjs().year() + startTime.value).format(
           'YYYY-MM-DD HH:mm:ss'
         )
@@ -170,6 +173,25 @@ export default defineComponent({
           .add(1, 'year')
           .subtract(1, 'day')
           .format('YYYY-MM-DD HH:mm:ss')
+        // 下一年的上学期
+      }
+
+      if (before && !after) {
+        state.params.startTime = dayjs(year + endTime.value).format('YYYY-MM-DD HH:mm:ss')
+        state.params.endTime = dayjs(year + startTime.value)
+          .subtract(1, 'day')
+          .format('YYYY-MM-DD HH:mm:ss')
+
+        // 下学期
+        state.actionTerm.forEach((item: any) => {
+          if (item.value === 'down') {
+            item.color = 'var(--van-primary-color)'
+            state.actionText = item.text
+            state.actionType = item.value
+          } else {
+            item.color = ''
+          }
+        })
       }
 
       await getList()

+ 1 - 0
src/school/train-planning/component/standard/index.tsx

@@ -284,6 +284,7 @@ export default defineComponent({
             list={forms.calendarList}
             nextMonth={(date: Date) => getList(date)}
             prevMonth={(date: Date) => getList(date)}
+            toDayMonth={(date: Date) => getList(date)}
             onSelect={(date: any) => {
               forms.calendarStatus = false
 

二進制
src/school/train-planning/images/icon-right-top-arrow.png


二進制
src/school/train-planning/images/icon-today.png


+ 21 - 1
src/school/train-planning/modal/calendar/index.module.less

@@ -21,7 +21,10 @@
 
     .right {
       transform: rotateZ(180deg);
-      margin-right: 16px;
+      // margin-right: 16px;
+    }
+    .today {
+      margin: 0 16px;
     }
 
     .disabled {
@@ -114,5 +117,22 @@
       display: inline-block !important;
       background-color: #ffd7a6;
     }
+
+    // 今天的角标
+    .today::before {
+      position: absolute;
+      top: 50%;
+      right: 0;
+      bottom: 0;
+      left: 50%;
+      width: 1.06667rem;
+      height: 1.44rem;
+      content: ' ';
+      transform: translate(-50%, -50%);
+      border-radius: 0.10667rem;
+      z-index: 1;
+      background: url('../../images/icon-right-top-arrow.png') no-repeat top left;
+      background-size: 12px;
+    }
   }
 }

+ 20 - 1
src/school/train-planning/modal/calendar/index.tsx

@@ -4,6 +4,7 @@ import dayjs from 'dayjs'
 import styles from './index.module.less'
 import IconArrow from '../../images/icon_arrow.png'
 import IconArrowDefault from '../../images/icon_arrow_default.png'
+import IconToday from '../../images/icon-today.png'
 import isToday from 'dayjs/plugin/isToday'
 import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'
 import OHeader from '@/components/o-header'
@@ -47,6 +48,13 @@ export default defineComponent({
       default: (date: Date) => {}
     },
     /**
+     * 当月,暂无限制
+     */
+    toDayMonth: {
+      type: Function,
+      default: (date: Date) => {}
+    },
+    /**
      * 日期选择结束时触发
      */
     selectDay: {
@@ -114,6 +122,7 @@ export default defineComponent({
           isActive = true
         }
       })
+
       // 判断是否有课程 并且 时间在当前时间之后
       // console.log(dayjs().isSameOrBefore(dayjs(date.date)), date.date)
       if (isActive && dayjs(dayjs().format('YYYY-MM-DD')).isSameOrBefore(dayjs(date.date))) {
@@ -126,6 +135,10 @@ export default defineComponent({
       } else {
         date.type = 'disabled'
       }
+
+      if (dateStr === dayjs().format('YYYY-MM-DD')) {
+        date.className = 'today'
+      }
       return date
     },
     onPrevMonth() {
@@ -138,11 +151,16 @@ export default defineComponent({
       // console.log(dayjs(this.minDate).format('YYYY-MM-DD HH:mm:ss'), 'this.minDate')
       this.prevMonth && this.prevMonth(this.minDate)
     },
+    // 今天
+    onToday() {
+      const tempDate = dayjs()
+      this._monthChange(tempDate)
+      this.toDayMonth && this.toDayMonth(this.minDate)
+    },
     onNextMonth() {
       // 下一月
       const tempDate = dayjs(this.currentDate).add(1, 'month')
       this._monthChange(tempDate)
-      // this._dayChange(this.minDate)
       this.nextMonth && this.nextMonth(this.minDate)
     },
     _monthChange(date: any) {
@@ -202,6 +220,7 @@ export default defineComponent({
                     class={[styles.right]}
                     onClick={this.onPrevMonth}
                   />
+                  <Icon name={IconToday} size={22} class={styles.today} onClick={this.onToday} />
                   <Icon name={IconArrow} size={22} onClick={this.onNextMonth} />
                 </div>
               </div>

+ 21 - 5
src/views/unit-test/model/keep-look-question/index.tsx

@@ -52,6 +52,7 @@ export default defineComponent({
     const state = reactive({
       answerDomId: 'answer' + +new Date(),
       answerRect: {} as any,
+      dpr: 1,
       sortable: null as any,
       list: [] as any,
       options: [] as any,
@@ -268,7 +269,14 @@ export default defineComponent({
     const renderDrawLine = (canvasRef: any) => {
       // 重新画线
       if (canvasRef.getContext) {
+        // console.log(canvasRef.offsetWidth, canvasRef.offsetHeight)
+
+        // 直接用 scale 放大整个坐标系,相对来说就是放大了每个绘制操作
         const ctx = canvasRef.getContext('2d')
+        // ctx.scale(dpr, dpr)
+        // ctx.scale(dpr, dpr)
+        // canvasRef.width = canvasRef.offsetWidth
+        // canvasRef.height = canvasRef.offsetHeight
         ctx.clearRect(0, 0, state.answerRect.width, state.answerRect.height)
         state.drawLineList.forEach((item: any) => {
           drawLine(ctx, item.startPoint, item.endPoint)
@@ -285,10 +293,11 @@ export default defineComponent({
      */
     const drawLine = (ctx: any, startPoint: any, endPoint: any) => {
       ctx.beginPath()
-      ctx.moveTo(startPoint.x, startPoint.y)
-      ctx.lineTo(endPoint.x, endPoint.y)
-      ctx.lineWidth = 2
+      ctx.moveTo(Math.floor(startPoint.x) * state.dpr, Math.floor(startPoint.y) * state.dpr)
+      ctx.lineTo(Math.floor(endPoint.x) * state.dpr, Math.floor(endPoint.y) * state.dpr)
+      ctx.lineWidth = 2 * state.dpr
       ctx.strokeStyle = '#FF8057'
+
       ctx.stroke()
     }
 
@@ -386,6 +395,9 @@ export default defineComponent({
         const answer: any = document.getElementById(state.answerDomId)
         const answerRect = useRect(answer)
         state.answerRect = answerRect
+
+        const dpr = window.devicePixelRatio
+        state.dpr = dpr
       })
     })
 
@@ -410,8 +422,12 @@ export default defineComponent({
             <canvas
               ref={canvasRef}
               class={styles.canvasSection}
-              width={state.answerRect.width || 0}
-              height={state.answerRect.height || 0}
+              width={state.answerRect.width * state.dpr || 0}
+              height={state.answerRect.height * state.dpr || 0}
+              style={{
+                width: (state.answerRect.width || 0) + 'px',
+                height: (state.answerRect.height || 0) + 'px'
+              }}
             ></canvas>
             {state.options.map((item: any) => (
               <div class={styles.answerItem}>

+ 5 - 0
src/views/unit-test/practice-mode/index.tsx

@@ -600,6 +600,11 @@ export default defineComponent({
         <ODialog
           message={state.dialogMessage}
           v-model:show={state.dialogStatus}
+          showCancelButton
+          cancelButtonText="返回"
+          onCancel={() => {
+            router.back()
+          }}
           confirmButtonText="立即开通"
           onConfirm={() => {
             router.push('/memberCenter')