feat: 扫描登陆
parent
37c66c6919
commit
4be7560d81
|
|
@ -161,6 +161,13 @@ onLoad((options) => {
|
|||
addWishList()
|
||||
}
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
if (typeName === '一键填报') {
|
||||
userStore.clearWishList()
|
||||
userStore.clearWishListId()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -58,6 +58,14 @@
|
|||
"enableShareTimeline": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"type": "page",
|
||||
"style": {
|
||||
"navigationBarTitleText": "授权登录"
|
||||
},
|
||||
"needLogin": true
|
||||
},
|
||||
{
|
||||
"path": "pages/evaluation/index/index",
|
||||
"type": "page",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
<route lang="json5" type="page">
|
||||
{
|
||||
style: {
|
||||
navigationBarTitleText: '授权登录',
|
||||
},
|
||||
needLogin: true,
|
||||
}
|
||||
</route>
|
||||
|
||||
<template>
|
||||
<view class="flex flex-col items-center">
|
||||
<image
|
||||
class="w-[440rpx] h-[440rpx] mt-[136rpx]"
|
||||
src="https://api.static.ycymedu.com/images/logo.png"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
|
||||
<button
|
||||
class="w-[493rpx]! mb-[40rpx] h-[88rpx]! rounded-[44rpx] text-[32rpx] text-white flex items-center justify-center bg-[#1580FF]"
|
||||
@click="handleAuthPage"
|
||||
>
|
||||
授权网页登录
|
||||
</button>
|
||||
|
||||
<button class="text-[#A2A2A2] bg-[#fff] text-[32rpx]" @click="handleCancel">取消登录</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { authQrCode } from '@/service/index/api'
|
||||
import { useUserStore } from '@/store/user'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
let scene = ''
|
||||
const handleCancel = () => {
|
||||
uni.switchTab({ url: '/pages/home/index/index' })
|
||||
}
|
||||
|
||||
const handleAuthPage = () => {
|
||||
authQrCode({
|
||||
userCode: scene,
|
||||
messageType: 2,
|
||||
weChat: { openId: userStore.userInfo.openid, sessionKey: '', unionId: '' },
|
||||
}).then((resp) => {
|
||||
if (resp.code == 200) {
|
||||
uni.showToast({
|
||||
title: '授权成功',
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
})
|
||||
uni.reLaunch({
|
||||
url: '/pages/home/index/index',
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '二维码失效,请刷新后重试',
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
scene = options.scene || ''
|
||||
})
|
||||
</script>
|
||||
|
|
@ -482,3 +482,28 @@ export const verifyInviteCode = ({ code }: { code: string }) => {
|
|||
export const getADBanner = ({ code }: { code: string } = { code: 'b001' }) => {
|
||||
return http.get('/api/zhiYuan/banner', { code })
|
||||
}
|
||||
|
||||
export const authQrCode = ({
|
||||
userCode,
|
||||
messageType,
|
||||
weChat,
|
||||
}: {
|
||||
userCode: string
|
||||
messageType: number
|
||||
weChat: {
|
||||
openId: string
|
||||
sessionKey: string
|
||||
unionId: string
|
||||
}
|
||||
}) => {
|
||||
return http.post(
|
||||
'https://api.sso.ycymedu.com/api/syswxopen/hookscuess',
|
||||
{
|
||||
userCode: userCode,
|
||||
messageType,
|
||||
weChat,
|
||||
tpkey: '9k1cbc3f546eda35168c3aa3cb91780fbe703f0996c6d123ea96dc85c70bbc0a',
|
||||
},
|
||||
{ hasPrefix: true },
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
interface NavigateToOptions {
|
||||
url: "/pages/home/index/index" |
|
||||
"/pages/index/index" |
|
||||
"/pages/evaluation/index/index" |
|
||||
"/pages/expert/index/index" |
|
||||
"/pages/ucenter/index/index" |
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ export const http = <T>(options: CustomRequestOptions) => {
|
|||
return new Promise<IResData<T>>((resolve, reject) => {
|
||||
if (options.query?.staticType === 'static') {
|
||||
options.url = `${staticBaseUrl}${options.url}`
|
||||
} else if (options.query?.haPrefix) {
|
||||
console.log(options.query)
|
||||
} else if (options.query?.hasPrefix) {
|
||||
} else {
|
||||
options.url = `${baseUrl}${options.url}`
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue