diff --git a/common/locales/en.js b/common/locales/en.js index e8edd92..ee437ea 100644 --- a/common/locales/en.js +++ b/common/locales/en.js @@ -153,6 +153,6 @@ export default { autodaygj:'Customize', nexttime:'Next follow-up reminder setting', details:'Details', - auth:'Authorize', + auth:'Lark Authorize', inputnl:'Please select', } \ No newline at end of file diff --git a/common/locales/zh.js b/common/locales/zh.js index 6af76c9..bb94c95 100644 --- a/common/locales/zh.js +++ b/common/locales/zh.js @@ -152,6 +152,6 @@ export default { autodaygj:'自定义', nexttime:'下次跟进提醒设置', details:'详情', - auth:'授权', + auth:'飞书授权', inputnl:'请选择', } \ No newline at end of file diff --git a/pages/index/customer.vue b/pages/index/customer.vue index 5c81684..8220466 100644 --- a/pages/index/customer.vue +++ b/pages/index/customer.vue @@ -103,6 +103,7 @@ uni.removeStorageSync('location') }, onShow() { + this.queryList(1, 10) this.options1=[{ text: this.$t('delete'), style: { diff --git a/pages/index/mine.vue b/pages/index/mine.vue index b7c5354..b920252 100644 --- a/pages/index/mine.vue +++ b/pages/index/mine.vue @@ -19,7 +19,7 @@ ID:{{userinfo.id}} - {{$t('auth')}} + @@ -49,6 +49,11 @@ {{$t('mine.feedback')}} --> + + + {{$t('auth')}} + + {{$t('mine.about')}} @@ -64,6 +69,7 @@ {{$t('mine.recyclebin')}} --> + {{$t('mine.logout')}} diff --git a/pages/index/webview.vue b/pages/index/webview.vue index 52a617b..bf52e8b 100644 --- a/pages/index/webview.vue +++ b/pages/index/webview.vue @@ -1,6 +1,6 @@ @@ -9,18 +9,59 @@ export default { data() { return { - webUrl:'' + webUrl:'', + datas:{} } }, onLoad(options) { - console.log(options); - this.feishugetAuth() - if(options.code){ + console.log(options) + this.getCode(options.code,options.state) + }, + methods: { + getUrlParam() { + let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)') + let r = window.location.search.substr(1).match(reg) + if (r != null) { + return unescape(r[2]) + } + return null + }, + getCode(code,state) { + // var code = this.getUrlParam('code'); + console.log(code) + var code_url = ''; + if (code == null || code == '' || !code) { + console.log(2222222) + request({ + url:'feishu/getinfo', + method:'post', + }).then(res => { + var data = res.data.data; + this.datas = data + console.log(data) + + code_url += 'https://open.feishu.cn/open-apis/authen/v1/authorize' + code_url += '?app_id=' + data.app_id + code_url += '&redirect_uri=' + data.redirect_uri + code_url += '&scope=' + data.scope + code_url += '&state=' + data.state; + + console.log(code_url) + // return; + window.location.href = code_url; + }) + } else { + this.getOpenId(code,state) + return; + } + }, + getOpenId(code,state) { request({ url:'feishu/getAuth', method:'post', data:{ - code:options.code + code: code, + state:state } }).then(res => { uni.showToast({ @@ -35,9 +76,7 @@ }, 1000); } }) - } - }, - methods: { + }, feishugetAuth(){ const pages = getCurrentPages(); const currentPage = pages[pages.length - 1];