Skip to content

Commit

Permalink
update 170904 12:05
Browse files Browse the repository at this point in the history
  • Loading branch information
SPxiaomin committed Sep 4, 2017
1 parent 8793e61 commit 1966ed3
Show file tree
Hide file tree
Showing 17 changed files with 2,547 additions and 1 deletion.
32 changes: 31 additions & 1 deletion Test/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ import {

import { connect } from 'react-redux';

import { PLAY, TOGGLE_START, TOGGLE_FIRST } from './action';
import {
PLAY,
TOGGLE_START,
TOGGLE_FIRST,
CHANGE_PROGRESS,
} from './action';

// let Home = ({ counter }) => (
// );
Expand All @@ -37,6 +42,13 @@ class Home extends Component {

this.props.toggleFirst();
}

$('#player')
.on($.jPlayer.event.timeupdate, (e) => {
// console.log(e.jPlayer.status.currentTime);
// console.log(e.jPlayer.status.currentPercentAbsolute)
this.props.changeProgress(e.jPlayer.status.currentPercentAbsolute);
});
// .jPlayer('setMedia', {
// mp3: this.props.musiclist[this.props.currentIndex].file
// });
Expand All @@ -46,6 +58,10 @@ class Home extends Component {
// .jPlayer('play');
}

progressChangeHandler(e) {

}

render() {
return (
<div>
Expand All @@ -58,6 +74,16 @@ class Home extends Component {
>
isStart: {this.props.isStart ? 'STOP' : 'START'}
</button>

<hr />

<div style={{ height: '5px', backgroundColor: '#ddd' }} onClick={(e) => {
this.progressChangeHandler(e);
}}>
<div style={{ height: '5px', backgroundColor: '#2f9842', width: `${this.props.progress}%` }}>

</div>
</div>
</div>
);
}
Expand All @@ -68,6 +94,7 @@ const mapStateToHomeProps = (state) => ({
currentIndex: state.currentIndex,
isStart: state.isStart,
isFirst: state.isFirst,
progress: state.progress,
});

const mapDispatchToHomeProps = (dispatch) => ({
Expand All @@ -77,6 +104,9 @@ const mapDispatchToHomeProps = (dispatch) => ({
toggleFirst: () => {
dispatch(TOGGLE_FIRST());
},
changeProgress: (progress) => {
dispatch(CHANGE_PROGRESS(progress));
}
});

Home = withRouter(connect(
Expand Down
5 changes: 5 additions & 0 deletions Test/src/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ export const TOGGLE_START = () => ({
export const TOGGLE_FIRST = () => ({
type: 'TOGGLE_FIRST'
});

export const CHANGE_PROGRESS = (progress) => ({
type: 'CHANGE_PROGRESS',
progress,
});
6 changes: 6 additions & 0 deletions Test/src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const initState = {
],
currentIndex: 0,
isFirst: true,
progress: 0,
};

export default (state = initState, action) => {
Expand All @@ -32,6 +33,11 @@ export default (state = initState, action) => {
...state,
isFirst: !state.isFirst,
};
case 'CHANGE_PROGRESS':
return {
...state,
progress: action.progress,
};
default:
return state;
}
Expand Down
22 changes: 22 additions & 0 deletions npm-debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
0 info it worked if it ends with ok
1 verbose cli [ '/home/spxiaomin/nvm/versions/node/v6.10.0/bin/node',
1 verbose cli '/home/spxiaomin/nvm/versions/node/v6.10.0/bin/npm',
1 verbose cli 'start' ]
2 info using npm@3.10.10
3 info using node@v6.10.0
4 verbose stack Error: ENOENT: no such file or directory, open '/home/spxiaomin/gitProject/React/package.json'
4 verbose stack at Error (native)
5 verbose cwd /home/spxiaomin/gitProject/React
6 error Linux 4.8.0-59-generic
7 error argv "/home/spxiaomin/nvm/versions/node/v6.10.0/bin/node" "/home/spxiaomin/nvm/versions/node/v6.10.0/bin/npm" "start"
8 error node v6.10.0
9 error npm v3.10.10
10 error path /home/spxiaomin/gitProject/React/package.json
11 error code ENOENT
12 error errno -2
13 error syscall open
14 error enoent ENOENT: no such file or directory, open '/home/spxiaomin/gitProject/React/package.json'
15 error enoent ENOENT: no such file or directory, open '/home/spxiaomin/gitProject/React/package.json'
15 error enoent This is most likely not a problem with npm itself
15 error enoent and is related to npm not being able to find a file.
16 verbose exit [ -2, true ]
21 changes: 21 additions & 0 deletions react-performance-improve/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Loading

0 comments on commit 1966ed3

Please sign in to comment.