pref: oos上传

feature/pay-0704-ch
ch 2 years ago
parent a5559eb9fc
commit 43bec0f46e

@ -1,3 +1,10 @@
/*
* @Author: ch
* @Date: 2022-07-07 17:27:04
* @LastEditors: ch
* @LastEditTime: 2022-07-09 11:14:35
* @Description: file content
*/
import request from '@/utils/request';
// OSS签名
export function sign(serviceName, configId) {
@ -9,23 +16,26 @@ export function sign(serviceName, configId) {
configId,
},
});
// console.info(serviceName, configId);
// return {
// accessId: 'LTAI4GHRNb5Xn2w5NeHVbR4c',
// policy: 'eyJleHBpcmF0aW9uIjoiMjAyMi0wNC0xNVQyMDowODoyNi4zMTlaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3NjAwMF0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJ0ZXN0LyJdXX0=',
// signature: 'okaB3sNp3vzyfM0S3ypudaUAZ+0=',
// dir: 'test/',
// host: 'https://msb-edu-dev.oss-cn-beijing.aliyuncs.com',
// expire: '1650053306',
// };
}
export function payCenterSign() {
return request({
url: '/payCenter/oss/ossSignature',
method: 'GET',
});
}
// 上传文件
export async function upload(serviceName, configId, file, cancelToken) {
let oss = await sign(serviceName, configId);
let oss = {};
if (serviceName) {
oss = await sign(serviceName, configId);
} else {
oss = await payCenterSign();
}
// return false;
let data = new FormData();
let arr = file.name.split('/');
arr[arr.length - 1] = encodeURIComponent(arr[arr.length - 1]);
data.append('name', arr.join('/'));
let name = file.uid + file.name.substring(file.name.lastIndexOf('.'));
data.append('name', name);
data.append('key', `${oss.dir}${'${filename}'}`);
data.append('policy', oss.policy);
data.append('OSSAccessKeyId', oss.accessId);

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-07-04 16:42:21
* @LastEditors: ch
* @LastEditTime: 2022-07-07 16:26:45
* @LastEditTime: 2022-07-09 10:38:04
* @Description: file content
-->
<template>
@ -170,7 +170,7 @@
* 上传阿里应用证书
*/
const handleUpload = async ({ file }) => {
const res = await upload('payCenter', 'application/', file);
const res = await upload(null, null, file);
form.appCertUrl = res;
};
const handleSave = async () => {

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-07-04 17:57:55
* @LastEditors: ch
* @LastEditTime: 2022-07-06 10:18:14
* @LastEditTime: 2022-07-09 10:39:00
* @Description: file content
-->
<template>
@ -100,14 +100,14 @@
* 上传公钥证书
*/
const handleUploadCert = async ({ file }) => {
const res = await upload('payCenter', 'merchant/', file);
const res = await upload(null, null, file);
form.aliPayCertUrl = res;
};
/**
* 上传根证书
*/
const handleUploadRootCert = async ({ file }) => {
const res = await upload('payCenter', 'merchant/', file);
const res = await upload(null, null, file);
form.aliPayRootCertUrl = res;
};
/**

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-07-04 17:57:45
* @LastEditors: ch
* @LastEditTime: 2022-07-06 11:18:45
* @LastEditTime: 2022-07-09 11:14:59
* @Description: file content
-->
<template>
@ -149,21 +149,22 @@
* 上传公钥证书
*/
const handleUploadCert = async ({ file }) => {
const res = await upload('payCenter', 'merchant/', file);
const res = await upload(null, null, file);
form.certOssUrl = res;
};
/**
* 上传私钥证书
*/
const handleUploadKeyCert = async ({ file }) => {
const res = await upload('payCenter', 'merchant/', file);
const res = await upload(null, null, file);
form.keyOssUrl = res;
};
/**
* 上传p12证书
*/
const handleUploadCert120 = async ({ file }) => {
const res = await upload('payCenter', 'merchant/', file);
// const res = await upload('payCenter', 'merchant/', file);
const res = await upload(null, null, file);
form.certP12OssUrl = res;
};
/**

@ -41,7 +41,7 @@
<script setup>
const store = useStore();
const route = useRoute();
const detail = reactive({});
let detail = reactive({});
const getDetail = async () => {
const res = await store.dispatch('payOrder/detail', route.params.id);
detail = Object.assign(detail, res);

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-07-07 14:29:36
* @LastEditors: ch
* @LastEditTime: 2022-07-07 15:42:44
* @LastEditTime: 2022-07-09 10:41:24
* @Description: file content
-->
<template>
@ -38,7 +38,7 @@
<script setup>
const store = useStore();
const route = useRoute();
const detail = reactive({});
let detail = reactive({});
const getDetail = async () => {
const res = await store.dispatch('refundOrder/detail', route.params.id);
detail = Object.assign(detail, res);

Loading…
Cancel
Save