master
fanluyan 2 years ago
parent 817c2ecd18
commit 0d2b85e709

@ -42,10 +42,7 @@
<img <img
@load="onImageLoad" @load="onImageLoad"
:src=" :src="
'http://192.168.50.200:88/images/' + hostName + '/images/' + parentdata.name + '/' + currentNodeData.name
parentdata.name +
'/' +
currentNodeData.name
" "
alt="" alt=""
class="img" class="img"
@ -107,6 +104,7 @@ export default {
}, },
// //
labelMarkArrs: [], labelMarkArrs: [],
hostName: "",
}; };
}, },
created() { created() {
@ -147,6 +145,16 @@ export default {
}); });
}, },
mounted() { mounted() {
console.log(window.location.host);
const isProduction = process.env.NODE_ENV === "production";
if (isProduction) {
// 使IP
this.hostName = window.location.origin;
console.log("aaaaaaaaaaaa");
} else {
// 使 target
this.hostName = "http://192.168.1.190:88"; // 使 target
}
this.$nextTick(() => { this.$nextTick(() => {
window.addEventListener("resize", this.updateImageSize); window.addEventListener("resize", this.updateImageSize);
}); });

@ -20,7 +20,8 @@ module.exports = defineConfig({
proxy: { proxy: {
"/img-api": { "/img-api": {
//表示拦截以/api开头的请求路径 //表示拦截以/api开头的请求路径
target: "http://192.168.50.200:88", // //target: "http://192.168.50.200:88", //
target: "http://192.168.1.190:88",
changOrigin: true, //是否开启跨域 changOrigin: true, //是否开启跨域
pathRewrite: { pathRewrite: {
"^/api": "/img-api", //重写api把api变成空字符因为我们真正请求的路径是没有api的 "^/api": "/img-api", //重写api把api变成空字符因为我们真正请求的路径是没有api的

Loading…
Cancel
Save