Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liu75675231 committed Aug 11, 2020
1 parent c1109f2 commit 3625bd8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/http/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import axios from '../utils/http';

export function login (username, password) {
axios.request({
url: '/user/login',
method: 'post',
data: {
username,
password,
},
});
}
22 changes: 18 additions & 4 deletions src/pages/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,31 @@
<div class="page-login">
<div class="login-panel">
<div class="login-title">{{ $t('pleaseLogin') }}</div>
<input class="login-input" type="text" name="username" :placeholder="$t('loginInputUsername')"/>
<input class="login-input" type="password" name="password" :placeholder="$t('loginInputPassword')"/>
<div class="login-btn">{{ $t('login') }}</div>
<input class="login-input" type="text" name="username" v-model="username" :placeholder="$t('loginInputUsername')"/>
<input class="login-input" type="password" name="password" v-model="password" :placeholder="$t('loginInputPassword')"/>
<div class="login-btn" @click="login">{{ $t('login') }}</div>
</div>
</div>

</template>

<script>
import { login } from '../http/user';
export default {
name: "login"
name: "login",
data () {
return {
username: '',
password: '',
}
},
methods: {
login () {
login(this.username, this.password).then((res) => {
console.log(res);
});
},
}
}
</script>

Expand Down

0 comments on commit 3625bd8

Please sign in to comment.