47 1 month ago
parent
commit
80af957717

+ 1 - 1
src/views/Home/Index.vue

@@ -191,7 +191,7 @@
                     暂无预测记录
                   </div> -->
                 </vue3ScrollSeamless>
-                <div v-if="list2.length == 0" style="width: 100%; height: 100px; display: flex; justify-content: center; align-items: center; margin-top: -230px;">
+                <div v-if="list.length == 0" style="width: 100%; height: 100px; display: flex; justify-content: center; align-items: center; margin-top: -230px;">
                   <el-empty description="暂无数据"/>
                 </div>
               </div>

+ 3 - 4
src/views/system/Home/Index.vue

@@ -18,7 +18,6 @@
                   <div class="flex items-center h-75px ">
                     <!-- <Icon :icon="item.icon" :size="25" class="mr-8px" /> -->
                     <Icon :icon="item.icon" :size="38" class="mr-8px " />
-    
                     <span class="text-17px c-white">{{ item.name }}</span>
                   </div>
                   <div class="mb-18px text-32px c-white ml-20px text-center">{{ t(item.message) }}</div>
@@ -306,19 +305,19 @@ const getProject = async () => {
     {
       name: '学院工作间数量',
       icon: 'svg-icon:gzs',
-      message: String(detail.deptNum) + '个',
+      message: String(detail.deptNum || 0) + '个',
       time: new Date()
     },
     {
       name: '导师数量',
       icon: 'svg-icon:ds',
-      message: String(detail.teacherNum) + '人',
+      message: String(detail.teacherNum || 0) + '人',
       time: new Date()
     },
     {
       name: '在校生数量',
       icon: 'svg-icon:zxs',
-      message: String(detail.studentNum) + '人',
+      message: String(detail.studentNum || 0) + '人',
       time: new Date()
     }
   

+ 2 - 2
src/views/system/studentSelf/SForm.vue

@@ -105,7 +105,7 @@ const formData = ref({
   nickname: '',
   password: '',
   sex: undefined,
-  // remark: '',
+  remark: '',
   userType: undefined,
   userNumber: '',
   dept: undefined,
@@ -202,7 +202,7 @@ const resetForm = () => {
     nickname: '',
     password: '',
     sex: undefined,
-    // remark: '',
+    remark: '',
     userType: undefined,
     userNumber: '',
     dept: undefined,

+ 9 - 9
src/views/system/studentSelf/index.vue

@@ -50,12 +50,12 @@
           </div>
 
         </ul>
-        <div class="info-description">
+        <div class="info-remark">
           <div style="display: flex; align-items: center;">
             <Icon icon="ep:picture" />
             <div class="div-label" style="margin-left: 8px;">简介:</div>
           </div>
-          <div class="description-content">{{ cleanedDescription }}</div>
+          <div class="remark-content">{{ cleanedremark }}</div>
           <div class="image-container">
             <div v-for="(url, index) in extractedImageUrls" :key="index" class="image-item">
               <img :src="url" />
@@ -129,7 +129,7 @@ const fetchImageUrls = async () => {
   try {
     loading.value = true; // 开始加载
     const res = await getUserProfile();
-    const urls = res.description.match(/<img.*?src="(.*?)"/g);
+    const urls = res.remark.match(/<img.*?src="(.*?)"/g);
     if (urls) {
       extractedImageUrls.value = urls.map(url => {
         const match = url.match(/src="(.*?)"/);
@@ -145,8 +145,8 @@ const fetchImageUrls = async () => {
   }
 };
 // 创建一个 computed 属性来处理并去掉 <p> 标签
-  const cleanedDescription = computed(() => {
-  return userInfo.value.description ? userInfo.value.description.replace(/<\/?[^>]+(>|$)/g, '') : '';
+  const cleanedremark = computed(() => {
+  return userInfo.value.remark ? userInfo.value.remark.replace(/<\/?[^>]+(>|$)/g, '') : '';
 });
 
 
@@ -177,7 +177,7 @@ const fetchImageUrls = async () => {
     //   form.email = res.email;
     //   form.name = res.name;
     //   form.leaderUserId = res.user.id;
-    //   form.description = res.description;
+    //   form.remark = res.remark;
     //   userInfo.value = res.user; 
     // };
 
@@ -200,7 +200,7 @@ const fetchImageUrls = async () => {
       openDialog,
       handleSuccess,
       extractedImageUrls,
-      cleanedDescription,
+      cleanedremark,
       userTypeMapping,
     };
   }
@@ -244,7 +244,7 @@ const fetchImageUrls = async () => {
   border-bottom: 1px solid #e7eaec; 
 }
 
-.info-description {
+.info-remark {
   margin-top: 30px; /* 与上面的信息分隔 */
   margin-left: 5%; /* 左侧与上面列表保持一致 */
   margin-right: 5%; /* 右侧与上面列表保持一致 */
@@ -264,7 +264,7 @@ const fetchImageUrls = async () => {
   
 }
 
-.description-content {
+.remark-content {
   white-space: pre-wrap; /* 保持换行 */
   overflow-wrap: break-word; /* 自动断行 */
   margin-right: 5%;

+ 1 - 1
src/views/system/workroomCollege/deptInfo/student.vue

@@ -16,7 +16,7 @@
             :show-overflow-tooltip="true"
           />
           <el-table-column label="年级" align="center" prop="grade" />
-          <el-table-column label="学号" align="center" prop="userNumber" />
+          <el-table-column label="学号" align="center" prop="userNumber" width="150"/>
           <el-table-column label="专业" align="center" prop="major" />
           <el-table-column label="导师姓名" align="center" prop="supervisor"/>
           <el-table-column

+ 21 - 3
src/views/system/workroomTeacher/TeacherSelf/TForm.vue

@@ -105,7 +105,7 @@ const formData = ref({
   nickname: '',
   password: '',
   sex: undefined,
-  // remark: '',
+  remark: '',
   userType: undefined,
   userNumber: '',
   dept: undefined,
@@ -155,6 +155,7 @@ const open = async (id?: number) => {
       console.log(data,'打开弹窗数据');
       formData.value = {
         ...data,
+        remark: data.remark || '',
         deptId: data.dept.id, 
         dept: data.dept.name
       }
@@ -173,6 +174,7 @@ const open = async (id?: number) => {
 }
 defineExpose({ open }) // 提供 open 方法,用于打开弹窗
 
+const imageUrls = ref<string[]>([]);
 /** 提交表单 */
 const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
 const submitForm = async () => {
@@ -184,7 +186,12 @@ const submitForm = async () => {
   // 提交请求
   formLoading.value = true
   try {
-    const data = formData.value as unknown as UserProfileUpdateReqVO
+    const content = formData.value.remark; // 获取富文本内容
+    imageUrls.value = extractImages(content);
+    const data = {
+      ...formData.value,
+      remark: content,
+    } as unknown as UserProfileUpdateReqVO
       await updateUserProfile(data)
     dialogVisible.value = false
     // 发送操作成功的事件
@@ -194,6 +201,17 @@ const submitForm = async () => {
   }
 }
 
+const extractImages = (htmlContent: string): string[] => {
+  const imgRegex = /<img[^>]+src="([^">]+)"/g;
+  let images: string[] = [];  // 明确声明 images 数组的类型为 string[]
+  let match;
+  while ((match = imgRegex.exec(htmlContent)) !== null) {
+    images.push(match[1]); // match[1] 是图片URL
+  }
+  return images;
+};
+
+
 /** 重置表单 */
 const resetForm = () => {
   formData.value = {
@@ -202,7 +220,7 @@ const resetForm = () => {
     nickname: '',
     password: '',
     sex: undefined,
-    // remark: '',
+    remark: '',
     userType: undefined,
     userNumber: '',
     dept: undefined,

+ 24 - 11
src/views/system/workroomTeacher/TeacherSelf/index.vue

@@ -50,12 +50,12 @@
           </div>
 
         </ul>
-        <div class="info-description">
+        <div class="info-remark">
           <div style="display: flex; align-items: center;">
             <Icon icon="ep:picture" />
             <div class="div-label" style="margin-left: 8px;">简介:</div>
           </div>
-          <div class="description-content">{{ cleanedDescription }}</div>
+          <div class="remark-content">{{ cleanedremark }}</div>
           <div class="image-container">
             <div v-for="(url, index) in extractedImageUrls" :key="index" class="image-item">
               <img :src="url" />
@@ -94,6 +94,19 @@ export default defineComponent({
     const loading = ref(true) // 列表的加载中
     const formRef = ref();
 
+    const form = reactive({
+      mobile: '',
+      email: '',
+      nickname: '',
+      password: '',
+      sex: undefined,
+      remark: '',
+      userType: undefined,
+      userNumber: '',
+      dept: undefined,
+      deptId: undefined,
+    });
+
     // 将 userInfo 定义放入 setup 中
 const userInfo = ref({} as ProfileVO)
 const getUserInfo = async () => {
@@ -129,7 +142,7 @@ const fetchImageUrls = async () => {
   try {
     loading.value = true; // 开始加载
     const res = await getUserProfile();
-    const urls = res.description.match(/<img.*?src="(.*?)"/g);
+    const urls = res.remark.match(/<img.*?src="(.*?)"/g);
     if (urls) {
       extractedImageUrls.value = urls.map(url => {
         const match = url.match(/src="(.*?)"/);
@@ -145,12 +158,12 @@ const fetchImageUrls = async () => {
   }
 };
 // 创建一个 computed 属性来处理并去掉 <p> 标签
-  const cleanedDescription = computed(() => {
-  return userInfo.value.description ? userInfo.value.description.replace(/<\/?[^>]+(>|$)/g, '') : '';
+  const cleanedremark = computed(() => {
+  return userInfo.value.remark ? userInfo.value.remark.replace(/<\/?[^>]+(>|$)/g, '') : '';
 });
 
 
-    // 表单提交
+    // // 表单提交
     // const submit = async () => {
     //   try {
     //     await formRef.value?.validate();
@@ -166,7 +179,7 @@ const fetchImageUrls = async () => {
     // };
 
 
-    // 表单重置
+    // // 表单重置
     // const init = async () => {
     //   const res = await getUserProfile();
     //   console.log('获取的数据:', res);
@@ -177,7 +190,7 @@ const fetchImageUrls = async () => {
     //   form.email = res.email;
     //   form.name = res.name;
     //   form.leaderUserId = res.user.id;
-    //   form.description = res.description;
+    //   form.remark = res.remark;
     //   userInfo.value = res.user; 
     // };
 
@@ -200,7 +213,7 @@ const fetchImageUrls = async () => {
       openDialog,
       handleSuccess,
       extractedImageUrls,
-      cleanedDescription,
+      cleanedremark,
       userTypeMapping,
     };
   }
@@ -244,7 +257,7 @@ const fetchImageUrls = async () => {
   border-bottom: 1px solid #e7eaec; 
 }
 
-.info-description {
+.info-remark {
   margin-top: 30px; /* 与上面的信息分隔 */
   margin-left: 5%; /* 左侧与上面列表保持一致 */
   margin-right: 5%; /* 右侧与上面列表保持一致 */
@@ -264,7 +277,7 @@ const fetchImageUrls = async () => {
   
 }
 
-.description-content {
+.remark-content {
   white-space: pre-wrap; /* 保持换行 */
   overflow-wrap: break-word; /* 自动断行 */
   margin-right: 5%;

+ 1 - 0
src/views/system/workroomTeacher/dept/index.vue

@@ -214,6 +214,7 @@ const openDialog = () => {
   loading.value = true; 
   dialogVisible.value = true;
   formRef.value.open(); // 打开弹窗
+  loading.value = false; // 关闭加载状态
 };
 
 const extractedImageUrls = ref<string[]>([]);

+ 1 - 1
src/views/system/workroomTeacher/dept/student.vue

@@ -19,7 +19,7 @@
             :show-overflow-tooltip="true"
           />
           <el-table-column label="年级" align="center" prop="grade" width="120" />
-          <el-table-column label="学号" align="center" prop="studentId" width="120" />
+          <el-table-column label="学号" align="center" prop="studentId" width="150" />
           <el-table-column label="专业" align="center" prop="major" width="120" />
           <!-- <el-table-column
             label="工作间"