抖音b端
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.

63 lines
1.4 KiB

  1. // pages/setpwd/setpwd.js
  2. const config = require('../../config/config.js')
  3. const Common = require("../../common/common.js")
  4. const app = getApp()
  5. Page({
  6. data: {
  7. phone: '',
  8. yzm: ''
  9. },
  10. onLoad(e) {
  11. this.setData({
  12. phone: e.phone,
  13. yzm: e.code
  14. })
  15. },
  16. setPwd(e) {
  17. let {
  18. newPwd,
  19. pwd
  20. } = e.detail.value
  21. var regx = /^(?![0-9]+$)(?![a-zA-Z]+$)[a-zA-Z\d]{8,16}$/;
  22. if (newPwd.match(regx) == null) {
  23. tt.showToast({
  24. title: '密码为8-16位字母和数字的组合',
  25. icon: "none"
  26. // image: './../../static/images/fail.png',
  27. })
  28. } else {
  29. console.log(newPwd)
  30. console.log(pwd)
  31. if (newPwd == pwd) {
  32. Common.updateUserPassword(this.data.phone, this.data.yzm, newPwd)
  33. .then(res => {
  34. if (res.code == 200) {
  35. tt.showToast({
  36. title: "修改成功",
  37. icon: "none",
  38. duration:1200
  39. })
  40. setTimeout(function () {
  41. tt.reLaunch({
  42. url: '/pages/main/main',
  43. })
  44. }, 1200)
  45. } else {
  46. tt.showToast({
  47. title: res.message,
  48. icon: "none"
  49. })
  50. }
  51. })
  52. } else {
  53. tt.showToast({
  54. title: '密码不一致',
  55. icon: "none"
  56. // image: './../../static/images/fail.png',
  57. })
  58. }
  59. }
  60. }
  61. })