wenhongquan 3 years ago
parent
commit
fcdd487b9c
1 changed files with 50 additions and 14 deletions
  1. 50 14
      src/views/login.vue

+ 50 - 14
src/views/login.vue

@@ -79,8 +79,8 @@ const { proxy } = getCurrentInstance();
 
 
 const loginForm = ref({
-  username: "admin",
-  password: "admin123",
+  username: "",
+  password: "",
   rememberMe: false,
   code: "",
   uuid: ""
@@ -100,25 +100,61 @@ const captchaOnOff = ref(true);
 const register = ref(false);
 const redirect = ref('/task/list/1');
 
+loading.value = true;
 
 function ddtologin(){
 
   try{
-    dd.runtime.permission.requestAuthCode({
-      corpId: "dingb9991e173e3ef14fa1320dcb25e91351",
-      onSuccess: function(result) {
-        store.dispatch("DDTOLogin", result.code).then(() => {
-          router.push({ path: redirect.value || "/" });
-        }).catch((e) => {
-          console.log( e)
+
+    if (dd.env.platform!=="notInDingTalk") {
+      dd.device.notification.showPreloader({
+        text: "登录中...", //loading显示的字符,空表示不显示文字
+        showIcon: true, //是否显示icon,默认true
+        onSuccess : function(result) {
+          /*{}*/
+        },
+        onFail : function(err) {}
+      })
+      dd.runtime.permission.requestAuthCode({
+        corpId: "dingb9991e173e3ef14fa1320dcb25e91351",
+        onSuccess: function (result) {
+          store.dispatch("DDTOLogin", result.code).then(() => {
+            dd.device.notification.hidePreloader({
+              onSuccess : function(result) {
+                /*{}*/
+              },
+              onFail : function(err) {}
+            })
+            router.push({path: redirect.value || "/"});
+          }).catch((e) => {
+            console.log(e)
+            loading.value = false;
+          });
           loading.value = false;
-        });
+          dd.device.notification.hidePreloader({
+            onSuccess : function(result) {
+              /*{}*/
+            },
+            onFail : function(err) {}
+          })
 
-      },
-      onFail : function(err) {}
-    })
-  }catch (e){
 
+        },
+        onFail: function (err) {
+          loading.value = false;
+          dd.device.notification.hidePreloader({
+            onSuccess : function(result) {
+              /*{}*/
+            },
+            onFail : function(err) {}
+          })
+        }
+      })
+    }else{
+      loading.value = false;
+    };
+  }catch (e){
+    loading.value = false;
   }
 }