Skip to content

Commit 0721109

Browse files
committed
feat: update wecomQrCode.vue to use qr_url for iframe source and add qr_url to props
1 parent cb4185b commit 0721109

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

ui/src/views/chat/user-login/scanCompinents/wecomQrCode.vue

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,28 @@
33
</template>
44

55
<script lang="ts" setup>
6-
import { nextTick, defineProps, onBeforeUnmount } from 'vue'
7-
import { useRoute, useRouter } from 'vue-router'
8-
import { getBrowserLang } from '@/locales'
6+
import {nextTick, defineProps, onBeforeUnmount} from 'vue'
7+
import {useRoute, useRouter} from 'vue-router'
8+
import {getBrowserLang} from '@/locales'
99
import useStore from '@/stores'
1010
11-
const WE_COM_ORIGIN = 'https://login.work.weixin.qq.com'
12-
const LOGIN_STATE = 'fit2cloud-wecom-qr'
1311
const props = defineProps<{
1412
config: {
1513
app_secret: string
1614
app_key: string
1715
corp_id?: string
1816
agent_id?: string
1917
callback_url: string
18+
qr_url: string
2019
}
2120
}>()
2221
2322
const router = useRouter()
2423
const route = useRoute()
25-
const { chatUser } = useStore()
24+
const {chatUser} = useStore()
2625
2726
const {
28-
params: { accessToken },
27+
params: {accessToken},
2928
} = route as any
3029
3130
let iframe: HTMLIFrameElement | null = null
@@ -67,7 +66,7 @@ const init = async () => {
6766
const redirectUri = encodeURIComponent(props.config.callback_url)
6867
6968
iframe.src =
70-
`${WE_COM_ORIGIN}/wwlogin/sso/login` +
69+
`${props.config.qr_url}` +
7170
`?login_type=CorpApp` +
7271
`&appid=${props.config.corp_id}` +
7372
`&agentid=${props.config.agent_id}` +
@@ -86,7 +85,7 @@ const init = async () => {
8685
chatUser.setToken(event.data.value)
8786
router.push({
8887
name: 'chat',
89-
params: { accessToken },
88+
params: {accessToken},
9089
query: route.query,
9190
})
9291
}

ui/src/views/login/scanCompinents/wecomQrCode.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ const props = defineProps<{
1313
app_key: string
1414
corp_id?: string
1515
agent_id?: string
16-
callback_url: string
16+
callback_url: string,
17+
qr_url: string
1718
}
1819
}>()
1920
@@ -34,7 +35,7 @@ const init = async () => {
3435
const redirectUri = encodeURIComponent(data.redirectUri)
3536
console.log('redirectUri', data.redirectUri)
3637
// 手动构建生成二维码的url
37-
iframeUrl.value = `https://login.work.weixin.qq.com/wwlogin/sso/login?login_type=CorpApp&appid=${data.corpId}&agentid=${data.agentId}&redirect_uri=${redirectUri}&state=fit2cloud-wecom-qr&lang=${lang}&panel_size=small`
38+
iframeUrl.value = `${props.config.qr_url}?login_type=CorpApp&appid=${data.corpId}&agentid=${data.agentId}&redirect_uri=${redirectUri}&state=fit2cloud-wecom-qr&lang=${lang}&panel_size=small`
3839
}
3940
4041
init()

0 commit comments

Comments
 (0)