OrdinaryModel.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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-form-item>
  45. </el-form>
  46. </div>
  47. </template>
  48. <script>
  49. import modelMixins from './modelMixins';
  50. export default {
  51. mixins:[modelMixins],
  52. props:{
  53. loginCheck:{
  54. type:Boolean,
  55. default:false
  56. },
  57. accountCheck:{
  58. type:Boolean,
  59. default:false
  60. }
  61. },
  62. data() {
  63. const validateClearn = (rule,value,callBack)=>{
  64. if(this.loginCheck||this.accountCheck){
  65. this.$emit('clearnHint')
  66. }
  67. callBack()
  68. }
  69. return {
  70. form:{
  71. account:'',
  72. checkPass:'',
  73. checked:false
  74. },
  75. rules:{
  76. account:[
  77. {required: true,message: /* "请输入账号" */this.$t('LoginPage.ph_account'),trigger: "blur"},
  78. {validator:validateClearn,trigger:['change']}
  79. ],
  80. checkPass:[
  81. {required: true,message: /* "请输入密码" */this.$t('LoginPage.ph_pwd'),trigger: "blur"},
  82. {validator:validateClearn,trigger:['change']}
  83. ]
  84. },
  85. hintMessage:''
  86. };
  87. },
  88. watch:{
  89. loginCheck(newVal){
  90. //显示/隐藏inline-message
  91. if(newVal){
  92. this.hintMessage=/* "账号或密码错误" */ this.$t('LoginPage.error_wrong_msg')
  93. }else{
  94. this.hintMessage=''
  95. }
  96. },
  97. accountCheck(newVal){
  98. if(newVal){
  99. this.hintMessage=/* "账号异常,请通过验证登录" */this.$t('LoginPage.error_abnormal_msg')
  100. }else{
  101. this.hintMessage=''
  102. }
  103. }
  104. },
  105. methods: {
  106. changeModel(){
  107. this.$emit('changeModel')
  108. }
  109. },
  110. };
  111. </script>
  112. <style scoped lang="scss">
  113. @import "./css/formStyle.scss";
  114. </style>