Home.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <div class="home">
  3. <a-alert :message="message" type="info" />
  4. <!-- 重置密码 -->
  5. <a-modal
  6. class="resetPwdModal"
  7. title="重置密码"
  8. width="60%"
  9. centered
  10. :footer="null"
  11. :closable="false"
  12. :maskClosable="false"
  13. :destroyOnClose="true"
  14. @cancel="openResetPwd=false"
  15. v-model="openResetPwd">
  16. <ResetPwd />
  17. </a-modal>
  18. <!-- 新产品上线提醒 -->
  19. <a-modal
  20. class="newProductTips"
  21. title="新产品上线提醒"
  22. width="60%"
  23. centered
  24. :footer="null"
  25. :maskClosable="false"
  26. :destroyOnClose="true"
  27. @cancel="openNewProduct=false"
  28. v-model="openNewProduct">
  29. <newProduct></newProduct>
  30. </a-modal>
  31. </div>
  32. </template>
  33. <script>
  34. import { mapGetters } from 'vuex'
  35. import ResetPwd from '@/views/user/ResetPwd.vue'
  36. import newProduct from '@/views/productManagement/newProduct/modal.vue'
  37. export default {
  38. name: 'Home',
  39. components: { ResetPwd, newProduct },
  40. data () {
  41. return {
  42. message: '欢迎登录' + process.env.VUE_APP_PRO_NAME,
  43. openResetPwd: false, // 重置密码是否显示
  44. openNewProduct: false
  45. }
  46. },
  47. computed: {
  48. ...mapGetters(['mustChangePwd'])
  49. },
  50. created () {
  51. },
  52. methods: {
  53. hasNewProduct () {
  54. this.openNewProduct = true
  55. }
  56. },
  57. beforeRouteEnter (to, from, next) {
  58. next(vm => {
  59. // 判断登录用户是否重置过密码(首次登陆需强制重置密码)
  60. if (vm.mustChangePwd == 0) {
  61. vm.openResetPwd = false
  62. } else {
  63. vm.openResetPwd = true
  64. }
  65. // 判断是否有新产品上线
  66. vm.hasNewProduct()
  67. })
  68. }
  69. }
  70. </script>
  71. <style scoped>
  72. .home {
  73. /* width: 900px;
  74. margin: 0 auto;
  75. padding: 25px 0; */
  76. }
  77. </style>