jcjy-components 0.0.68 → 0.0.691
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/README.md +10 -10
- package/dist/components/auth-gateway/bind-org-dialog.vue +7 -17
- package/dist/components/auth-gateway/index.vue +1 -5
- package/dist/components/auth-gateway/interface.ts +14 -18
- package/dist/components/auth-gateway/login-form.vue +3 -11
- package/dist/components/auth-gateway/util.ts +19 -26
- package/dist/components/auth-gateway/wechat-form.vue +2 -9
- package/dist/components/auth-gateway/wechat-scan-view.vue +1 -3
- package/dist/index.ts +6 -9
- package/package.json +22 -20
- package/dist/components/file-manager/index.vue +0 -3
package/README.md
CHANGED
|
@@ -98,18 +98,18 @@ const handleRegisterSuccess = (userInfo) => {
|
|
|
98
98
|
|
|
99
99
|
#### Props
|
|
100
100
|
|
|
101
|
-
| 属性
|
|
102
|
-
|
|
103
|
-
| mode
|
|
104
|
-
| showRegister
|
|
105
|
-
| showWechatLogin | boolean | true
|
|
101
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
102
|
+
| --------------- | ------- | --------- | ------------------------------------- |
|
|
103
|
+
| mode | string | 'default' | 显示模式:'default', 'center', 'left' |
|
|
104
|
+
| showRegister | boolean | true | 是否显示注册入口 |
|
|
105
|
+
| showWechatLogin | boolean | true | 是否显示微信登录 |
|
|
106
106
|
|
|
107
107
|
#### Events
|
|
108
108
|
|
|
109
|
-
| 事件名
|
|
110
|
-
|
|
111
|
-
| login-success
|
|
112
|
-
| register-success
|
|
109
|
+
| 事件名 | 参数 | 说明 |
|
|
110
|
+
| -------------------- | -------- | ------------------ |
|
|
111
|
+
| login-success | userInfo | 登录成功时触发 |
|
|
112
|
+
| register-success | userInfo | 注册成功时触发 |
|
|
113
113
|
| wechat-login-success | userInfo | 微信登录成功时触发 |
|
|
114
114
|
|
|
115
115
|
### 主题工具
|
|
@@ -171,4 +171,4 @@ jcjy-components/
|
|
|
171
171
|
|
|
172
172
|
## 许可证
|
|
173
173
|
|
|
174
|
-
MIT License
|
|
174
|
+
MIT License
|
|
@@ -4,20 +4,14 @@
|
|
|
4
4
|
fullscreen
|
|
5
5
|
:show-close="false"
|
|
6
6
|
body-class="!p-0"
|
|
7
|
-
header-class="hidden"
|
|
7
|
+
header-class="!hidden"
|
|
8
8
|
class="!p-0"
|
|
9
9
|
>
|
|
10
|
-
<header class="h-
|
|
11
|
-
<img
|
|
12
|
-
|
|
13
|
-
class="w-full h-full"
|
|
14
|
-
style="object-fit: cover"
|
|
15
|
-
/>
|
|
16
|
-
<div
|
|
17
|
-
class="absolute top-0 left-0 right-0 bottom-0 bg-black/40 w-full h-full"
|
|
18
|
-
></div>
|
|
10
|
+
<header class="h-[400px] relative">
|
|
11
|
+
<img src="./img/bind-bg.jpg" class="w-full h-full" style="object-fit: cover" />
|
|
12
|
+
<div class="absolute top-0 left-0 right-0 bottom-0 bg-black/40 w-full h-full"></div>
|
|
19
13
|
</header>
|
|
20
|
-
<div class="text-center -mt-
|
|
14
|
+
<div class="text-center -mt-[400px] relative z-1 pt-20">
|
|
21
15
|
<div class="text-white font-bold text-2xl">验证身份信息</div>
|
|
22
16
|
<div class="font-400 text-lg text-white my-2">
|
|
23
17
|
我们需要验证你的身份信息,以便为你提供更好的服务
|
|
@@ -54,13 +48,9 @@
|
|
|
54
48
|
/>
|
|
55
49
|
</el-form-item>
|
|
56
50
|
|
|
57
|
-
<el-button class="w-full my-4" type="primary" @click="handleConfirm"
|
|
58
|
-
>验证</el-button
|
|
59
|
-
>
|
|
51
|
+
<el-button class="w-full my-4" type="primary" @click="handleConfirm">验证</el-button>
|
|
60
52
|
<div></div>
|
|
61
|
-
<el-button type="primary" class="w-full" plain @click="handleClose"
|
|
62
|
-
>返回</el-button
|
|
63
|
-
>
|
|
53
|
+
<el-button type="primary" class="w-full" plain @click="handleClose">返回</el-button>
|
|
64
54
|
</el-form>
|
|
65
55
|
</el-card>
|
|
66
56
|
</div>
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="auth-gateway w-screen h-screen overflow-hidden"
|
|
4
|
-
:class="rootClass"
|
|
5
|
-
:style="rootStyle"
|
|
6
|
-
>
|
|
2
|
+
<div class="auth-gateway w-screen h-screen overflow-hidden" :class="rootClass" :style="rootStyle">
|
|
7
3
|
<div v-if="isInited" class="auth-gateway-card" v-loading="confirmLoading">
|
|
8
4
|
<transition name="zoom-in-center" mode="out-in">
|
|
9
5
|
<el-card
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import IMG_LOGO from
|
|
2
|
-
import IMG_BG from
|
|
1
|
+
import IMG_LOGO from './img/logo.png';
|
|
2
|
+
import IMG_BG from './img/bg.jpg';
|
|
3
3
|
|
|
4
4
|
export const TabKey = {
|
|
5
5
|
LOGIN: 0,
|
|
@@ -15,13 +15,9 @@ export interface AuthGatewayProps {
|
|
|
15
15
|
strictRegister?: boolean;
|
|
16
16
|
binding: (
|
|
17
17
|
v: { orgName: string; name: string; code: string },
|
|
18
|
-
headers: { token: string }
|
|
18
|
+
headers: { token: string },
|
|
19
19
|
) => Promise<any>;
|
|
20
|
-
register: (params: {
|
|
21
|
-
userName: string;
|
|
22
|
-
passwd: string;
|
|
23
|
-
weChatOpenId?: string;
|
|
24
|
-
}) => Promise<any>;
|
|
20
|
+
register: (params: { userName: string; passwd: string; weChatOpenId?: string }) => Promise<any>;
|
|
25
21
|
login: (params: {
|
|
26
22
|
weChatCode?: string;
|
|
27
23
|
userName?: string;
|
|
@@ -47,23 +43,23 @@ export interface AuthGatewayConfig {
|
|
|
47
43
|
// loginUrl: string; // 登录页url
|
|
48
44
|
favicon?: string; // icon url
|
|
49
45
|
loginBackground?: string; // 登录页背景 url
|
|
50
|
-
skipBind?:
|
|
51
|
-
hf?:
|
|
52
|
-
nb?:
|
|
46
|
+
skipBind?: '0' | '1'; // 是否绑定 0 :默认绑定 1: 不需要绑定
|
|
47
|
+
hf?: '0' | '1'; // 是否隐藏登录页页脚 (0:显示 1:隐藏)
|
|
48
|
+
nb?: '0' | '1'; // 使用无logo的背景(0:显示,1:隐藏)
|
|
53
49
|
cf?: string; // 自定义页脚内容
|
|
54
|
-
from?:
|
|
50
|
+
from?: 'inline'; // 来源 inline 则不自动跳转
|
|
55
51
|
hideWx?: string; // 隐藏微信登录 有数据就隐藏
|
|
56
|
-
layout?:
|
|
52
|
+
layout?: 'default' | 'center' | 'left';
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
export const DEFAULT_CONFIG: AuthGatewayConfig = {
|
|
60
|
-
title:
|
|
56
|
+
title: 'AIGC实训平台',
|
|
61
57
|
favicon: IMG_LOGO,
|
|
62
58
|
loginBackground: IMG_BG,
|
|
63
|
-
layout:
|
|
64
|
-
skipBind:
|
|
65
|
-
nb:
|
|
66
|
-
hf:
|
|
59
|
+
layout: 'default',
|
|
60
|
+
skipBind: '0',
|
|
61
|
+
nb: '0',
|
|
62
|
+
hf: '0',
|
|
67
63
|
cf: `
|
|
68
64
|
<div style="font-size:14px;color:white;">
|
|
69
65
|
<a
|
|
@@ -10,11 +10,7 @@
|
|
|
10
10
|
v-if="contextProps.config?.favicon || contextProps.config?.title"
|
|
11
11
|
class="flex items-center justify-center gap-3 mb-4"
|
|
12
12
|
>
|
|
13
|
-
<img
|
|
14
|
-
v-if="contextProps.config.favicon"
|
|
15
|
-
:src="contextProps.config.favicon"
|
|
16
|
-
class="w-7"
|
|
17
|
-
/>
|
|
13
|
+
<img v-if="contextProps.config.favicon" :src="contextProps.config.favicon" class="w-7" />
|
|
18
14
|
<b class="text-xl">
|
|
19
15
|
{{ contextProps.config.title }}
|
|
20
16
|
</b>
|
|
@@ -44,14 +40,10 @@
|
|
|
44
40
|
</el-button>
|
|
45
41
|
|
|
46
42
|
<div class="text-center mt-4">
|
|
47
|
-
<el-link class="!font-400" @click="handleToggle(TabKey.REGISTER)"
|
|
48
|
-
>注册账号</el-link
|
|
49
|
-
>
|
|
43
|
+
<el-link class="!font-400" @click="handleToggle(TabKey.REGISTER)">注册账号</el-link>
|
|
50
44
|
|
|
51
45
|
<template v-if="!hideLoginMethods">
|
|
52
|
-
<el-divider
|
|
53
|
-
><span class="text-xs text-black/40"> 其他登录方式 </span></el-divider
|
|
54
|
-
>
|
|
46
|
+
<el-divider><span class="text-xs text-black/40"> 其他登录方式 </span></el-divider>
|
|
55
47
|
|
|
56
48
|
<el-button link @click="handleToggle(TabKey.WECHAT_SCAN)">
|
|
57
49
|
<img src="./img/wechat.png" alt="" class="size-6" />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Vibrant } from
|
|
2
|
-
import { Md5 } from
|
|
1
|
+
import { Vibrant } from 'node-vibrant/browser';
|
|
2
|
+
import { Md5 } from 'ts-md5';
|
|
3
3
|
|
|
4
4
|
export function transformModel(v: { email: string; password: string }) {
|
|
5
5
|
const { email, password } = v;
|
|
@@ -23,17 +23,14 @@ export function setTheme(colors: any[]) {
|
|
|
23
23
|
const root = document.documentElement;
|
|
24
24
|
const color = `${r} ${g} ${b}`;
|
|
25
25
|
const elColor = `rgb(${r},${g},${b})`;
|
|
26
|
-
root.style.setProperty(
|
|
27
|
-
root.style.setProperty(
|
|
26
|
+
root.style.setProperty('--color-primary', color);
|
|
27
|
+
root.style.setProperty('--el-color-primary', elColor);
|
|
28
28
|
|
|
29
29
|
for (let i = 1; i <= 10; i++) {
|
|
30
|
-
root.style.setProperty(
|
|
31
|
-
`--el-color-primary-light-${i}`,
|
|
32
|
-
generateLightColors(i, { r, g, b })
|
|
33
|
-
);
|
|
30
|
+
root.style.setProperty(`--el-color-primary-light-${i}`, generateLightColors(i, { r, g, b }));
|
|
34
31
|
root.style.setProperty(
|
|
35
32
|
`--el-color-primary-dark-${i}`,
|
|
36
|
-
generateLightColors(i, { r, g, b }, { r: 0, g: 0, b: 0 })
|
|
33
|
+
generateLightColors(i, { r, g, b }, { r: 0, g: 0, b: 0 }),
|
|
37
34
|
);
|
|
38
35
|
}
|
|
39
36
|
}
|
|
@@ -45,16 +42,14 @@ export function setTitle(title?: string, favicon?: string) {
|
|
|
45
42
|
let iconEl = document.querySelector("link[rel='icon']");
|
|
46
43
|
|
|
47
44
|
if (!iconEl) {
|
|
48
|
-
iconEl = document.createElement(
|
|
49
|
-
iconEl.setAttribute(
|
|
45
|
+
iconEl = document.createElement('link');
|
|
46
|
+
iconEl.setAttribute('rel', 'icon');
|
|
50
47
|
document.head.appendChild(iconEl);
|
|
51
48
|
}
|
|
52
49
|
|
|
53
50
|
// 防止缓存 & 兼容 https
|
|
54
|
-
const href = favicon.startsWith(
|
|
55
|
-
|
|
56
|
-
: `${window.location.origin}${favicon}`;
|
|
57
|
-
iconEl.setAttribute("href", `${href}?v=${Date.now()}`);
|
|
51
|
+
const href = favicon.startsWith('http') ? favicon : `${window.location.origin}${favicon}`;
|
|
52
|
+
iconEl.setAttribute('href', `${href}?v=${Date.now()}`);
|
|
58
53
|
}
|
|
59
54
|
}
|
|
60
55
|
/**
|
|
@@ -67,7 +62,7 @@ export function setTitle(title?: string, favicon?: string) {
|
|
|
67
62
|
function mixColors(
|
|
68
63
|
mixColor: { r: number; g: number; b: number },
|
|
69
64
|
baseColor: { r: number; g: number; b: number },
|
|
70
|
-
ratio: number
|
|
65
|
+
ratio: number,
|
|
71
66
|
) {
|
|
72
67
|
const r = Math.round(baseColor.r + (mixColor.r - baseColor.r) * ratio);
|
|
73
68
|
const g = Math.round(baseColor.g + (mixColor.g - baseColor.g) * ratio);
|
|
@@ -90,7 +85,7 @@ function rgbToCss({ r, g, b }: { r: number; g: number; b: number }, alpha = 1) {
|
|
|
90
85
|
function generateLightColors(
|
|
91
86
|
level: number,
|
|
92
87
|
baseColor: { r: number; g: number; b: number },
|
|
93
|
-
mixColor = { r: 255, g: 255, b: 255 }
|
|
88
|
+
mixColor = { r: 255, g: 255, b: 255 },
|
|
94
89
|
) {
|
|
95
90
|
const ratio = level / 10; // 1~9 -> 0.1~0.9
|
|
96
91
|
const mixed = mixColors(mixColor, baseColor, ratio);
|
|
@@ -105,7 +100,7 @@ export const passwordValidator = (
|
|
|
105
100
|
uppercase: number;
|
|
106
101
|
numbers: number;
|
|
107
102
|
symbols: number;
|
|
108
|
-
}
|
|
103
|
+
}>,
|
|
109
104
|
) => {
|
|
110
105
|
const defaultConfig: any = {
|
|
111
106
|
minLength: 8,
|
|
@@ -117,15 +112,15 @@ export const passwordValidator = (
|
|
|
117
112
|
};
|
|
118
113
|
|
|
119
114
|
const rulesMap: any = {
|
|
120
|
-
lowercase: { reg: /[a-z]/g, msg:
|
|
121
|
-
uppercase: { reg: /[A-Z]/g, msg:
|
|
122
|
-
numbers: { reg: /[0-9]/g, msg:
|
|
123
|
-
symbols: { reg: /[^a-zA-Z0-9]/g, msg:
|
|
115
|
+
lowercase: { reg: /[a-z]/g, msg: '小写字母' },
|
|
116
|
+
uppercase: { reg: /[A-Z]/g, msg: '大写字母' },
|
|
117
|
+
numbers: { reg: /[0-9]/g, msg: '数字' },
|
|
118
|
+
symbols: { reg: /[^a-zA-Z0-9]/g, msg: '特殊符号' },
|
|
124
119
|
};
|
|
125
120
|
|
|
126
121
|
return (_rule: any, value: string, callback: any) => {
|
|
127
122
|
if (!value) {
|
|
128
|
-
return callback(new Error(
|
|
123
|
+
return callback(new Error('请输入密码'));
|
|
129
124
|
}
|
|
130
125
|
|
|
131
126
|
if (value.length < defaultConfig.minLength) {
|
|
@@ -135,9 +130,7 @@ export const passwordValidator = (
|
|
|
135
130
|
for (const key in rulesMap) {
|
|
136
131
|
const count = (value.match(rulesMap[key].reg) || []).length;
|
|
137
132
|
if (count < defaultConfig[key]) {
|
|
138
|
-
return callback(
|
|
139
|
-
new Error(`密码至少包含 ${defaultConfig[key]} 个${rulesMap[key].msg}`)
|
|
140
|
-
);
|
|
133
|
+
return callback(new Error(`密码至少包含 ${defaultConfig[key]} 个${rulesMap[key].msg}`));
|
|
141
134
|
}
|
|
142
135
|
}
|
|
143
136
|
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-card
|
|
3
|
-
|
|
4
|
-
class="h-[420px]"
|
|
5
|
-
body-class="relative flex h-full items-center"
|
|
6
|
-
>
|
|
7
|
-
<el-link
|
|
8
|
-
type="primary"
|
|
9
|
-
class="!font-400 !absolute top-4 left-4"
|
|
10
|
-
@click="emits('back')"
|
|
2
|
+
<el-card shadow="hover" class="h-[420px]" body-class="relative flex h-full items-center">
|
|
3
|
+
<el-link type="primary" class="!font-400 !absolute top-4 left-4" @click="emits('back')"
|
|
11
4
|
>返 回</el-link
|
|
12
5
|
>
|
|
13
6
|
<div class="flex flex-col flex-1 items-center justify-center gap-5 px-4">
|
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
>
|
|
7
7
|
<div :id="DOM_ID" class="size-40"></div>
|
|
8
8
|
<b class="my-4">请使用微信扫码登录</b>
|
|
9
|
-
<el-link class="!font-400" @click="emits('back')">
|
|
10
|
-
返 回
|
|
11
|
-
</el-link>
|
|
9
|
+
<el-link class="!font-400" @click="emits('back')"> 返 回 </el-link>
|
|
12
10
|
</el-card>
|
|
13
11
|
</template>
|
|
14
12
|
|
package/dist/index.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import type { App } from
|
|
2
|
-
import AuthGateway from
|
|
3
|
-
import { setTheme, setThemeByUrl } from
|
|
4
|
-
import { ElLoadingDirective } from
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import AuthGateway from './components/auth-gateway/index.vue';
|
|
3
|
+
import { setTheme, setThemeByUrl } from './components/auth-gateway/util';
|
|
4
|
+
import { ElLoadingDirective } from 'element-plus';
|
|
5
5
|
export const theme = {
|
|
6
6
|
setTheme,
|
|
7
7
|
setThemeByUrl,
|
|
8
8
|
};
|
|
9
9
|
export { AuthGateway };
|
|
10
10
|
// 用于在父项目中注册 Element Plus 组件的类型声明
|
|
11
|
-
export interface AuthGatewayOptions {
|
|
12
|
-
// Element Plus 组件通过父项目按需加载,这里不需要导入
|
|
13
|
-
}
|
|
14
11
|
|
|
15
12
|
export default {
|
|
16
13
|
install(app: App) {
|
|
17
|
-
app.directive(
|
|
18
|
-
app.component(
|
|
14
|
+
app.directive('loading', ElLoadingDirective);
|
|
15
|
+
app.component('AuthGateway', AuthGateway);
|
|
19
16
|
},
|
|
20
17
|
};
|
package/package.json
CHANGED
|
@@ -1,50 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jcjy-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.691",
|
|
4
4
|
"description": "Vue 3 组件库",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist",
|
|
9
|
-
"package.json"
|
|
10
|
-
],
|
|
11
5
|
"keywords": [
|
|
12
|
-
"vue",
|
|
13
|
-
"vue3",
|
|
14
6
|
"components",
|
|
7
|
+
"element-plus",
|
|
15
8
|
"ui",
|
|
16
|
-
"
|
|
9
|
+
"vue",
|
|
10
|
+
"vue3"
|
|
17
11
|
],
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"package.json"
|
|
15
|
+
],
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "./dist/index.ts",
|
|
22
18
|
"dependencies": {
|
|
23
19
|
"node-vibrant": "^4.0.3",
|
|
24
20
|
"ts-md5": "^2.0.1"
|
|
25
21
|
},
|
|
26
22
|
"devDependencies": {
|
|
27
23
|
"@tailwindcss/vite": "^4.1.18",
|
|
28
|
-
"tailwindcss": "^4.1.18",
|
|
29
24
|
"@types/node": "^25.0.3",
|
|
30
25
|
"@vitejs/plugin-vue": "^6.0.3",
|
|
31
26
|
"@vue/tsconfig": "^0.8.1",
|
|
32
27
|
"element-plus": "^2.13.0",
|
|
33
|
-
"oxfmt": "^0.
|
|
34
|
-
"oxlint": "^1.
|
|
35
|
-
"rollup-plugin-visualizer": "^6.0.5",
|
|
28
|
+
"oxfmt": "^0.20.0",
|
|
29
|
+
"oxlint": "^1.35.0",
|
|
36
30
|
"sass": "^1.97.1",
|
|
31
|
+
"tailwindcss": "^4.1.18",
|
|
37
32
|
"typescript": "~5.9.3",
|
|
38
33
|
"vite": "7.3.0",
|
|
39
|
-
"vite-plugin-dts": "^4.5.4",
|
|
40
34
|
"vue": "^3.5.26",
|
|
41
35
|
"vue-tsc": "^3.2.1"
|
|
42
36
|
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"element-plus": "^2.0.0",
|
|
39
|
+
"vue": "^3.0.0"
|
|
40
|
+
},
|
|
43
41
|
"scripts": {
|
|
44
42
|
"dev": "vite",
|
|
45
43
|
"build": "vue-tsc -b && vite build",
|
|
46
44
|
"preview": "vite preview",
|
|
47
45
|
"build:types": "vue-tsc -b && vite build --mode build-types",
|
|
48
|
-
"push:npm": "node build.js && pnpm publish"
|
|
46
|
+
"push:npm": "node build.js && pnpm publish",
|
|
47
|
+
"lint": "oxlint",
|
|
48
|
+
"lint:fix": "oxlint --fix",
|
|
49
|
+
"format": "oxfmt .",
|
|
50
|
+
"format:check": "oxfmt --check ."
|
|
49
51
|
}
|
|
50
52
|
}
|