飞书授权

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', autodaygj:'Customize',
nexttime:'Next follow-up reminder setting', nexttime:'Next follow-up reminder setting',
details:'Details', details:'Details',
auth:'Authorize', auth:'Lark Authorize',
inputnl:'Please select', inputnl:'Please select',
} }
+1 -1
View File
@@ -152,6 +152,6 @@ export default {
autodaygj:'自定义', autodaygj:'自定义',
nexttime:'下次跟进提醒设置', nexttime:'下次跟进提醒设置',
details:'详情', details:'详情',
auth:'授权', auth:'飞书授权',
inputnl:'请选择', inputnl:'请选择',
} }
+1
View File
@@ -103,6 +103,7 @@
uni.removeStorageSync('location') uni.removeStorageSync('location')
}, },
onShow() { onShow() {
this.queryList(1, 10)
this.options1=[{ this.options1=[{
text: this.$t('delete'), text: this.$t('delete'),
style: { style: {
+7 -1
View File
@@ -19,7 +19,7 @@
<view class="minemp"> <view class="minemp">
<view class="mineid">ID:{{userinfo.id}}</view> <view class="mineid">ID:{{userinfo.id}}</view>
<!-- <view class="mp" @click="gomymp">{{$t('auth')}}</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> </view>
</view> </view>
@@ -49,6 +49,11 @@
<span>{{$t('mine.feedback')}}</span> <span>{{$t('mine.feedback')}}</span>
<uni-icons type="right" class="icon" size="18"></uni-icons> <uni-icons type="right" class="icon" size="18"></uni-icons>
</view> --> </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')"> <view class="sonContent" @click="navTo('/pages/mine/about')">
<image class="son-img-bg" src="/static/image/mine/icon5.png"></image> <image class="son-img-bg" src="/static/image/mine/icon5.png"></image>
<span>{{$t('mine.about')}}</span> <span>{{$t('mine.about')}}</span>
@@ -64,6 +69,7 @@
<span>{{$t('mine.recyclebin')}}</span> <span>{{$t('mine.recyclebin')}}</span>
<uni-icons type="right" class="icon" size="18"></uni-icons> <uni-icons type="right" class="icon" size="18"></uni-icons>
</view> --> </view> -->
<view class="sonContent" @click="logout"> <view class="sonContent" @click="logout">
<image class="son-img-bg" src="/static/image/mine/icon7.png"></image> <image class="son-img-bg" src="/static/image/mine/icon7.png"></image>
<span>{{$t('mine.logout')}}</span> <span>{{$t('mine.logout')}}</span>
+47 -8
View File
@@ -1,6 +1,6 @@
<template> <template>
<view> <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> </view>
</template> </template>
@@ -9,18 +9,59 @@
export default { export default {
data() { data() {
return { return {
webUrl:'' webUrl:'',
datas:{}
} }
}, },
onLoad(options) { onLoad(options) {
console.log(options); console.log(options)
this.feishugetAuth() this.getCode(options.code,options.state)
if(options.code){ },
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({ request({
url:'feishu/getAuth', url:'feishu/getAuth',
method:'post', method:'post',
data:{ data:{
code:options.code code: code,
state:state
} }
}).then(res => { }).then(res => {
uni.showToast({ uni.showToast({
@@ -35,9 +76,7 @@
}, 1000); }, 1000);
} }
}) })
}
}, },
methods: {
feishugetAuth(){ feishugetAuth(){
const pages = getCurrentPages(); const pages = getCurrentPages();
const currentPage = pages[pages.length - 1]; const currentPage = pages[pages.length - 1];