updatepaypass.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <view class="register container">
  3. <nav-header>修改支付密码</nav-header>
  4. <!-- <view class="title">
  5. <view class="login_view">
  6. <view class="">
  7. 修改支付密码
  8. </view>
  9. <view class="">
  10. </view>
  11. </view>
  12. <view class="text">
  13. <image src="@/static/login/logo.png" mode="widthFix"></image>
  14. </view>
  15. </view> -->
  16. <view class="login_content">
  17. <!-- <view class="input_item">
  18. <view class="">
  19. <input type="number" v-model="oldPwd" placeholder="输入旧密码" maxlength="6">
  20. </view>
  21. </view> -->
  22. <view class="input_item">
  23. <!-- <view class="">
  24. 输入新密码
  25. </view> -->
  26. <view class="">
  27. <input type="number" v-model="newPwd" placeholder="输入新密码" maxlength="6">
  28. </view>
  29. </view>
  30. <view class="input_item">
  31. <!-- <view class="">
  32. 再次输入密码
  33. </view> -->
  34. <view class="">
  35. <input type="number" v-model="truePwd" placeholder="再次输入密码" maxlength="6">
  36. </view>
  37. </view>
  38. <view class="input_item">
  39. <view class="" style="display: flex;align-items: center;justify-content: space-between;">
  40. <view class="">
  41. <input type="text" v-model="codeImgVal" placeholder="图形验证" style="width: 400rpx;">
  42. </view>
  43. <image class="code_img sendcode" @click="getVerify" :src="codeImgData.image"
  44. style="width: 160rpx;height: 70rpx;margin-right: 10rpx;"></image>
  45. </view>
  46. </view>
  47. <view class="input_item flex">
  48. <!-- <view class="" style="width: 300rpx;">
  49. 输入验证码
  50. </view> -->
  51. <view class="">
  52. <input type="number" style="width: 350rpx;" v-model="verify" placeholder="输入验证码">
  53. </view>
  54. <view class="sendcode" @click="sendCode" v-if="time<=0" style="width: 300rpx;text-align: right;">
  55. 发送验证码
  56. </view>
  57. <view class="sendcode_count" v-else style="width: 300rpx;text-align: right;">
  58. {{time}}秒后重新发送
  59. </view>
  60. </view>
  61. </view>
  62. <view class="login_btn" @click="confirm">
  63. 确认修改
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import myInput from "@/components/my/input_sz.vue"
  69. import navHeader from "@/components/my/nav_header.vue"
  70. export default {
  71. data() {
  72. return {
  73. verify: "", //验证码
  74. oldPwd: "", //新密码
  75. newPwd: "", //旧密码
  76. truePwd: "", //确认密码
  77. typecode: true, //验证码发送后的状态
  78. count: 0, //倒计时
  79. time: 0, //定时器全局控制器
  80. userinfo: {},
  81. codeImgData: {},
  82. codeImgVal: '',
  83. bgc: false
  84. }
  85. },
  86. components: {
  87. myInput,
  88. navHeader
  89. },
  90. onHide() {
  91. clearInterval(this.time)
  92. },
  93. onLoad() {
  94. this.get_user_info()
  95. this.getVerify()
  96. },
  97. methods: {
  98. getVerify() {
  99. this.api.graphVer().then(res => {
  100. this.codeImgData = res.data
  101. })
  102. },
  103. get_user_info() {
  104. uni.showLoading()
  105. this.user_info = uni.getStorageSync("user_info")
  106. uni.hideLoading()
  107. console.log(this.user_info)
  108. },
  109. // sendCode(phone) {
  110. // if (this.user_info.phone) {
  111. // this.api.smsCode(this.user_info.phone).then(res => {
  112. // if (res.code == 1) {
  113. // this.count = res.data.time
  114. // //短信发送成功 开始倒计时
  115. // this.start()
  116. // this.$api.pop("发送成功")
  117. // }
  118. // })
  119. // }
  120. // },
  121. sendCode() {
  122. if (!this.codeImgVal) {
  123. this.$api.pop('请先输入图形验证')
  124. return
  125. }
  126. this.bgc = true
  127. // 真实验证
  128. this.api.smsCode(this.user_info.phone, this.codeImgVal, this.codeImgData.uniqid).then(res => {
  129. if (res.code == 1 && res.data.time >= 50) {
  130. this.$api.pop(res.info)
  131. this.time = 60
  132. setInterval(() => {
  133. if (this.time <= 0) {
  134. this.time = 0
  135. return
  136. }
  137. --this.time
  138. }, 1000)
  139. } else {
  140. this.$api.pop(res.info)
  141. }
  142. })
  143. },
  144. //提交修改
  145. confirm() {
  146. this.api.update_paypass(this.verify, this.oldPwd, this.newPwd, this.truePwd).then(res => {
  147. if (res.code == 1) {
  148. this.$api.pop("修改成功")
  149. setTimeout(() => {
  150. this.$api.totabar("/pages/my/my")
  151. }, 1000);
  152. }
  153. })
  154. }
  155. }
  156. }
  157. </script>
  158. <style scoped>
  159. .register {
  160. box-sizing: border-box;
  161. padding-top: 100rpx;
  162. }
  163. .title {
  164. width: 600rpx;
  165. font-size: 46rpx;
  166. display: flex;
  167. align-items: center;
  168. justify-content: space-between;
  169. margin: 180rpx auto 0 auto;
  170. }
  171. /deep/ .uni-input-wrapper {
  172. color: #fff;
  173. }
  174. .login_view {
  175. font-size: 68rpx;
  176. }
  177. .login_content {
  178. width: 686rpx;
  179. margin: 70rpx auto 0;
  180. }
  181. .text {
  182. width: 120rpx;
  183. }
  184. .input_item {
  185. background-color: #1D1F1E;
  186. width: 686rpx;
  187. height: 100rpx;
  188. font-size: 32rpx;
  189. margin-top: 60rpx;
  190. line-height: 100rpx;
  191. color: #fff;
  192. border-bottom: 1px solid rgba(0, 0, 0, .1);
  193. border-radius: 24rpx;
  194. }
  195. .flex {
  196. display: flex;
  197. }
  198. input {
  199. /* margin-left: 20rpx; */
  200. height: 100rpx;
  201. line-height: 100rpx;
  202. text-indent: 30rpx;
  203. }
  204. .label {
  205. width: 250rpx;
  206. }
  207. .sendcode {
  208. font-size: 24rpx;
  209. color: #fff;
  210. }
  211. .sendcode_count {
  212. font-size: 24rpx;
  213. text-align: right;
  214. width: 200rpx;
  215. color: #fff;
  216. }
  217. .login_btn {
  218. width: 686rpx;
  219. height: 100rpx;
  220. font-size: 32rpx;
  221. line-height: 100rpx;
  222. margin: 0 auto;
  223. margin-top: 88rpx;
  224. text-align: center;
  225. border-radius: 16rpx;
  226. background: linear-gradient(180deg, #69FF60 0%, #0C9D5B 100%);
  227. color: #000;
  228. }
  229. .gologin {
  230. font-size: 28rpx;
  231. margin: 22rpx auto;
  232. text-align: center;
  233. }
  234. .blue {
  235. color: #21E4F0;
  236. }
  237. .agreement {
  238. /* width: 550rpx; */
  239. /* margin: 50rpx 30rpx; */
  240. font-size: 28rpx;
  241. display: flex;
  242. align-items: center;
  243. justify-content: center;
  244. color: #999999;
  245. text-indent: 14rpx;
  246. margin-top: 32rpx;
  247. margin-bottom: 50rpx;
  248. }
  249. .circle {
  250. width: 24rpx;
  251. height: 24rpx;
  252. border-radius: 50%;
  253. border: 1px solid #999999;
  254. }
  255. .circle_checked {
  256. width: 24rpx;
  257. height: 24rpx;
  258. border-radius: 50%;
  259. background: #21E4F0;
  260. border: 1px solid #21E4F0;
  261. }
  262. /deep/.input-placeholder {
  263. color: #fff;
  264. }
  265. .bgc {
  266. background: linear-gradient(180deg, #69FF60 0%, #0C9D5B 100%);
  267. color: #000;
  268. }
  269. </style>