|
@@ -6,15 +6,22 @@
|
|
|
<div class="ptc-form">
|
|
|
<div class="title">Sign in to PTC Care Plus</div>
|
|
|
<div class="ptc-form-item">
|
|
|
- <input class="ptc-input" placeholder="email address" />
|
|
|
+ <input
|
|
|
+ v-model="loginData.email"
|
|
|
+ class="ptc-input"
|
|
|
+ placeholder="email address"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="ptc-form-item">
|
|
|
- <input class="ptc-input" type="password" placeholder="password" />
|
|
|
+ <input
|
|
|
+ v-model="loginData.password"
|
|
|
+ class="ptc-input"
|
|
|
+ type="password"
|
|
|
+ placeholder="password"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="ptc-form-item">
|
|
|
- <button class="ptc-button" @click="showSurprise = true">
|
|
|
- SIGN IN
|
|
|
- </button>
|
|
|
+ <button class="ptc-button" @click="handleLogin">SIGN IN</button>
|
|
|
</div>
|
|
|
<div class="ptc-form-item">
|
|
|
<p class="tip">
|
|
@@ -67,10 +74,22 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref } from 'vue'
|
|
|
+import { ref, reactive } from 'vue'
|
|
|
+import { useRouter } from 'vue-router'
|
|
|
import NavBar from '@/components/nav-bar/index.vue'
|
|
|
+import { login } from '@/service/user'
|
|
|
|
|
|
+const router = useRouter()
|
|
|
const showSurprise = ref(false)
|
|
|
+const loginData = reactive<ApiUser.Login.Request>({
|
|
|
+ email: '',
|
|
|
+ password: '',
|
|
|
+})
|
|
|
+
|
|
|
+async function handleLogin() {
|
|
|
+ await login(loginData)
|
|
|
+ router.push('/')
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|