修改模型详情回显图片
This commit is contained in:
parent
5093d978b4
commit
f3bc668e65
@ -14,6 +14,7 @@ import { searchAlgorithmsModelPage} from "@/api/business/algorithmModel";
|
||||
import Page from '@/components/Pagination/page.vue'
|
||||
|
||||
import { getDictItemById } from '@/api/dict';
|
||||
const apiUrl = import.meta.env.VITE_APP_BASE_API; // 基础路径
|
||||
const menuData:any = ref([]);
|
||||
const algorithmData:any = ref([]);
|
||||
// 查询字典项
|
||||
@ -341,7 +342,7 @@ function changeShowResult(isShow:boolean){ // 切换显示结果模型
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="dialogVisible" :close-on-click-modal="false"
|
||||
:modal="false" draggable :before-close="handleClose" :title="title"
|
||||
:modal="false" draggable :before-close="handleClose" :title="'模型详情'"
|
||||
append-to-body width="1145px" height="600px">
|
||||
<div style=" width: calc(100%); height: calc(100vh - 200px);">
|
||||
<div style="display: flex; margin-bottom: 20px; border-bottom: 1px solid #e5e5e5;padding-bottom: 5px;">
|
||||
@ -379,7 +380,7 @@ function changeShowResult(isShow:boolean){ // 切换显示结果模型
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div v-else style="width: 100%; height: calc(100% - 50px);">
|
||||
<img src="file:///E:/python_coding/keffCenter/models/GPR/CylindricalTank/V1/error.jpg" alt="" style="width: 100%; height: 100%;object-fit:contain;">
|
||||
<img :src="apiUrl +'/models/'+ info.metricsImagePath" alt="" style="width: 100%; height: 100%;object-fit:contain;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -4,11 +4,14 @@ import cn.hutool.cache.Cache;
|
||||
import cn.hutool.cache.CacheUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@ -17,7 +20,20 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
@Resource
|
||||
private FileSpaceProperties fileSpaceProperties;
|
||||
|
||||
@Value("${file-space.model-path:E:/python_coding/keffCenter/models/}")
|
||||
private String modelPath;
|
||||
|
||||
|
||||
/**
|
||||
* 跨域配置:允许前端访问 /models/** 资源
|
||||
*/
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/models/**") // 仅放行 /models/** 路径
|
||||
.allowedOrigins("http://localhost:3000") // 前端地址
|
||||
.allowedMethods("GET") // 仅允许 GET
|
||||
.allowCredentials(true); // 如需带 cookie
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Cache<String, String> loginuserCache() {
|
||||
@ -41,6 +57,7 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
System.out.println("[WebConfig] modelPath in addResourceHandlers = " + modelPath);
|
||||
registry.addResourceHandler("/icon/**")
|
||||
.addResourceLocations("classpath:/static/icon/")
|
||||
.setCachePeriod(0);
|
||||
@ -52,9 +69,19 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
registry.addResourceHandler("swagger-ui.html").addResourceLocations(
|
||||
"classpath:/META-INF/resources/");
|
||||
|
||||
// 把本地 modelPath 映射到 /models/** URL
|
||||
String path = modelPath.replace("\\", "/");
|
||||
if (!path.endsWith("/")) {
|
||||
path += "/";
|
||||
}
|
||||
registry.addResourceHandler("/models/**")
|
||||
.addResourceLocations("file:" + path);
|
||||
|
||||
String systemUrl = "file:" + fileSpaceProperties.getSystem().replace("\\", "/")+"user\\";
|
||||
registry.addResourceHandler("/avatar/**").addResourceLocations(systemUrl).setCachePeriod(0);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user