Browse Source

feat: 上传apk使用同一个cdn url

qiji
nili 6 months ago
parent
commit
a701f9c589
  1. 2
      dist/_umi_route_preload_helper.d525eb24.js
  2. 4
      dist/index.html
  3. 1
      dist/p__App__AppManagement.4cf1b18c.async.js
  4. 1
      dist/p__App__AppManagement.7b88d7c4.async.js
  5. 2
      dist/umi.e0c98130.js
  6. 1
      src/pages/App/AppBasicConfigForm.tsx
  7. 16
      src/pages/OSSUpload.tsx

2
dist/_umi_route_preload_helper.dcc239ae.js → dist/_umi_route_preload_helper.d525eb24.js

@ -1 +1 @@
!function(){"use strict";var t="/".replace(/([^/])$/,"$1/"),e=location.pathname,n=e.startsWith(t)&&decodeURI("/".concat(e.slice(t.length)));if(n){var a=document,c=a.head,r=a.createElement.bind(a),i=function(t,e,n){var a,c=e.r[t]||(null===(a=Object.entries(e.r).find((function(e){var n=e[0];return new RegExp("^".concat(n.replace(/\/:[^/]+/g,"/[^/]+").replace("/*","/.+"),"$")).test(t)})))||void 0===a?void 0:a[1]);return null==c?void 0:c.map((function(t){var a=e.f[t][1],c=e.f[t][0];return{type:c.split(".").pop(),url:"".concat(n.publicPath).concat(c),attrs:[["data-".concat(e.b),"".concat(e.p,":").concat(a)]]}}))}(n,{"p":"ant-design-pro","b":"webpack","f":[["51.a2ea1b3b.async.js",51],["134.6fc81d91.async.js",134],["169.57647c7d.async.js",169],["p__Welcome.61596037.async.js",185],["p__MoneyManagement.7ad34f8d.async.js",190],["247.3fe8fb10.async.js",247],["t__plugin-layout__Layout.6cae69f5.chunk.css",301],["t__plugin-layout__Layout.4594a64b.async.js",301],["p__User__Login__index.9d3ab92e.async.js",366],["p__DeviceOwnerApp.c61abcd9.async.js",371],["390.41467286.async.js",390],["393.38316f72.async.js",393],["397.fb5f72c1.async.js",397],["p__SuperAdmin.92290426.async.js",455],["p__Proxy__ProxyUserManagement.7f03f17a.async.js",526],["531.4c68f902.async.js",531],["539.49b7b156.async.js",539],["p__AdvRecordListV2.7d43902a.async.js",542],["p__Bind.b6ee068f.async.js",557],["559.016bfdbb.async.js",559],["p__404.0c100574.async.js",571],["635.20e45f05.async.js",635],["p__App__AppManagement.7b88d7c4.async.js",731],["p__AdminManagement.16f4328b.async.js",816],["822.4ba8fa04.async.js",822],["841.614ef4c0.async.js",841],["p__AdvRecordList.fc092f59.async.js",857],["p__UserManagement.5e827801.async.js",903],["905.6e225d1b.async.js",905],["930.fca7adbf.async.js",930],["942.561ac28f.async.js",942],["p__Proxy__ProxyAdvRecordListV2.edf1fabd.async.js",990]],"r":{"/*":[20,28],"/":[1,6,7,19,21,28],"/welcome":[1,2,3,11,19,29,6,7,21,28],"/super":[0,1,2,5,13,15,16,24,28,29,6,7,19,21],"/adminList":[0,1,2,23,24,30,6,7,19,21,28],"/bind":[1,2,11,12,18,19,29,6,7,21,28],"/appList":[0,1,2,5,12,15,16,22,24,28,29,6,7,19,21],"/advList/:code":[0,1,2,15,16,19,24,25,26,28,29,6,7,21],"/advListV2/:code":[0,1,2,15,16,17,19,24,25,28,29,6,7,21],"/user/:code":[0,1,2,15,16,24,27,28,29,6,7,19,21],"/money/:code":[0,1,2,4,15,16,24,28,29,6,7,19,21],"/app/:code":[0,1,2,9,15,16,19,24,25,28,29,6,7,21],"/user/login":[1,2,8,15,24],"/proxy/advListV2/:code":[0,1,2,15,16,19,24,25,28,29,31,6,7,21],"/proxy/user/:code":[0,1,2,14,15,16,24,28,29,6,7,19,21]}},{publicPath:"/"});null==i||i.forEach((function(t){var e,n=t.type,a=t.url;if("js"===n)(e=r("script")).src=a,e.async=!0;else{if("css"!==n)return;(e=r("link")).href=a,e.rel="preload",e.as="style"}t.attrs.forEach((function(t){e.setAttribute(t[0],t[1]||"")})),c.appendChild(e)}))}}();
!function(){"use strict";var t="/".replace(/([^/])$/,"$1/"),e=location.pathname,n=e.startsWith(t)&&decodeURI("/".concat(e.slice(t.length)));if(n){var a=document,c=a.head,r=a.createElement.bind(a),i=function(t,e,n){var a,c=e.r[t]||(null===(a=Object.entries(e.r).find((function(e){var n=e[0];return new RegExp("^".concat(n.replace(/\/:[^/]+/g,"/[^/]+").replace("/*","/.+"),"$")).test(t)})))||void 0===a?void 0:a[1]);return null==c?void 0:c.map((function(t){var a=e.f[t][1],c=e.f[t][0];return{type:c.split(".").pop(),url:"".concat(n.publicPath).concat(c),attrs:[["data-".concat(e.b),"".concat(e.p,":").concat(a)]]}}))}(n,{"p":"ant-design-pro","b":"webpack","f":[["51.a2ea1b3b.async.js",51],["134.6fc81d91.async.js",134],["169.57647c7d.async.js",169],["p__Welcome.61596037.async.js",185],["p__MoneyManagement.7ad34f8d.async.js",190],["247.3fe8fb10.async.js",247],["t__plugin-layout__Layout.6cae69f5.chunk.css",301],["t__plugin-layout__Layout.4594a64b.async.js",301],["p__User__Login__index.9d3ab92e.async.js",366],["p__DeviceOwnerApp.c61abcd9.async.js",371],["390.41467286.async.js",390],["393.38316f72.async.js",393],["397.fb5f72c1.async.js",397],["p__SuperAdmin.92290426.async.js",455],["p__Proxy__ProxyUserManagement.7f03f17a.async.js",526],["531.4c68f902.async.js",531],["539.49b7b156.async.js",539],["p__AdvRecordListV2.7d43902a.async.js",542],["p__Bind.b6ee068f.async.js",557],["559.016bfdbb.async.js",559],["p__404.0c100574.async.js",571],["635.20e45f05.async.js",635],["p__App__AppManagement.4cf1b18c.async.js",731],["p__AdminManagement.16f4328b.async.js",816],["822.4ba8fa04.async.js",822],["841.614ef4c0.async.js",841],["p__AdvRecordList.fc092f59.async.js",857],["p__UserManagement.5e827801.async.js",903],["905.6e225d1b.async.js",905],["930.fca7adbf.async.js",930],["942.561ac28f.async.js",942],["p__Proxy__ProxyAdvRecordListV2.edf1fabd.async.js",990]],"r":{"/*":[20,28],"/":[1,6,7,19,21,28],"/welcome":[1,2,3,11,19,29,6,7,21,28],"/super":[0,1,2,5,13,15,16,24,28,29,6,7,19,21],"/adminList":[0,1,2,23,24,30,6,7,19,21,28],"/bind":[1,2,11,12,18,19,29,6,7,21,28],"/appList":[0,1,2,5,12,15,16,22,24,28,29,6,7,19,21],"/advList/:code":[0,1,2,15,16,19,24,25,26,28,29,6,7,21],"/advListV2/:code":[0,1,2,15,16,17,19,24,25,28,29,6,7,21],"/user/:code":[0,1,2,15,16,24,27,28,29,6,7,19,21],"/money/:code":[0,1,2,4,15,16,24,28,29,6,7,19,21],"/app/:code":[0,1,2,9,15,16,19,24,25,28,29,6,7,21],"/user/login":[1,2,8,15,24],"/proxy/advListV2/:code":[0,1,2,15,16,19,24,25,28,29,31,6,7,21],"/proxy/user/:code":[0,1,2,14,15,16,24,28,29,6,7,19,21]}},{publicPath:"/"});null==i||i.forEach((function(t){var e,n=t.type,a=t.url;if("js"===n)(e=r("script")).src=a,e.async=!0;else{if("css"!==n)return;(e=r("link")).href=a,e.rel="preload",e.as="style"}t.attrs.forEach((function(t){e.setAttribute(t[0],t[1]||"")})),c.appendChild(e)}))}}();

4
dist/index.html

@ -7,10 +7,10 @@
<title>Ant Design Pro</title>
<link rel="stylesheet" href="/umi.1ca9308c.css">
<script async src="/scripts/loading.js"></script>
<script src="/_umi_route_preload_helper.dcc239ae.js"></script>
<script src="/_umi_route_preload_helper.d525eb24.js"></script>
</head>
<body>
<div id="root"></div>
<script src="/umi.fe244e1a.js"></script>
<script src="/umi.e0c98130.js"></script>
</body>
</html>

1
dist/p__App__AppManagement.4cf1b18c.async.js

File diff suppressed because one or more lines are too long

1
dist/p__App__AppManagement.7b88d7c4.async.js

File diff suppressed because one or more lines are too long

2
dist/umi.fe244e1a.js → dist/umi.e0c98130.js

File diff suppressed because one or more lines are too long

1
src/pages/App/AppBasicConfigForm.tsx

@ -80,6 +80,7 @@ const AppBasicConfigForm: React.FC<AppBasicConfigFormProps> = (props) => {
<Input />
</Form.Item>
<OSSUpload
url={props.appCode}
onUploadSuccess={(url: string, file: File) => {
form.setFieldsValue({ url: url, fileSize: formatByte(file.size) });
}}

16
src/pages/OSSUpload.tsx

@ -1,16 +1,17 @@
import { getSts } from '@/services/matrix/admin';
import { toMD5 } from '@/utils/encryptUtil';
import { InboxOutlined } from '@ant-design/icons';
import OSS from 'ali-oss';
import { Button, message, Upload, UploadFile, UploadProps } from 'antd';
import React, { useEffect, useState } from 'react';
import { getSts } from '../services/matrix/admin';
interface OSSUploadProps {
onUploadSuccess?: (fileUrl: string, file: File) => void;
onUploadError?: (error: any) => void;
url?: string;
}
const OSSUpload: React.FC<OSSUploadProps> = ({ onUploadSuccess, onUploadError }) => {
const OSSUpload: React.FC<OSSUploadProps> = ({ onUploadSuccess, onUploadError, url }) => {
const [uploading, setUploading] = useState(false);
const [ossClient, setOssClient] = useState<OSS | null>(null);
const [fileList, setFileList] = useState<UploadFile[]>([]);
@ -57,8 +58,15 @@ const OSSUpload: React.FC<OSSUploadProps> = ({ onUploadSuccess, onUploadError })
},
]);
try {
const md5 = await toMD5(file);
const fileName = `matrix/${md5}.${file.name.split('.').pop()}`;
const suffix = file.name.split('.').pop();
let fileName;
if (!url) {
const md5 = await toMD5(file);
fileName = `matrix/${md5}.${suffix}`;
} else {
fileName = `matrix/${url}.${suffix}`;
}
await ossClient?.put(fileName, file, {
headers: {
'Content-Type': file.type,

Loading…
Cancel
Save