yuang-framework-ui-common 1.0.14 → 1.0.16

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.
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <ele-page>
3
+ <el-result title="500">
4
+ <template #icon>
5
+ <div style="width: 250px; height: 295px; margin: 20px 0 10px 0">
6
+ <icon-svg />
7
+ </div>
8
+ </template>
9
+ <template #sub-title>
10
+ <ele-text type="placeholder">抱歉, 服务器出错了.</ele-text>
11
+ </template>
12
+ <template #extra>
13
+ <router-link to="/" style="display: inline-flex; text-decoration: none">
14
+ <el-button type="primary">返回首页</el-button>
15
+ </router-link>
16
+ </template>
17
+ </el-result>
18
+ </ele-page>
19
+ </template>
20
+
21
+ <script lang="ts" setup>
22
+ import IconSvg from './components/icon-svg.vue';
23
+
24
+ defineOptions({ name: 'Exception500' });
25
+ </script>
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <div>encryptData:{{encryptData }}</div>
3
+ <div>decryptData:{{decryptData }}</div>
4
+ </template>
5
+
6
+ <script setup lang="ts">
7
+ import { onMounted, ref } from 'vue';
8
+ import {getAesRandomKey, aesEncrypt, aesDecrypt} from '../../../lib/utils/aesUtils';
9
+
10
+ let encryptData = ref('');
11
+ let decryptData = ref('');
12
+ onMounted(() => {
13
+
14
+ let aesRandomKey = getAesRandomKey();
15
+ encryptData.value = aesEncrypt(aesRandomKey, '测试');
16
+ decryptData.value = aesDecrypt(aesRandomKey, encryptData.value);
17
+ })
18
+ </script>
19
+
20
+ <style scoped>
21
+
22
+ </style>
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <el-button @click="showSuccessMessage('成功')">成功</el-button>
3
+ <el-button @click="showInfoMessage('信息')">信息</el-button>
4
+ <el-button @click="showWarningMessage('警告')">警告</el-button>
5
+ <el-button @click="showErrorMessage('错误')">错误</el-button>
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ import {showSuccessMessage, showInfoMessage, showWarningMessage, showErrorMessage} from '../../../lib/utils/messageUtils';
10
+ </script>
11
+
12
+ <style scoped>
13
+
14
+ </style>
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <div>encryptData:{{ encryptData }}</div>
3
+ <div>decryptData:{{ decryptData }}</div>
4
+ </template>
5
+
6
+ <script setup lang="ts">
7
+ import {onMounted, ref} from 'vue';
8
+ import {getRsaKeys, rsaEncrypt, rsaDecrypt} from '../../../lib/utils/rsaUtils';
9
+
10
+ let encryptData = ref('');
11
+ let decryptData = ref('');
12
+
13
+ onMounted(async () => {
14
+
15
+ let rsaKeys = await getRsaKeys();
16
+
17
+ encryptData.value = rsaEncrypt(rsaKeys.publicKey, '测试');
18
+ decryptData.value = rsaDecrypt(rsaKeys.privateKey, encryptData.value);
19
+ })
20
+
21
+ </script>
22
+
23
+ <style scoped>
24
+
25
+ </style>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <div>ssoEncrypt:{{ ssoEncrypt }}</div>
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import {onMounted, ref} from 'vue';
7
+ import {getSsoEncrypt} from '../../../lib/utils/ssoUtils';
8
+
9
+ let ssoEncrypt = ref('');
10
+
11
+ onMounted(async () => {
12
+ ssoEncrypt.value = getSsoEncrypt('测试');
13
+ })
14
+
15
+ </script>
16
+
17
+ <style scoped>
18
+
19
+ </style>
@@ -1,54 +0,0 @@
1
- import axios from "axios"
2
-
3
- import {clearSsoAccessToken} from '../utils/ssoUtils';
4
-
5
-
6
- const $http = axios.create({
7
- baseURL: (window as any).$config?.apiBaseUrl ?? '/gateway-api',
8
- timeout: 5000,
9
- headers: {}
10
- })
11
-
12
-
13
- /* 请求拦截 */
14
- $http.interceptors.request.use(config => {
15
- config.headers["X-Requested-With"] = 'XMLHttpRequest';
16
-
17
- let gatewayAccessToken = localStorage.getItem("gatewayAccessToken") ?? '';
18
- let gatewayPublicKey = localStorage.getItem("gatewayPublicKey") ?? '';
19
- let ssoAccessToken = localStorage.getItem("ssoAccessToken") ?? '';
20
- if (gatewayAccessToken) {
21
- config.headers["Gateway-Access-Token"] = gatewayAccessToken;
22
- }
23
- if (gatewayPublicKey) {
24
- config.headers["Gateway-Public-Key"] = gatewayPublicKey;
25
- }
26
-
27
- if (ssoAccessToken) {
28
- config.headers["Sso-Access-Token"] = ssoAccessToken;
29
- }
30
- config.headers["Request-Id"] = 'test';
31
- return config;
32
- }, err => Promise.reject(err));
33
-
34
-
35
- /* 响应拦截器 */
36
- $http.interceptors.response.use((res) => {
37
- // 登录过期处理
38
- if (res.data.statusCode !== 200) {
39
- if (res.data.statusCode === 401) {
40
- clearSsoAccessToken();
41
- // router.push('/sso/login');
42
- location.href = 'http://localhost:8110/sso-ui-pc/sso/login';
43
- return Promise.reject(new Error(res.data.message));
44
- }
45
- return Promise.reject(new Error(res.data.message));
46
- }
47
-
48
- return res;
49
- }, (error) => {
50
- return Promise.reject(error);
51
- });
52
-
53
-
54
- export default $http
@@ -1,22 +0,0 @@
1
-
2
- import http from '../config/http';
3
-
4
- const initGateway = () => {
5
- return new Promise<void>(async resolve => {
6
- let gatewayAccessToken = localStorage.getItem("gatewayAccessToken");
7
- if (!gatewayAccessToken) {
8
- let res = await http.get('/server/gateway/getGatewayConfig');
9
- if (res.data.statusCode != 200) {
10
- return console.error(res.data.message);
11
- }
12
- localStorage.setItem("gatewayAccessToken", res.data.data.gatewayAccessToken);
13
- localStorage.setItem("gatewayPublicKey", res.data.data.gatewayPublicKey);
14
- }
15
- resolve();
16
- })
17
-
18
- }
19
-
20
- export {
21
- initGateway
22
- }