Pārlūkot izejas kodu

云南节点分支提交

tangning 16 stundas atpakaļ
vecāks
revīzija
7bed8cfe87

+ 1 - 1
index.html

@@ -28,7 +28,7 @@
         console.log(appParam, basePath, 6666)
         if (appParam.fromRoute == 'fire') {
           faviconPath = basePath + 'fire.ico';
-        } else if (appParam.fromRoute == 'criminal') {
+        } else if (appParam.fromRoute == 'criminal' || appParam.fromRoute == 'yunnan') {
           faviconPath = basePath + 'police.ico';
         } else if (appParam.fromRoute == 'xmfire') {
           faviconPath = basePath + 'jmlogo.png';

+ 31 - 2
src/api/map-tile.ts

@@ -1,6 +1,8 @@
 import axios from "./instance";
-import { MAP_TILE_LIST } from "./constant";
-
+import { MAP_TILE_LIST, UPLOAD_FILE, UPLOAD_HEADS, } from "./constant";
+import { jsonToForm } from "@/utils";
+import { params } from '@/env'
+import { uploadFile } from '@/api'
 type ServiceMapTile = {
   id: number;
   name: string,
@@ -22,3 +24,30 @@ export const fetchMapTiles = async () => {
     mapUrls: JSON.parse(item.mapUrl),
   }));
 };
+export const getSettingsResource = async () => {
+  return await axios.get("/fusion/settingsResource/info", { params: { fusionId: params.caseId } });
+};
+
+export const delSettingsResource = async (id : any) => {
+  return await axios.post("/fusion/settingsResource/delete", { id });
+};
+
+export const addSettingsResource = async (file: File) => {
+  const res = await await axios<string>({
+      method: "POST",
+      url: UPLOAD_FILE,
+      data: jsonToForm({ file: file }),
+      headers: { ...UPLOAD_HEADS },
+    })
+  console.log(res, file, );
+  const data = await axios.post("/fusion/settingsResource/saveOrUpdate", {
+    fusionId: params.caseId,
+    resource: res,
+    backType: "fusion",
+    name: file.name,
+    scale: 0,
+    rotate: 0,
+  });
+
+  return { ...data, cover: res.data }
+}

+ 3 - 2
src/app.vue

@@ -89,9 +89,10 @@ function getAppParam() {
 }
 const gotoLogin = () => {
   const params = getAppParam();
+  let fromRoute = params.fromRoute == 'yunnan'?'criminal':params.fromRoute;
   // alert("请登录");/${params.fromRoute}/#/mix3dManager
-  const loginHref = `/${params.fromRoute}/#/login`
-  location.href = loginHref + '?redirect=' + escape(`/${params.fromRoute}/#/mix3dManager`)
+  const loginHref = `/${fromRoute}/#/login`
+  location.href = loginHref + '?redirect=' + escape(`/${fromRoute}/#/mix3dManager`)
   // showLogin.value = true;
 };
 

+ 5 - 0
src/assets/style/global.less

@@ -52,4 +52,9 @@ button, input, select, textarea {
   width: 80px;
   font-size: 12px;
   height: 28px;
+}
+.ellipsis1 {
+  overflow:hidden; //超出的文本隐藏
+  text-overflow:ellipsis; //溢出用省略号显示
+  white-space:nowrap; //溢出不换行
 }

+ 6 - 1
src/main.ts

@@ -99,4 +99,9 @@ watchEffect(
 export default app;
 
 document.documentElement.addEventListener('contextmenu', ev => ev.preventDefault())
-document.documentElement.addEventListener('click', ev => ev.preventDefault())
+document.documentElement.addEventListener('click', ev => {
+  const dom = ev.target as HTMLDivElement
+  if (dom.tagName.toUpperCase() === 'A') {
+    ev.preventDefault()
+  }
+})

+ 12 - 11
src/views/login.vue

@@ -79,23 +79,24 @@ const guid = () => {
   });
 };
 // 图片验证码
