소스 검색

提交哦

1
mo 1 년 전
부모
커밋
a0a29385a5

+ 6 - 0
src/components/TheTooltip/index.module.less

@@ -0,0 +1,6 @@
+.showContentWidth {
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  // display: inline-block;
+}

+ 75 - 0
src/components/TheTooltip/index.tsx

@@ -0,0 +1,75 @@
+import { NTooltip } from 'naive-ui'
+import { defineComponent, PropType } from 'vue'
+import styles from './index.module.less'
+
+export default defineComponent({
+  name: 'the-tooltip',
+  props: {
+    maxWidth: {
+      type: Number,
+      default: 300
+    },
+    showContentWidth: {
+      type: Number,
+      default: 120
+    },
+    tipsContent: {
+      type: String,
+      default: ''
+    },
+    content: {
+      type: String,
+      default: ''
+    },
+    placement: {
+      type: String as PropType<
+        | 'top-start'
+        | 'top'
+        | 'top-end'
+        | 'right-start'
+        | 'right'
+        | 'right-end'
+        | 'bottom-start'
+        | 'bottom'
+        | 'bottom-end'
+        | 'left-start'
+        | 'left'
+        | 'left-end'
+      >,
+      default: 'top'
+    },
+    showArrow: {
+      type: Boolean,
+      default: true
+    },
+    trigger: {
+      type: String as PropType<'hover' | 'click'>,
+      default: 'hover'
+    }
+  },
+  setup(props) {
+    return () => (
+      <>
+        <NTooltip
+          style={{ maxWidth: props.maxWidth + 'px' }}
+          trigger={props.trigger}
+          placement={props.placement}
+          showArrow={props.showArrow}
+          delay={500}
+        >
+          {{
+            trigger: () => (
+              <p
+                style={{ maxWidth: props.showContentWidth + 'px' }}
+                class={styles.showContentWidth}
+              >
+                {props.content}
+              </p>
+            ),
+            default: () => props.tipsContent || props.content
+          }}
+        </NTooltip>
+      </>
+    )
+  }
+})

+ 2 - 1
src/views/classList/index.tsx

@@ -26,6 +26,7 @@ import ClassGuide from '@/custom-plugins/guide-page/class-guide';
 import { useRouter } from 'vue-router';
 import { rowDark } from 'naive-ui/es/legacy-grid/styles';
 import TheEmpty from '/src/components/TheEmpty';
+import TheTooltip from '/src/components/TheTooltip';
 export default defineComponent({
   name: 'class-classList',
   setup(props, { emit }) {
@@ -120,7 +121,7 @@ export default defineComponent({
           title: '上次学习',
           key: 'lastStudy',
           render(row: any) {
-            return <p>{row.lastStudy ? row.lastStudy : '--'}</p>;
+            return <TheTooltip content={row.lastStudy ? row.lastStudy : '--'} />;
           }
         },
         {

+ 2 - 2
src/views/setting/index.tsx

@@ -32,11 +32,11 @@ export default defineComponent({
           <NTabPane name="person" tab="个人信息">
             <PersonInfo></PersonInfo>
           </NTabPane>
-          {/* {user.info.isSuperAdmin && ( */}
+         {user.info.isSuperAdmin && (
           <NTabPane name="school" tab="学校设置">
             <SchoolInfo />
           </NTabPane>
-          {/* )} */}
+          )}
         </NTabs>
       </div>
     );

+ 1 - 1
src/views/studentList/components/studentAfterWork.tsx

@@ -156,7 +156,7 @@ export default defineComponent({
             return (
               <div>
                 {row.trainingStatus == 'UNSUBMITTED' ? (
-                  <p class={styles.nosub}>未提交</p>
+                  <p class={styles.nosub} style={{color:'#aaa'}}>未提交</p>
                 ) : null}
                 {row.trainingStatus == 'SUBMITTED' ? (
                   <p style={{color:'#EA4132'}} class={styles.ison}>不合格</p>