diff --git a/src/api/account/center.ts b/src/api/account/center.ts new file mode 100644 index 00000000..5523992a --- /dev/null +++ b/src/api/account/center.ts @@ -0,0 +1,3 @@ +import server from '@/utils/request' + +export const getSsoBinds_api = (): any =>server.get(`/application/sso/me/bindings`) diff --git a/src/api/system/apply.ts b/src/api/system/apply.ts index b3b4c218..c9925453 100644 --- a/src/api/system/apply.ts +++ b/src/api/system/apply.ts @@ -12,7 +12,7 @@ export const delApply_api = (id: string) => server.remove(`/application/${id}`) // 获取组织列表 export const getDepartmentList_api = () => server.get(`/organization/_all/tree`); -// 获取组织列表 +// 获取应用详情 export const getAppInfo_api = (id: string) => server.get(`/application/${id}`); // 新增应用 export const addApp_api = (data: object) => server.post(`/application`, data); diff --git a/src/router/menu.ts b/src/router/menu.ts index 9a175396..0213719d 100644 --- a/src/router/menu.ts +++ b/src/router/menu.ts @@ -31,6 +31,10 @@ export default [ path: '/system/Api', component: () => import('@/views/system/Platforms/index.vue') }, + { + path: '/account/center', + component: () => import('@/views/account/Center/index.vue') + }, // end: 测试用, 可删除 diff --git a/src/views/account/Center/index.vue b/src/views/account/Center/index.vue new file mode 100644 index 00000000..3687fd51 --- /dev/null +++ b/src/views/account/Center/index.vue @@ -0,0 +1,266 @@ + + + + + diff --git a/src/views/home/components/InitHome/index.vue b/src/views/home/components/InitHome/index.vue index 888aae8a..6ecfbc39 100644 --- a/src/views/home/components/InitHome/index.vue +++ b/src/views/home/components/InitHome/index.vue @@ -10,7 +10,7 @@ :class="{ selected: selectValue === 'device' }" @click="selectValue = 'device'" > - + - + - + import { setView_api } from '@/api/home'; +import { getImage } from '@/utils/comm'; const emits = defineEmits(['refresh']); const selectValue = ref('device'); diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 04e6ac88..73a2948b 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -6,8 +6,26 @@ - - + + @@ -19,14 +37,16 @@ import DeviceHome from './components/DeviceHome/index.vue'; import DevOpsHome from './components/DevOpsHome/index.vue'; import ComprehensiveHome from './components/ComprehensiveHome/index.vue'; import Api from '@/views/system/Platforms/Api/index.vue'; +import { useUserInfo } from '@/store/userInfo'; import { isNoCommunity } from '@/utils/utils'; import { getMe_api, getView_api } from '@/api/home'; - -const router = useRouter(); +import { getAppInfo_api } from '@/api/system/apply'; const currentView = ref(''); const loading = ref(true); +const clientId = useUserInfo().$state.userInfos.id; +const secureKey = ref(''); // 获取选择的视图 const setCurrentView = () => { @@ -49,7 +69,12 @@ if (isNoCommunity) { item.type === 'api-client' || item.type.id === 'api-client', ); - isApiUser ? router.push('/system/api') : setCurrentView(); + if (isApiUser) { + currentView.value = 'api'; + getAppInfo_api(clientId).then((resp: any) => { + secureKey.value = resp.result.apiServer.secureKey; + }); + } else setCurrentView(); } }); } else setCurrentView(); @@ -57,7 +82,15 @@ if (isNoCommunity) { diff --git a/src/views/system/Apply/Api/index.vue b/src/views/system/Apply/Api/index.vue index f42c9b7c..80c31416 100644 --- a/src/views/system/Apply/Api/index.vue +++ b/src/views/system/Apply/Api/index.vue @@ -1,12 +1,13 @@ diff --git a/src/views/system/Apply/View/index.vue b/src/views/system/Apply/View/index.vue index 8e67c7ce..9a0aaef1 100644 --- a/src/views/system/Apply/View/index.vue +++ b/src/views/system/Apply/View/index.vue @@ -1,14 +1,45 @@ - + diff --git a/src/views/system/Platforms/Api/components/ChooseApi.vue b/src/views/system/Platforms/Api/components/ChooseApi.vue index 66103ba8..675968e9 100644 --- a/src/views/system/Platforms/Api/components/ChooseApi.vue +++ b/src/views/system/Platforms/Api/components/ChooseApi.vue @@ -3,7 +3,7 @@ @@ -16,7 +16,9 @@ - 保存 + 保存 diff --git a/src/views/system/Platforms/Api/components/LeftTree.vue b/src/views/system/Platforms/Api/components/LeftTree.vue index 7420a355..2f2dc316 100644 --- a/src/views/system/Platforms/Api/components/LeftTree.vue +++ b/src/views/system/Platforms/Api/components/LeftTree.vue @@ -132,11 +132,9 @@ const filterPath = (path: object, filterArr: string[]) => { delete value[prop]; } } - if(Object.keys(value).length === 0) delete path[key] + if (Object.keys(value).length === 0) delete path[key]; } } - console.log(path, filterArr); - return path; }; diff --git a/src/views/system/Platforms/Api/index.vue b/src/views/system/Platforms/Api/index.vue index be81a8e2..2597594f 100644 --- a/src/views/system/Platforms/Api/index.vue +++ b/src/views/system/Platforms/Api/index.vue @@ -3,7 +3,7 @@
- + @@ -71,7 +72,6 @@ import ChooseApi from './components/ChooseApi.vue'; import ApiDoes from './components/ApiDoes.vue'; import ApiTest from './components/ApiTest.vue'; -const route = useRoute(); const props = defineProps<{ mode: modeType; showTitle?: boolean; @@ -117,15 +117,17 @@ const initSelectedApi: apiDetailsType = { }; const selectedApi = ref(initSelectedApi); -const canSelectKeys = ref([]); // 左侧可展示的项 const selectedKeys = ref([]); // 右侧默认勾选的项 let selectSourceKeys = ref([]); init(); function init() { - const code = route.query.code; + // 右侧默认选中初始化 if (props.mode === 'appManger') { - } else if (props.mode === 'home') { + getApiGranted_api(props.code as string).then((resp) => { + selectedKeys.value = resp.result as string[]; + selectSourceKeys.value = [...(resp.result as string[])]; + }) } else if (props.mode === 'api') { apiOperations_api().then((resp) => { selectedKeys.value = resp.result as string[];