Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ Qiniu-JavaScript-SDK 为客户端 SDK,没有包含 `token` 生成实现,为

Qiniu-JavaScript-SDK 的示例 [Demo](http://jssdk-v2.demo.qiniu.io) 中的服务器端部分是基于 [Node.js 服务器端 SDK](https://developer.qiniu.com/kodo/sdk/nodejs) 开发的。

* [JavaScript SDK 在线示例](http://jssdk-v2.demo.qiniu.io/)
* [JavaScript SDK 在线示例 V3](https://js-sdk-demo.qiniu.io)
* [JavaScript SDK 在线示例 V2](http://jssdk-v2.demo.qiniu.io)
Comment on lines +43 to +44
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这 v2 v3 语义不是很明确,一开始根本想不出来是 js sdk 的版本… 还以为是 demo 的版本 = =
文档开头说的 2.x 3.x 这里怎么就成了 v2 v3 术语不配套?
而且对这个文档来说,v3 本来就是配套的,v2 才是奇怪的那个… 比如上面就有 v2 的文档入口,这个为什么是例外


<!--
本 SDK 可使开发者忽略上传底层实现细节,而更多的关注 UI 层的展现。
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import classnames from './style.less'

export const App = () => {
const [fileList, setFileList] = React.useState<UniqueFile[]>([])
const [settingVisible, setSettingVisible] = React.useState(false)
const [settingVisible, setSettingVisible] = React.useState(true)

const selectFile = (file: UniqueFile) => {
setFileList(files => [file, ...files])
Expand Down
4 changes: 2 additions & 2 deletions site/src/components/Input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as React from 'react'
import classnames from './style.less'

interface IProps {
value: string | undefined
onChange(v: string | undefined): void
value: string
onChange(v: string): void

placeholder?: string | undefined
}
Expand Down
50 changes: 48 additions & 2 deletions site/src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,50 @@ import * as React from 'react'
import qiniuLogo from './assets/logo.svg'
import classnames from './style.less'

function Copyright() {
return (
<>
© {new Date().getFullYear()} <a href="https://www.qiniu.com/" rel="noopener" target="_blank">七牛云</a>
</>
)
}

function OfficialDoc() {
return (
<a
rel="noopener"
target="_blank"
href="http://developer.qiniu.com/code/v6/sdk/javascript.html"
>
官方文档
</a>
)
}

function Issue() {
return (
<a
rel="noopener"
target="_blank"
href="https://github.com/qiniu/js-sdk/issues"
>
上报问题
</a>
)
}

function V2Link() {
return (
<a
rel="noopener"
target="_blank"
href="http://jssdk-v2.demo.qiniu.io"
>
V2版本
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

术语统一 & 空格

</a>
)
}

interface IProps { }

export function Layout(props: React.PropsWithChildren<IProps>) {
Expand All @@ -13,8 +57,10 @@ export function Layout(props: React.PropsWithChildren<IProps>) {
{props.children}
</div>
<footer className={classnames.footer}>
对象存储文件上传 DEMO
© {new Date().getFullYear()} <a href="https://www.qiniu.com/" rel="noopener" target="_blank" >七牛云</a>
对象存储文件上传 DEMO <Copyright />
<OfficialDoc />
<Issue />
<V2Link />
</footer>
</>
)
Expand Down
11 changes: 10 additions & 1 deletion site/src/components/Layout/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,17 @@
text-align: center;

a {
color: #777;
color: inherit;
outline: none;
}

a:hover {
color: rgb(44, 178, 255);
outline: none;
text-decoration: none;
}

a + a {
margin-left: 0.5rem;
}
}
11 changes: 6 additions & 5 deletions site/src/components/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ interface IProps { }

export function Settings(props: IProps) {
const setting = React.useMemo(() => utils.loadSetting(), [])
const [uphost, seUphost] = React.useState<string | undefined>(setting.uphost)
const [deadline, setDeadline] = React.useState<number>(setting.deadline || 0)
const [assessKey, setAssessKey] = React.useState<string | undefined>(setting.assessKey)
const [secretKey, setSecretKey] = React.useState<string | undefined>(setting.secretKey)
const [bucketName, setBucketName] = React.useState<string | undefined>(setting.bucketName)

const [deadline, setDeadline] = React.useState<number>(0)
const [uphost, seUphost] = React.useState<string>(setting.uphost || '')
const [assessKey, setAssessKey] = React.useState<string>(setting.assessKey || '')
const [secretKey, setSecretKey] = React.useState<string>(setting.secretKey || '')
const [bucketName, setBucketName] = React.useState<string>(setting.bucketName || '')

React.useEffect(() => {
utils.saveSetting({
Expand Down
16 changes: 15 additions & 1 deletion site/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
const ESLintPlugin = require('eslint-webpack-plugin')
const WebpackBar = require('webpackbar')

const htmlTemp = `
<!DOCTYPE html>
<html>
<head>
<title state-data-title="">七牛云 - JS SDK 示例 V3</title>
<meta name="viewport" content="initial-scale=1.0,width=device-width,user-scalable=no">
<link rel="shortcut icon" href="https://qiniu.staticfile.org/favicon.ico" type="image/vnd.microsoft.icon">
</head>
<body>
<div id="root"></div>
</body>
</html>
`

module.exports = {
context: path.join(__dirname, 'src'),
devtool: 'source-map',
Expand Down Expand Up @@ -71,7 +85,7 @@ module.exports = {

plugins: [
new HtmlWebpackPlugin({
templateContent: '<!DOCTYPE html><html><body><div id="root"></div></body></html>',
templateContent: htmlTemp,
inject: 'head'
}),
new HotModuleReplacementPlugin(),
Expand Down