Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
web-purchase
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张冬
web-purchase
Commits
a12de9cd
Commit
a12de9cd
authored
Nov 10, 2020
by
张冬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OSS配置,按钮间距
parent
b76f3bc1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
22 deletions
+19
-22
ali-oss.js
src/api/ali-oss.js
+19
-22
index.css
src/assets/css/theme-green/index.css
+0
-0
No files found.
src/api/ali-oss.js
View file @
a12de9cd
...
@@ -8,27 +8,24 @@ let OSS = require('ali-oss');
...
@@ -8,27 +8,24 @@ let OSS = require('ali-oss');
* [region] {String}:bucket所在的区域, 默认oss-cn-hangzhou。
* [region] {String}:bucket所在的区域, 默认oss-cn-hangzhou。
*/
*/
let
client
=
new
OSS
({
let
client
=
new
OSS
({
// region: 'oss-cn-beijing',
// //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,部署在服务端使用RAM子账号或STS,部署在客户端使用STS。
// accessKeyId: 'LTAI4GG1zbSAQrjAvWL8bJKX',
// accessKeySecret: '06yXwRMA5ppeTb0hI29lG3jQqwr4A8',
// bucket: 'hsz1997'
region
:
'oss-cn-beijing'
,
region
:
'oss-cn-beijing'
,
//云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,部署在服务端使用RAM子账号或STS,部署在客户端使用STS。
//云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,部署在服务端使用RAM子账号或STS,部署在客户端使用STS。
accessKeyId
:
'LTAI4GG1zbSAQrjAvWL8bJKX'
,
accessKeyId
:
'LTAI4FyVepQBtS7P6waqWbjC'
,
accessKeySecret
:
'06yXwRMA5ppeTb0hI29lG3jQqwr4A8'
,
accessKeySecret
:
'Fu97bC8ygDnsef8dhXlU4ZEaB2gNDM'
,
bucket
:
'hsz1997'
bucket
:
'jieancai'
// region: 'oss-cn-beijing.aliyuncs.com',
// bucket: 'jieancai',
// accesskeyId: 'LTAI4FyVepQBtS7P6waqWbjC',
// accesskeySecret: 'Fu97bC8ygDnsef8dhXlU4ZEaB2gNDM',
});
});
/**
/**
* 上传文件,大小不能超过5GB
* @param {string} ObjName OSS的储存路径和文件名字
* @param {string} fileUrl 本地文件
*
* @retruns Promise
*/
*/
export
const
put
=
async
(
ObjName
,
fileUrl
)
=>
{
export
const
put
=
async
(
ObjName
,
fileUrl
)
=>
{
try
{
try
{
console
.
log
(
ObjName
,
fileUrl
)
let
result
=
await
client
.
put
(
`/img/
${
ObjName
}
`
,
fileUrl
);
let
result
=
await
client
.
put
(
`/img/
${
ObjName
}
`
,
fileUrl
);
// AAA为文件夹, ObjName为文件名字,可以只写名字,就直接储存在 bucket 的根路径
// AAA为文件夹, ObjName为文件名字,可以只写名字,就直接储存在 bucket 的根路径
return
result
;
return
result
;
...
@@ -44,12 +41,12 @@ export const getFileNameUUID = () => {
...
@@ -44,12 +41,12 @@ export const getFileNameUUID = () => {
return
`
${
+
new
Date
()}
_
${
rx
()}${
rx
()}
`
;
return
`
${
+
new
Date
()}
_
${
rx
()}${
rx
()}
`
;
};
};
export
function
client1
(
data
)
{
//
export function client1(data) {
//data后端提供数据
//
//data后端提供数据
return
new
OSS
({
//
return new OSS({
region
:
data
.
region
,
//
region: data.region,
accessKeyId
:
data
.
accessKeyId
,
//
accessKeyId: data.accessKeyId,
accessKeySecret
:
data
.
accessKeySecret
,
//
accessKeySecret: data.accessKeySecret,
bucket
:
data
.
bucket
//
bucket: data.bucket
});
//
});
}
//
}
src/assets/css/theme-green/index.css
View file @
a12de9cd
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment