fix: 修复登录成功之后在某些情况下无法进入初始化页面
This commit is contained in:
parent
4d9263f4fa
commit
1e37450614
|
@ -1,4 +1,4 @@
|
|||
<h1 align="center"> JetLinks-ui-vue v1.0.0</h1>
|
||||
<h1 align="center"> JetLinks-ui-vue</h1>
|
||||
|
||||
## 平台简介
|
||||
|
||||
|
|
|
@ -47,3 +47,7 @@ export const getClusters = () =>
|
|||
export const getPluginList = (data: any) => server.post('/plugin/driver/_query/no-paging', data)
|
||||
|
||||
export const getPluginConfig = (id: string) => server.get(`/plugin/driver/${id}/description`)
|
||||
|
||||
export const getCommandsByAccess = (id: string) => server.get(`/gateway/device/${id}/commands`)
|
||||
|
||||
export const getCommandsDevicesByAccessId = (id: string, data: any) => server.post(`/gateway/device/${id}/command/QueryDevicePage`, data)
|
||||
|
|
|
@ -7,6 +7,8 @@ export const uploadFile = `${BASE_API_PATH}/plugin/driver/upload`
|
|||
|
||||
export const add = (data: any) => post('/plugin/driver', data)
|
||||
|
||||
export const update = (data: any) => patch('/plugin/driver', data)
|
||||
|
||||
export const removeFn = (id: string) => remove(`/plugin/driver/${id}`)
|
||||
|
||||
export const detail = (id: string) => get(`/plugin/driver/${id}`)
|
||||
|
@ -19,7 +21,7 @@ export const detail = (id: string) => get(`/plugin/driver/${id}`)
|
|||
*/
|
||||
export const getProductsById = (id: string) => get(`/plugin/driver/${id}/products`)
|
||||
|
||||
export const savePluginData = (type: string, pluginId: string, internalId: string, externalId: string ) => patch(`/plugin/mapping/${type}/${pluginId}/${internalId}`, externalId)
|
||||
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}`)
|
||||
|
||||
|
@ -28,3 +30,5 @@ export const getPublic = (id: string, path: string) => get(`/plugin/driver/${id}
|
|||
export const getTypes = () => get(`/dictionary/internal-plugin-type/items`)
|
||||
|
||||
export const vailIdFn = (id: string ) => get(`/plugin/driver/id/_validate`, { id })
|
||||
|
||||
export const getProductByPluginId = (id: string) => get(`/plugin/driver/${id}/products`)
|
|
@ -13,3 +13,4 @@ declare module '*.ts';
|
|||
declare module 'js-cookie';
|
||||
declare module 'jetlinks-ui-components';
|
||||
declare module 'vue3-json-viewer';
|
||||
declare module 'event-source-polyfill';
|
|
@ -143,7 +143,7 @@ const handleTypeChange = (record: IVariable) => {
|
|||
record.format = 'timestamp';
|
||||
break;
|
||||
case 'double':
|
||||
record.format = '%.xf';
|
||||
record.format = '%.2f';
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1219,6 +1219,10 @@ const handleSubmit = () => {
|
|||
delete formData.value.template.ttsmessage;
|
||||
}
|
||||
|
||||
if (formData.value.provider === 'dingTalkRobotWebHook' && formData.value.template?.messageType === 'text') {
|
||||
formData.value.template.text!.content = formData.value.template.message as string
|
||||
}
|
||||
|
||||
formRef.value?.validate()
|
||||
.then(async () => {
|
||||
btnLoading.value = true;
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
|
||||
<script setup lang="ts" name="user">
|
||||
import PermissionButton from '@/components/PermissionButton/index.vue';
|
||||
import AddBindUserDialog from './components/addBindUserDialog.vue';
|
||||
import AddBindUserDialog from './components/AddBindUserDialog.vue';
|
||||
import { getBindUserList_api, unBindUser_api } from '@/api/system/department';
|
||||
import { message } from 'jetlinks-ui-components';
|
||||
|
||||
|
|
|
@ -169,8 +169,8 @@ import {
|
|||
getInitSet,
|
||||
systemVersion,
|
||||
bindInfo,
|
||||
settingDetail,
|
||||
} from '@/api/login';
|
||||
settingDetail, userDetail
|
||||
} from '@/api/login'
|
||||
import { useUserInfo } from '@/store/userInfo';
|
||||
import { LocalStore } from '@/utils/comm';
|
||||
import { BASE_API_PATH, TOKEN_KEY, Version_Code } from '@/utils/variable';
|
||||
|
@ -250,18 +250,29 @@ const onFinish = async () => {
|
|||
const res: any = await authLogin(form);
|
||||
loading.value = false;
|
||||
if (res.success) {
|
||||
store.$patch({
|
||||
...res.result,
|
||||
username: form.username,
|
||||
});
|
||||
LocalStore.set(TOKEN_KEY, res?.result.token);
|
||||
if (res.result.user?.username === 'admin') {
|
||||
const userResp = await userDetail()
|
||||
if (userResp.success) {
|
||||
store.$patch({
|
||||
userInfos: {
|
||||
...userResp.result,
|
||||
token: res?.result.token,
|
||||
},
|
||||
isAdmin: userResp.username === "admin",
|
||||
});
|
||||
|
||||
if (userResp.result?.username === 'admin') {
|
||||
const resp: any = await getInitSet();
|
||||
if (resp.status === 200 && !resp.result.length) {
|
||||
window.location.href = '/#/init-home';
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
store.$patch({
|
||||
...res.result
|
||||
});
|
||||
}
|
||||
window.location.href = '/';
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in New Issue