From df301b97413a533114ed73fb24bf21b655e39027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E6=88=90=E5=BC=BA?= Date: Fri, 27 Nov 2020 15:44:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) diff --git a/src/App.vue b/src/App.vue index 3e15256..2aee0c1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -34,10 +34,8 @@ export default { components: { }, computed: { - ...mapState(['user']) }, async created () { - console.log('created: ') if (!dd.other) { var vConsole = new VConsole({ vConsole_switch_x: 0, @@ -45,63 +43,12 @@ export default { }) localStorage.setItem('vConsole_switch_y', 0) localStorage.setItem('vConsole_switch_x', 1000) - // await this.handleGetDingtalkCode() - // await this.handleDingtalkLogin() } }, async mounted () { this.dd = dd }, methods: { - onCancel () { - - }, - ...mapMutations(['SET_USER_INFO']), - // 获取钉钉鉴权码 - handleGetDingtalkCode () { - return new Promise((resolve, reject) => { - let _this = this - dd.runtime.permission.requestAuthCode({ - corpId: 'ding267474e759bbca1c35c2f4657eb6378f', - onSuccess (res) { - console.log('result===', res) - _this.dingCode = res - resolve() - }, - onFail (err) { - console.log('err===', err) - _this.dingCode = err - resolve() - } - }) - }) - }, - // 钉钉免登录 - async handleDingtalkLogin (val = this.dingCode) { - const res = await apiDingtalkLogin(val) - console.log('钉钉免登录res: ', res) - if (res && res.code === 200) { - this.$cookies.set('token', res.token) - await this.handleInfo() - this.dataForm.verify = '登录成功,跳转中...' - // window.open(window.location.protocol + '//' + window.location.host + '/digitization/kpi/workbench/home?code=' + this.dingCode.code) - } else { - this.dataForm.verify = '身份验证失败' + res.msg - this.$message.error(this.dataForm.verify) - this.$router.replace({ name: 'dingTalkLogin' }) - } - }, - // 获取用户信息 - async handleInfo () { - let res = await apiUserInfo() - console.log('获取用户信息res: ', res) - if (res.code === 200) { - this.SET_USER_INFO(res.user) - this.SET_USER_AUTH(res.data) - } else { - this.$message.error(res.msg0) - } - } } }