Skip to content

Commit 3be5080

Browse files
authored
fix: Captcha optimize (#560)
* fix: yarn无法启动 * fix(login.vue): 验证码操作优化,el-message调用修复 * fix: 原配置会导致linux下直接显示宋体,修复为自动选择非衬线字体
1 parent 7fae66f commit 3be5080

File tree

4 files changed

+479
-62
lines changed

4 files changed

+479
-62
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@babel/polyfill": "^7.4.4",
1818
"@tinymce/tinymce-vue": "^4.0.0",
1919
"axios": "^0.24.0",
20-
"core-js": "^3.6.5",
20+
"core-js": "^3.23.5",
2121
"dayjs": "^1.10.4",
2222
"element-plus": "^2.1.4",
2323
"event-source-polyfill": "^1.0.7",

src/assets/style/realize/reset.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ input {
8484
border: 0;
8585
font-size: 100%;
8686
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
87-
Microsoft YaHei, SimSun, sans-serif;
87+
Microsoft YaHei, sans-serif;
8888
font-weight: normal;
8989
vertical-align: baseline;
9090
}

src/view/login/login.vue

+9-6
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<input type="password" v-model="account.password" autocomplete="off" placeholder="请填写用户登录密码" />
1414
</div>
1515
<div class="form-item password" v-if="captchaImage">
16-
<img class="captcha" :src="captchaImage" />
17-
<input type="password" v-model="account.captcha" autocomplete="off" placeholder="请填写验证码" />
16+
<img class="captcha" :src="captchaImage" @click.stop="getCaptcha()" />
17+
<input type="text" v-model="account.captcha" autocomplete="off" placeholder="请填写验证码" />
1818
</div>
1919
<button class="submit-btn" type="submit">登录</button>
2020
</form>
@@ -23,9 +23,10 @@
2323
</template>
2424

2525
<script>
26-
import { reactive, ref, onMounted, getCurrentInstance } from 'vue'
26+
import { reactive, ref, onMounted } from 'vue'
2727
import { useStore } from 'vuex'
2828
import { useRouter } from 'vue-router'
29+
import { ElMessage } from 'element-plus'
2930
import axios from 'lin/plugin/axios'
3031
import UserModel from '@/lin/model/user'
3132
import Utils from '@/lin/util/util'
@@ -40,7 +41,6 @@ export default {
4041
const store = useStore()
4142
const router = useRouter()
4243
const throttleLogin = ref(null)
43-
const { ctx } = getCurrentInstance()
4444
4545
const account = reactive({
4646
username: '',
@@ -59,11 +59,12 @@ export default {
5959
await getInformation()
6060
loading.value = false
6161
router.push(Config.defaultRoute)
62-
ctx.$message({
62+
ElMessage({
6363
message: '登录成功',
6464
type: 'success',
6565
})
6666
} catch (e) {
67+
getCaptcha()
6768
loading.value = false
6869
}
6970
}
@@ -103,6 +104,7 @@ export default {
103104
return {
104105
account,
105106
loading,
107+
getCaptcha,
106108
captchaImage,
107109
throttleLogin,
108110
}
@@ -114,8 +116,8 @@ export default {
114116
.login {
115117
width: 100%;
116118
height: 100%;
117-
background-size: auto;
118119
background: #1b2c5f url('../../assets/image/login/login-ba.png') no-repeat center center;
120+
background-size: cover;
119121
120122
.team-name {
121123
position: fixed;
@@ -172,6 +174,7 @@ export default {
172174
width: 80px;
173175
right: 30px;
174176
top: -22px;
177+
cursor: pointer;
175178
}
176179
}
177180

0 commit comments

Comments
 (0)