Skip to content

Commit fa5ab77

Browse files
committed
fix: 输入框符合要求按钮高亮
1 parent 1653776 commit fa5ab77

4 files changed

Lines changed: 51 additions & 7 deletions

File tree

packages/design-core/src/login/ForgotPassword.vue

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
</tiny-tooltip>
5353
</tiny-form-item>
5454
<tiny-form-item>
55-
<tiny-button type="primary" @click="handleForgot"> 提交</tiny-button>
55+
<tiny-button :class="{ successBg: isReady }" type="primary" @click="handleForgot"> 提交</tiny-button>
5656
</tiny-form-item>
5757
</tiny-form>
5858
<div class="forgot-bottom">
@@ -62,7 +62,7 @@
6262
</template>
6363

6464
<script lang="ts">
65-
import { reactive, watch } from 'vue'
65+
import { reactive, watch, computed } from 'vue'
6666
import { TinyForm, TinyFormItem, TinyInput, TinyButton, TinyTooltip } from '@opentiny/vue'
6767
import useLogin from './js/useLogin'
6868
import { getMetaApi, META_SERVICE } from '@opentiny/tiny-engine-meta-register'
@@ -90,6 +90,17 @@ export default {
9090
rules: [...useLogin().passwordRules]
9191
})
9292
93+
const isReady = computed(() => {
94+
return (
95+
state.forgotData.username &&
96+
state.forgotData.password &&
97+
state.forgotData.key &&
98+
state.forgotData.confirmPassword &&
99+
!state.pwManualShow &&
100+
state.forgotData.confirmPassword === state.forgotData.password
101+
)
102+
})
103+
93104
const handleConfirmPwChange = () => {
94105
if (state.forgotData.confirmPassword !== state.forgotData.password) {
95106
state.confirmManualShow = true
@@ -146,6 +157,7 @@ export default {
146157
)
147158
return {
148159
state,
160+
isReady,
149161
handleForgot,
150162
toLogin
151163
}
@@ -188,6 +200,10 @@ export default {
188200
}
189201
}
190202
203+
.successBg {
204+
background: #191919 !important;
205+
}
206+
191207
:deep(.tiny-form-item__content) {
192208
margin-left: 0 !important;
193209
}

packages/design-core/src/login/Index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export default {
7676
}
7777
7878
.login-right {
79-
flex: 1;
79+
flex: 1.2;
80+
margin-top: 50px;
8081
margin-left: 80px;
8182
.login-form {
8283
box-sizing: border-box;
@@ -102,6 +103,9 @@ export default {
102103
margin-top: 20px;
103104
font-size: 14px;
104105
}
106+
:deep(.tiny-button.tiny-button.tiny-button.tiny-button.tiny-button--primary) {
107+
border: none;
108+
}
105109
:deep(.tiny-input.tiny-input .tiny-input__inner.tiny-input__inner) {
106110
height: 32px;
107111
font-size: 14px;

packages/design-core/src/login/Login.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
></tiny-input>
1515
</tiny-form-item>
1616
<tiny-form-item>
17-
<tiny-button type="primary" @click="handleLogin"> 登录 </tiny-button>
17+
<tiny-button :class="{ successBg: isReady }" type="primary" @click="handleLogin"> 登录 </tiny-button>
1818
</tiny-form-item>
1919
</tiny-form>
2020
<div class="login-bottom">
@@ -29,7 +29,7 @@
2929
</template>
3030

3131
<script lang="ts">
32-
import { reactive } from 'vue'
32+
import { reactive, computed } from 'vue'
3333
import { TinyForm, TinyFormItem, TinyInput, TinyButton } from '@opentiny/vue'
3434
import { getMetaApi, META_SERVICE } from '@opentiny/tiny-engine-meta-register'
3535
import useLogin from './js/useLogin'
@@ -51,6 +51,10 @@ export default {
5151
}
5252
})
5353
54+
const isReady = computed(() => {
55+
return state.loginData.username && state.loginData.password
56+
})
57+
5458
const handleLogin = () => {
5559
getMetaApi(META_SERVICE.Http)
5660
.post('/platform-center/api/user/login', {
@@ -78,8 +82,10 @@ export default {
7882
const toForgot = () => {
7983
emit('changeStatus', useLogin().FORGOT)
8084
}
85+
8186
return {
8287
state,
88+
isReady,
8389
handleLogin,
8490
toRegister,
8591
toForgot
@@ -111,6 +117,9 @@ export default {
111117
padding-left: 40%;
112118
margin-bottom: 24px;
113119
}
120+
.successBg {
121+
background: #191919 !important;
122+
}
114123
115124
.login-other::before,
116125
.login-other::after {

packages/design-core/src/login/Register.vue

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</tiny-tooltip>
5050
</tiny-form-item>
5151
<tiny-form-item>
52-
<tiny-button type="primary" @click="handleRegister"> 注册</tiny-button>
52+
<tiny-button :class="{ successBg: isReady }" type="primary" @click="handleRegister"> 注册</tiny-button>
5353
</tiny-form-item>
5454
</tiny-form>
5555
<div class="register-bottom">
@@ -60,7 +60,7 @@
6060
</template>
6161

6262
<script lang="ts">
63-
import { reactive, watch } from 'vue'
63+
import { reactive, watch, computed } from 'vue'
6464
import { TinyForm, TinyFormItem, TinyInput, TinyButton, TinyTooltip } from '@opentiny/vue'
6565
import useLogin from './js/useLogin'
6666
import { getMetaApi, META_SERVICE } from '@opentiny/tiny-engine-meta-register'
@@ -86,6 +86,16 @@ export default {
8686
rules: [...useLogin().passwordRules]
8787
})
8888
89+
const isReady = computed(() => {
90+
return (
91+
state.registerData.username &&
92+
state.registerData.password &&
93+
state.registerData.confirmPassword &&
94+
!state.pwManualShow &&
95+
state.registerData.confirmPassword === state.registerData.password
96+
)
97+
})
98+
8999
const handleConfirmPwChange = () => {
90100
if (state.registerData.confirmPassword !== state.registerData.password) {
91101
state.confirmManualShow = true
@@ -144,6 +154,7 @@ export default {
144154
145155
return {
146156
state,
157+
isReady,
147158
handleRegister,
148159
handlePwChange,
149160
toLogin
@@ -188,6 +199,10 @@ export default {
188199
}
189200
}
190201
202+
.successBg {
203+
background: #191919 !important;
204+
}
205+
191206
:deep(.tiny-form-item__content) {
192207
margin-left: 0 !important;
193208
}

0 commit comments

Comments
 (0)