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.

verification.vue 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="formBox">
  3. <!-- <view class="from_item">
  4. <text class="label">账号验证</text>
  5. <input type="text" placeholder="输入验证码" v-model="model1.uname" placeholder-style="color:#000">
  6. </view> -->
  7. <view class="from_item">
  8. <text class="label">手机号码</text>
  9. <input type="number" placeholder="" v-model="model1.mobile" placeholder-style="color:#000" maxlength="11">
  10. </view>
  11. <view class="from_item">
  12. <text class="label">验证码</text>
  13. <input type="text" placeholder="请输入验证码" v-model="model1.code" placeholder-style="color:#000">
  14. <text class="btn" @click="getCode" v-if="waitTime==0">获取验证码</text>
  15. <text class="btn" v-else>{{waitTime}}</text>
  16. </view>
  17. <button class="submit" @click="submit">验证</button>
  18. </view>
  19. </template>
  20. <script setup lang="ts">
  21. import {
  22. reactive,
  23. ref
  24. } from "vue";
  25. import {
  26. navTo
  27. } from "@/utils/utils"
  28. import {
  29. onLoad,
  30. onShow
  31. } from "@dcloudio/uni-app";
  32. import {
  33. stringToJson
  34. } from "../../utils/network/encryption.js";
  35. import {
  36. request
  37. } from "../../utils/network/request.js";
  38. import {
  39. sendCode,
  40. relieveCarId
  41. } from "@/utils/network/api.js"
  42. const model1 = reactive({
  43. vehiclePlate: '',
  44. vehiclePlatecolor: '',
  45. openid: '',
  46. idcardFrontImgUrl: '',
  47. idcardBacktImgUrl: '',
  48. vehPosImgUrl: '',
  49. vehNegImgUrl: '',
  50. peopleVehicleImgUrl: '',
  51. commitmentUrl: '',
  52. mobile: '',
  53. code: ''
  54. })
  55. let waitTime = ref(0)
  56. const getCode = () => {
  57. console.log(123);
  58. if (model1.mobile) {
  59. sendCodeApi()
  60. codeInterval()
  61. }else{
  62. uni.showToast({
  63. title: '请输入手机号',
  64. icon:'none'
  65. });
  66. }
  67. }
  68. //倒计时函数
  69. const codeInterval = () => {
  70. waitTime.value = 60
  71. let timer = setInterval(() => {
  72. if (waitTime.value == 1) {
  73. clearInterval(timer)
  74. }
  75. waitTime.value -= 1
  76. }, 1000)
  77. }
  78. // 发送验证码
  79. const sendCodeApi = (type) => {
  80. //参数说明
  81. let options = {
  82. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  83. data: {
  84. mobile: model1.mobile
  85. }, //请求参数
  86. method: "POST", //提交方式(默认POST)
  87. showLoading: true, //是否显示加载中(默认显示)
  88. };
  89. //调用方式
  90. request(sendCode, options)
  91. .then((res) => {
  92. let data = stringToJson(res.bizContent)
  93. console.log(data,"#################");
  94. if (data.info == "成功.") {
  95. console.log('######################CCCCCCCCCCCCCCCCC');
  96. }
  97. })
  98. .catch((err) => {
  99. console.log(err);
  100. });
  101. }
  102. const submit = () => {
  103. console.log("111");
  104. console.log(model1);
  105. let options = {
  106. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  107. data: model1,
  108. method: "POST", //提交方式(默认POST)
  109. showLoading: true, //是否显示加载中(默认显示)
  110. };
  111. //调用方式
  112. request(relieveCarId, options)
  113. .then((res) => {
  114. stringToJson(res.bizContent)
  115. const data = stringToJson(res.bizContent);
  116. console.log(data, "数据");
  117. if (data.info == "成功.") {
  118. navTo(`/after-sale/rescind-carId/result?carid=${model1.vehiclePlate}`)
  119. }
  120. })
  121. .catch((err) => {
  122. console.log(err);
  123. });
  124. }
  125. onLoad((option) => {
  126. console.log(option, "这是传过来的参数");
  127. console.log(JSON.parse(option.fromData), "这是传过来的参数");
  128. let data = JSON.parse(option.fromData)
  129. model1.vehiclePlate = data.vehiclePlate
  130. model1.vehiclePlatecolor = data.vehiclePlatecolor
  131. model1.openid = data.openid
  132. model1.idcardFrontImgUrl = data.idcardFrontImgUrl
  133. model1.idcardBacktImgUrl = data.idcardBacktImgUrl
  134. model1.vehPosImgUrl = data.vehPosImgUrl
  135. model1.vehNegImgUrl = data.vehNegImgUrl
  136. model1.peopleVehicleImgUrl = data.peopleVehicleImgUrl
  137. model1.commitmentUrl = data.commitmentUrl
  138. })
  139. </script>
  140. <style>
  141. page {
  142. width: 100%;
  143. height: 100%;
  144. }
  145. </style>
  146. <style lang="scss" scoped>
  147. .formBox {
  148. height: 90%;
  149. width: 100%;
  150. // background-color: red;
  151. .from_item {
  152. padding: 30rpx;
  153. padding-top: 60rpx;
  154. position: relative;
  155. .label {
  156. font-size: 28rpx;
  157. font-family: Microsoft YaHei;
  158. font-weight: 400;
  159. color: #777777;
  160. }
  161. input {
  162. font-size: 32rpx;
  163. font-family: Microsoft YaHei;
  164. font-weight: 400;
  165. color: #333333;
  166. line-height: 58rpx;
  167. border-bottom: 1rpx solid #DCDCDC;
  168. margin-top: 50rpx;
  169. padding-bottom: 10rpx;
  170. }
  171. .btn {
  172. position: absolute;
  173. right: 45rpx;
  174. bottom: 48rpx;
  175. background: transparent;
  176. font-size: 30rpx;
  177. color: #15E5C1;
  178. z-index: 999;
  179. }
  180. }
  181. .submit {
  182. background: linear-gradient(to left, #43A1E0 0%, #13E7C1 100%);
  183. width: 670rpx;
  184. height: 80rpx;
  185. line-height: 80rpx;
  186. color: #fff;
  187. border-radius: 100rpx;
  188. position: fixed;
  189. bottom: 100rpx;
  190. left: 50%;
  191. transform: translate(-50%);
  192. font-size: 32rpx;
  193. font-family: Microsoft YaHei;
  194. font-weight: 400;
  195. color: #FFFFFF;
  196. line-height: 80rpx;
  197. }
  198. }
  199. </style>