forget.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <view class="content">
  3. <view class="top_bg">
  4. <image
  5. class="top_close"
  6. @click="$navBack()"
  7. src="/static/image/login/close_icon.png"
  8. mode="scaleToFill"
  9. />
  10. <view class="top_text">
  11. <view>忘记密码</view>
  12. <image
  13. class="top_icon"
  14. src="/static//image/login/dot_icon.png"
  15. mode="scaleToFill"
  16. />
  17. </view>
  18. </view>
  19. <view class="w pdx-40 main">
  20. <u--input
  21. class="h-112"
  22. v-model="loginParam.phone"
  23. placeholder="请输入手机号码"
  24. border="bottom"
  25. clearable
  26. ></u--input>
  27. <!-- #ifndef APP-NVUE -->
  28. <u-input
  29. class="h-112 mgt-16"
  30. v-model="loginParam.code"
  31. placeholder="请输入验证码"
  32. border="bottom"
  33. clearable
  34. >
  35. <!-- #endif -->
  36. <!-- #ifdef APP-NVUE -->
  37. <u--input
  38. class="h-112 mgt-16"
  39. v-model="loginParam.code"
  40. placeholder="请输入验证码"
  41. border="bottom"
  42. clearable
  43. >
  44. <!-- #endif -->
  45. <template slot="suffix">
  46. <u-code
  47. :seconds="seconds"
  48. @end="end"
  49. @start="start"
  50. change-text="xs"
  51. ref="uCode"
  52. :keep-running="true"
  53. @change="codeChange"
  54. ></u-code>
  55. <u-button
  56. :disabled="!isShowCode"
  57. @tap="sliderVerify"
  58. class="code_btn"
  59. >{{ tips }}</u-button
  60. >
  61. </template>
  62. <!-- #ifdef APP-NVUE -->
  63. </u--input>
  64. <!-- #endif -->
  65. <!-- #ifndef APP-NVUE -->
  66. </u-input>
  67. <!-- #endif -->
  68. <!-- #ifndef APP-NVUE -->
  69. <u-input
  70. class="h-112 mgt-16"
  71. v-model="loginParam.password"
  72. :password="!isViewPassword"
  73. placeholder="请输入密码"
  74. border="bottom"
  75. clearable
  76. >
  77. <!-- #endif -->
  78. <!-- #ifdef APP-NVUE -->
  79. <u--input
  80. class="h-112 mgt-16"
  81. v-model="loginParam.password"
  82. :password="!isViewPassword"
  83. placeholder="请输入密码"
  84. border="bottom"
  85. clearable
  86. >
  87. <!-- #endif -->
  88. <template slot="suffix">
  89. <u-icon
  90. @click="isViewPassword = !isViewPassword"
  91. :name="isViewPassword ? 'eye-fill' : 'eye-off'"
  92. color="#303030"
  93. size="24"
  94. ></u-icon>
  95. </template>
  96. <!-- #ifdef APP-NVUE -->
  97. </u--input>
  98. <!-- #endif -->
  99. <!-- #ifndef APP-NVUE -->
  100. </u-input>
  101. <!-- #endif -->
  102. <!-- #ifndef APP-NVUE -->
  103. <u-input
  104. class="h-112 mgt-16"
  105. v-model="loginParam.confirmPwd"
  106. :password="!isViewConfirmPwd"
  107. placeholder="请确认密码"
  108. border="bottom"
  109. clearable
  110. >
  111. <!-- #endif -->
  112. <!-- #ifdef APP-NVUE -->
  113. <u--input
  114. class="h-112 mgt-16"
  115. v-model="loginParam.confirmPwd"
  116. :password="!isViewConfirmPwd"
  117. placeholder="请确认密码"
  118. border="bottom"
  119. clearable
  120. >
  121. <!-- #endif -->
  122. <template slot="suffix">
  123. <u-icon
  124. @click="isViewConfirmPwd = !isViewConfirmPwd"
  125. :name="isViewConfirmPwd ? 'eye-fill' : 'eye-off'"
  126. color="#303030"
  127. size="24"
  128. ></u-icon>
  129. </template>
  130. <!-- #ifdef APP-NVUE -->
  131. </u--input>
  132. <!-- #endif -->
  133. <!-- #ifndef APP-NVUE -->
  134. </u-input>
  135. <!-- #endif -->
  136. <u-button :disabled="!isSubmit" class="login" @tap="submit"
  137. >提交</u-button
  138. >
  139. </view>
  140. <zmm-slider-verify
  141. ref="sliderVerify"
  142. @success="successHandle"
  143. @error="errorHandle"
  144. @close="closeHandle"
  145. ></zmm-slider-verify>
  146. </view>
  147. </template>
  148. <script>
  149. import { isValidPhone, isValidPassword } from "@/utils/index";
  150. export default {
  151. data() {
  152. return {
  153. isViewPassword: false,
  154. isViewConfirmPwd: false,
  155. isCode: false, //验证码按钮状态
  156. tips: "", // 验证码提示文字
  157. seconds: 60, //验证码秒数
  158. loginParam: {
  159. phone: undefined,
  160. code: undefined,
  161. password: undefined,
  162. confirmPwd: undefined,
  163. },
  164. };
  165. },
  166. computed: {
  167. isShowCode() {
  168. return this.loginParam.phone && !this.isCode;
  169. },
  170. isSubmit() {
  171. return (
  172. this.loginParam.phone &&
  173. this.loginParam.code &&
  174. this.loginParam.password &&
  175. this.loginParam.confirmPwd
  176. );
  177. },
  178. },
  179. watch: {},
  180. onLoad() {},
  181. methods: {
  182. //显示验证组件
  183. sliderVerify() {
  184. if (isValidPhone(this.loginParam.phone)) {
  185. this.$refs["sliderVerify"].show();
  186. } else {
  187. uni.$u.toast("请输入正确手机号");
  188. }
  189. },
  190. //验证通过回调
  191. successHandle(e) {
  192. console.log(e);
  193. this.getCode();
  194. },
  195. //验证失败回调
  196. errorHandle(e) {
  197. console.log(e);
  198. },
  199. //组件关闭回调
  200. closeHandle(e) {
  201. console.log(e);
  202. },
  203. codeChange(text) {
  204. this.tips = text;
  205. },
  206. getCode() {
  207. if (this.$refs.uCode.canGetCode) {
  208. // 模拟向后端请求验证码
  209. uni.showLoading({
  210. title: "正在获取验证码",
  211. });
  212. setTimeout(() => {
  213. uni.hideLoading();
  214. // 这里此提示会被this.start()方法中的提示覆盖
  215. uni.$u.toast("验证码已发送");
  216. // 通知验证码组件内部开始倒计时
  217. this.$refs.uCode.start();
  218. }, 2000);
  219. } else {
  220. uni.$u.toast("倒计时结束后再发送");
  221. }
  222. },
  223. end() {
  224. // uni.$u.toast('倒计时结束');
  225. this.isCode = false;
  226. },
  227. start() {
  228. // uni.$u.toast('倒计时开始');
  229. this.isCode = true;
  230. },
  231. submit() {
  232. console.log("提交参数 :===>>", this.loginParam);
  233. },
  234. },
  235. };
  236. </script>
  237. <style scoped lang="scss">
  238. .content {
  239. width: 100vw;
  240. height: 100vh;
  241. display: flex;
  242. flex-direction: column;
  243. align-items: center;
  244. position: relative;
  245. }
  246. .top_bg {
  247. position: relative;
  248. width: 100vw;
  249. height: 568rpx;
  250. flex-shrink: 0;
  251. background: linear-gradient(to bottom, #ffd8bf, #ffffff);
  252. .top_close {
  253. position: absolute;
  254. top: 128rpx;
  255. left: 40rpx;
  256. width: 48rpx;
  257. height: 48rpx;
  258. }
  259. .top_text {
  260. position: absolute;
  261. top: 224rpx;
  262. left: 64rpx;
  263. display: flex;
  264. color: #070602;
  265. font-family: "MiSans VF";
  266. font-size: 52rpx;
  267. font-style: normal;
  268. font-weight: 600;
  269. line-height: normal;
  270. letter-spacing: 0.66rpx;
  271. text-transform: uppercase;
  272. }
  273. .top_icon {
  274. margin-top: -10rpx;
  275. margin-left: 8rpx;
  276. width: 24rpx;
  277. height: 24rpx;
  278. }
  279. }
  280. .main {
  281. margin-top: -72rpx;
  282. .login {
  283. margin-top: 240rpx;
  284. height: 96rpx;
  285. width: 100%;
  286. flex-shrink: 0;
  287. border-radius: 64rpx;
  288. background: #fe6505;
  289. color: #ffffff;
  290. text-align: center;
  291. font-family: "MiSans VF";
  292. font-size: 36rpx;
  293. font-style: normal;
  294. font-weight: 500;
  295. }
  296. .code_btn {
  297. padding: 0rpx 24rpx;
  298. height: 60rpx;
  299. border-radius: 32rpx;
  300. font-size: 24rpx;
  301. color: #fff;
  302. font-weight: 400;
  303. background: linear-gradient(0deg, #fe6505 0%, #fe6505 100%), #141111;
  304. }
  305. .code_btn_off {
  306. background: #fe65054d;
  307. }
  308. }
  309. </style>