From 0f2fdf16f47bd2d1d8fee86449c3a5095ccc8c23 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 21 十月 2022 18:32:04 +0800
Subject: [PATCH] 首发版本 2022.10.21

---
 pages/m_user/p_changepw/p_changepw.js |   84 ++++++++++++++++++------------------------
 1 files changed, 36 insertions(+), 48 deletions(-)

diff --git a/pages/m_user/p_changepw/p_changepw.js b/pages/m_user/p_changepw/p_changepw.js
index 9043dbc..6080e17 100644
--- a/pages/m_user/p_changepw/p_changepw.js
+++ b/pages/m_user/p_changepw/p_changepw.js
@@ -1,6 +1,9 @@
 // pages/m_user/p_changepw/p_changepw.js
 import b_inputCheck from '../../../base/behaviors/b_inputCheck'
 import b_loadingToast from '../../../base/behaviors/b_loadingToast'
+import userservice from '../../../service/userservice'
+
+const app = getApp()
 
 Page({
   behaviors: [b_inputCheck, b_loadingToast],
@@ -12,7 +15,7 @@
         name: "鍘熷瘑鐮�",
         id: "oldPassword",
         input: true,
-        type: 'password',
+        // type: 'password',
         value: '',
         noValue: false,
       },
@@ -42,52 +45,37 @@
 
   },
 
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
-   */
-  onReady() {
-
-  },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
-   */
-  onShow() {
-
-  },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌
-   */
-  onHide() {
-
-  },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇
-   */
-  onUnload() {
-
-  },
-
-  /**
-   * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
-   */
-  onPullDownRefresh() {
-
-  },
-
-  /**
-   * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
-   */
-  onReachBottom() {
-
-  },
-
-  /**
-   * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
-   */
-  onShareAppMessage() {
-
+  _submit(e) {
+    if (e.oldPassword == e.newPassword) {
+      this.setData({
+        errorMsg: '鏂板瘑鐮佷笉鑳藉拰鍘熷瘑鐮佺浉鍚�',
+      })
+      return
+    }
+    userservice.changePW(app.globalData.accessToken.userId, e.oldPassword, e.newPassword, {
+      success(res) {
+        if (res.success) {
+          wx.navigateBack({
+            delta: 1,
+            success: () => {
+              wx.showToast({
+                title: res.message,
+                duration: 2000,
+                icon: 'success',
+                mask: true,
+              })
+            }
+          })
+        } else {
+          wx.showToast({
+            title: res.message,
+            duration: 2000,
+            icon: 'error',
+            mask: true,
+          })
+        }
+        
+      }
+    })
   }
 })
\ No newline at end of file

--
Gitblit v1.9.3