Skip to content

Commit

Permalink
chore: use ts in login page
Browse files Browse the repository at this point in the history
  • Loading branch information
LaicZhang committed Apr 23, 2022
1 parent a3321d4 commit dda857e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<script>
</script>

<script setup>
import { defineComponent, onBeforeMount, onMounted, reactive, ref } from 'vue'
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
import useVuexWithRouter from '@/hooks/useVuexWithRoutert'
import { getIpApi, getWeatherLikeApi, loginApi, menuPermissionApi } from '@/api'
Expand All @@ -58,8 +58,8 @@ const toPageHome = () => {
const BASE_CDN_URL = store.state.BASE_CDN_URL
const baseImgUrl = ref(`${BASE_CDN_URL}/img/bg-default.png`)
const coverImgUrl = ref('')
const captchaRef = ref('')
const userFormRef = ref(null)
// const captchaRef = ref('')
const userFormRef: any = ref(null)
const userForm = reactive({
userName: '',
userPwd: '',
Expand Down Expand Up @@ -94,12 +94,12 @@ const getMenuPermission = async() => {
store.commit('setActionList', actionList)
store.commit('setMenuList', menuList)
}
const encodedUserPwd = (userPwd) => {
const encodedUserPwd = (userPwd: string) => {
userForm.userPwd = btoa(userPwd)
return userForm.userPwd
}
const userFromCommit = () => {
userFormRef.value.validate(async(valid) => {
userFormRef.value.validate(async(valid: any) => {
if (valid) {
encodedUserPwd(userForm.userPwd)
const loginInfo = await loginApi(userForm)
Expand All @@ -125,7 +125,7 @@ const toForget = () => {
const toHomeAsVisitor = () => {
userForm.userName = 'visitor'
userForm.userPwd = '123456'
userForm.captchaCode = '123456'
// userForm.captchaCode = '123456'
userFromCommit()
}
onMounted(() => {
Expand Down

0 comments on commit dda857e

Please sign in to comment.