Register.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <el-container>
  3. <el-main>
  4. <login-bar />
  5. <router-view />
  6. <el-row class="movie-list">
  7. <el-col :md="8" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px" />
  8. <el-col :md="8" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px" />
  9. <el-col :md="8" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
  10. <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px; text-align: center">
  11. <el-card class="box-card">
  12. <div slot="header" class="clearfix">
  13. <span>注册帐号</span>
  14. </div>
  15. <div class="text item">
  16. <el-form v-if="registryEnable" ref="form" :model="userRegistry" label-width="100px">
  17. <el-form-item label="帐号" label-width="90px">
  18. <el-input
  19. v-model="userRegistry.principal"
  20. placeholder="请输入邮箱或手机号"
  21. style="width: 45%; padding-right: 5px"
  22. clearable
  23. />
  24. <el-button :disabled="isBtn" @click="registerVerifyCode">{{ code }}</el-button>
  25. </el-form-item>
  26. <el-form-item label="验证码" label-width="90px">
  27. <el-input
  28. v-model="userRegistry.verifyCode"
  29. placeholder="请输入短信验证码"
  30. style="padding-right: 1px"
  31. clearable
  32. />
  33. </el-form-item>
  34. <el-form-item label="密码" label-width="90px">
  35. <el-input
  36. v-model="userRegistry.credential"
  37. type="password"
  38. placeholder="请输入密码"
  39. style="padding-right: 1px"
  40. clearable
  41. />
  42. </el-form-item>
  43. <el-form-item label="图形验证码" label-width="90px">
  44. <el-image :src="captchaCode" @click="getCaptcha" />
  45. <el-input
  46. v-model="userRegistry.captchaCode"
  47. placeholder="请输入图形验证码"
  48. style="width: 50%; padding-right: 10px"
  49. clearable
  50. />
  51. </el-form-item>
  52. </el-form>
  53. <div v-else class="text item">
  54. <span>系统当前未开放注册</span>
  55. </div>
  56. <el-button v-if="registryEnable" type="primary" :loading="isLoading" @click.native="registerBtn">注册</el-button>
  57. <el-button type="plain" @click="login">返回登入</el-button>
  58. </div>
  59. </el-card>
  60. </el-row>
  61. </el-col>
  62. </el-row>
  63. </el-main>
  64. </el-container>
  65. </template>
  66. <script>
  67. import { userMixin } from 'assets/js/mixin'
  68. import LoginBar from 'components/layout/LoginBar'
  69. import { getRegistryStatus } from '@/api/account'
  70. export default {
  71. name: 'Register',
  72. components: {
  73. LoginBar
  74. },
  75. mixins: [userMixin],
  76. data() {
  77. return {
  78. registryEnable: false
  79. }
  80. },
  81. watch: {
  82. $route() {
  83. this.$router.go()
  84. }
  85. },
  86. mounted() {
  87. this.getData()
  88. },
  89. created() {
  90. document.title = '注册帐号'
  91. },
  92. methods: {
  93. getData() {
  94. getRegistryStatus().then(resp => {
  95. if (resp.code === 0) {
  96. this.registryEnable = resp.data
  97. if (this.registryEnable) {
  98. this.fetchPubkey(2)
  99. }
  100. }
  101. })
  102. },
  103. login() {
  104. this.$router.push('/login')
  105. }
  106. }
  107. }
  108. </script>
  109. <style>
  110. /*处于手机屏幕时*/
  111. @media screen and (max-width: 768px){
  112. .movie-list {
  113. padding-top: 8px;
  114. padding-left: 0.5%;
  115. padding-right: 0.5%;
  116. }
  117. }
  118. .movie-list {
  119. padding-top: 15px;
  120. padding-left: 6%;
  121. padding-right: 6%;
  122. }
  123. </style>