Browse Source

修改oss

zhuyiyi 1 month ago
parent
commit
41ff23e97e
3 changed files with 10 additions and 7 deletions
  1. 6 6
      src/components/FileUpload/index.vue
  2. 3 0
      src/router/index.js
  3. 1 1
      src/views/info.vue

+ 6 - 6
src/components/FileUpload/index.vue

@@ -55,7 +55,7 @@
       </template>
     </el-upload>
     <el-dialog v-model="dialogVisible">
-      <img :src="dialogImageUrl" alt="Preview Image" style="width: 100%;"/>
+      <img :src="dialogImageUrl" alt="Preview Image" style="width: 100%" />
     </el-dialog>
   </div>
 </template>
@@ -78,7 +78,7 @@ const props = defineProps({
 
 const emit = defineEmits();
 const uploadList = ref([]);
-const baseUrl = "https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/";
+const baseUrl = "https://ltcloudfile.oss-cn-hangzhou.aliyuncs.com/";
 const fileList = ref([]);
 const dialogImageUrl = ref("");
 const dialogVisible = ref(false);
@@ -241,13 +241,13 @@ function handleChange(file, fileList) {
   let fileDir = dayjs().format("YYYYMMDD");
   const client = new OSS({
     // yourregion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。
-    region: "oss-cn-fuzhou",
+    region: "oss-cn-hangzhou",
     // 从环境变量中获取访问凭证。运行本代码示例之前,请确保已设置环境变量OSS_ACCESS_KEY_ID和OSS_ACCESS_KEY_SECRET。
     accessKeyId: process.env.VUE_APP_OSS_ACCESS_KEY_ID,
     accessKeySecret: process.env.VUE_APP_OSS_ACCESS_KEY_SECRET,
     // 填写存储空间名称。
-    bucket: "dfdiyfile",
-    endpoint: "https://oss-cn-fuzhou.aliyuncs.com",
+    bucket: "ltcloudfile",
+    endpoint: "https://oss-cn-hangzhou.aliyuncs.com",
   });
   let name = "desgn/" + fileDir + "/" + guid() + getSuff(file.name);
   // storeAs表示上传的object name , file表示上传的文件
@@ -257,7 +257,7 @@ function handleChange(file, fileList) {
     })
     .then((result) => {
       console.log(result);
-      let url = `https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/${result.name}`;
+      let url = `https://ltcloudfile.oss-cn-hangzhou.aliyuncs.com/${result.name}`;
       /**
        * 设置本地上传成功的回调
        */

+ 3 - 0
src/router/index.js

@@ -3,6 +3,9 @@ const routes = [
   {
     path: "/",
     component: () => import("@/views/info"),
+  },{
+    path: "/invoice",
+    component: () => import("@/views/invoice"),
   },
 ];
 

+ 1 - 1
src/views/info.vue

@@ -54,7 +54,7 @@ import { getFormData, saveFormData } from "../api/index";
 import { useRouter } from "vue-router";
 import { ElMessage } from "element-plus";
 import { handleBatchDownload } from "../utils/downFile";
-const baseUrl = "https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/";
+const baseUrl = "https://ltcloudfile.oss-cn-hangzhou.aliyuncs.com/";
 import { ref } from "vue";
 import FileUpload from "../components/FileUpload/index";
 const { currentRoute } = useRouter();