bayi 1 vuosi sitten
vanhempi
commit
2dc7413f83
1 muutettua tiedostoa jossa 15 lisäystä ja 2 poistoa
  1. 15 2
      pages/my/index.js

+ 15 - 2
pages/my/index.js

@@ -61,7 +61,8 @@ Page({
       success: async ({
         content
       }) => {
-        if (content.trim()) {
+        let regexp = /^[a-zA-Z0-9]{4}$/
+        if (regexp.test(content)) {
           let activationRes = await getLearnCard({
             cardNo: content
           })
@@ -75,8 +76,20 @@ Page({
             activationModal: true,
             activationRes
           })
+        } else {
+          if (typeof this.getTabBar === 'function') {
+            this.getTabBar().setData({
+              mask: true
+            })
+          }
+          this.setData({
+            activationModal: true,
+            activationRes: {
+              code: 581,
+              message: '请检查激活码输入是否正确'
+            }
+          })
         }
-        /*   */
       }
     })
   },