Browse Source

数据修改

黄琪勇 7 months ago
parent
commit
8b118f32de
4 changed files with 107 additions and 1 deletions
  1. 97 0
      public/data.json
  2. 0 0
      public/json.json
  3. 9 0
      src/utils/oss-file-upload.ts
  4. 1 1
      src/views/pptScreen/pptScreen.vue

+ 97 - 0
public/data.json

@@ -0,0 +1,97 @@
+{
+  "title": "未命名演示文稿",
+  "width": 1920,
+  "height": 1080,
+  "theme": {
+    "themeColor": "#5b9bd5",
+    "fontColor": "#333",
+    "fontName": "Microsoft Yahei",
+    "backgroundColor": "#fff",
+    "shadow": {
+      "h": 3,
+      "v": 3,
+      "blur": 2,
+      "color": "#808080"
+    },
+    "outline": {
+      "width": 2,
+      "color": "#525252",
+      "style": "solid"
+    }
+  },
+  "slides": [
+    {
+      "elements": [
+        {
+          "type": "video",
+          "subtype": "elf-video",
+          "id": "xvUVnf",
+          "left": 161.70000000000002,
+          "top": 110.9,
+          "width": 639,
+          "height": 360,
+          "name": "media1",
+          "src": "https://oss.dayaedu.com/pptList/media1.mp4",
+          "poster": "https://oss.dayaedu.com/pptList/image1.png",
+          "videoSize": 741673,
+          "posterSize": 0,
+          "md5": "47d9366652b30595f88fc768cda19857"
+        },
+        {
+          "type": "audio",
+          "subtype": "elf-audio",
+          "id": "B_Qxvx",
+          "left": 1231.7,
+          "top": 64.8,
+          "width": 400,
+          "height": 50,
+          "src": "https://oss.dayaedu.com/pptList/media2.mp3",
+          "name": "media2",
+          "focusOrder": 1,
+          "size": 29318632,
+          "md5": "f81693a4e832793da5db98ccf255aa2c"
+        },
+        {
+          "type": "shape",
+          "id": "UmJVMI",
+          "left": 362.1,
+          "top": 61.8,
+          "width": 640.0000000000001,
+          "height": 58,
+          "rotate": 0,
+          "viewBox": [200, 200],
+          "fixedRatio": false,
+          "fill": "transparent",
+          "path": "M 0 0 L 200 0 L 200 200 L 0 200 Z",
+          "text": {
+            "content": "<p style=><span style=\"font-family:Sans-serif\"><span style=\"font-size:36px;color:#000000;\">视频</span></span></p>",
+            "defaultColor": "#000000",
+            "defaultFontName": "Sans-serif",
+            "align": "top"
+          },
+          "outline": { "style": "solid", "width": 1, "color": "transparent" }
+        },
+        {
+          "type": "shape",
+          "id": "jEyG30",
+          "left": 1149,
+          "top": 28.8,
+          "width": 640.0000000000001,
+          "height": 58,
+          "rotate": 0,
+          "viewBox": [200, 200],
+          "fixedRatio": false,
+          "fill": "transparent",
+          "path": "M 0 0 L 200 0 L 200 200 L 0 200 Z",
+          "text": {
+            "content": "<p style=><span style=\"font-family:Sans-serif\"><span style=\"font-size:36px;color:#000000;\">文本</span></span></p>",
+            "defaultColor": "#000000",
+            "defaultFontName": "Sans-serif",
+            "align": "top"
+          },
+          "outline": { "style": "solid", "width": 1, "color": "transparent" }
+        }
+      ]
+    }
+  ]
+}

File diff suppressed because it is too large
+ 0 - 0
public/json.json


+ 9 - 0
src/utils/oss-file-upload.ts

@@ -8,6 +8,8 @@ const ossType = "tencent"
 
 export default async function fileUpload(fileName: string, file: Blob) {
   loadingBar.loading(true, "资源上传中")
+  // 上传名称加上时间戳
+  fileName = addTimestampBeforeExtension(fileName)
   const resUploadSign = await getUploadSign(fileName)
   if (resUploadSign.code === 200) {
     try {
@@ -67,3 +69,10 @@ const onOnlyFileUpload = (signature: string, params: { fileName: string; file: B
     }
   })
 }
+
+function addTimestampBeforeExtension(filename: string) {
+  const dotIndex = filename.lastIndexOf(".")
+  const name = filename.substring(0, dotIndex)
+  const extension = filename.substring(dotIndex)
+  return `${name}_${Date.now()}${extension}`
+}

+ 1 - 1
src/views/pptScreen/pptScreen.vue

@@ -14,7 +14,7 @@ const slidesStore = useSlidesStore()
 
 const initLoading = ref(true)
 
-Axios.get("json.json")
+Axios.get("data.json")
   .then(res => {
     if (res.status === 200 && typeof res.data === "object") {
       const { title, width, height, theme, slides } = res.data

Some files were not shown because too many files changed in this diff