钉钉 登录测试

(cherry picked from commit cb34ffaeeee0d63e3c2211fdb69a77c3c5fab23e)
This commit is contained in:
Xia Zekun
2024-09-06 17:22:59 +08:00
committed by mzaxd
parent 5597600854
commit b9ba9a1574
2 changed files with 28 additions and 0 deletions
+7
View File
@@ -21,8 +21,15 @@ import 'ant-design-vue/dist/antd.css'
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
// 引入 VConsole
import VConsole from 'vconsole'
Vue.config.productionTip = false
// 启动 VConsole
// eslint-disable-next-line no-new
if (window._CONFIG.vConsole) new VConsole()
Vue.use(Vant)
Vue.use(VueI18n)
Vue.prototype.$message = Toast
+21
View File
@@ -28,6 +28,7 @@ import { getRSAPublicKey } from '@/utils/encryption'
import { JSEncrypt } from 'jsencrypt'
import { mapActions } from 'vuex'
import { getAction } from '@api/manage'
import * as dd from 'dingtalk-jsapi'
export default {
name: 'LoginPage',
@@ -43,11 +44,31 @@ export default {
}
},
created () {
// 尝试通过钉钉登录
this.loginFromDingTalk()
// 正常登录部分
this.getPublicKey()
this.handleChangeCheckCode()
},
methods: {
...mapActions(['Login']),
// 尝试通过钉钉登录
loginFromDingTalk () {
if (dd.env.platform === 'notInDingTalk') {
console.log('请在钉钉内打开')
return false
}
const ddCorpId = window._CONFIG.ddCorpId
console.log('ddCorpId', ddCorpId)
dd.runtime.permission.requestAuthCode({
cropId: ddCorpId,
onSuccess: function (info) {
console.log('dd requestAuthCode success:', info)
}
})
},
// 获取RSA公钥
getPublicKey () {
// 获取公钥