123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- const app = require('../../utils/util.js');
- var util = require('../../utils/md5.js')
- Page({
- data: {
- defaultType1: true,
- passwordType1: true,
- defaultType2: true,
- passwordType2: true,
- defaultType3: true,
- passwordType3: true,
- info: {},
- },
- eyeStatus1() {
- if (this.data.defaultType1) {
- this.setData({
- passwordType1: false,
- defaultType1: false,
- })
- } else {
- this.setData({
- passwordType1: true,
- defaultType1: true,
- })
- }
- },
- eyeStatus2() {
- if (this.data.defaultType2) {
- this.setData({
- passwordType2: false,
- defaultType2: false,
- })
- } else {
- this.setData({
- passwordType2: true,
- defaultType2: true,
- })
- }
- },
- eyeStatus3() {
- if (this.data.defaultType3) {
- this.setData({
- passwordType3: false,
- defaultType3: false,
- })
- } else {
- this.setData({
- passwordType3: true,
- defaultType3: true,
- })
- }
- },
- formSubmit(e) {
- console.log(e.detail, "daying");
- if (e.detail.value.oldPwd) {
- if (e.detail.value.pwd) {
- if (e.detail.value.newPwd) {
- if (e.detail.value.pwd.toString().length > 5) {
- if (e.detail.value.pwd == e.detail.value.newPwd) {
- wx.request({
- url: app.globalData.publicUrl + '/applet/updatePwd',
- method: "GET",
- header: {
- appletsId: wx.getStorageSync('openId')
- },
- data: e.detail.value,
- success: (res) => {
- if (res.data.code == 0) {
- wx.showModal({
- showCancel: false,
- content: '密码已修改',
- success: () => {
- wx.switchTab({
- url: '/pages/index/index',
- })
- }
- })
- } else if(res.data.code == 1) {
- wx.showToast({
- title: "修改失败,原密码不正确",
- icon: 'none',
- duration: 2000,
- })
- }else{
- wx.showToast({
- title: "修改失败,请联系管理员",
- icon: 'none',
- duration: 2000,
- })
- }
- }
- })
- } else {
- wx.showToast({
- title: "两次输入密码不一致",
- icon: 'none',
- duration: 2000,
- })
- }
- } else {
- wx.showToast({
- title: "密码长度最少为6位",
- icon: 'none',
- duration: 2000,
- })
- }
- } else {
- wx.showToast({
- title: "在输入新密码不能为空",
- icon: 'none',
- duration: 2000,
- })
- }
- } else {
- wx.showToast({
- title: "新密码不能为空",
- icon: 'none',
- duration: 2000,
- })
- }
- } else {
- wx.showToast({
- title: "原密码不能为空",
- icon: 'none',
- duration: 2000,
- })
- }
- },
- onLoad: function () {
- wx.request({
- url: app.globalData.publicUrl + '/applet/findUserInfo',
- method: "GET",
- header: {
- appletsId: wx.getStorageSync('openId')
- },
- success: (res) => {
- console.log(res, "000");
- this.setData({
- info: res.data.data
- })
- }
- })
- },
- })
|