fix: 修复iot账号无法登录可视化
* fix: bug#12637 * fix: 修复右上角通知文件notification兼容处理 * fix: bug#12637、12632 * fix: bug#12460 * fix: bug#12362 * fix: bug#12350 * fix: bug#12338 * fix: 优化插件映射传参 * fix: 修复采集器查询失败问题 * fix: 修复内部应用页面跳转后显示错误提示的问题 * fix: 修复插件设备映射后没有回显 * fix: 修复插件管理新增id校验失败 * fix: 删除多余代码 * fix: 修复iot账号无法登录可视化 * fix: 优化oauth页面 * fix: 修复iot账号无法登录可视化
This commit is contained in:
parent
df525770f4
commit
efded34ff2
|
@ -6,7 +6,7 @@ export default {
|
||||||
title: 'Jetlinks', // 浏览器标签页title
|
title: 'Jetlinks', // 浏览器标签页title
|
||||||
layout: {
|
layout: {
|
||||||
title: '物联网平台', // 平台title
|
title: '物联网平台', // 平台title
|
||||||
logo: '/icons/icon-192x192.png', // 平台logo
|
logo: '/logo.png', // 平台logo
|
||||||
siderWidth: 208, // 左侧菜单栏宽度
|
siderWidth: 208, // 左侧菜单栏宽度
|
||||||
headerHeight: 48, // 头部高度
|
headerHeight: 48, // 头部高度
|
||||||
collapsedWidth: 48,
|
collapsedWidth: 48,
|
||||||
|
|
|
@ -21,6 +21,13 @@ export const detail = (id: string) => get(`/plugin/driver/${id}`)
|
||||||
*/
|
*/
|
||||||
export const getProductsById = (id: string) => get(`/plugin/driver/${id}/products`)
|
export const getProductsById = (id: string) => get(`/plugin/driver/${id}/products`)
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param type product:产品;device:设备
|
||||||
|
* @param pluginId 设备接入id
|
||||||
|
* @param internalId 产品或者设备id
|
||||||
|
* @param externalId 映射id
|
||||||
|
*/
|
||||||
export const savePluginData = (type: string, pluginId: string, internalId: string, externalId: string ) => patch(`/plugin/mapping/${type}/${pluginId}/${internalId}`, externalId, { headers: {'Content-Type': "text/plain"}})
|
export const savePluginData = (type: string, pluginId: string, internalId: string, externalId: string ) => patch(`/plugin/mapping/${type}/${pluginId}/${internalId}`, externalId, { headers: {'Content-Type': "text/plain"}})
|
||||||
|
|
||||||
export const getPluginData = (type: string, pluginId: string, internalId: string ) => get(`/plugin/mapping/${type}/${pluginId}/${internalId}`)
|
export const getPluginData = (type: string, pluginId: string, internalId: string ) => get(`/plugin/mapping/${type}/${pluginId}/${internalId}`)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||||
import menus, { AccountCenterBindPath, InitHomePath, LoginPath } from './menu'
|
import menus, { AccountCenterBindPath, InitHomePath, LoginPath, OauthPath } from './menu'
|
||||||
import { cleanToken, getToken } from '@/utils/comm'
|
import { cleanToken, getToken } from '@/utils/comm'
|
||||||
import { useUserInfo } from '@/store/userInfo'
|
import { useUserInfo } from '@/store/userInfo'
|
||||||
import { useSystem } from '@/store/system'
|
import { useSystem } from '@/store/system'
|
||||||
|
@ -14,12 +14,13 @@ const router = createRouter({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const filterPath = [ InitHomePath, AccountCenterBindPath ]
|
const filterPath = [ InitHomePath ]
|
||||||
|
const noTokenPath = [ AccountCenterBindPath, OauthPath ]
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
// TODO 切换路由取消请求
|
// TODO 切换路由取消请求
|
||||||
const token = getToken()
|
const token = getToken()
|
||||||
if (to.path === AccountCenterBindPath) {
|
if (noTokenPath.includes(to.path)) {
|
||||||
next()
|
next()
|
||||||
} else if (token) {
|
} else if (token) {
|
||||||
if (to.path === LoginPath) {
|
if (to.path === LoginPath) {
|
||||||
|
|
|
@ -280,7 +280,8 @@ export function filterAsyncRouter(asyncRouterMap: any, parentCode = '', level =
|
||||||
icon: route.icon,
|
icon: route.icon,
|
||||||
title: route.name,
|
title: route.name,
|
||||||
hideInMenu: route.isShow === false,
|
hideInMenu: route.isShow === false,
|
||||||
buttons: route.buttons?.map((b: any) => b.id) || []
|
buttons: route.buttons?.map((b: any) => b.id) || [],
|
||||||
|
isApp: hasAppId,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,16 @@ interface AxiosResponseRewrite<T = any[]> extends AxiosResponse<T, any> {
|
||||||
|
|
||||||
export const SUCCESS_CODE = 200 // 成功代码
|
export const SUCCESS_CODE = 200 // 成功代码
|
||||||
|
|
||||||
const filterApiUrl = ['/system/version', '/system/config/front', '/authorize/captcha/config', '/application/sso/_all', '/authorize/captcha/image', '/application/sso/bind-code', '/authorize/login']
|
const filterApiUrl = [
|
||||||
|
'/system/version',
|
||||||
|
'/system/config/front',
|
||||||
|
'/authorize/captcha/config',
|
||||||
|
'/application/sso/_all',
|
||||||
|
'/authorize/captcha/image',
|
||||||
|
'/application/sso/bind-code',
|
||||||
|
'/authorize/login',
|
||||||
|
'/application/'
|
||||||
|
]
|
||||||
|
|
||||||
export const request = axios.create({
|
export const request = axios.create({
|
||||||
withCredentials: false,
|
withCredentials: false,
|
||||||
|
@ -149,10 +158,10 @@ const errorHandler = (error: any) => {
|
||||||
} else if (status === 401) {
|
} else if (status === 401) {
|
||||||
showNotification('Unauthorized', '用户未登录', '401')
|
showNotification('Unauthorized', '用户未登录', '401')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
cleanToken()
|
// cleanToken()
|
||||||
router.replace({
|
// router.replace({
|
||||||
path: LoginPath
|
// path: LoginPath
|
||||||
})
|
// })
|
||||||
}, 0)
|
}, 0)
|
||||||
} else if (status === 404) {
|
} else if (status === 404) {
|
||||||
showNotification(error?.code, error?.response?.data?.message, '404')
|
showNotification(error?.code, error?.response?.data?.message, '404')
|
||||||
|
|
|
@ -157,19 +157,17 @@ const defualtDataSource: any = ref(_.cloneDeep(root));
|
||||||
const defualtParams = {
|
const defualtParams = {
|
||||||
paging: false,
|
paging: false,
|
||||||
sorts: [{ name: 'createTime', order: 'desc' }],
|
sorts: [{ name: 'createTime', order: 'desc' }],
|
||||||
terms: [
|
terms: !!channelId ? [
|
||||||
{
|
{
|
||||||
terms: !!channelId
|
terms: [
|
||||||
? [
|
|
||||||
{
|
{
|
||||||
column: 'channelId',
|
column: 'channelId',
|
||||||
value: channelId,
|
value: channelId,
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
: [],
|
|
||||||
type: 'and',
|
type: 'and',
|
||||||
},
|
},
|
||||||
],
|
] : [],
|
||||||
};
|
};
|
||||||
const params = ref();
|
const params = ref();
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,6 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: undefined
|
default: undefined
|
||||||
},
|
},
|
||||||
channelId: {
|
|
||||||
type: String,
|
|
||||||
default: undefined
|
|
||||||
},
|
|
||||||
id: {
|
id: {
|
||||||
type: String,
|
type: String,
|
||||||
default: undefined
|
default: undefined
|
||||||
|
@ -47,12 +43,14 @@ const route = useRoute()
|
||||||
|
|
||||||
const handleOk = async () => {
|
const handleOk = async () => {
|
||||||
if (checkKey.value) {
|
if (checkKey.value) {
|
||||||
|
loading.value = true
|
||||||
const res = await savePluginData(
|
const res = await savePluginData(
|
||||||
'device',
|
'device',
|
||||||
props.channelId!,
|
props.accessId!,
|
||||||
route.params.id as string,
|
route.params.id as string,
|
||||||
checkKey.value
|
checkKey.value
|
||||||
).catch(() => ({ success: false }))
|
).catch(() => ({ success: false }))
|
||||||
|
loading.value = false
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
emit('submit', checkKey.value)
|
emit('submit', checkKey.value)
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,6 @@
|
||||||
<InkingModal
|
<InkingModal
|
||||||
v-if='inkingVisible'
|
v-if='inkingVisible'
|
||||||
:id='inklingDeviceId'
|
:id='inklingDeviceId'
|
||||||
:channelId='channelId'
|
|
||||||
:accessId='instanceStore.current.accessId'
|
:accessId='instanceStore.current.accessId'
|
||||||
@cancel="inkingVisible = false"
|
@cancel="inkingVisible = false"
|
||||||
@submit='saveInkling'
|
@submit='saveInkling'
|
||||||
|
@ -146,7 +145,8 @@ const saveInkling = (id: string) => {
|
||||||
instanceStore.refresh(instanceStore.current?.id);
|
instanceStore.refresh(instanceStore.current?.id);
|
||||||
}
|
}
|
||||||
channelId.value = id
|
channelId.value = id
|
||||||
giveAnInkling()
|
queryInkling()
|
||||||
|
inkingVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const giveAnInkling = () => {
|
const giveAnInkling = () => {
|
||||||
|
@ -158,7 +158,7 @@ const queryInkling = () => {
|
||||||
queryPluginAccessDetail(instanceStore.current?.accessId).then(async res => {
|
queryPluginAccessDetail(instanceStore.current?.accessId).then(async res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
channelId.value = res.result.channelId
|
channelId.value = res.result.channelId
|
||||||
const pluginRes = await getPluginData('device', res.result.channelId, instanceStore.current?.id)
|
const pluginRes = await getPluginData('device',instanceStore.current?.accessId, instanceStore.current?.id)
|
||||||
if (pluginRes.success) {
|
if (pluginRes.success) {
|
||||||
inklingDeviceId.value = pluginRes.result?.externalId
|
inklingDeviceId.value = pluginRes.result?.externalId
|
||||||
}
|
}
|
||||||
|
|
|
@ -680,7 +680,7 @@ const getData = async (accessId?: string) => {
|
||||||
if (productStore.current?.accessProvider === 'plugin_gateway') {
|
if (productStore.current?.accessProvider === 'plugin_gateway') {
|
||||||
queryPluginAccessDetail(_accessId).then(async res => { //
|
queryPluginAccessDetail(_accessId).then(async res => { //
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
const pluginRes = await getPluginData('product', res.result.channelId, productStore.current?.id)
|
const pluginRes = await getPluginData('product', _accessId, productStore.current?.id)
|
||||||
const resp = await getProductByPluginId(res.result.channelId).catch(() => ({ success: false, result: []}))
|
const resp = await getProductByPluginId(res.result.channelId).catch(() => ({ success: false, result: []}))
|
||||||
if (resp.success) {
|
if (resp.success) {
|
||||||
productTypes.value = resp.result.map(item => {
|
productTypes.value = resp.result.map(item => {
|
||||||
|
@ -758,10 +758,10 @@ const updateAccessData = async (id: string, values: any) => {
|
||||||
submitLoading.value = false
|
submitLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (access.value?.provider === "plugin_gateway") {
|
if (access.value?.provider === "plugin_gateway" && productData.id) {
|
||||||
await savePluginData(
|
await savePluginData(
|
||||||
'product',
|
'product',
|
||||||
access.value?.channelId,
|
access.value?.id,
|
||||||
productStore.current.id,
|
productStore.current.id,
|
||||||
productData.id
|
productData.id
|
||||||
).catch(() => ({}))
|
).catch(() => ({}))
|
||||||
|
|
|
@ -133,10 +133,10 @@ const updateAccessData = async (id: string, values: any, metadata: string) => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.access?.provider === 'plugin_gateway') {
|
if (props.access?.provider === 'plugin_gateway' && props.data.productTypeId) {
|
||||||
await savePluginData(
|
await savePluginData(
|
||||||
'product',
|
'product',
|
||||||
props.access.channelId,
|
props.access.id,
|
||||||
props.data.id,
|
props.data.id,
|
||||||
props.data.productTypeId
|
props.data.productTypeId
|
||||||
).catch(() => ({}))
|
).catch(() => ({}))
|
||||||
|
|
|
@ -101,11 +101,11 @@ const columns = [
|
||||||
]
|
]
|
||||||
|
|
||||||
const selectedKeys = computed(() => {
|
const selectedKeys = computed(() => {
|
||||||
return dataSource.value.filter(item => !!item?.plugin).map(item => item.id)
|
return dataSource.value?.filter(item => !!item?.plugin).map(item => item.id) || []
|
||||||
})
|
})
|
||||||
|
|
||||||
const selectedPluginKeys = computed(() => {
|
const selectedPluginKeys = computed(() => {
|
||||||
return dataSource.value.filter(item => !!item?.plugin).map(item => item.plugin)
|
return dataSource.value?.filter(item => !!item?.plugin).map(item => item.plugin) || []
|
||||||
})
|
})
|
||||||
|
|
||||||
const getMetadataMapData = () => {
|
const getMetadataMapData = () => {
|
||||||
|
@ -124,7 +124,6 @@ const getMetadataMapData = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const search = (value: string) => {
|
const search = (value: string) => {
|
||||||
console.log(value)
|
|
||||||
if (value) {
|
if (value) {
|
||||||
dataSource.value = dataSourceCache.value.filter((item: any) => {
|
dataSource.value = dataSourceCache.value.filter((item: any) => {
|
||||||
return !!item.name?.includes(value)
|
return !!item.name?.includes(value)
|
||||||
|
@ -152,7 +151,7 @@ const getDefaultMetadata = async () => {
|
||||||
type: item.valueType?.type,
|
type: item.valueType?.type,
|
||||||
plugin: _m?.pluginId, // 插件物模型id
|
plugin: _m?.pluginId, // 插件物模型id
|
||||||
}
|
}
|
||||||
})
|
}) || []
|
||||||
dataSourceCache.value = dataSource.value
|
dataSourceCache.value = dataSource.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +160,7 @@ const getPluginMetadata = (): Promise<{ properties: any[]}> => {
|
||||||
queryPluginAccessDetail(productDetail.value?.accessId!).then(async res => {
|
queryPluginAccessDetail(productDetail.value?.accessId!).then(async res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
const _channelId = (res.result as any)!.channelId
|
const _channelId = (res.result as any)!.channelId
|
||||||
const pluginRes = await getPluginData('product', _channelId, productDetail.value?.id).catch(() => ({ success: false, result: {}}))
|
const pluginRes = await getPluginData('product', productDetail.value?.accessId, productDetail.value?.id).catch(() => ({ success: false, result: {}}))
|
||||||
const resp = await getProductByPluginId(_channelId).catch(() => ({ success: false, result: []}))
|
const resp = await getProductByPluginId(_channelId).catch(() => ({ success: false, result: []}))
|
||||||
if (resp.success) {
|
if (resp.success) {
|
||||||
const _item = (resp.result as any[])?.find((item: any) => item.id === (pluginRes?.result as any)?.externalId)
|
const _item = (resp.result as any[])?.find((item: any) => item.id === (pluginRes?.result as any)?.externalId)
|
||||||
|
|
|
@ -38,10 +38,14 @@ const handle = async (appId: string, url: string) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
|
const matchedItem: any = route.matched?.[0]
|
||||||
|
if (matchedItem?.meta?.isApp) {
|
||||||
const params = route.path.split('/')?.[1];
|
const params = route.path.split('/')?.[1];
|
||||||
const url = route.path.split('/').slice(2).join('/');
|
const url = route.path.split('/').slice(2).join('/');
|
||||||
handle(params, url);
|
handle(params, url);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ const loading = ref(false)
|
||||||
const vailId = async (_: any, value: string) => {
|
const vailId = async (_: any, value: string) => {
|
||||||
if (!props.data.id && value) { // 新增校验
|
if (!props.data.id && value) { // 新增校验
|
||||||
const resp = await vailIdFn(value)
|
const resp = await vailIdFn(value)
|
||||||
if (resp.success && resp.result) {
|
if (resp.success && resp.result && !resp.result.passed) {
|
||||||
return Promise.reject('ID重复');
|
return Promise.reject('ID重复');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<div class='oauth-content-header'>
|
<div class='oauth-content-header'>
|
||||||
<img :src='headerImg' />
|
<img :src='headerImg' />
|
||||||
</div>
|
</div>
|
||||||
|
<h2>授权登录</h2>
|
||||||
<div class='oauth-content-content'>
|
<div class='oauth-content-content'>
|
||||||
<div class='oauth-content-content-text'>
|
<div class='oauth-content-content-text'>
|
||||||
您正在授权登录, {{ appName }} 将获得以下权限:
|
您正在授权登录, {{ appName }} 将获得以下权限:
|
||||||
|
@ -32,15 +33,16 @@
|
||||||
<div class='oauth-content-header'>
|
<div class='oauth-content-header'>
|
||||||
<img :src='headerImg' />
|
<img :src='headerImg' />
|
||||||
</div>
|
</div>
|
||||||
|
<h2>授权登录</h2>
|
||||||
<div class='oauth-content-login'>
|
<div class='oauth-content-login'>
|
||||||
<j-form layout='horizontal' size='large' :model='formModel' >
|
<j-form layout='vertical' :model='formModel' ref='formRef' >
|
||||||
<j-form-item name='username'>
|
<j-form-item label='用户名' name='username' required :rules='[{ required: true, message: "请输入用户名"}]'>
|
||||||
<j-input placeholder='用户名' v-model:value='formModel.username' />
|
<j-input placeholder='用户名' v-model:value='formModel.username' />
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
<j-form-item name='password'>
|
<j-form-item label='密码' name='password' required :rules='[{ required: true, message: "请输入密码"}]'>
|
||||||
<j-input-password placeholder='密码' v-model:value='formModel.password' />
|
<j-input-password placeholder='密码' v-model:value='formModel.password' />
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
<j-form-item name='verifyCode' v-if='captcha.base64'>
|
<j-form-item name='verifyCode' v-if='captcha.base64' required :rules='[{ required: true, message: "请输入验证码"}]'>
|
||||||
<j-input placeholder='请输入验证码' v-model:value='formModel.verifyCode' >
|
<j-input placeholder='请输入验证码' v-model:value='formModel.verifyCode' >
|
||||||
<template #addonAfter>
|
<template #addonAfter>
|
||||||
<img
|
<img
|
||||||
|
@ -72,9 +74,10 @@
|
||||||
|
|
||||||
<script setup lang='ts' name='Oauth'>
|
<script setup lang='ts' name='Oauth'>
|
||||||
import { TOKEN_KEY } from '@/utils/variable'
|
import { TOKEN_KEY } from '@/utils/variable'
|
||||||
import { config, code, getOAuth2, initApplication, authLogin } from '@/api/login'
|
import { config, code, getOAuth2, initApplication, authLogin, settingDetail } from '@/api/login'
|
||||||
import { getMe_api } from '@/api/home'
|
import { getMe_api } from '@/api/home'
|
||||||
import { getImage } from '@/utils/comm'
|
import { getImage, getToken } from '@/utils/comm'
|
||||||
|
import Config from '../../../config/config'
|
||||||
|
|
||||||
const spinning = ref(true)
|
const spinning = ref(true)
|
||||||
const isLogin = ref(false)
|
const isLogin = ref(false)
|
||||||
|
@ -85,6 +88,9 @@ const userName = ref('-')
|
||||||
const internal = ref('false')
|
const internal = ref('false')
|
||||||
const params = ref()
|
const params = ref()
|
||||||
|
|
||||||
|
document.title = `OAuth授权-${Config.title}`;
|
||||||
|
headerImg.value = getImage(Config.layout.logo)
|
||||||
|
|
||||||
type LoginParam = {
|
type LoginParam = {
|
||||||
username: string;
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
|
@ -104,13 +110,18 @@ const captcha = reactive<{base64?: string, key?: string }>({
|
||||||
key: undefined
|
key: undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const formRef = ref()
|
||||||
|
|
||||||
const getApplication = async (clientId: string) => {
|
const getApplication = async (clientId: string) => {
|
||||||
const res = await initApplication(clientId)
|
const res = await initApplication(clientId)
|
||||||
if (res.success) {
|
if (res.success && res.result) {
|
||||||
appName.value = res.result.name
|
appName.value = res.result.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取验证码配置
|
||||||
|
*/
|
||||||
const getCode = async () => {
|
const getCode = async () => {
|
||||||
const resp = await config()
|
const resp = await config()
|
||||||
if (resp.result?.enabled) {
|
if (resp.result?.enabled) {
|
||||||
|
@ -138,6 +149,7 @@ const changeAccount = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const getLoginUser = async (data?: any) => {
|
const getLoginUser = async (data?: any) => {
|
||||||
|
if (getToken()) { // 未登录
|
||||||
const res = await getMe_api()
|
const res = await getMe_api()
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
userName.value = res.result?.user.name
|
userName.value = res.result?.user.name
|
||||||
|
@ -157,7 +169,12 @@ const getLoginUser = async (data?: any) => {
|
||||||
spinning.value = false
|
spinning.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
getApplication(data.client_id || params.value.client_id)
|
||||||
|
setTimeout(() => {
|
||||||
|
spinning.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getQueryVariable = (variable: any) => {
|
const getQueryVariable = (variable: any) => {
|
||||||
|
@ -172,23 +189,26 @@ const getQueryVariable = (variable: any) => {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const doLogin = async () => {
|
const doLogin = () => {
|
||||||
|
formRef.value.validate().then( async data => {
|
||||||
const res = await authLogin({
|
const res = await authLogin({
|
||||||
verifyKey: captcha.key,
|
verifyKey: captcha.key,
|
||||||
...formModel
|
...formModel
|
||||||
})
|
})
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
getLoginUser()
|
|
||||||
const token = res.result.token
|
const token = res.result.token
|
||||||
localStorage.setItem(TOKEN_KEY, token)
|
localStorage.setItem(TOKEN_KEY, token)
|
||||||
goOAuth2Fn()
|
getLoginUser()
|
||||||
|
// goOAuth2Fn()
|
||||||
} else {
|
} else {
|
||||||
getCode()
|
getCode()
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const initPage = async () => {
|
const initPage = async () => {
|
||||||
let redirectUrl
|
let redirectUrl
|
||||||
|
// 获取url中的配置信息
|
||||||
const items = {
|
const items = {
|
||||||
client_id: getQueryVariable('client_id'),
|
client_id: getQueryVariable('client_id'),
|
||||||
state: getQueryVariable('state'),
|
state: getQueryVariable('state'),
|
||||||
|
@ -202,9 +222,8 @@ const initPage = async () => {
|
||||||
const url = `${origin.join('/')}${items.redirect_uri?.split('redirect=')[1]}`
|
const url = `${origin.join('/')}${items.redirect_uri?.split('redirect=')[1]}`
|
||||||
// redirectUrl = `${items.redirect_uri?.split('redirect_uri=')[0]}?redirect=${url}`
|
// redirectUrl = `${items.redirect_uri?.split('redirect_uri=')[0]}?redirect=${url}`
|
||||||
redirectUrl = items.redirect_uri
|
redirectUrl = items.redirect_uri
|
||||||
console.log(origin, items.redirect_uri)
|
|
||||||
}
|
}
|
||||||
|
// 获取用户信息
|
||||||
getLoginUser({
|
getLoginUser({
|
||||||
...items,
|
...items,
|
||||||
internal: getQueryVariable('internal'),
|
internal: getQueryVariable('internal'),
|
||||||
|
@ -218,9 +237,22 @@ const initPage = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.title = 'OAuth授权-jetlinks';
|
const getSettingDetail = () => {
|
||||||
headerImg.value = getImage('/logo.png')
|
settingDetail('front').then((res: any) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
const ico: any = document.querySelector('link[rel="icon"]');
|
||||||
|
ico.href = res.result.ico;
|
||||||
|
headerImg.value = res.result.logo
|
||||||
|
if (res.result.title) {
|
||||||
|
document.title = `OAuth授权-${res.result.title}`;
|
||||||
|
} else {
|
||||||
|
document.title = 'OAuth授权';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getSettingDetail()
|
||||||
getCode()
|
getCode()
|
||||||
initPage()
|
initPage()
|
||||||
|
|
||||||
|
@ -309,7 +341,8 @@ initPage()
|
||||||
gap: 24px;
|
gap: 24px;
|
||||||
}
|
}
|
||||||
.oauth-content-login {
|
.oauth-content-login {
|
||||||
max-width: 300px;
|
width: 100%;
|
||||||
|
padding: 0 24px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue