bind-account-password.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view class="container">
  3. <view class="login-wrap">
  4. <view class="login-form">
  5. <u--form
  6. labelPosition="left"
  7. :model="userInfo"
  8. :rules="rules"
  9. ref="form1"
  10. >
  11. <u-form-item
  12. label="密码"
  13. prop="password"
  14. labelWidth="auto"
  15. labelAlign="right"
  16. >
  17. <u--input
  18. v-model="userInfo.password"
  19. placeholder="请输入6到18位的密码"
  20. border="bottom"
  21. maxlength="18"
  22. minlength="6"
  23. type="password"
  24. ></u--input>
  25. </u-form-item>
  26. <u-form-item
  27. labelWidth="auto"
  28. labelAlign="right"
  29. label="确认密码"
  30. prop="password1"
  31. width="120"
  32. >
  33. <u--input
  34. maxlength="20"
  35. v-model="userInfo.password1"
  36. placeholder="请再次输入密码"
  37. border="bottom"
  38. type="password"
  39. ></u--input>
  40. </u-form-item>
  41. </u--form>
  42. </view>
  43. </view>
  44. <view @click="gotoSettingTransactionPassword()" class="op-btn-wrap">
  45. <view class="h-btn">
  46. <text>下一步</text>
  47. </view>
  48. </view>
  49. <view class="h-mark-desc">
  50. <view class="h-text">
  51. <text>*账号密码建议输入6到18位的数字、字母和特殊符号组成</text>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. export default {
  58. data() {
  59. return {
  60. userInfo: {
  61. phone: '',
  62. smsCode: '',
  63. openId: '',
  64. password: '',
  65. password1: '',
  66. transactionPassword: '',
  67. reference: '',
  68. },
  69. tips2: '',
  70. rules: {
  71. password: {
  72. required: true,
  73. min: 6,
  74. max: 18,
  75. message: '请输入6到18位密码',
  76. trigger: ['blur', 'change'],
  77. },
  78. password1: [
  79. {
  80. required: true,
  81. min: 6,
  82. max: 18,
  83. message: '请输入6到18位密码',
  84. trigger: ['blur', 'change'],
  85. },
  86. {
  87. validator: (rule, value, callback) => {
  88. if(this.userInfo.password === value){
  89. return true;
  90. }
  91. return false;
  92. },
  93. message: "两次输入密码不一致",
  94. trigger: ['blur', 'change'],
  95. }
  96. ],
  97. },
  98. }
  99. },
  100. onLoad(option) {
  101. // 判断Openid是否为空
  102. if(!this.$isDataEmpty(option)){
  103. this.userInfo = JSON.parse(option.data);
  104. }
  105. },
  106. onReady() {
  107. this.$refs.form1.setRules(this.rules)
  108. },
  109. methods: {
  110. // 去设置交易密码
  111. gotoSettingTransactionPassword(){
  112. let that = this;
  113. this.$refs.form1.validate().then(res => {
  114. uni.$u.route({
  115. url: '/pages/login/bind-transaction-password',
  116. params: {
  117. data: JSON.stringify(that.userInfo)
  118. }
  119. })
  120. }).catch(errors => {
  121. uni.$u.toast('校验失败,请认真填写')
  122. })
  123. },
  124. }
  125. }
  126. </script>
  127. <style lang="scss">
  128. page,body{
  129. background: #fff;
  130. }
  131. .container{
  132. background: #fff;
  133. height: 500px;
  134. .login-wrap {
  135. display: flex;
  136. justify-content: center;
  137. .login-form{
  138. width: 90%;
  139. }
  140. .account{
  141. display: flex;
  142. }
  143. .identifying-code{
  144. }
  145. }
  146. .op-btn-wrap{
  147. margin-top: 30px;
  148. display: flex;
  149. justify-content: center;
  150. align-items: center;
  151. .h-btn{
  152. text-align: center;
  153. width: 343px;
  154. height: 42px;
  155. background: #FFE05C;
  156. border-radius: 27px;
  157. line-height: 42px;
  158. }
  159. }
  160. }
  161. </style>