wenhongquan 3 년 전
부모
커밋
04bf24fb7a
1개의 변경된 파일26개의 추가작업 그리고 48개의 파일을 삭제
  1. 26 48
      src/views/login.vue

+ 26 - 48
src/views/login.vue

@@ -78,54 +78,6 @@ const { proxy } = getCurrentInstance();
 
 
 
-try{
-  dd.runtime.permission.requestAuthCode({
-  corpId: "dingb9991e173e3ef14fa1320dcb25e91351",
-  onSuccess: function(result) {
-    /*{
-        code: 'hYLK98jkf0m' //string authCode
-    }*/
-    store.dispatch("DDLogin", result.code).then(() => {
-      router.push({ path: redirect.value || "/" });
-    }).catch(() => {
-      loading.value = false;
-    });
-
-    // console.log(result)
-  },
-  onFail : function(err) {}
-
-})
-
-
-
-
-}catch (e){
-
-}
-
-
-// dd.config({
-//   agentId: '', // 必填,微应用ID
-//   corpId: '',//必填,企业ID
-//   timeStamp: '', // 必填,生成签名的时间戳
-//   nonceStr: '', // 必填,自定义固定字符串。
-//   signature: '', // 必填,签名
-//   type:0,
-//   jsApiList : [
-//     'runtime.info',
-//     'biz.contact.choose',
-//     'device.notification.confirm',
-//     'device.notification.alert',
-//     'device.notification.prompt',
-//     'biz.ding.post',
-//     'biz.util.openLink',
-//   ] // 必填,需要使用的jsapi列表,注意:不要带dd。
-// });
-
-// dd.error(function (err) {
-//   alert('dd error: ' + JSON.stringify(err));
-// })//该方法必须带上,用来捕获鉴权出现的异常信息,否则不方便排查出现的问题
 
 const loginForm = ref({
   username: "admin",
@@ -149,6 +101,31 @@ const captchaOnOff = ref(true);
 const register = ref(false);
 const redirect = ref('/task/list/1');
 
+
+function ddlogin(){
+
+  try{
+    dd.runtime.permission.requestAuthCode({
+      corpId: "dingb9991e173e3ef14fa1320dcb25e91351",
+      onSuccess: function(result) {
+        /*{
+            code: 'hYLK98jkf0m' //string authCode
+        }*/
+        store.dispatch("DDLogin", result.code).then(() => {
+          router.push({ path: redirect.value || "/" });
+        }).catch(() => {
+          loading.value = false;
+        });
+
+        // console.log(result)
+      },
+      onFail : function(err) {}
+    })
+  }catch (e){
+
+  }
+}
+
 function handleLogin() {
   proxy.$refs.loginRef.validate(valid => {
     if (valid) {
@@ -201,6 +178,7 @@ function getCookie() {
 
 getCode();
 getCookie();
+ddlogin();
 </script>
 
 <style lang='scss' scoped>