password.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view class="password-page">
  3. <view class="form">
  4. <uni-forms ref="form" :rules="rules" :model="form" :label-width="80">
  5. <uni-forms-item label="原密码" name="original_password" required>
  6. <uni-easyinput v-model="form.original_password" type="password" placeholder="请输入原密码"></uni-easyinput>
  7. </uni-forms-item>
  8. <uni-forms-item label="新密码" name="new_password" required>
  9. <uni-easyinput v-model="form.new_password" type="password" placeholder="请输入新密码"></uni-easyinput>
  10. </uni-forms-item>
  11. <uni-forms-item label="再次确认" name="password" required>
  12. <uni-easyinput v-model="form.password" type="password" placeholder="请再次输入新密码"></uni-easyinput>
  13. </uni-forms-item>
  14. </uni-forms>
  15. <footer @click="onSubmit">提交</footer>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. rules:{
  24. original_password:{
  25. rules:[
  26. {
  27. required: true,
  28. errorMessage: '请输入原密码'
  29. }
  30. ],
  31. validateTrigger:'submit'
  32. },
  33. new_password:{
  34. rules:[
  35. {
  36. required: true,
  37. errorMessage: '请输入新密码'
  38. }
  39. ],
  40. validateTrigger:'submit'
  41. },
  42. password:{
  43. rules:[
  44. {
  45. required: true,
  46. errorMessage: '请再次输入新密码'
  47. }
  48. ],
  49. validateTrigger:'submit'
  50. },
  51. },
  52. form:{
  53. original_password:"",
  54. new_password:"",
  55. password:""
  56. }
  57. }
  58. },
  59. methods: {
  60. onSubmit(){
  61. this.$refs.form.validate().then(res=>{
  62. console.log('表单数据信息:', res);
  63. }).catch(err =>{
  64. console.log('表单错误信息:', err);
  65. })
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .password-page{
  72. background: #F3F5FB;
  73. height: 100vh;
  74. .form{
  75. width: 686upx;
  76. background-color: #fff;
  77. margin: 0 auto;
  78. padding:40upx 36upx 2upx 36upx;
  79. box-sizing: border-box;
  80. border-radius: 20upx;
  81. }
  82. footer{
  83. width: 100%;
  84. height: 136upx;
  85. background: #FFFFFF;
  86. border-radius: 16upx 16upx 0px 0px;
  87. position: fixed;
  88. left: 0;
  89. bottom: 0;
  90. text-align: center;
  91. color: #168DEC;
  92. font-size: 32upx;
  93. padding-top: 20upx;
  94. letter-spacing: 2px;
  95. }
  96. }
  97. </style>