修改oss

This commit is contained in:
2025-11-05 15:18:14 +08:00
parent 650fa9e20e
commit 41ff23e97e
3 changed files with 10 additions and 7 deletions
+6 -6
View File
@@ -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
View File
@@ -3,6 +3,9 @@ const routes = [
{
path: "/",
component: () => import("@/views/info"),
},{
path: "/invoice",
component: () => import("@/views/invoice"),
},
];
+1 -1
View File
@@ -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();