当前位置:网站首页>Vant implements a simple login registration module and a personal user center
Vant implements a simple login registration module and a personal user center
2022-07-03 01:38:00 【Something beside the book】
design sketch :


Code :
Personal center :
<template>
<div>
<div class="top">
<div>
<img class="tar" src="@/assets/lz.jpg" alt="">
<p style="float:left;color:#FFFFFF;margin-left:15px;margin-top:20px"> Up to duck </p>
<div style="float:right;height:25px;background-color:#295F96;margin-top:25px;width: 80PX; border-radius: 15px 0px 0px 15px;color:#FFFFFF"> <a href="#" style="color:#FFFFFF"> To do today </a></div>
</div>
<div> </div>
<div style="clear: both">
<div style="margin-top:10px;color:#FFFFFF;float:left;margin-left:30px;">
<div> dynamic </div>
<div>0</div>
</div>
<div style="margin-top:10px;color:#FFFFFF;float:left;margin-left:110px;">
<div> Focus on </div>
<div>99</div>
</div>
<div style="margin-top:10px;color:#FFFFFF;float:left;margin-left:110px;">
<div> fans </div>
<div>10</div>
</div>
</div>
</div>
<div style="">
<div style="float:left;margin-left:30px;margin-top:10px">
<div ><van-icon size="25" name="star-o" /></div>
<div style="margin-top:3px"> Collection </div>
</div>
<div style="float:left;margin-left:110px;margin-top:10px">
<div ><van-icon size="25" name="clock-o" /></div>
<div style="margin-top:3px"> history </div>
</div>
<div style="float:left;margin-left:110px;margin-top:10px">
<div ><van-icon size="25" name="todo-list-o" /></div>
<div style="margin-top:3px"> works </div>
</div>
<div style="clear: both;;width:100%;height:10px"></div>
</div>
<div style="margin-top:10px; clear: both; border-top: 1px solid #e2e2ee;">
<div> </div>
<div> Content area </div>
</div>
<div style="clear:both;">
<van-tabbar
v-model="active"
active-color="#07c160"
>
<van-tabbar-item icon="home-o"> label </van-tabbar-item>
<van-tabbar-item icon="search"> label </van-tabbar-item>
<van-tabbar-item icon="fire-o"> label </van-tabbar-item>
<van-tabbar-item icon="setting-o"> label </van-tabbar-item>
</van-tabbar>
</div>
<div>
</div>
</div>
</template>
<style scoped>
.top{
height: 150px;
width: 100%;
background-color: #1e87ff;
margin-top:-58px
}
.tar{
margin-top: 20px;
height: 70px;
width: 70px;
border-radius: 50%;
float: left;
margin-left:10px;
}
</style>
<script>
import Tabbar from '@/components/tab/Tabbar.vue'
export default{
data(){
return{
userName:'',
pwd:'',
active: 0
}
},
//axios
//getApi() ---> axios aixos.get('http://localhost:8080/api')
// The back end got the request -- Data processing -- Data back to
// The local browser gets the data
components:{
Tabbar,
},
created(){
var userLogin = localStorage.getItem("userLogin");
userLogin = JSON.parse(userLogin);
console.log(userLogin.name);
console.log(userLogin.pwd);
this.userName = userLogin.name;
this.pwd = userLogin.pwd;
},
methods:{
exit(){
localStorage.removeItem("userLogin"); // Remove saved data
this.$router.replace("/home");
},
onClickLeft() {
Toast(' return ');
},
onClickRight() {
Toast(' Button ');
}
}
}
</script>
<style>
.top{
height: 100px;
width: 100%;
background-color: #1e87ff;
margin-top:-58px
}
.tar{
margin-top: 20px;
height: 70px;
width: 70px;
border-radius: 50%;
}
</style>
Sign in :
<template>
<van-form @submit="onSubmit">
<div >
<div> </div>
<img class="tar" src="@/assets/lz.jpg" alt="">
</div>
<van-field
left-icon="friends-o"
v-model="username"
style="margin-top:10px"
name=" user name "
label=" user :"
placeholder=" Please enter a user name "
:rules="[{ required: true, message: ' Please fill in the user name ' }]"
label-width="50"
class="input"
/>
<van-field
left-icon="smile-comment-o"
v-model="password"
type="password"
name=" password "
label=" password :"
placeholder=" Please input a password "
label-width="50"
:rules="[{ required: true, message: ' Please fill in the password ' }]"
class="input"
/>
<div style="margin: 16px;">
<van-button round block type="info" native-type="submit"> Submit </van-button>
</div>
<div class="reg">
<div @click="toRegister" style="font-size: small;"> There is no account ? Register now </div>
</div>
</van-form>
</template>
<script>
import { Dialog } from 'vant';
export default{
data(){
return{
username:'',
password:'',
show:false,
userList:[],
}
},
methods:{
onSubmit(){
var list = localStorage.getItem("userList");
console.log(list);
if(list == null ){
Dialog.alert({
title: ' Dear user :',
message: ' Login account does not exist , Log back in !',
theme: 'round-button',
}).then(() => {
this.username = '';
this.password = '';
});
}else{
this.userList = JSON.parse(list);
for(var i = 0 ; i < this.userList.length ; i++){
console.log(this.userList[i].name);
console.log(this.userList[i].pwd);
if(this.userList[i].name == this.username && this.userList[i].pwd == this.password){
Dialog.alert({
title: ' Dear user :',
message: ' Login successful !',
theme: 'round-button',
}).then(() => {
this.$router.replace({path:'/home'});
});
localStorage.setItem("userLogin",JSON.stringify(this.userList[i]));
return ;
}
}
Dialog.alert({
title: ' Dear user :',
message: ' Login account does not exist , Log back in !',
theme: 'round-button',
}).then(() => {
this.username = '';
this.password = '';
});
}
},
toRegister(){
this.$router.replace('/user/register')
}
},
components:{
[Dialog.Component.name]: Dialog.Component,
}
}
</script>
<style scoped>
/* .juli{
margin-top: 50px;
background-color: pink;
} */
.input{
margin-top: 50px;
border-bottom: 1px solid #e2e2ee;
}
.tar{
margin-top: 20px;
height: 70px;
width: 70px;
border-radius: 50%;
}
/* .back{
} */
</style>
边栏推荐
- Qtablewidget lazy load remaining memory, no card!
- Introduction to flask tutorial
- C language course information management system
- 什么是调。调的故事
- Swiftui component Encyclopedia: using scenekit and swiftui to build interactive 3D pie charts (tutorial with source code)
- 网络安全-openvas
- Everything文件搜索工具
- Common English Vocabulary
- Arduino DY-SV17F自动语音播报
- MySQL - database query - basic query
猜你喜欢

