Commit c00b70a8 authored by 胡占生's avatar 胡占生 🇨🇳

fix: 算法接口地址调整,案例图片接口联调

parent 9bc5f65a
...@@ -8,4 +8,4 @@ VITE_APP_ENV = 'development' ...@@ -8,4 +8,4 @@ VITE_APP_ENV = 'development'
VITE_APP_BASE_API = '/dev-api' VITE_APP_BASE_API = '/dev-api'
# 图片服务器地址 # 图片服务器地址
VITE_IMG_BASE_PATH = 'http://192.168.4.206' VITE_IMG_BASE_PATH = 'http://192.168.3.82'
...@@ -11,4 +11,4 @@ VITE_APP_BASE_API = '/ai' ...@@ -11,4 +11,4 @@ VITE_APP_BASE_API = '/ai'
VITE_BUILD_COMPRESS = gzip VITE_BUILD_COMPRESS = gzip
# 图片服务器地址 # 图片服务器地址
VITE_IMG_BASE_PATH = 'http://192.168.4.206' VITE_IMG_BASE_PATH = 'http://192.168.3.82'
\ No newline at end of file \ No newline at end of file
...@@ -11,4 +11,4 @@ VITE_APP_BASE_API = '/stage-api' ...@@ -11,4 +11,4 @@ VITE_APP_BASE_API = '/stage-api'
VITE_BUILD_COMPRESS = gzip VITE_BUILD_COMPRESS = gzip
# 图片服务器地址 # 图片服务器地址
VITE_IMG_BASE_PATH = 'http://192.168.4.206' VITE_IMG_BASE_PATH = 'http://192.168.3.82'
\ No newline at end of file \ No newline at end of file
...@@ -84,4 +84,22 @@ export function updateAlgState(data) { ...@@ -84,4 +84,22 @@ export function updateAlgState(data) {
method: 'post', method: 'post',
data: data data: data
}) })
}
// 新增算法案例列表
export function addListAlgorithmCase(data) {
return request({
url: '/yunshou/aiAlgorithmCase/addList',
method: 'post',
data: data
})
}
// 查询算法案例列表
export function listCase(query) {
return request({
url: '/yunshou/aiAlgorithmCase/list',
method: 'get',
params: query
})
} }
\ No newline at end of file
...@@ -83,7 +83,7 @@ const number = ref(0); ...@@ -83,7 +83,7 @@ const number = ref(0);
const uploadList = ref([]); const uploadList = ref([]);
const dialogImageUrl = ref(""); const dialogImageUrl = ref("");
const dialogVisible = ref(false); const dialogVisible = ref(false);
const baseUrl = 'http://192.168.4.206' const baseUrl = import.meta.env.VITE_IMG_BASE_PATH
const uploadImgUrl = computed( const uploadImgUrl = computed(
() => props.defaultUrl + "/common/upload" () => props.defaultUrl + "/common/upload"
); );
......
<template> <template>
<div class="component-upload-image"> <div class="component-upload-image">
<div v-if="isImgLayout"> <div v-if="isImgLayout" style="display: flex">
<div class="media-list" v-for="(item, index) in fileList" :key="index"> <div class="media-list" v-for="(item, index) in fileList" :key="index">
<el-image <el-image
class="media-file image-file" class="media-file image-file"
...@@ -117,7 +117,7 @@ const number = ref(0); ...@@ -117,7 +117,7 @@ const number = ref(0);
const uploadList = ref([]); const uploadList = ref([]);
const dialogImageUrl = ref(""); const dialogImageUrl = ref("");
const dialogVisible = ref(false); const dialogVisible = ref(false);
const baseUrl = 'http://192.168.4.206' const baseUrl = import.meta.env.VITE_IMG_BASE_PATH
const uploadImgUrl = computed( const uploadImgUrl = computed(
() => props.defaultUrl + "/common/upload" () => props.defaultUrl + "/common/upload"
); );
...@@ -266,6 +266,7 @@ function getFileType(fileName) { ...@@ -266,6 +266,7 @@ function getFileType(fileName) {
width: 100%; width: 100%;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
flex-direction: column;
} }
.media-list { .media-list {
position: relative; position: relative;
......
...@@ -25,7 +25,7 @@ import elementIcons from '@/components/SvgIcon/svgicon' ...@@ -25,7 +25,7 @@ import elementIcons from '@/components/SvgIcon/svgicon'
import './permission' // permission control import './permission' // permission control
import { useDict } from '@/utils/dict' import { useDict } from '@/utils/dict'
import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi' import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels, isNotEmpty} from '@/utils/ruoyi'
// 分页组件 // 分页组件
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
...@@ -59,6 +59,7 @@ app.config.globalProperties.handleTree = handleTree ...@@ -59,6 +59,7 @@ app.config.globalProperties.handleTree = handleTree
app.config.globalProperties.addDateRange = addDateRange app.config.globalProperties.addDateRange = addDateRange
app.config.globalProperties.selectDictLabel = selectDictLabel app.config.globalProperties.selectDictLabel = selectDictLabel
app.config.globalProperties.selectDictLabels = selectDictLabels app.config.globalProperties.selectDictLabels = selectDictLabels
app.config.globalProperties.isNotEmpty = isNotEmpty
// 全局组件挂载 // 全局组件挂载
app.component('DictTag', DictTag) app.component('DictTag', DictTag)
......
...@@ -36,8 +36,7 @@ const useUserStore = defineStore( ...@@ -36,8 +36,7 @@ const useUserStore = defineStore(
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo().then(res => { getInfo().then(res => {
const user = res.user const user = res.user
console.log('%c [ user ]-38', 'font-size:13px; background:pink; color:#bf2c9f;', user) const avatar = (user.avatar == "" || user.avatar == null) ? defAva : 'http://192.168.3.82'+ user.avatar;
const avatar = (user.avatar == "" || user.avatar == null) ? defAva : 'http://192.168.4.206'+ user.avatar;
// const avatar = (user.avatar == "" || user.avatar == null) ? defAva : import.meta.env.VITE_APP_BASE_API + user.avatar; // const avatar = (user.avatar == "" || user.avatar == null) ? defAva : import.meta.env.VITE_APP_BASE_API + user.avatar;
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
......
...@@ -244,3 +244,8 @@ export function getNormalPath(p) { ...@@ -244,3 +244,8 @@ export function getNormalPath(p) {
export function blobValidate(data) { export function blobValidate(data) {
return data.type !== 'application/json' return data.type !== 'application/json'
} }
// 非空校验
export function isNotEmpty(value) {
return value !== null && value !== undefined && value !== '';
}
\ No newline at end of file
...@@ -275,7 +275,13 @@ ...@@ -275,7 +275,13 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="24"> <el-col :span="24">
<el-form-item label-width="130px" label="在线体验案例图片/视频" prop="algorithmBannerVideo"> <el-form-item label-width="130px" label="在线体验案例图片/视频" prop="algorithmBannerVideo">
<ImgVideoUpload :modelValue="form.algorithmBannerVideo" :fileType="['png', 'jpg', 'mp4']" :limit='5' :fileSize="20" :isShowTip="true"/> <ImgVideoUpload
:modelValue="imgVideoData"
:fileType="['png', 'jpg', 'mp4']"
:limit='4'
:fileSize="20"
:isShowTip="true"
@update:modelValue="getImgVideoData"/>
<!-- <ImageUpload :modelValue="form.algorithmBannerVideo" :limit='1' :fileSize="30" @update:modelValue="getImageUrl"/> --> <!-- <ImageUpload :modelValue="form.algorithmBannerVideo" :limit='1' :fileSize="30" @update:modelValue="getImageUrl"/> -->
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -454,7 +460,7 @@ ...@@ -454,7 +460,7 @@
</template> </template>
<script setup> <script setup>
import { addAlg, updateAlg , detailAlg , listAlgFile} from "@/api/algorithmList/index.js"; import { addAlg, updateAlg , detailAlg , listAlgFile, addListAlgorithmCase , listCase} from "@/api/algorithmList/index.js";
import { listScene, detailScene , addScene, updateScene, deleteScene} from "@/api/algorithmList/scene.js"; import { listScene, detailScene , addScene, updateScene, deleteScene} from "@/api/algorithmList/scene.js";
import { listBoundary, detailBoundary , addBoundary, updateBoundary, deleteBoundary} from "@/api/algorithmList/boundary.js"; import { listBoundary, detailBoundary , addBoundary, updateBoundary, deleteBoundary} from "@/api/algorithmList/boundary.js";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
...@@ -465,6 +471,7 @@ const openScene = ref(false); ...@@ -465,6 +471,7 @@ const openScene = ref(false);
const openBoundary = ref(false); const openBoundary = ref(false);
const isAdd = ref(true); const isAdd = ref(true);
const title = ref(""); const title = ref("");
const imgVideoData = ref("");
const titleScene = ref(""); const titleScene = ref("");
const titleBoundary = ref(""); const titleBoundary = ref("");
const activeName = ref("基础信息"); const activeName = ref("基础信息");
...@@ -513,6 +520,9 @@ function getAlgorithmBanner(url){ ...@@ -513,6 +520,9 @@ function getAlgorithmBanner(url){
function getBoundaryImageUrl(url){ function getBoundaryImageUrl(url){
formBoundary.value.caseFile=url formBoundary.value.caseFile=url
} }
function getImgVideoData(url){
imgVideoData.value=url
}
/** 表单重置 */ /** 表单重置 */
function reset() { function reset() {
...@@ -542,6 +552,7 @@ function handleUpdate(row) { ...@@ -542,6 +552,7 @@ function handleUpdate(row) {
const id = row.id || ids.value; const id = row.id || ids.value;
ids.value = id; ids.value = id;
getSceneList(); getSceneList();
getListCase();
getBoundaryList() getBoundaryList()
detailAlg(id).then(response => { detailAlg(id).then(response => {
form.value = response.data; form.value = response.data;
...@@ -556,6 +567,7 @@ function submitForm() { ...@@ -556,6 +567,7 @@ function submitForm() {
proxy.$refs["algRef"].validate(valid => { proxy.$refs["algRef"].validate(valid => {
if (valid) { if (valid) {
if (form.value.id != undefined) { if (form.value.id != undefined) {
addCaseFile()
updateAlg(form.value).then(response => { updateAlg(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功"); proxy.$modal.msgSuccess("修改成功");
open.value = false; open.value = false;
...@@ -722,6 +734,7 @@ function submitBoundaryRefForm() { ...@@ -722,6 +734,7 @@ function submitBoundaryRefForm() {
} }
}); });
} }
/** 取消按钮 */ /** 取消按钮 */
function cancelBoundary() { function cancelBoundary() {
openBoundary.value = false; openBoundary.value = false;
...@@ -729,6 +742,53 @@ function cancelBoundary() { ...@@ -729,6 +742,53 @@ function cancelBoundary() {
} }
/** 查询案例文件列表 */
function getListCase() {
listCase({ algorithmId: ids.value,caseType:2}).then(response => {
imgVideoData.value = response.rows.map(item=>{
return item.caseFile
});
});
}
//新增案例文件
function addCaseFile(){
console.log("🚀 ~ addCaseFile ~ imgVideoData.value:", imgVideoData.value)
if(proxy.isNotEmpty(imgVideoData.value)){
const params={
algorithmId:form.value.id,
list:[]
}
imgVideoData.value.split(",").forEach(item => {
params.list.push({
algorithmId:form.value.id,
caseFile:item,
caseType:2,
fileType:getFileType(item),
})
});
console.log("🚀 ~ addCaseFile ~ params:", params)
addListAlgorithmCase(params).then(res=>{
console.log(res)
})
}
}
// 判断当前文件类型
function getFileType(fileName) {
const videoType =['mp4','avi','mov','wmv','flv','mkv','rmvb','3gp','mpg','mpeg','webm']
const ImgType = ['jpg','jpeg','png','gif','bmp','tiff','webp',]
let fileType = fileName.split(".").pop();
if (videoType.includes(fileType)) {
return "1";
}
if (ImgType.includes(fileType)) {
return "0";
}
}
defineExpose({ handleAdd , handleUpdate }) defineExpose({ handleAdd , handleUpdate })
</script> </script>
......
...@@ -57,7 +57,10 @@ ...@@ -57,7 +57,10 @@
v-for="item in invalidList" :key="item.id" v-for="item in invalidList" :key="item.id"
@click="handBuiltImg(item.caseFile)" @click="handBuiltImg(item.caseFile)"
> >
<img width="100%" :src="'http://192.168.4.206'+item.caseFile" alt=""> <img width="100%" v-if="getFileType(item.caseFile)=='0'" :src="'http://192.168.3.82'+item.caseFile" alt="">
<video width="100%" v-else controls class="drawImg">
<source :src="'http://192.168.3.82'+item.caseFile" type="video/mp4" />
</video>
</div> </div>
<ImgVideoUpload <ImgVideoUpload
style="position: absolute;bottom: 5px;left: 26%;" style="position: absolute;bottom: 5px;left: 26%;"
...@@ -157,7 +160,7 @@ const applicationList = ref([]) ...@@ -157,7 +160,7 @@ const applicationList = ref([])
const effectiveList = ref([]) const effectiveList = ref([])
const invalidList = ref([]) const invalidList = ref([])
const nowText=ref('算法详情') const nowText=ref('算法详情')
const baseUrl = 'http://192.168.4.206' const baseUrl = 'http://192.168.3.82'
const data = reactive({ const data = reactive({
form: {}, form: {},
queryParams: { queryParams: {
...@@ -205,13 +208,27 @@ function judgeImgUrl(item){ ...@@ -205,13 +208,27 @@ function judgeImgUrl(item){
return item return item
} }
}else{ }else{
return 'http://192.168.4.206/profile/upload/2024/08/28/banner%20background_20240828095250A003.png' return 'http://192.168.3.82/profile/upload/2024/08/28/banner%20background_20240828095250A003.png'
} }
} }
function handBuiltImg(item){ function handBuiltImg(item){
nowImg.value = item nowImg.value = item
} }
// 判断当前文件类型
function getFileType(fileName) {
const videoType =['mp4','avi','mov','wmv','flv','mkv','rmvb','3gp','mpg','mpeg','webm']
const ImgType = ['jpg','jpeg','png','gif','bmp','tiff','webp',]
let fileType = fileName.split(".").pop();
if (videoType.includes(fileType)) {
return "1";
}
if (ImgType.includes(fileType)) {
return "0";
}
}
getDetials() getDetials()
</script> </script>
......
...@@ -16,7 +16,7 @@ export function useWebSockets() { ...@@ -16,7 +16,7 @@ export function useWebSockets() {
// 定义点击事件 myFn // 定义点击事件 myFn
function handeUpload(e){ function handeUpload(e){
uploadData.value = e uploadData.value = e
client.value = new WebSocketManager('ws://192.168.4.206:8111/ai/sf',websocketMessage) client.value = new WebSocketManager('ws://192.168.3.82:8111/ai/sf',websocketMessage)
client.value.connect(); client.value.connect();
} }
function websocketMessage(e) { function websocketMessage(e) {
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
<template v-slot:default > <template v-slot:default >
<div style="width: 100%;max-height: 200px;overflow: hidden;"> <div style="width: 100%;max-height: 200px;overflow: hidden;">
<img <img
:src="'http://192.168.4.206' +item.cardImg" :src="'http://192.168.3.82' +item.cardImg"
style="width: 100%;" style="width: 100%;"
/> />
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment