You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

forget-password.vue 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <u-form :model="form" ref="form1" label-width=140 v-if='state.isShow'>
  3. <u-form-item label="对公账户" >
  4. <u-input placeholder='请输入你的账户' type="text" v-model="state.form.name" />
  5. <u-button type="success" size="mini" @click="search" >查询</u-button>
  6. </u-form-item>
  7. </u-form>
  8. <view v-else>
  9. <u-form :model="form" ref="form1" label-width=180 >
  10. <u-form-item label="用户名">
  11. <u-input placeholder='用户名' type="text" v-model="state.form.name" />
  12. <u-button type="success" size="mini" @click="search" >查询</u-button>
  13. </u-form-item>
  14. <u-form-item label="手机号" >
  15. <u-input placeholder='手机号' type="number" v-model="state.form.tel" disabled/>
  16. </u-form-item>
  17. <u-form-item label="验证码">
  18. <u-input v-model="state.form.code" placeholder='请输入短信验证码'/>
  19. <u-button type="success" size="mini" @click="getCode" v-if="waitTime==0">获取验证码</u-button>
  20. <text class="btn" v-else>{{waitTime}}后重试</text>
  21. </u-form-item>
  22. <u-form-item label="新密码" >
  23. <u-input placeholder='请输入' v-model="state.form.password" />
  24. </u-form-item>
  25. <u-form-item label="确认密码" >
  26. <u-input placeholder='请输入' v-model="state.form.againPassword" />
  27. </u-form-item>
  28. </u-form>
  29. <button @click='goLogin()'>确定</button>
  30. </view>
  31. </template>
  32. <script setup lang="ts">
  33. import { reactive,ref } from "vue";
  34. import { navTo } from "@/utils/utils";
  35. let waitTime = ref(0);
  36. const state = reactive({
  37. form:{
  38. name: '张三',
  39. tel:'',
  40. code:'',
  41. password:'',
  42. againPassword:'',
  43. },
  44. isShow:true,
  45. });
  46. const search=()=>{
  47. console.log("查询")
  48. state.isShow=false;
  49. }
  50. const getCode = () => {
  51. console.log(123);
  52. if (state.form.tel) {
  53. sendCodeApi()
  54. codeInterval()
  55. } else {
  56. uni.showToast({
  57. title: '请输入手机号',
  58. icon: 'none'
  59. });
  60. }
  61. }
  62. // 发送验证码
  63. const sendCodeApi = (type) => {
  64. //参数说明
  65. let options = {
  66. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  67. data: {
  68. mobile: state.form.tel
  69. }, //请求参数
  70. method: "POST", //提交方式(默认POST)
  71. showLoading: true, //是否显示加载中(默认显示)
  72. };
  73. //调用方式
  74. request(sendCode, options)
  75. .then((res) => {
  76. let data = stringToJson(res.bizContent)
  77. console.log(data, "#################");
  78. if (data.info == "成功.") {
  79. console.log('######################CCCCCCCCCCCCCCCCC');
  80. }
  81. })
  82. .catch((err) => {
  83. console.log(err);
  84. });
  85. }
  86. //倒计时函数
  87. const codeInterval = () => {
  88. waitTime.value = 60
  89. let timer = setInterval(() => {
  90. if (waitTime.value == 1) {
  91. clearInterval(timer)
  92. }
  93. waitTime.value -= 1
  94. }, 1000)
  95. }
  96. const goLogin=()=>{
  97. navTo(`/subpackage/after-sale/account-recharge/login`);
  98. }
  99. </script>
  100. <style scoped>
  101. ::v-deep .u-form-item--right__content__slot{
  102. display:flex !important;
  103. }
  104. ::v-deep .u-form-item__body{
  105. padding: 0 40rpx;
  106. font-size: 32rpx;
  107. }
  108. ::v-deep .u-input__input{
  109. font-size: 32rpx !important;
  110. }
  111. ::v-deep .u-size-mini{
  112. font-size: 28rpx !important;
  113. padding: 12px 32rpx !important;
  114. white-space: nowrap;
  115. }
  116. button{
  117. width: 75%;
  118. background-color: rgb(25,190,107);
  119. color: white;
  120. border-color: 1rpx solid rgb(75,164,89);
  121. height: 90rpx;
  122. line-height: 90rpx;
  123. margin-top:60rpx;
  124. font-size:38rpx;
  125. }
  126. </style>