forked from p96170835/amis
audio 增加在table中显示
This commit is contained in:
parent
fc78161f0f
commit
d5c2aee4d0
|
@ -10,6 +10,11 @@ export default {
|
||||||
label: "ID",
|
label: "ID",
|
||||||
type: "text"
|
type: "text"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "audio",
|
||||||
|
label: "音频",
|
||||||
|
type: "audio"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "carousel",
|
name: "carousel",
|
||||||
label: "轮播图",
|
label: "轮播图",
|
||||||
|
|
|
@ -6,6 +6,7 @@ export default {
|
||||||
{
|
{
|
||||||
"type": "video",
|
"type": "video",
|
||||||
"autoPlay": false,
|
"autoPlay": false,
|
||||||
|
"rates": [1.0, 1.5, 2.0],
|
||||||
"src": "https://media.w3.org/2010/05/sintel/trailer_hd.mp4",
|
"src": "https://media.w3.org/2010/05/sintel/trailer_hd.mp4",
|
||||||
"poster": "https://video-react.js.org/assets/poster.png"
|
"poster": "https://video-react.js.org/assets/poster.png"
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ module.exports = function(req, res) {
|
||||||
title: '{{name.title}}',
|
title: '{{name.title}}',
|
||||||
description: '{{lorem.words}}'
|
description: '{{lorem.words}}'
|
||||||
}), Math.round(Math.random() * 10)),
|
}), Math.round(Math.random() * 10)),
|
||||||
|
audio: 'https://news-bos.cdn.bcebos.com/mvideo/%E7%9A%87%E5%90%8E%E5%A4%A7%E9%81%93%E4%B8%9C.aac',
|
||||||
carousel: [
|
carousel: [
|
||||||
{
|
{
|
||||||
image: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg'
|
image: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "amis",
|
"name": "amis",
|
||||||
"version": "1.0.0-rc.2",
|
"version": "1.0.0-rc.3",
|
||||||
"description": "一种MIS页面生成工具",
|
"description": "一种MIS页面生成工具",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-placeholder {
|
&-placeholder {
|
||||||
|
@ -170,7 +171,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&-option {
|
&-option {
|
||||||
min-width: px2rem(100px);
|
|
||||||
padding: (
|
padding: (
|
||||||
$Form-select-menu-height - $Form-input-lineHeight *
|
$Form-select-menu-height - $Form-input-lineHeight *
|
||||||
$Form-input-fontSize - px2rem(2px)
|
$Form-input-fontSize - px2rem(2px)
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { RendererData, Action } from './types';
|
||||||
interface ScopedComponentType extends React.Component<RendererProps> {
|
interface ScopedComponentType extends React.Component<RendererProps> {
|
||||||
doAction?: (action: Action, data: RendererData, throwErrors?: boolean) => void;
|
doAction?: (action: Action, data: RendererData, throwErrors?: boolean) => void;
|
||||||
receive?: (values: RendererData, subPath?: string) => void;
|
receive?: (values: RendererData, subPath?: string) => void;
|
||||||
reload?: (subPpath?:string, query?:RendererData | null, ctx?: RendererData) => void;
|
reload?: (subPath?:string, query?:RendererData | null, ctx?: RendererData) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ export interface AudioProps extends RendererProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AudioState {
|
export interface AudioState {
|
||||||
|
src?: string;
|
||||||
isReady?: boolean;
|
isReady?: boolean;
|
||||||
muted?: boolean;
|
muted?: boolean;
|
||||||
playing?: boolean;
|
playing?: boolean;
|
||||||
|
@ -47,6 +48,7 @@ export class Audio extends React.Component<AudioProps, AudioState> {
|
||||||
};
|
};
|
||||||
|
|
||||||
state: AudioState = {
|
state: AudioState = {
|
||||||
|
src: this.props.value || this.props.src || '',
|
||||||
isReady: false,
|
isReady: false,
|
||||||
muted: false,
|
muted: false,
|
||||||
playing: false,
|
playing: false,
|
||||||
|
@ -79,7 +81,7 @@ export class Audio extends React.Component<AudioProps, AudioState> {
|
||||||
@autobind
|
@autobind
|
||||||
progress() {
|
progress() {
|
||||||
clearTimeout(this.progressTimeout);
|
clearTimeout(this.progressTimeout);
|
||||||
if (this.props.src && this.audio) {
|
if (this.state.src && this.audio) {
|
||||||
const currentTime = this.audio.currentTime || 0;
|
const currentTime = this.audio.currentTime || 0;
|
||||||
const duration = this.audio.duration;
|
const duration = this.audio.duration;
|
||||||
const played = currentTime / duration;
|
const played = currentTime / duration;
|
||||||
|
@ -116,7 +118,7 @@ export class Audio extends React.Component<AudioProps, AudioState> {
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
handleMute() {
|
handleMute() {
|
||||||
if (!this.props.src) {
|
if (!this.state.src) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const {muted, prevVolume} = this.state;
|
const {muted, prevVolume} = this.state;
|
||||||
|
@ -130,7 +132,7 @@ export class Audio extends React.Component<AudioProps, AudioState> {
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
handlePlaying() {
|
handlePlaying() {
|
||||||
if (!this.props.src) {
|
if (!this.state.src) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let playing = this.state.playing;
|
let playing = this.state.playing;
|
||||||
|
@ -142,7 +144,7 @@ export class Audio extends React.Component<AudioProps, AudioState> {
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
getCurrentTime() {
|
getCurrentTime() {
|
||||||
if (!this.audio || !this.props.src || !this.state.isReady) {
|
if (!this.audio || !this.state.src || !this.state.isReady) {
|
||||||
return '0:00';
|
return '0:00';
|
||||||
}
|
}
|
||||||
const duration = this.audio.duration;
|
const duration = this.audio.duration;
|
||||||
|
@ -152,7 +154,7 @@ export class Audio extends React.Component<AudioProps, AudioState> {
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
getDuration() {
|
getDuration() {
|
||||||
if (!this.audio || !this.props.src) {
|
if (!this.audio || !this.state.src) {
|
||||||
return '0:00';
|
return '0:00';
|
||||||
}
|
}
|
||||||
if (!this.state.isReady) {
|
if (!this.state.isReady) {
|
||||||
|
@ -180,7 +182,7 @@ export class Audio extends React.Component<AudioProps, AudioState> {
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
onSeekChange(e: any) {
|
onSeekChange(e: any) {
|
||||||
if (!this.props.src) {
|
if (!this.state.src) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const played = e.target.value;
|
const played = e.target.value;
|
||||||
|
@ -212,7 +214,7 @@ export class Audio extends React.Component<AudioProps, AudioState> {
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
setVolume(e: any) {
|
setVolume(e: any) {
|
||||||
if (!this.props.src) {
|
if (!this.state.src) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const volume = e.target.value;
|
const volume = e.target.value;
|
||||||
|
@ -242,7 +244,7 @@ export class Audio extends React.Component<AudioProps, AudioState> {
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
toggleHandlePlaybackRate() {
|
toggleHandlePlaybackRate() {
|
||||||
if (!this.props.src) {
|
if (!this.state.src) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -252,7 +254,7 @@ export class Audio extends React.Component<AudioProps, AudioState> {
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
toggleHandleVolume(type: boolean) {
|
toggleHandleVolume(type: boolean) {
|
||||||
if (!this.props.src) {
|
if (!this.state.src) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -370,13 +372,12 @@ export class Audio extends React.Component<AudioProps, AudioState> {
|
||||||
const {
|
const {
|
||||||
className,
|
className,
|
||||||
inline,
|
inline,
|
||||||
src,
|
|
||||||
autoPlay,
|
autoPlay,
|
||||||
loop,
|
loop,
|
||||||
controls,
|
controls,
|
||||||
classnames: cx
|
classnames: cx
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const {muted} = this.state;
|
const {muted, src} = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cx('Audio', className, inline ? 'Audio--inline' : '')}>
|
<div className={cx('Audio', className, inline ? 'Audio--inline' : '')}>
|
||||||
|
|
Loading…
Reference in New Issue