Преглед изворни кода

Merge branch 'master' of http://git.cc-lotus.info/roose/mzxiaochengxu

roose пре 4 година
родитељ
комит
220f516dc2
1 измењених фајлова са 28 додато и 13 уклоњено
  1. 28 13
      pages/personInfo/personInfo.js

+ 28 - 13
pages/personInfo/personInfo.js

@@ -26,23 +26,39 @@ Page({
     })
   },
   tuichu() {
-    wx.request({
-      url: app.globalData.publicUrl + '/applet/unbind',
-      method: "GET",
-      data: {
-        appletsId: wx.getStorageSync('openId')
-      },
-      success: (res) => {
-        if (res.data.code == 0) {
-          wx.clearStorageSync();
-          wx.switchTab({
-            url: '/pages/index/index',
+    wx.showModal({
+      showCancel: true,
+      content: "您确认要退出吗?",
+      success(res) {
+        if (res.confirm) {
+          wx.showLoading({
+            mask: true,
+            title: '退出中',
+          })
+          wx.request({
+            url: app.globalData.publicUrl + '/applet/unbind',
+            method: "GET",
+            data: {
+              appletsId: wx.getStorageSync('openId')
+            },
+            success: (res) => {
+              if (res.data.code == 0) {
+                wx.hideLoading()
+                wx.clearStorageSync();
+                wx.switchTab({
+                  url: '/pages/index/index',
+                })
+              }
+            },
+            fail:()=>{
+              wx.hideLoading()
+            }
           })
         }
       }
     })
-  },
 
+  },
   onShow() {
     console.log(wx.getStorageSync('user'), "打印");
     if (wx.getStorageSync('user') == '') {
@@ -67,5 +83,4 @@ Page({
   onLoad() {
 
   }
-
 })