OrdinaryModel.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <div class="ordinary-model-wrap model-wrap">
  3. <el-form
  4. ref="modelForm"
  5. label-position="right"
  6. label-width="0px"
  7. :model="form"
  8. :rules="rules">
  9. <el-form-item prop="account">
  10. <el-input
  11. type="text"
  12. v-model="form.account"
  13. auto-complete="off"
  14. :placeholder="$t('LoginPage.ph_account')"
  15. />
  16. <span class="inline-message el-form-item__error"
  17. v-show="(loginCheck||accountCheck)&&form.account.length">
  18. {{hintMessage}}
  19. </span>
  20. </el-form-item>
  21. <el-form-item prop="checkPass">
  22. <el-input
  23. type="password" show-password
  24. v-model="form.checkPass"
  25. auto-complete="off"
  26. :placeholder="$t('LoginPage.ph_pwd')"
  27. @copy.native.capture.prevent="()=>{return false}"
  28. @cut.native.capture.prevent="()=>{return false}"
  29. @paste.native.capture.prevent="()=>{return false}"
  30. />
  31. <span class="inline-message el-form-item__error"
  32. v-show="(loginCheck||accountCheck)&&form.checkPass.length">
  33. {{hintMessage}}</span>
  34. </el-form-item>
  35. <el-form-item class="remember-cont" prop="checked">
  36. <el-checkbox v-model="form.checked" class="remember">
  37. <!-- 记住账号密码 -->{{ $t('LoginPage.label_remember') }}
  38. <el-tooltip effect="dark" :content="$t('LoginPage.vaild_day_msg')" placement="top">
  39. <span class="hint-text">
  40. <i class="el-icon-question"></i>
  41. </span>
  42. </el-tooltip>
  43. </el-checkbox>
  44. <!-- <el-button type="text" style="font-size: 16px;" @click="changeModel">{{ $t('LoginPage.label_forget') }}</el-button> -->
  45. </el-form-item>
  46. </el-form>
  47. </div>
  48. </template>
  49. <script>
  50. import modelMixins from './modelMixins';
  51. export default {
  52. mixins:[modelMixins],
  53. props:{
  54. loginCheck:{
  55. type:Boolean,
  56. default:false
  57. },
  58. accountCheck:{
  59. type:Boolean,
  60. default:false
  61. }
  62. },
  63. data() {
  64. const validateClearn = (rule,value,callBack)=>{
  65. if(this.loginCheck||this.accountCheck){
  66. this.$emit('clearnHint')
  67. }
  68. callBack()
  69. }
  70. return {
  71. form:{
  72. account:'',
  73. checkPass:'',
  74. checked:false
  75. },
  76. rules:{
  77. account:[
  78. {required: true,message: /* "请输入账号" */this.$t('LoginPage.ph_account'),trigger: "blur"},
  79. {validator:validateClearn,trigger:['change']}
  80. ],
  81. checkPass:[
  82. {required: true,message: /* "请输入密码" */this.$t('LoginPage.ph_pwd'),trigger: "blur"},
  83. {validator:validateClearn,trigger:['change']}
  84. ]
  85. },
  86. hintMessage:''
  87. };
  88. },
  89. watch:{
  90. loginCheck(newVal){
  91. //显示/隐藏inline-message
  92. if(newVal){
  93. this.hintMessage=/* "账号或密码错误" */ this.$t('LoginPage.error_wrong_msg')
  94. }else{
  95. this.hintMessage=''
  96. }
  97. },
  98. accountCheck(newVal){
  99. if(newVal){
  100. this.hintMessage=/* "账号异常,请通过验证登录" */this.$t('LoginPage.error_abnormal_msg')
  101. }else{
  102. this.hintMessage=''
  103. }
  104. }
  105. },
  106. methods: {
  107. changeModel(){
  108. this.$emit('changeModel')
  109. }
  110. },
  111. };
  112. </script>
  113. <style scoped lang="scss">
  114. @import "./css/formStyle.scss";
  115. </style>