Prechádzať zdrojové kódy

fix(frontend): 退出切换密码校验失败时补充用户提示

iwt 2 týždňov pred
rodič
commit
550b7b7c0a
1 zmenil súbory, kde vykonal 12 pridanie a 6 odobranie
  1. 12 6
      cfc-frontend/components/ProfileHeader.vue

+ 12 - 6
cfc-frontend/components/ProfileHeader.vue

@@ -121,12 +121,18 @@ export default {
         editable: true,
         success: async function(res) {
           if (!res.confirm || !res.content) return
-          var ok = await self.$store.dispatch('switchBackWithPassword', res.content)
-          if (ok) {
-            self.isSwitchedChild = false
-            self.role = 'parent'
-            uni.showToast({ title: '已退出切换', icon: 'success' })
-            uni.reLaunch({ url: '/pages/index-home/index' })
+          try {
+            var ok = await self.$store.dispatch('switchBackWithPassword', res.content)
+            if (ok) {
+              self.isSwitchedChild = false
+              self.role = 'parent'
+              uni.showToast({ title: '已退出切换', icon: 'success' })
+              uni.reLaunch({ url: '/pages/index-home/index' })
+            } else {
+              uni.showToast({ title: '密码错误', icon: 'none' })
+            }
+          } catch (e) {
+            uni.showToast({ title: '验证失败', icon: 'none' })
           }
         }
       })