index.tsx 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * <<
  3. * Davinci
  4. * ==
  5. * Copyright (C) 2016 - 2017 EDP
  6. * ==
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. * >>
  19. */
  20. import React, { useMemo, FC } from 'react'
  21. import Canvas from './Canvas'
  22. import { Route, Switch, Redirect } from 'react-router-dom'
  23. import { useSelector } from 'react-redux'
  24. import Login from 'containers/Login'
  25. import Register from 'containers/Register'
  26. import { makeSelectVersion } from 'containers/App/selectors'
  27. import JoinOrganization from 'containers/Register/JoinOrganization'
  28. import { CLIENT_VERSION } from 'app/globalConstants'
  29. const styles = require('./Background.less')
  30. export const Background: FC = () => {
  31. const version = useSelector(makeSelectVersion())
  32. const davinciVersion = useMemo(() => {
  33. return (
  34. <p>
  35. {!version ? (
  36. ''
  37. ) : CLIENT_VERSION !== version ? (
  38. <span className={styles.versionerror}>
  39. 客户端与服务端版本不一致,请更新
  40. </span>
  41. ) : (
  42. <>
  43. <b>版本: </b>
  44. <span>{version}</span>
  45. </>
  46. )}
  47. </p>
  48. )
  49. }, [version])
  50. return (
  51. <div className={styles.container}>
  52. <Canvas />
  53. {/*<img*/}
  54. {/* className={styles.logo}*/}
  55. {/* src={require('assets/images/logo_light.svg')}*/}
  56. {/*/>*/}
  57. <Switch>
  58. <Route path="/login" component={Login} />
  59. <Route path="/register" component={Register} />
  60. <Route path="/joinOrganization" component={JoinOrganization} />
  61. {/*<Redirect to="/login" />*/}
  62. </Switch>
  63. <div className={styles.version}>{davinciVersion}</div>
  64. </div>
  65. )
  66. }
  67. export default Background