Skip to content

Commit 96b2d93

Browse files
committed
fix rotate captcha
1 parent 6d789bf commit 96b2d93

File tree

10 files changed

+48
-22
lines changed

10 files changed

+48
-22
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ interface Data {
272272
angle: number;
273273
image: string;
274274
thumb: string;
275+
thumbSize: number;
275276
}
276277

277278
// events = {}

README_zh.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ interface Data {
274274
angle: number;
275275
image: string;
276276
thumb: string;
277+
thumbSize: number;
277278
}
278279

279280
// events = {}

example/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ nextTick(() => {
208208
/////////////////////////////////
209209
210210
const rotateData = reactive({
211-
angle: 20,
212211
image: rotateImage,
213212
thumb: rotateThumb,
213+
thumbSize: 195,
214214
})
215215
const rotateEvents = {
216216
rotate(angle: number): void {

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "go-captcha-vue",
3-
"version": "2.0.5",
3+
"version": "2.0.6",
44
"private": false,
55
"type": "module",
66
"license": "MIT",
@@ -47,11 +47,11 @@
4747
],
4848
"scripts": {
4949
"dev": "vite",
50-
"build": "run-p type-check \"build-only {@}\" --",
51-
"build-only": "vite build && run-p tsd",
50+
"build": "run-p type:check \"build:only {@}\" --",
51+
"build:only": "vite build && run-p tsd",
5252
"tsd": "vue-tsc --rootDir ./packages --declaration --emitDeclarationOnly --noEmit false --outDir ./dist",
5353
"preview": "vite preview --port 5050",
54-
"type-check": "vue-tsc --noEmit -p tsconfig.json"
54+
"type:check": "vue-tsc --noEmit -p tsconfig.json"
5555
},
5656
"peerDependencies": {
5757
"vue": ">=3"

packages/components/click/index.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ const imageStyles = computed(() => {
142142
})
143143
144144
const hasDisplayImageState = computed(() => {
145-
return localData.image != '' || localData.thumb != ''
145+
return (localData.image && localData.image.length > 0) || (localData.thumb && localData.thumb.length > 0)
146146
})
147147
148148
const hasDisplayWrapperState = computed(() => {
@@ -174,9 +174,10 @@ defineExpose<ClickExpose>({
174174
z-index: 2;
175175
width: 22px;
176176
height: 22px;
177-
color: #cedffe;
178-
background: #3e7cff;
177+
color: var(--go-captcha-theme-dot-color-color);
178+
background: var(--go-captcha-theme-dot-bg-color);
179179
border: 3px solid #f7f9fb;
180+
border-color: var(--go-captcha-theme-dot-border-color);
180181
display:-webkit-box;
181182
display:-webkit-flex;
182183
display:-ms-flexbox;

packages/components/rotate/index.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const props = withDefaults(
9999
{
100100
config: defaultConfig,
101101
events: () => ({} as RotateEvent),
102-
data: () => ({} as RotateData),
102+
data: defaultRotateData,
103103
},
104104
)
105105
@@ -154,7 +154,11 @@ const wrapperStyles = computed(() => {
154154
155155
const thumbStyles = computed(() => {
156156
return {
157-
transform: `rotate(${handler.state.thumbAngle}deg)`
157+
transform: `rotate(${handler.state.thumbAngle}deg)`,
158+
...(localData.thumbSize > 0 ? {
159+
width: localData.thumbSize + "px",
160+
height: localData.thumbSize + "px"
161+
} : {})
158162
}
159163
})
160164
@@ -174,11 +178,11 @@ const imageStyles = computed(() => {
174178
})
175179
176180
const hasDisplayImageState = computed(() => {
177-
return localData.image != ''
181+
return localData.image && localData.image.length > 0
178182
})
179183
180184
const hasDisplayThumbImageState = computed(() => {
181-
return localData.thumb != ''
185+
return localData.thumb && localData.thumb.length > 0
182186
})
183187
184188
const hasDisplayWrapperState = computed(() => {
@@ -262,6 +266,14 @@ defineExpose<RotateExpose>({
262266
right: 0;
263267
bottom: 0;
264268
269+
display: -webkit-box;
270+
display: -moz-box;
271+
display: -ms-flexbox;
272+
display: -webkit-flex;
273+
display: flex;
274+
justify-content: center;
275+
align-items: center;
276+
265277
img {
266278
max-width: 100%;
267279
max-height: 100%;

packages/components/rotate/meta/data.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ export interface RotateData {
99
angle: number;
1010
image: string;
1111
thumb: string;
12+
thumbSize: number;
1213
}
1314

1415
export const defaultRotateData = ():RotateData => ({
1516
angle: 0,
1617
image: '',
17-
thumb: ''
18+
thumb: '',
19+
thumbSize: 0
1820
})

packages/components/slide-region/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const props = withDefaults(
7878
{
7979
config: defaultConfig,
8080
events: () => ({} as SlideRegionEvent),
81-
data: () => ({} as SlideRegionData),
81+
data: defaultSlideRegionData,
8282
},
8383
)
8484
@@ -151,11 +151,11 @@ const imageStyles = computed(() => {
151151
})
152152
153153
const hasDisplayImageState = computed(() => {
154-
return localData.image != ''
154+
return localData.image && localData.image.length > 0
155155
})
156156
157157
const hasDisplayThumbImageState = computed(() => {
158-
return localData.thumb != ''
158+
return localData.thumb && localData.thumb.length > 0
159159
})
160160
161161
const hasDisplayWrapperState = computed(() => {

packages/components/slide/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const props = withDefaults(
9494
{
9595
config: defaultConfig,
9696
events: () => ({} as SlideEvent),
97-
data: () => ({} as SlideData),
97+
data: defaultSlideData,
9898
},
9999
)
100100
@@ -171,11 +171,11 @@ const imageStyles = computed(() => {
171171
})
172172
173173
const hasDisplayImageState = computed(() => {
174-
return localData.image != ''
174+
return localData.image && localData.image.length > 0
175175
})
176176
177177
const hasDisplayThumbImageState = computed(() => {
178-
return localData.thumb != ''
178+
return localData.thumb && localData.thumb.length > 0
179179
})
180180
181181
const hasDisplayWrapperState = computed(() => {

packages/gocaptcha.less

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@
2121
--go-captcha-theme-loading-icon-color: #3e7cff;
2222
--go-captcha-theme-body-bg-color: #34383e;
2323

24+
--go-captcha-theme-dot-color-color: #cedffe;
25+
--go-captcha-theme-dot-bg-color: #4e87ff;
26+
--go-captcha-theme-dot-border-color: #ffffff;
27+
2428
--go-captcha-theme-default-color: #3e7cff;
2529
--go-captcha-theme-default-bg-color: #ecf5ff;
26-
--go-captcha-theme-default-border-color: #3e7cff;
30+
--go-captcha-theme-default-border-color: #50a1ff;
2731
--go-captcha-theme-default-hover-color: #e0efff;
2832

2933
--go-captcha-theme-error-color: #ed4630;
@@ -42,7 +46,7 @@
4246
.go-captcha {
4347
&.gc-wrapper {
4448
padding: 12px 16px;
45-
background-color: var(--go-captcha-theme-bg-color);
49+
//background-color: var(--go-captcha-theme-bg-color);
4650
-webkit-touch-callout: none;
4751
-webkit-user-select: none;
4852
-moz-user-select: none;
@@ -62,6 +66,10 @@
6266
box-shadow: 0 0 20px rgba(100, 100, 100, 0.1);
6367
-webkit-box-shadow: 0 0 20px rgba(100, 100, 100, 0.1);
6468
-moz-box-shadow: 0 0 20px rgba(100, 100, 100, 0.1);
69+
70+
&.gc-wrapper {
71+
background-color: var(--go-captcha-theme-bg-color);
72+
}
6573
}
6674

6775
.gc-header {
@@ -114,6 +122,7 @@
114122
overflow: hidden;
115123

116124
.gc-body-inner{
125+
position: relative;
117126
background: var(--go-captcha-theme-body-bg-color);
118127
}
119128
}
@@ -204,7 +213,7 @@
204213
color: var(--go-captcha-theme-btn-color);
205214
background-color: var(--go-captcha-theme-btn-bg-color);
206215
border: 1px solid transparent;
207-
border-color: var(--go-captcha-theme-btn-bg-color);
216+
border-color: var(--go-captcha-theme-btn-border-color);
208217
-webkit-appearance: none;
209218
box-sizing: border-box;
210219
outline: none;

0 commit comments

Comments
 (0)