Explorar el Código

修复总控下的公司认证信息页面的图像回显问题-jly

jialuyu hace 1 mes
padre
commit
3bfa8e9117
Se han modificado 1 ficheros con 26 adiciones y 3 borrados
  1. 26 3
      src/views/system/audit/detail.vue

+ 26 - 3
src/views/system/audit/detail.vue

@@ -29,10 +29,10 @@
               <span class="text-[#1d2129]">{{ detail.creditCode || '-' }}</span>
             </div>
             
-            <div class="flex mt-6" v-if="detail.authLetter">
+            <div class="flex mt-6" v-if="authLetterUrl">
               <span class="w-32 text-[#4e5969]">委托招聘证明:</span>
               <div class="flex gap-4">
-                <el-image style="width: 120px; height: 80px" class="border rounded border-gray-200 bg-gray-50" :src="`${baseApi}/resource/oss/file/${detail.authLetter}`" :preview-src-list="[`${baseApi}/resource/oss/file/${detail.authLetter}`]" fit="contain"></el-image>
+                <el-image style="width: 120px; height: 80px" class="border rounded border-gray-200 bg-gray-50" :src="authLetterUrl" :preview-src-list="[authLetterUrl]" fit="contain"></el-image>
               </div>
             </div>
           </div>
@@ -45,7 +45,7 @@
           </h3>
           <div class="info-list space-y-4 text-sm">
             <div class="mb-6">
-               <el-avatar :size="64" :src="detail.avatar ? `${baseApi}/resource/oss/file/${detail.avatar}` : undefined" class="bg-gray-200 text-lg">
+               <el-avatar :size="64" :src="avatarUrl || undefined" class="bg-gray-200 text-lg">
                  {{ detail.surname || '头像' }}
                </el-avatar>
             </div>
@@ -131,6 +131,7 @@ import { ref, onMounted } from 'vue';
 import { useRouter, useRoute } from 'vue-router';
 import { ElMessage, ElMessageBox } from 'element-plus';
 import { getAudit, auditPass, auditReject } from '@/api/system/audit';
+import { listByIds } from '@/api/system/oss';
 
 const baseApi = import.meta.env.VITE_APP_BASE_API;
 import { AuditVO } from '@/api/system/audit/types';
@@ -140,6 +141,8 @@ const route = useRoute();
 const loading = ref(true);
 const submitLoading = ref(false);
 const detail = ref<AuditVO>({} as AuditVO);
+const avatarUrl = ref('');
+const authLetterUrl = ref('');
 const auditForm = ref({
   remark: ''
 });
@@ -150,6 +153,26 @@ const getDetail = async () => {
     const id = route.query.id as string;
     const res = await getAudit(id);
     detail.value = res.data;
+
+    // 获取联系人头像真实URL
+    if (res.data.avatar) {
+      listByIds(res.data.avatar).then(ossRes => {
+        if (ossRes.data && ossRes.data.length) {
+          const rawUrl = ossRes.data[0].url;
+          avatarUrl.value = rawUrl.startsWith('http') ? rawUrl : baseApi + rawUrl;
+        }
+      });
+    }
+
+    // 获取委托招聘证明真实URL
+    if (res.data.authLetter) {
+      listByIds(res.data.authLetter).then(ossRes => {
+        if (ossRes.data && ossRes.data.length) {
+          const rawUrl = ossRes.data[0].url;
+          authLetterUrl.value = rawUrl.startsWith('http') ? rawUrl : baseApi + rawUrl;
+        }
+      });
+    }
   } catch (error) {
     ElMessage.error('获取详情失败');
   } finally {