什么是调。调的故事

leetcode刷题_两数之和 II - 输入有序数组

MySQL - database query - condition query

C application interface development foundation - form control (1) - form form

Top ten regular spot trading platforms 2022
![[data mining] task 5: k-means/dbscan clustering: double square](/img/e7/678197e703d1a28b765a0e3afd5580.png)
[data mining] task 5: k-means/dbscan clustering: double square

Scheme and practice of cold and hot separation of massive data

MySQL - database query - basic query

Arduino DY-SV17F自动语音播报
![[fh-gfsk] fh-gfsk signal analysis and blind demodulation research](/img/8a/8ca80f51a03341c982d52980c54b01.png)
[fh-gfsk] fh-gfsk signal analysis and blind demodulation research
随机推荐
Wireshark data analysis and forensics a.pacapng
C application interface development foundation - form control (1) - form form
d,ldc構建共享庫
Is there a handling charge for spot gold investment
SSL flood attack of DDoS attack
[androd] module dependency replacement of gradle's usage skills
wirehark数据分析与取证A.pacapng
Force buckle 204 Count prime
Mathematical knowledge: step Nim game game game theory
Using tensorboard to visualize the model, data and training process
Create your first Kivy program Hello word (tutorial includes source code)
Leetcode 6103 - minimum fraction to delete an edge from the tree
tp6快速安装使用MongoDB实现增删改查
【面试题】1369- 什么时候不能使用箭头函数?
MySQL - database query - condition query
Virtual list
The thread reuse problem of PageHelper using ThreadLocal, did you use it correctly?
QTableWidget懒加载剩内存,不卡!
Why is it not recommended to use BeanUtils in production?
Mathematical knowledge: divisible number inclusion exclusion principle