yuang-framework-ui-common 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config/http.ts +2 -1
- package/lib/utils/ssoUtils.ts +2 -2
- package/package.json +2 -1
- package/src/App.vue +12 -0
- package/src/main.ts +25 -0
- package/src/router/index.ts +17 -0
- package/src/shims-vue.d.ts +10 -0
package/lib/config/http.ts
CHANGED
@@ -4,7 +4,7 @@ import {clearSsoAccessToken} from '../utils/ssoUtils';
|
|
4
4
|
|
5
5
|
|
6
6
|
const $http = axios.create({
|
7
|
-
baseURL: (window as any)
|
7
|
+
baseURL: (window as any).$config?.apiBaseUrl ?? '/gateway-api',
|
8
8
|
timeout: 5000,
|
9
9
|
headers: {}
|
10
10
|
})
|
@@ -12,6 +12,7 @@ const $http = axios.create({
|
|
12
12
|
|
13
13
|
/* 请求拦截 */
|
14
14
|
$http.interceptors.request.use(config => {
|
15
|
+
config.headers["X-Requested-With"] = 'XMLHttpRequest';
|
15
16
|
|
16
17
|
let gatewayAccessToken = localStorage.getItem("gatewayAccessToken") ?? '';
|
17
18
|
let ssoAccessToken = localStorage.getItem("ssoAccessToken") ?? '';
|
package/lib/utils/ssoUtils.ts
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
import Cookies from 'js-cookie'
|
5
5
|
|
6
6
|
const getSsoLoginUrl = (redirectUrl = '') => {
|
7
|
-
let ssoLoginUrl = (window as any).$config
|
7
|
+
let ssoLoginUrl = ((window as any).$config?.apiFullBaseUrl ?? '') + '/sso-api/server/sso/login';
|
8
8
|
if (!redirectUrl) {
|
9
9
|
ssoLoginUrl += `?redirectUrl=${encodeURIComponent(window.location.href)}`;
|
10
10
|
} else if (redirectUrl) {
|
@@ -14,7 +14,7 @@ const getSsoLoginUrl = (redirectUrl = '') => {
|
|
14
14
|
}
|
15
15
|
|
16
16
|
const getSsoLogoutUrl = (redirectUrl = '') => {
|
17
|
-
let ssoLogoutUrl = (window as any).$config
|
17
|
+
let ssoLogoutUrl = ((window as any).$config?.apiFullBaseUrl ?? '') + '/sso-api/server/sso/logout';
|
18
18
|
if (!redirectUrl) {
|
19
19
|
ssoLogoutUrl += `?redirectUrl=${encodeURIComponent(window.location.href)}`;
|
20
20
|
} else if (redirectUrl) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "yuang-framework-ui-common",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.8",
|
4
4
|
"private": false,
|
5
5
|
"type": "module",
|
6
6
|
"scripts": {
|
@@ -15,6 +15,7 @@
|
|
15
15
|
},
|
16
16
|
"files": [
|
17
17
|
"dist",
|
18
|
+
"src",
|
18
19
|
"lib"
|
19
20
|
],
|
20
21
|
"main": "dist/yuang-framework-ui-common.umd.js",
|
package/src/App.vue
ADDED
package/src/main.ts
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
import { createApp } from 'vue'
|
3
|
+
import { createPinia } from 'pinia'
|
4
|
+
|
5
|
+
import App from './App.vue'
|
6
|
+
import router from './router'
|
7
|
+
|
8
|
+
const app = createApp(App)
|
9
|
+
|
10
|
+
app.use(createPinia())
|
11
|
+
app.use(router)
|
12
|
+
|
13
|
+
app.use(ElementPlus)
|
14
|
+
|
15
|
+
app.mount('#app')
|
16
|
+
|
17
|
+
|
18
|
+
/*
|
19
|
+
npm config get registry
|
20
|
+
|
21
|
+
npm config set registry=https://registry.npmjs.org
|
22
|
+
npm config set registry=https://registry.npmmirror.com
|
23
|
+
|
24
|
+
|
25
|
+
*/
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import {createRouter, createWebHistory} from 'vue-router'
|
2
|
+
|
3
|
+
const router = createRouter({
|
4
|
+
history: createWebHistory(import.meta.env.BASE_URL),
|
5
|
+
routes: [
|
6
|
+
|
7
|
+
]
|
8
|
+
})
|
9
|
+
|
10
|
+
|
11
|
+
/* 路由守卫 */
|
12
|
+
router.beforeEach(async (to, from, next) => {
|
13
|
+
next();
|
14
|
+
});
|
15
|
+
|
16
|
+
|
17
|
+
export default router
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* shims-vue.d.ts文件是一种声明文件,用来告诉TypeScript如何处理.vue文件,填补TypeScript对.vue文件类型识别缺失的文件,为Vue.js的单文件组件提供类型定义支持。
|
3
|
+
* 否则会报错:Vue: Could not find a declaration file for module @/components/YuButton/index.
|
4
|
+
*/
|
5
|
+
/* eslint-disable */
|
6
|
+
declare module '*.vue' {
|
7
|
+
import type { DefineComponent } from 'vue';
|
8
|
+
const component: DefineComponent<{}, {}, any>;
|
9
|
+
export default component;
|
10
|
+
}
|