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.

verification.vue 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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. proxyUrl: "", //委托书
  55. })
  56. let waitTime = ref(0)
  57. const getCode = () => {
  58. console.log(123);
  59. if (model1.mobile) {
  60. sendCodeApi()
  61. codeInterval()
  62. } else {
  63. uni.showToast({
  64. title: '请输入手机号',
  65. icon: 'none'
  66. });
  67. }
  68. }
  69. //倒计时函数
  70. const codeInterval = () => {
  71. waitTime.value = 60
  72. let timer = setInterval(() => {
  73. if (waitTime.value == 1) {
  74. clearInterval(timer)
  75. }
  76. waitTime.value -= 1
  77. }, 1000)
  78. }
  79. // 发送验证码
  80. const sendCodeApi = (type) => {
  81. //参数说明
  82. let options = {
  83. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  84. data: {
  85. mobile: model1.mobile
  86. }, //请求参数
  87. method: "POST", //提交方式(默认POST)
  88. showLoading: true, //是否显示加载中(默认显示)
  89. };
  90. //调用方式
  91. request(sendCode, options)
  92. .then((res) => {
  93. let data = stringToJson(res.bizContent)
  94. console.log(data, "#################");
  95. if (data.info == "成功.") {
  96. console.log('######################CCCCCCCCCCCCCCCCC');
  97. }
  98. })
  99. .catch((err) => {
  100. console.log(err);
  101. });
  102. }
  103. const submit = () => {
  104. console.log("111");
  105. console.log(model1);
  106. let options = {
  107. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  108. data: model1,
  109. method: "POST", //提交方式(默认POST)
  110. showLoading: true, //是否显示加载中(默认显示)
  111. };
  112. //调用方式
  113. request(relieveCarId, options)
  114. .then((res) => {
  115. stringToJson(res.bizContent)
  116. const data = stringToJson(res.bizContent);
  117. console.log(data, "数据");
  118. if (data.info == "成功.") {
  119. navTo(`/subpackage/after-sale/rescind-carId/result?carid=${model1.vehiclePlate}`)
  120. }
  121. })
  122. .catch((err) => {
  123. console.log(err);
  124. });
  125. }
  126. onLoad((option) => {
  127. console.log(option, "这是传过来的参数");
  128. console.log(JSON.parse(option.fromData), "这是传过来的参数");
  129. let data = JSON.parse(option.fromData)
  130. model1.vehiclePlate = data.vehiclePlate
  131. model1.vehiclePlatecolor = data.vehiclePlatecolor
  132. model1.openid = data.openid
  133. model1.idcardFrontImgUrl = data.idcardFrontImgUrl
  134. model1.idcardBacktImgUrl = data.idcardBacktImgUrl
  135. model1.vehPosImgUrl = data.vehPosImgUrl
  136. model1.vehNegImgUrl = data.vehNegImgUrl
  137. model1.peopleVehicleImgUrl = data.peopleVehicleImgUrl
  138. model1.commitmentUrl = data.commitmentUrl
  139. model1.proxyUrl = data.proxyUrl
  140. })
  141. </script>
  142. <style>
  143. page {
  144. width: 100%;
  145. height: 100%;
  146. }
  147. </style>
  148. <style lang="scss" scoped>
  149. .formBox {
  150. height: 90%;
  151. width: 100%;
  152. // background-color: red;
  153. .from_item {
  154. padding: 30rpx;
  155. padding-top: 60rpx;
  156. position: relative;
  157. .label {
  158. font-size: 28rpx;
  159. font-family: Microsoft YaHei;
  160. font-weight: 400;
  161. color: #777777;
  162. }
  163. input {
  164. font-size: 32rpx;
  165. font-family: Microsoft YaHei;
  166. font-weight: 400;
  167. color: #333333;
  168. line-height: 58rpx;
  169. border-bottom: 1rpx solid #DCDCDC;
  170. margin-top: 50rpx;
  171. padding-bottom: 10rpx;
  172. }
  173. .btn {
  174. position: absolute;
  175. right: 45rpx;
  176. bottom: 48rpx;
  177. background: transparent;
  178. font-size: 30rpx;
  179. color: #15E5C1;
  180. z-index: 999;
  181. }
  182. }
  183. .submit {
  184. background: linear-gradient(to left, #43A1E0 0%, #13E7C1 100%);
  185. width: 670rpx;
  186. height: 80rpx;
  187. line-height: 80rpx;
  188. color: #fff;
  189. border-radius: 100rpx;
  190. position: fixed;
  191. bottom: 100rpx;
  192. left: 50%;
  193. transform: translate(-50%);
  194. font-size: 32rpx;
  195. font-family: Microsoft YaHei;
  196. font-weight: 400;
  197. color: #FFFFFF;
  198. line-height: 80rpx;
  199. }
  200. }
  201. </style>