飞书授权

This commit is contained in:
浅念
2025-03-22 19:23:14 +08:00
parent 93b8f8729b
commit 198387027e
5 changed files with 58 additions and 12 deletions
+1 -1
View File
@@ -153,6 +153,6 @@ export default {
autodaygj:'Customize',
nexttime:'Next follow-up reminder setting',
details:'Details',
auth:'Authorize',
auth:'Lark Authorize',
inputnl:'Please select',
}
+1 -1
View File
@@ -152,6 +152,6 @@ export default {
autodaygj:'自定义',
nexttime:'下次跟进提醒设置',
details:'详情',
auth:'授权',
auth:'飞书授权',
inputnl:'请选择',
}
+1
View File
@@ -103,6 +103,7 @@
uni.removeStorageSync('location')
},
onShow() {
this.queryList(1, 10)
this.options1=[{
text: this.$t('delete'),
style: {
+7 -1
View File
@@ -19,7 +19,7 @@
<view class="minemp">
<view class="mineid">ID:{{userinfo.id}}</view>
<!-- <view class="mp" @click="gomymp">{{$t('auth')}}</view> -->
<view v-if="!isopenid" class="mp" @click="gomyauth">{{$t('auth')}}</view>
<!-- <view v-if="!isopenid" class="mp" @click="gomyauth">{{$t('auth')}}</view> -->
</view>
</view>
</view>
@@ -49,6 +49,11 @@
<span>{{$t('mine.feedback')}}</span>
<uni-icons type="right" class="icon" size="18"></uni-icons>
</view> -->
<view class="sonContent" @click="gomyauth">
<image class="son-img-bg" style="width: 30px; height: 30px;" src="/static/image/login/fenshu.png"></image>
<span>{{$t('auth')}}</span>
<uni-icons type="right" class="icon" size="18"></uni-icons>
</view>
<view class="sonContent" @click="navTo('/pages/mine/about')">
<image class="son-img-bg" src="/static/image/mine/icon5.png"></image>
<span>{{$t('mine.about')}}</span>
@@ -64,6 +69,7 @@
<span>{{$t('mine.recyclebin')}}</span>
<uni-icons type="right" class="icon" size="18"></uni-icons>
</view> -->
<view class="sonContent" @click="logout">
<image class="son-img-bg" src="/static/image/mine/icon7.png"></image>
<span>{{$t('mine.logout')}}</span>
+48 -9
View File
@@ -1,6 +1,6 @@
<template>
<view>
<web-view style="background-color: #fafafa;height: 100vh;" ref="webview" :src="webUrl"></web-view>
<!-- <web-view style="background-color: #fafafa;height: 100vh;" ref="webview" :src="webUrl"></web-view> -->
</view>
</template>
@@ -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];