mo 1 anno fa
parent
commit
6696e7278a
1 ha cambiato i file con 34 aggiunte e 3 eliminazioni
  1. 34 3
      src/views/classList/components/classStudent.tsx

+ 34 - 3
src/views/classList/components/classStudent.tsx

@@ -7,7 +7,8 @@ import {
   NFormItem,
   NImage,
   NSelect,
-  NSpace
+  NSpace,
+  useMessage
 } from 'naive-ui';
 import SearchInput from '@/components/searchInput';
 import CSelect from '@/components/CSelect';
@@ -29,6 +30,7 @@ export default defineComponent({
       },
       tableList: [] as any
     });
+    const message =useMessage()
     const route = useRoute();
     const router = useRouter();
     const search = () => {
@@ -62,6 +64,17 @@ export default defineComponent({
     onMounted(() => {
       getList();
     });
+
+    const copyTo = (text: string) => {
+      const input = document.createElement('input');
+      input.value = text;
+      document.body.appendChild(input);
+      input.select();
+      input.setSelectionRange(0, input.value.length);
+      document.execCommand('Copy');
+      document.body.removeChild(input);
+      message.success('复制成功');
+    };
     const gotoDetail = (row: any) => {
       router.push({
         path: '/classStudentDetail',
@@ -72,11 +85,29 @@ export default defineComponent({
       return [
         {
           title: '学生姓名',
-          key: 'nickname'
+          key: 'nickname',
+          render: (row: any) => {
+            return (
+              <div
+                style={{ userSelect: 'all', cursor: 'pointer' }}
+                onClick={() => copyTo(row.nickname)}>
+                {row.nickname}
+              </div>
+            );
+          }
         },
         {
           title: '手机号',
-          key: 'phone'
+          key: 'phone',
+          render: (row: any) => {
+            return (
+              <div
+                style={{ userSelect: 'all', cursor: 'pointer' }}
+                onClick={() => copyTo(row.phone)}>
+                {row.phone}
+              </div>
+            );
+          }
         },
         {
           title: '性别',