reset.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <!--
  2. * @Author: wangwei
  3. * @Date: 2020-12-29 16:05:36
  4. * @LastEditTime: 2021-01-15 19:16:35
  5. * @LastEditors: Please set LastEditors
  6. * @Description: 重置密码
  7. * @FilePath: /java-pc/src/views/member/center/accountSafe.vue
  8. -->
  9. <template>
  10. <div class="sld_reset_password_mange">
  11. <MemberTitle :memberTitle="L['重置密码']"></MemberTitle>
  12. <div class="container">
  13. <div class="title">重置支付密码</div>
  14. <div class="mange_con">
  15. <div class="without_phone_tip" v-if="!memberInfo.data.memberMobile">
  16. 请先绑定手机号,再进行重置支付密码操作!
  17. </div>
  18. <!-- 重置支付密码 start -->
  19. <template v-if="memberInfo.data.hasPayPassword">
  20. <span class="current"
  21. >当前手机号
  22. {{
  23. memberInfo.data.memberMobile ? memberInfo.data.memberMobile : "--"
  24. }}</span
  25. >
  26. <div class="sms_code_con flex_row_center_center">
  27. <el-input
  28. v-model="sms_code"
  29. placeholder="请输入短信验证码"
  30. type="number"
  31. ></el-input>
  32. <div class="get_sms pointer" @click="getSmsCode">
  33. {{ countDownM ? countDownM + L["s后获取"] : L["获取验证码"] }}
  34. </div>
  35. </div>
  36. <el-input
  37. type="password"
  38. class="password input"
  39. v-model="password"
  40. placeholder="请输入支付密码"
  41. autocomplete="new-password"
  42. ></el-input>
  43. <el-input
  44. type="password"
  45. class="password input"
  46. v-model="confirm_password"
  47. placeholder="请再次输入支付密码"
  48. autocomplete="new-password"
  49. >
  50. </el-input>
  51. <div class="error_tip">
  52. <span
  53. v-if="errorMsg"
  54. style="color: #e1251b; font-size: 14px"
  55. class="iconfont icon-jubao"
  56. ></span>
  57. {{ errorMsg }}
  58. </div>
  59. <div class="next flex_row_center_center pointer" @click="next">
  60. 重置支付密码
  61. </div>
  62. </template>
  63. <!-- 重置支付密码 end -->
  64. </div>
  65. <div class="manage_tips">
  66. <p class="tips_title">{{ L["温馨提示"] }}:</p>
  67. <p>• {{ L["为了保障您的账号安全,变更重要信息需进行身份验证。"] }}</p>
  68. <p>• {{ L["变更过程中有任何疑问请联系在线客服解决。"] }}</p>
  69. <p>
  70. {{ L["如手机号/邮箱已不再使用无法获取验证码,请联系在线客服解决。"] }}
  71. </p>
  72. <p>• {{ L["复杂的密码可使账号更安全且建议定期更换密码。"] }}</p>
  73. </div>
  74. </div>
  75. </div>
  76. </template>
  77. <script setup>
  78. import { ElInput, ElMessage,ElDialog,ElPagination, } from "element-plus";
  79. import { getCurrentInstance, reactive, ref, watch } from "vue";
  80. // import { lang_zn } from "@/assets/language/zh";
  81. import { getCurLanguage } from '@/composables/common.js';
  82. import { useFiltersStore } from "@/store/filter.js";
  83. const filtersStore = useFiltersStore();
  84. // const L = lang_zn;
  85. const L = getCurLanguage();
  86. definePageMeta({
  87. layout: "member",
  88. middleware: ["auth"],
  89. });
  90. const { proxy } = getCurrentInstance();
  91. const sms_code = ref("");
  92. const errorMsg = ref("");
  93. const password = ref(""); //输入新密码
  94. const confirm_password = ref(""); //再次输入新密码
  95. const old_password = ref(""); //输入旧密码
  96. // const confirm_password = ref("");
  97. const timeOutId = ref(""); //定时器的返回值
  98. const countDownM = ref(0); //短信验证码倒计时
  99. const memberInfo = reactive({ data: filtersStore.getMemberInfo });
  100. const isSmsClick = ref(false);
  101. const getSmsCode = () => {
  102. if (isSmsClick.value) {
  103. return;
  104. } else if (countDownM.value) {
  105. return;
  106. }
  107. isSmsClick.value = true;
  108. var param = {};
  109. param.verifyType = 2;
  110. param.verifyAddr = memberInfo.data.memberMobile;
  111. get("v3/msg/front/commons/sendVerifyCode", param).then((res) => {
  112. if (res.state == 200) {
  113. countDownM.value = 60;
  114. countDown();
  115. isSmsClick.value = false;
  116. } else {
  117. ElMessage.error(res.msg);
  118. isSmsClick.value = false;
  119. }
  120. });
  121. };
  122. const next = () => {
  123. isSmsClick.value = false;
  124. if (!memberInfo.data.memberMobile) {
  125. errorMsg.value = "请先绑定手机号,再进行操作!";
  126. return false;
  127. }
  128. let param = {};
  129. //重置支付密码
  130. //验证码校验
  131. if (!sms_code.value) {
  132. errorMsg.value = L["请输入短信验证码"];
  133. return false;
  134. } else {
  135. let checkSmsCodeVal = checkSmsCode(sms_code.value);
  136. if (checkSmsCodeVal !== true) {
  137. errorMsg.value = checkSmsCodeVal;
  138. return false;
  139. }
  140. }
  141. if (!password.value) {
  142. errorMsg.value = "请输入支付密码";
  143. return false;
  144. }
  145. if (!confirm_password.value) {
  146. errorMsg.value = "请再次输入支付密码";
  147. return false;
  148. }
  149. if (password.value != confirm_password.value) {
  150. errorMsg.value = "请输入一致的支付密码";
  151. return false;
  152. }
  153. //验证密码是否符合规则
  154. let checkPwdVal = checkPwd(password.value);
  155. if (checkPwdVal !== true) {
  156. errorMsg.value = checkPwdVal;
  157. return false;
  158. }
  159. let url = "v3/member/front/memberPassword/addPayPwd";
  160. param.memberMobile = memberInfo.data.memberMobile;
  161. param.verifyCode = sms_code.value;
  162. param.payPwd = password.value;
  163. post(url, param).then((res) => {
  164. if (res.state == 200) {
  165. ElMessage.success(res.msg);
  166. errorMsg.value = "";
  167. sms_code.value = "";
  168. password.value = "";
  169. confirm_password.value = "";
  170. } else {
  171. errorMsg.value = res.msg;
  172. }
  173. });
  174. };
  175. //倒计时
  176. const countDown = () => {
  177. countDownM.value--;
  178. if (countDownM.value == 0) {
  179. isSmsClick.value = false;
  180. clearTimeout(timeOutId.value);
  181. } else {
  182. timeOutId.value = setTimeout(countDown, 1000);
  183. }
  184. };
  185. watch([password, confirm_password, sms_code], () => {
  186. password.value = password.value.substring(0, 20);
  187. confirm_password.value = confirm_password.value.substring(0, 20);
  188. sms_code.value = sms_code.value.substring(0, 6);
  189. });
  190. </script>
  191. <style lang="scss" scoped>
  192. .sld_reset_password_mange {
  193. width: 1007px;
  194. float: left;
  195. margin-left: 10px;
  196. .container {
  197. background-color: white;
  198. width: 100%;
  199. box-sizing: border-box;
  200. border: 1px solid #eaeaea;
  201. padding: 25px 40px;
  202. .manage_tips {
  203. width: 938px;
  204. background: #fffdee;
  205. border: 1px solid #edd28b;
  206. padding: 15px 36px;
  207. margin-top: 117px;
  208. p {
  209. color: #555555;
  210. margin-top: 10px;
  211. }
  212. .tips_title {
  213. font-weight: bold;
  214. margin-bottom: 11px;
  215. margin-top: 0;
  216. }
  217. }
  218. .title {
  219. font-size: 18px;
  220. border-bottom: 1px dashed #eaeaea;
  221. padding-bottom: 25px;
  222. font-weight: 600;
  223. margin-bottom: 20px;
  224. }
  225. .mange_con {
  226. width: 360px;
  227. margin: 62px auto 0;
  228. .current {
  229. line-height: 56px;
  230. font-size: 14px;
  231. color: #000000;
  232. }
  233. .error_tip {
  234. height: 15px;
  235. margin-top: 10px;
  236. color: #f30213;
  237. i {
  238. margin-right: 10px;
  239. }
  240. }
  241. .without_phone_tip {
  242. line-height: 56px;
  243. font-size: 16px;
  244. color: $colorMain2;
  245. }
  246. .sms_code_con {
  247. width: 100%;
  248. .get_sms {
  249. width: 100px;
  250. height: 40px;
  251. line-height: 38px;
  252. background: #00985e;
  253. text-align: center;
  254. color: white;
  255. font-size: 14px;
  256. border-radius: 0 3px 3px 0;
  257. }
  258. }
  259. .margin {
  260. margin-top: 20px;
  261. }
  262. .next {
  263. width: 170px;
  264. height: 40px;
  265. background: #00985e;
  266. color: #fff;
  267. font-size: 18px;
  268. font-weight: bold;
  269. text-align: center;
  270. color: white;
  271. margin-top: 20px;
  272. line-height: 40px;
  273. border-radius: 3px;
  274. margin: 42px auto 0;
  275. }
  276. }
  277. }
  278. }
  279. </style>
  280. <style lang="scss">
  281. .sld_reset_password_mange {
  282. .el-input {
  283. width: 280px;
  284. height: 40px;
  285. border-radius: 3px 0 0 3px;
  286. position: inherit;
  287. }
  288. .el-input__inner {
  289. width: 280px;
  290. height: 40px;
  291. border-radius: 3px 0 0 3px;
  292. }
  293. .input {
  294. width: 100%;
  295. height: 40px;
  296. margin-top: 20px;
  297. border-radius: 3px;
  298. .el-input__inner {
  299. height: 40px;
  300. border-radius: 3px;
  301. width: 100%;
  302. }
  303. }
  304. }
  305. input[type="number"] {
  306. -moz-appearance: textfield;
  307. }
  308. input[type="number"]::-webkit-inner-spin-button,
  309. input[type="number"]::-webkit-outer-spin-button {
  310. -webkit-appearance: none;
  311. margin: 0;
  312. }
  313. /**
  314. * 解决el-input设置类型为number时,中文输入法光标上移问题
  315. **/
  316. .el-input__inner {
  317. line-height: 1px !important;
  318. }
  319. </style>