/six_detective

This is project for driving equipment.

Primary LanguageJavaScript

Super LOP Web

Environment Prepare

Install node_modules:

npm install --registry=https://registry.npm.taobao.org

or

yarn

Provided Scripts

Scripts provided in package.json. It's safe to modify or add additional script:

Start project

npm start

Build project

npm run build

Check code style

npm run lint

You can also use script to auto fix some lint error:

npm run lint:fix

Test code

npm test

Requset Tips

  1. common response data
// ...code
+flag === 1 ? { items } : { msg: msg || 'response data error' };

// model
const { items, msg } = yield call(/* url */,/* params */)
  1. unified error handle, just deal with status code
function errorHandler(error) {
  const { response } = error;

  if (response.status) {
    const { status, statusText, url } = response;
    const errorText = codeMessage[status] || statusText;
    notification.error({
      message: errorText,
      description: `request error ${status}: ${/[^/]*\.json/.exec(url)}`,
    });
  }
  return response;
}
  1. model error capture by manual
*queryOrgs({params},{call,put}){
  // ...code
  throw new Error(/* error message*/)
}
export const dva = {
  config: {
    onError(e) {
      // if it's comment,component can not capture error
      e.preventDefault();
      notification.error({
        message: 'oops error!!!',
        description: e.toString(),
      });
    },
  },
};
  1. async request error capture in component
*queryOrgs(action, { call, put }) {
  // ...code
  return Promise.reject(/* error message*/)
}
dispatch({
  type:'queryOrgs'
  params: // {...}
}).catch(err=>{
  // receive err message
})

abbreviation list

  • LOP: Large Open Positions
  • BI: Beneficial Identity
  • TO: Transaction Originator
  • ECP: Electronic Communication Platform
  • EP: Exchange Participant
  • CA: Capital