Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

forget-password.vue 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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 >
  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==1">获取验证码</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" type='password'/>
  24. </u-form-item>
  25. <u-form-item label="确认密码" >
  26. <u-input placeholder='请输入' v-model="state.form.againPassword" type='password'/>
  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. import {changePass} from "@/utils/network/api.js";
  36. let waitTime = ref(0);
  37. const state = reactive({
  38. form:{
  39. name: '',
  40. tel:'',
  41. code:'',
  42. password:'',
  43. againPassword:'',
  44. },
  45. isShow:true,
  46. });
  47. const search=()=>{
  48. console.log("查询")
  49. state.isShow=false;
  50. }
  51. const getCode = () => {
  52. console.log(123);
  53. if (state.form.tel) {
  54. sendCodeApi()
  55. codeInterval()
  56. } else {
  57. uni.showToast({
  58. title: '请输入手机号',
  59. icon: 'none'
  60. });
  61. }
  62. }
  63. // 发送验证码
  64. const sendCodeApi = (type) => {
  65. //参数说明
  66. let options = {
  67. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  68. data: {
  69. mobile: state.form.tel
  70. }, //请求参数
  71. method: "POST", //提交方式(默认POST)
  72. showLoading: true, //是否显示加载中(默认显示)
  73. };
  74. //调用方式
  75. request(sendCode, options)
  76. .then((res) => {
  77. let data = stringToJson(res.bizContent)
  78. console.log(data, "#################");
  79. if (data.info == "成功.") {
  80. console.log('######################CCCCCCCCCCCCCCCCC');
  81. }
  82. })
  83. .catch((err) => {
  84. console.log(err);
  85. });
  86. }
  87. //倒计时函数
  88. const codeInterval = () => {
  89. waitTime.value = 60
  90. let timer = setInterval(() => {
  91. if (waitTime.value == 1) {
  92. clearInterval(timer)
  93. }
  94. waitTime.value -= 1
  95. }, 1000)
  96. }
  97. const goLogin=()=>{
  98. if(!state.form.name){
  99. msg("请输入用户名!");
  100. return;
  101. }
  102. if(!state.form.password){
  103. msg("请输入密码!");
  104. return;
  105. }
  106. if(!state.form.againPassword){
  107. msg("请确认密码!");
  108. return;
  109. }
  110. let options = {
  111. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  112. data: {
  113. accountId: state.form.name,
  114. oldPwd: '',
  115. newPwd: state.form.password
  116. }, //请求参数
  117. method: "POST", //提交方式(默认POST)
  118. showLoading: true, //是否显示加载中(默认显示)
  119. };
  120. //调用方式
  121. request(changePass, options).then((res) => {
  122. navTo(`/subpackage/after-sale/account-recharge/login`);
  123. })
  124. .catch((err) => {
  125. console.log(err);
  126. });
  127. }
  128. </script>
  129. <style scoped>
  130. ::v-deep .u-form-item--right__content__slot{
  131. display:flex !important;
  132. }
  133. ::v-deep .u-form-item__body{
  134. padding: 0 40rpx;
  135. font-size: 32rpx;
  136. }
  137. ::v-deep .u-input__input{
  138. font-size: 32rpx !important;
  139. }
  140. ::v-deep .u-size-mini{
  141. font-size: 28rpx !important;
  142. padding: 12px 32rpx !important;
  143. white-space: nowrap;
  144. }
  145. button{
  146. width: 75%;
  147. height: 80rpx;
  148. margin-top:60rpx;
  149. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  150. border-radius: 40rpx;
  151. font-size: 32rpx;
  152. font-weight: 400;
  153. color: #ffffff;
  154. line-height: 80rpx;
  155. }
  156. .btn{
  157. background: #19BE6B;
  158. padding: 0rpx 32rpx;
  159. border-radius: 10rpx;
  160. color: white;
  161. font-size: 24rpx;
  162. height: 46rpx;
  163. line-height: 46rpx;
  164. text-align: center;
  165. }
  166. ::v-deep .u-form-item--right__content__slot{
  167. display:flex !important;
  168. align-items: center;
  169. }
  170. </style>