-let baseURL = "https://test-mix3d.4dkankan.com";
-const imgKey = ref(guid());
-const refer = () => (imgKey.value = guid());
-if (window.location.href.indexOf("localhost") !== -1) {
-  baseURL = "https://test-mix3d.4dkankan.com";
-} else if (window.location.href.indexOf("test") !== -1) {
-  baseURL = "https://test-mix3d.4dkankan.com";
-} else {
-  baseURL = "https://mix3d.4dkankan.com";
-}
+let baseURL = ''
+// "https://test-mix3d.4dkankan.com";
+// const imgKey = ref(guid());
+// const refer = () => (imgKey.value = guid());
+// if (window.location.href.indexOf("localhost") !== -1) {
+//   baseURL = "https://test-mix3d.4dkankan.com";
+// } else if (window.location.href.indexOf("test") !== -1) {
+//   baseURL = "https://test-mix3d.4dkankan.com";
+// } else {
+//   baseURL = "https://mix3d.4dkankan.com";
+// }
 const codeImg = computed(() => baseURL + getCode + "?key=" + imgKey.value);
 const getDeptId = () => {
   const fromRoute = params.fromRoute;
   if (fromRoute === "fire") return "1";
   if (fromRoute === "cjzfire") return "DEP000011734134901809483776";
   if (fromRoute === "xmfire") return "3";
-  if (fromRoute === "criminal") return "2";
+  if (fromRoute === "criminal" || fromRoute === "yunnan") return "2";
   return "";
 };
 const login = (username: string, password: string, code: string) => {

+ 19 - 7
src/views/setting/back-item.vue

@@ -1,21 +1,24 @@
 <template>
   <div class="back-item" :class="{ [type]: true, active }">
     <img :src="url" v-if="['img', 'map'].includes(type)" />
-    <i class="iconfont" :class="url" v-else-if="type === 'icon'" />
+    <i class="iconfonts" :class="url" v-else-if="type === 'icon'" />
     <span :style="{ background: url }" v-else></span>
-    <p class="back-item-desc">{{ label }}</p>
-
+    <p class="back-item-desc ellipsis1" :title="label">{{ label }}</p>
+    <ui-icon v-if="item.isUpload" @click.stop="emit('del', item)" class="iconclose" type="close" />
     <div class="border"></div>
   </div>
 </template>
 <script lang="ts" setup>
-defineProps<{ type: string; url: string; label: string; active: boolean }>();
+defineProps<{ type: string; url: string; label: string; active: boolean, item: object }>();
+const emit = defineEmits(['del']);
 </script>
 
 <style lang="scss" scoped>
 .back-item {
+  width: 88px;
+  position: relative;
   > span,
-  .iconfont,
+  .iconfonts,
   img {
     display: block;
     height: 88px;
@@ -25,7 +28,7 @@ defineProps<{ type: string; url: string; label: string; active: boolean }>();
     border-radius: 4px;
   }
 
-  .iconfont {
+  .iconfonts {
     display: flex;
     align-items: center;
     justify-content: center;
@@ -39,7 +42,7 @@ defineProps<{ type: string; url: string; label: string; active: boolean }>();
 
   &.active {
     > span,
-    .iconfont,
+    .iconfonts,
     img {
       outline-color: #00c8af;
     }
@@ -52,4 +55,13 @@ defineProps<{ type: string; url: string; label: string; active: boolean }>();
   margin-top: 10px;
   text-align: center;
 }
+.iconclose{
+  font-size: 14px !important;
+  height: 14px !important;
+
+  position: absolute;
+  right: 0;
+  top: 0;
+  z-index: 1;
+}
 </style>

+ 1 - 0
src/views/setting/index.vue

@@ -94,6 +94,7 @@ let initMapId = setting.value!.mapId;
 let initTitle = caseProject.value?.fusionTitle;
 let isFirst = true;
 const changeBack = (mapData?: [string | null, number | null], title?: string) => {
+  console.log('changeBack', mapData, title);
   const back = mapData ? mapData[0] : setting.value?.back;
   const mapId = mapData ? mapData[1] : setting.value?.mapId;
   console.log('changeBack', mapId);

+ 64 - 10
src/views/setting/select-back.vue

@@ -7,6 +7,7 @@
             <ui-icon type="menu" />
             <BackItem
               :type="back.type"
+              :item="back"
               :label="back.label"
               :url="back.image"
               :active="activeParent === back.value"
@@ -41,9 +42,11 @@
       <BackItem
         v-else
         :type="back.type"
+        :item="back"
         :label="back.label"
         :url="back.image"
-        :active="value[0] === back.value"
+        @del="handleDel"
+        :active="back.value && value[0] === back.value"
         @click="value[0] !== back.value && $emit('update:value', [back.value, null])"
       />
     </template>
@@ -53,10 +56,10 @@
           <ui-icon type="add" />
         </p>
     </div>
-    <Confirm v-if="showFile" >
+    <Confirm title="新增" v-if="showFile" :func="clickHandler">
         <template v-slot:content>
           <div class="fileContent" style="width: 360px">
-            <div class="file">
+            <div class="filediv">
               <span>全景图</span>
               <ui-input
                   class="imgqjt-input"
@@ -73,7 +76,9 @@
                     <ui-button class="small-button" type="submit" >选择全景图</ui-button>
                   </template>
               </ui-input>
-              <span></span>
+              <span class="filename" v-if="myfile && myfile.name" :title="myfile && myfile.name">{{ myfile && myfile.name }}
+                <ui-icon @click="myfile = null" class="iconclose" type="close" />
+              </span>
             </div>
             <div class="tips">支持JPG/JPEG格式,2:1宽高比的全景图,建议分辨率≥4096×2048,全景图大小不超过20MB。</div>
           </div>
@@ -86,19 +91,24 @@
 import { Dropdown, MenuItem, Menu } from "ant-design-vue";
 import { computed, ref } from "vue";
 import BackItem from "./back-item.vue";
-import { fetchMapTiles } from "@/api/map-tile";
+import { fetchMapTiles, addSettingsResource, getSettingsResource, delSettingsResource } from "@/api/map-tile";
 import { sysTiles } from "@/store";
 import { Confirm } from "bill/index";
+import { Dialog, Message } from "bill/expose-common";
+// import Message from "bill/components/message/message.vue";
+import { params } from "@/env";
 
 const props = defineProps<{
   value: [string | null | undefined, number | null | undefined];
 }>();
-defineEmits<{
+const emit = defineEmits<{
   (e: "update:value", value: [string | null, number | null]): void;
 }>();
-const file = ref<File | null>(null);
+const myfile = ref<File | null>(null);
+const audioSize = 20 * 1024 * 1024;
 const showFile = ref(false)
-const backs = computed(() => [
+const myList = ref([])
+const backsList = [
   { label: "无", type: "icon", image: "icon-without", value: "none" },
   {
     label: "地图",
@@ -131,7 +141,8 @@ const backs = computed(() => [
     image: "https://4dkk.4dage.com/fusion/default/images/pic_bw@2x.png",
     value: "https://4dkk.4dage.com/fusion/default/images/傍晚.jpg",
   },
-]);
+]
+const backs = computed(() => ([...backsList, ...myList.value]));
 
 const activeParent = computed(() => {
   console.log(backs.value, 'activeParent', props.value);
@@ -148,7 +159,37 @@ const activeParent = computed(() => {
   }
 });
 const updateFile = async ({ file, preview }: { file: File; preview: string }) => {
-  console.log(file, preview, 'updateFile');
+  myfile.value = file;
+}
+const getbacksList = async () => {
+  const list = await getSettingsResource()
+  myList.value = list.map(ele => ({ ...ele, isUpload: true, image: ele.resource, value: ele.resource, type: 'img' }))
+  console.log(list, 'getbacksList');
+}
+const handleDel = async (item : any) => {
+  console.log(item, 'handleDel', props.value);
+  if (!(await Dialog.confirm("确定要删除吗?"))) return;
+  if(props.value[0] == item.value) emit('update:value', ['none', null])
+  await delSettingsResource(item.id)
+  await getbacksList()
+}
+getbacksList()
+const clickHandler = async (status: any) => {
+  console.log(status, 'clickHandler', showFile.value);
+  if (status == 'ok') {
+    // 验证是否选择了文件
+    if(!myfile.value){
+      Message.error("请选择全景图文件");
+      throw "全景图文件不能为空";
+    }
+    // 上传全景图文件并刷新列表
+    await addSettingsResource(myfile.value)
+    getbacksList()
+    showFile.value = false
+  }else{
+    // 取消上传,关闭弹窗
+    showFile.value = false
+  }
 }
  const handleFile = () => {
     showFile.value = true;
@@ -208,5 +249,18 @@ const updateFile = async ({ file, preview }: { file: File; preview: string }) =>
     margin: 0 20px;
     position: relative;
   }
+  .filediv{
+    white-space: nowrap;
+    /* 3. 超出容器的部分隐藏 */
+    overflow: hidden;
+    /* 4. 超出部分用省略号替代(核心) */
+    text-overflow: ellipsis;
+    .filename{
+      position: relative;
+      .iconclose{
+        position: absolute;
+      }
+    }
+  }
 }
 </style>

+ 3 - 2
vite.config.ts

@@ -8,7 +8,8 @@ import { resolve } from 'path'
 // const oss = `https://phx.4dkankan.com/`
 // const ip = `https://phx.4dkankan.com/`
 const oss = `https://4dkk.4dage.com/`
-const ip = `https://test-mix3d.4dkankan.com/`
+const ip = `http://192.168.0.93/`
+// const ip = `https://test-mix3d.4dkankan.com/`
 
 const proxy = {
   '/offlineData': {
@@ -37,7 +38,7 @@ const proxy = {
     rewrite: path => path.replace(/^\/swkk/, '')
   },
   '/oss': {
-    target: `${oss}/`,
+    target: `${ip}/`,
     changeOrigin: true,
     rewrite: path => path.replace(/^\/oss/, '/oss')
   },