| | |
| | | }, |
| | | plugins: ['vue', '@typescript-eslint'], |
| | | rules: { |
| | | "vue/comment-directive": "off", |
| | | 'vue/multi-word-component-names': 'off', |
| | | '@typescript-eslint/no-empty-function': 'off', |
| | | '@typescript-eslint/no-explicit-any': 'off', |
| | |
| | | // 然而在 Linux 和 Unix 中只使用简单的换行分隔符 (LF)。 |
| | | // 对应的控制字符为 "\n" (LF) 和 "\r\n"(CRLF)。auto意为保持现有的行尾 |
| | | // 换行符使用 lf 结尾是 可选值"<auto|lf|crlf|cr>" |
| | | endOfLine: 'auto' |
| | | endOfLine: 'auto', |
| | | overrides: [ |
| | | { |
| | | "files": "*.html", |
| | | "options": { |
| | | "parser": "html" |
| | | } |
| | | } |
| | | ] |
| | | }; |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | |
| | | <head> |
| | | <meta charset="utf-8" /> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
| | |
| | | } |
| | | </style> |
| | | </head> |
| | | <script src="./src/assets/ddlogin.js"></script> |
| | | <!-- <script src="https://g.alicdn.com/dingding/dinglogin/0.0.5/ddLogin.js"></script> --> |
| | | |
| | | <body> |
| | | <div id="app"> |
| | | <div id="loader-wrapper"> |
| | |
| | | </div> |
| | | <script type="module" src="/src/main.ts"></script> |
| | | </body> |
| | | |
| | | <script src="public/ddlogin.js"></script> |
| | | </html> |
| | |
| | | } |
| | | } else { |
| | | // 没有token |
| | | console.log("没有token"); |
| | | console.log('没有token'); |
| | | if (whiteList.indexOf(to.path) !== -1) { |
| | | // 在免登录白名单,直接进入 |
| | | next(); |
| | |
| | | NProgress.done(); |
| | | }); |
| | | |
| | | const judge = (token: string) => { |
| | | const judge = (token: string | null) => { |
| | | if (token) { |
| | | var data = JSON.parse(token) |
| | | const data = JSON.parse(token); |
| | | if (data != null) { |
| | | if (data.expirse != null && new Date().getTime() - data.expirse < 60 * 60 * 1000) { |
| | | return true |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false |
| | | } |
| | | return false; |
| | | }; |
| | |
| | | } |
| | | // get请求映射params参数 |
| | | if (config.method === 'get' && config.params) { |
| | | console.log(config.params, '请求参数'); |
| | | let url = config.url + '?' + tansParams(config.params); |
| | | url = url.slice(0, -1); |
| | | config.params = {}; |
| | |
| | | } |
| | | // 当开启参数加密 |
| | | if (isEncrypt && (config.method === 'post' || config.method === 'put' || config.method === 'get')) { |
| | | console.log('开启了参数加密'); |
| | | // 生成一个 AES 密钥 |
| | | const aesKey = generateAesKey(); |
| | | config.headers['encrypt-key'] = encrypt(encryptBase64(aesKey)); |
| | |
| | | return config; |
| | | }, |
| | | (error: any) => { |
| | | console.log(error); |
| | | console.log(error, 'wcs'); |
| | | return Promise.reject(error); |
| | | } |
| | | ); |
| | |
| | | setToken(JSON.stringify(data)); |
| | | window.location.href = '/index'; |
| | | } else { |
| | | ElMessage({ message: '登录失败', type: 'error' }); |
| | | ElMessage({ message: '无权访问', type: 'error' }); |
| | | setTimeout(() => { |
| | | window.location.href = '/login'; |
| | | }, 3000); |
| | |
| | | } else { |
| | | var mode = 'openid corpid'; |
| | | window.location.href = |
| | | 'https://login.dingtalk.com/oauth2/auth?redirect_uri=http://127.0.0.1:81/login&response_type=code&client_id=dingl5dxahaj3uzfug66&scope=' + |
| | | 'https://login.dingtalk.com/oauth2/auth?redirect_uri=http://171.221.173.53:8801/login&response_type=code&client_id=dingl5dxahaj3uzfug66&scope=' + |
| | | encodeURIComponent(mode) + |
| | | '&state=dddd&prompt=consent'; |
| | | // // STEP3:在需要的时候,调用 window.DTFrameLogin 方法构造登录二维码,并处理登录成功或失败的回调。 |