file author : 王佳欣
 *  email import IS from '@utils/is' ; import URI from '@utils/uri' ; export default class Router { private static formatURL ( url ) { let urlResult = '' ; if ( typeof url === 'string' && url . indexOf ( 'http' ) === 0 ) { urlResult = url ; } else if ( typeof url === 'string' ) { const uri = URI . parse ( window . location . href ) ; const port = uri . port === 80 ? '' : `:${ uri . port }` ; const finalPath = uri . path === '' ? '' : `${ uri . path }/` ; const path = url . indexOf ( '/' ) === - 1 ? finalPath : '' ; urlResult = `${ document . location . protocol }//${ uri . hostname }${ port }/${ path }${ url }` ; } else { urlResult = URI . format ( url ) ; } return urlResult ; } public static push ( url ) { window . location . href = Router . formatURL ( url ) ; } public static replace ( url ) { window . location . replace ( Router . formatURL ( url ) ) ; } public static goBack ( ) { if ( IS . isIos ( ) && document . referrer ) { Router . replace ( document . referrer ) ; } else { window . history . go ( - 1 ) ; } } public static reload ( ) { window . location . reload ( ) ; } } ;