editPayPassWord.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view>
  3. <u-cell title="1xx****xxxx"></u-cell>
  4. <u--input placeholder="密码" border="surround" v-model="value"
  5. @change="change"
  6. :customStyle="{height: '40px'}"
  7. ></u--input>
  8. <u--input placeholder="确认密码" border="surround" v-model="value" @change="change" :customStyle="{height: '40px'}"></u--input>
  9. <u-input placeholder="后置插槽" :customStyle="{height: '40px'}">
  10. <template slot="suffix">
  11. <u-code ref="uCode" @change="codeChange" seconds="20" changeText="X秒重新获取"></u-code>
  12. <u-button @tap="getCode" :text="tips" type="primary" size=""></u-button>
  13. </template>
  14. </u-input>
  15. <div class="save-btn">
  16. <u-button type="primary">立即设置</u-button>
  17. </div>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. tips: '发送验证码',
  25. }
  26. },
  27. methods: {
  28. change() {
  29. console.log(this.value);
  30. },
  31. codeChange(text) {
  32. console.log('codeChange');
  33. this.tips = text
  34. },
  35. getCode() {
  36. if (this.$refs.uCode.canGetCode) {
  37. // 模拟向后端请求验证码
  38. uni.showLoading({
  39. title: '正在获取验证码'
  40. })
  41. setTimeout(() => {
  42. uni.hideLoading();
  43. // 这里此提示会被this.start()方法中的提示覆盖
  44. uni.$u.toast('验证码已发送');
  45. // 通知验证码组件内部开始倒计时
  46. this.$refs.uCode.start();
  47. }, 2000);
  48. } else {
  49. uni.$u.toast('倒计时结束后再发送');
  50. }
  51. },
  52. }
  53. }
  54. </script>
  55. <style lang="scss" scoped>
  56. .save-btn{
  57. text-align:center;
  58. // margin-top:20px;
  59. position: fixed;
  60. bottom: 0;
  61. width: 100%;
  62. padding: 30px;
  63. box-sizing: border-box;
  64. }
  65. </style>