updatepassword.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. const app = require('../../utils/util.js');
  2. var util = require('../../utils/md5.js')
  3. Page({
  4. data: {
  5. defaultType1: true,
  6. passwordType1: true,
  7. defaultType2: true,
  8. passwordType2: true,
  9. defaultType3: true,
  10. passwordType3: true,
  11. },
  12. eyeStatus1() {
  13. if (this.data.defaultType1) {
  14. this.setData({
  15. passwordType1: false,
  16. defaultType1: false,
  17. })
  18. } else {
  19. this.setData({
  20. passwordType1: true,
  21. defaultType1: true,
  22. })
  23. }
  24. },
  25. eyeStatus2() {
  26. if (this.data.defaultType2) {
  27. this.setData({
  28. passwordType2: false,
  29. defaultType2: false,
  30. })
  31. } else {
  32. this.setData({
  33. passwordType2: true,
  34. defaultType2: true,
  35. })
  36. }
  37. },
  38. eyeStatus3() {
  39. if (this.data.defaultType3) {
  40. this.setData({
  41. passwordType3: false,
  42. defaultType3: false,
  43. })
  44. } else {
  45. this.setData({
  46. passwordType3: true,
  47. defaultType3: true,
  48. })
  49. }
  50. },
  51. formSubmit(e) {
  52. console.log(e.detail, "daying");
  53. var password = e.detail.value.pwd;
  54. wx.request({
  55. url: app.globalData.publicUrl + '/applet/bing',
  56. method: "GET",
  57. data: {
  58. name: e.detail.value.name,
  59. pwd: util.hexMD5(password),
  60. appletsId: wx.getStorageSync('openId')
  61. },
  62. success: (res) => {
  63. }
  64. })
  65. // wx.switchTab({
  66. // url: '/pages/index/index',
  67. // })
  68. },
  69. onLoad: function () {
  70. var that = this;
  71. wx.login({
  72. success: res => {
  73. // 获取到用户的 code 之后:res.code
  74. console.log("用户的code:" + res.code);
  75. const appid = "wx1c015df104db7030"
  76. const secret = "d1956c1b5d3601657c98b0dc80a006f7"
  77. let url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' + appid + '&secret=' + secret + '&js_code=' + res.code + '&grant_type=authorization_code';
  78. wx.request({
  79. // 自行补上自己的 APPID 和 SECRET
  80. url: url,
  81. success: res => {
  82. // 获取到用户的 openid
  83. console.log("用户的openid:" + res.data.openid);
  84. wx.setStorageSync('openId', res.data.openid)
  85. }
  86. });
  87. }
  88. });
  89. },
  90. })