Browse Source

Merge branch 'xj' of http://192.168.0.115:3000/bill/public-fuse into xj

gemercheung 1 year ago
parent
commit
5d95a4f0d2

+ 1 - 1
src/constant/scene.ts

@@ -26,7 +26,7 @@ export const SceneTypePaths: { [key in SceneType]: string[] } = {
   [SceneType.SWKK]: [
     "/swkk/spg.html",
     "/swkk/epg.html",
-    `/swkk/livestream/fd/${appConstant.name}.html`,
+    `/livestream/fd/${appConstant.name}.html`,
   ],
   [SceneType.SWKJ]: ["/swkk/spg.html", "/swkk/epg.html"],
   [SceneType.SWSS]: ["/swss/index.html", "/swss/index.html"],

+ 0 - 1
src/main.ts

@@ -8,7 +8,6 @@ import { setApp } from "@/helper/mount";
 import { router } from "./router";
 import { appConstant } from "./app";
 import "@/store/system";
-import "@/assets/style/public.scss";
 
 const app = createApp(App);
 

+ 1 - 0
src/request/urls.ts

@@ -228,6 +228,7 @@ export const onLineCheck = "/web/fireProject/onLineCheck";
 export const caseApiList = "/fusion-xj/caseImg/list";
 export const saveApiOrUpdate = "/fusion-xj/caseImg/saveOrUpdate";
 export const caseApiDel = "/fusion-xj/caseImg/delete";
+export const caseApiUpdateSort = "/fusion-xj/caseImg/updateSort";
 
 export const getSysSetting = `/fusion-xj/systemSetting/info`;
 export const updateSysSetting = `/fusion-xj/systemSetting/save`;

+ 11 - 5
src/setSystem.ts

@@ -14,7 +14,9 @@ import {
   updateSysSetting,
 } from "@/request";
 
-const modules = import.meta.glob("@/assets/style/theme/*.scss");
+const modules = import.meta.glob("@/assets/style/theme/*.scss", {
+  query: "?inline",
+});
 
 axios.get(getSysSetting).then((data) => {
   systemData.value.name = data.data.title;
@@ -46,16 +48,20 @@ export const systemData = ref({
   color: themeColors[0],
 });
 
-const refresh = () => {
+const $style = document.createElement("style");
+$style.setAttribute("type", "text/css");
+document.body.appendChild($style);
+
+const refresh = async () => {
   title.value = systemData.value.name;
 
   const key = Object.keys(modules).find((key) =>
     key.includes(systemData.value.color)
   );
   if (key) {
-    return modules[key]();
-  } else {
-    return Promise.resolve();
+    const res1: any = await modules[key]();
+    const res2: any = await import("@/assets/style/public.scss?inline");
+    $style.innerHTML = res1.default + res2.default;
   }
 };
 

+ 6 - 2
src/store/case.ts

@@ -10,6 +10,7 @@ import {
   caseApiList,
   saveApiOrUpdate,
   caseApiDel,
+  caseApiUpdateSort,
   caseInquestInfo,
   caseInquestOpt,
   caseInquestExport
@@ -85,8 +86,8 @@ export const getCaseScenes = (scenes: Scene[]) => {
 export const replaceCaseScenes = (caseId: number, caseScenes: CaseScenes) =>
   axios.post(repCaseScenes, { sceneNumParam: caseScenes, caseId });
 
-export const caseImgList = (caseId: number, orderBy: string) =>
-  axios.post(caseApiList, { orderBy: orderBy || 'desc', caseId });
+export const caseImgList = (caseId: number, orderBy: string | null) =>
+  axios.post(caseApiList, { orderBy: orderBy || '', caseId });
 
 export const saveOrUpdate = (params: CaseImg) =>
   axios.post(saveApiOrUpdate, { ...params });
@@ -94,6 +95,9 @@ export const saveOrUpdate = (params: CaseImg) =>
 export const caseDel = (id: number) =>
   axios.post(caseApiDel, { id });
 
+export const caseUpdateSort = (list: [CaseImg]) =>
+  axios.post(caseApiUpdateSort, { paramList: list });
+
 export const getCaseInquestInfo = (caseId: number) =>
   axios.get(caseInquestInfo, { params: { caseId } });
 

+ 7 - 7
src/view/case/addPhotoFile.vue

@@ -89,10 +89,10 @@ watch(props, newValue => {
   caseFile.value.imgUrl = newValue.data.imgUrl;
   caseFile.value.sort = newValue.data.sort;
   if(newValue.data.imgUrl){
-    file.value = [{
-    name: newValue.data.imgInfo,
-    url: newValue.data.imgUrl,
-  }]
+    file.value = {
+    name: newValue.data.imgInfo || '',
+    url: newValue.data.imgUrl || '',
+  }
   }
 },{ immediate: true })
 watchEffect(() => {
@@ -105,10 +105,10 @@ const httpsApi = async ({file})=> {
   console.log('httpsApi', file)
   let fileUrl = await uploadFile(file);
 
-  file.value = [{
+  file.value = {
     name: file.name,
     url: fileUrl,
-  }]
+  }
   console.log('httpsApi', file, fileUrl)
 }
 
@@ -122,7 +122,7 @@ defineExpose<QuiskExpose>({
       throw "附件标题不能为空!";
     }
     console.log('defineExpose', caseFile.value, file.value)
-    let imgUrl = file.value && file.value.value ? file.value.value[0]?.url : file.value[0]?.url
+    let imgUrl = file.value && file.value.value ? file.value.value?.url : file.value?.url
     await saveOrUpdate({ ...caseFile.value, imgUrl });
     return caseFile.value;
   },

+ 24 - 9
src/view/case/photos/draggable.vue

@@ -16,7 +16,7 @@
 
 <script setup lang="ts">
 import { ref, onMounted, watch } from 'vue'
-import { caseImgList, CaseImg, caseDel } from "@/store/case";
+import { caseImgList, CaseImg, caseDel, caseUpdateSort } from "@/store/case";
 import { VueDraggable } from 'vue-draggable-plus'
 import { addCaseImgFile } from "../quisk";
 // import { IconRabbish } from '@element-plus/icons-vue'
@@ -28,19 +28,22 @@ const emit = defineEmits<{
 const list = ref<CaseImg[]>([])
 
 watch(()=>props.sortType,(newValue, oldValue)=>{
-    console.log('sum is changed',newValue,oldValue);
     emit("changeList", list.value);
 },{ deep: true, immediate:true})
 
-function onChange(event: any) {
-  emit("changeList", list.value);
+async function onChange() {
+  let apiList = list.value.map((item, index) => {
+    return {...item, sort: index + 1}
+  })
+  await caseUpdateSort(apiList)
+  emit("changeList", apiList);
 }
 function handleItem(index) {
   emit("handleItem", index);
   
 }
 async function getList () {
-  let lists = await caseImgList(props.caseId)
+  let lists = await caseImgList(props.caseId, '')
   list.value = lists.data
   emit("changeList", list.value);
 
@@ -52,16 +55,19 @@ function handleDet(index: Number, id: Number) {
     console.log('handleDet', list.value);
   })
 }
-function handleEdit(params) {
-  addCaseImgFile({ caseId: props.caseId, data: {
+async function handleEdit(params) {
+  await addCaseImgFile({ caseId: props.caseId, data: {
     ...params,
   } });
+  getList()
 }
 onMounted(() => {
   getList()
   // emit("update:list", props.list.value);
 })
-
+defineExpose({
+  getList
+});
 
 </script>
 <style lang="scss" scoped>
@@ -87,7 +93,7 @@ onMounted(() => {
       justify-content: space-between;
       align-items: center;
       div{
-        width: calc(100% - 20px);
+        width: 100%;
         white-space: nowrap;
         text-overflow: ellipsis;
         overflow: hidden;
@@ -95,6 +101,15 @@ onMounted(() => {
       .EditPen{
         width: 20px;
         height: 20px;
+        display: none;
+      }
+      &:hover{
+        div{
+          width: calc(100% - 20px);
+        }
+        .EditPen{
+          display: block;
+        }
       }
     }
     .itemIcon{

+ 6 - 3
src/view/case/photos/index.vue

@@ -10,7 +10,7 @@
           >{{ sortType ? "横排" : "竖排" }}</el-button
         >
       </div>
-      <draggable ref="draggableRef" :caseId="caseId" :sortType="sortType" @changeList="changeList" @handleItem="handleItem" />
+      <draggable ref="childRef" :caseId="caseId" :sortType="sortType" @changeList="changeList" @handleItem="handleItem" />
     </div>
     <div class="right">
       <swiper
@@ -59,7 +59,7 @@ import draggable from './draggable.vue';
 const props = defineProps({ caseId: Number });
 const newlist = ref([]);
 const swiperRef = ref(null);
-const draggableRef = ref(null);
+const childRef = ref(null);
 const caseId = ref(props.caseId);
 const sortType = ref(false);
 const addCaseFileHandler = async () => {
@@ -72,7 +72,10 @@ const addCaseFileHandler = async () => {
   refresh();
 };
 function refresh() {
-  console.log("changeList", draggableRef.value);
+  console.log("changeList", childRef.value);
+  if(childRef.value) {
+    childRef.value.getList()
+  }
 }
 const changeList = (list) => {
   let newList = [];