yb课堂 注册-登陆-个人模块 《三十九》
Cube-UI的form表单
https://didi.github.io/cube-ui/#/zh-CN/docs/form
注册
Register.vue
<template>
<div class="main">
<cube-form :model="model" @submit="submitHandler">
<cube-form-group>
<!--名称-->
<cube-form-item :field="fields[0]"></cube-form-item>
<!--⼿机号-->
<cube-form-item :field="fields[1]"></cube-form-item>
<!--密码-->
<cube-form-item :field="fields[2]"></cube-form-item>
</cube-form-group>
<cube-form-group>
<cube-button type="submit">注册</cube-button>
</cube-form-group>
</cube-form>
<router-link to="/login" class="reg">登录</router-link>
</div>
</template>
<script>
import { registerApi } from "@/api/getData.js";
export default {
//注册接口引入
data() {
return {
model: {
phoneValue: "",
pwdValue: "",
nameValue: ""
},
fields: [
{
type: "input",
modelKey: "phoneValue",
label: "手机号",
props: {
placeholeder: "请输入手机"
},
rules: {
required: true
},
messages: {
required: "手机号不能为空"
}
},
{
type: "input",
modelKey: "pwdValue",
label: "密码",
props: {
placeholeder: "请输入密码",
type: "password",
eye: {
open: false
}
},
rules: {
required: true
},
messages: {
required: "密码不能为空"
}
},
{
type: "input",
modelKey: "nameValue",
label: "姓名",
props: {
placeholeder: "请输入姓名"
},
rules: {
required: true
},
messages: {
required: "姓名不能为空"
}
}
]
};
},
methods: {
submitHandler(e, model) {
e.preventDefault();
//调用注册业务
registerApi(model.nameValue, model.phoneValue, model.pwdValue).then(
res => {
if (res.data.code === 0) {
const toast = this.$createToast({
txt: "注册成功",
type: "correct",
time: 1500
});
toast.show();
}
}
);
}
}
};
</script>
<style lang="scss" scoped>
.main {
padding: 50px 5% 0;
text-align: center;
}
//注册
.cube-btn {
margin-top: 20px;
}
// 登录
.reg {
display: inline-block;
margin-top: 30px;
font-size: 18px;
}
</style>
登陆
Login.vue
<template>
<div class="main">
<cube-form :model="model" @submit="submitHandler">
<cube-form-group>
<!--⼿机号-->
<cube-form-item :field="fields[0]"></cube-form-item>
<!--密码-->
<cube-form-item :field="fields[1]"></cube-form-item>
</cube-form-group>
<cube-form-group>
<cube-button type="submit">登陆</cube-button>
</cube-form-group>
</cube-form>
<router-link to="/register" class="reg">注册</router-link>
</div>
</template>
<script>
import { loginApi } from "@/api/getData.js";
export default {
//注册接口引入
data() {
return {
model: {
phoneValue: "",
pwdValue: "",
},
fields: [
{
type: "input",
modelKey: "phoneValue",
label: "手机号",
props: {
placeholeder: "请输入手机"
},
rules: {
required: true
},
messages: {
required: "手机号不能为空"
}
},
{
type: "input",
modelKey: "pwdValue",
label: "密码",
props: {
placeholeder: "请输入密码",
type: "password",
eye: {
open: false
}
},
rules: {
required: true
},
messages: {
required: "密码不能为空"
}
}
]
};
},
methods: {
submitHandler(e, model) {
e.preventDefault();
//调用注册业务
loginApi(model.phoneValue, model.pwdValue).then(
res => {
if (res.data.code === 0) {
//登陆成功,跳转到个人中心
//将token存储起来
localStorage.setItem('token',res.data.data)
this.$store.dispatch('setToken', res.data.data)
//跳转页面
this.$router.push({ path: '/'})
}else{
const toast = this.$createToast({
txt: "登陆失败",
type: "error",
time: 1500
});
toast.show();
}
}
);
}
}
};
</script>
<style lang="scss" scoped>
.main {
padding: 50px 5% 0;
text-align: center;
}
// 登录
.cube-btn {
margin-top: 20px;
}
//注册
.reg {
display: inline-block;
margin-top: 30px;
font-size: 18px;
}
</style>
yb课堂 注册-登陆-个人模块 《三十九》的更多相关文章
- Gradle 1.12用户指南翻译——第三十九章. IDEA 插件
本文由CSDN博客万一博主翻译,其他章节的翻译请参见: http://blog.csdn.net/column/details/gradle-translation.html 翻译项目请关注Githu ...
- 第三百三十九节,Python分布式爬虫打造搜索引擎Scrapy精讲—Scrapy启动文件的配置—xpath表达式
第三百三十九节,Python分布式爬虫打造搜索引擎Scrapy精讲—Scrapy启动文件的配置—xpath表达式 我们自定义一个main.py来作为启动文件 main.py #!/usr/bin/en ...
- NeHe OpenGL教程 第三十九课:物理模拟
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
- Java进阶(三十九)Java集合类的排序,查找,替换操作
Java进阶(三十九)Java集合类的排序,查找,替换操作 前言 在Java方向校招过程中,经常会遇到将输入转换为数组的情况,而我们通常使用ArrayList来表示动态数组.获取到ArrayList对 ...
- SQL注入之Sqli-labs系列第三十八关、第三十九关,第四十关(堆叠注入)
0x1 堆叠注入讲解 (1)前言 国内有的称为堆查询注入,也有称之为堆叠注入.个人认为称之为堆叠注入更为准确.堆叠注入为攻击者提供了很多的攻击手段,通过添加一个新 的查询或者终止查询,可以达到修改数据 ...
- centos shell编程5 LANMP一键安装脚本 lamp sed lnmp 变量和字符串比较不能用-eq cat > /usr/local/apache2/htdocs/index.php <<EOF重定向 shell的变量和函数命名不能有横杠 平台可以用arch命令,获取是i686还是x86_64 curl 下载 第三十九节课
centos shell编程5 LANMP一键安装脚本 lamp sed lnmp 变量和字符串比较不能用-eq cat > /usr/local/apache2/htdocs/ind ...
- “全栈2019”Java第三十九章:构造函数、构造方法、构造器
难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...
- WPF,Silverlight与XAML读书笔记第三十九 - 可视化效果之3D图形
原文:WPF,Silverlight与XAML读书笔记第三十九 - 可视化效果之3D图形 说明:本系列基本上是<WPF揭秘>的读书笔记.在结构安排与文章内容上参照<WPF揭秘> ...
- 微信小程序把玩(三十九)navigation API
原文:微信小程序把玩(三十九)navigation API 演示效果也看到了小程序也就提供这几个处理导航控制.值得注意的是只能同时导航五个页面 主要属性: 导航条一些方法 wx.setNavigati ...
- 《手把手教你》系列技巧篇(三十九)-java+ selenium自动化测试-JavaScript的调用执行-上篇(详解教程)
1.简介 在做web自动化时,有些情况selenium的api无法完成,需要通过第三方手段比如js来完成实现,比如去改变某些元素对象的属性或者进行一些特殊的操作,本文将来讲解怎样来调用JavaScri ...
随机推荐
- Splashtop 教育行业用户增加700%
由于新冠肺炎大流行继续限制对大学.学院和K-12学校的计算机实验室的物理访问,Splashtop的销售数据表明,越来越多的学校开始使用远程访问软件作为使用计算机实验室资源的替代方法. 在6月到8月 ...
- C语言:++ --优先级的深入理解
#include <stdio.h> int main() { int num = 11; int result = ++num > 11 && --num < ...
- MYSQL造数据占用临时表空间
在MySQL中,临时表空间通常用于存储如ORDER BY.GROUP BY.DISTINCT.UNION.JOIN等操作中产生的临时数据.当这些操作的数据集太大而无法在内存中完成时,MySQL会使用磁 ...
- Vue History模式IIS的配置补充
摘自 :https://blog.csdn.net/ssdnif/article/details/103856283 官方提供的配置<?xml version="1.0" e ...
- python垃圾回收和缓存管理
Python垃圾回收和缓存管理 你有没有想过为什么我们频繁地使用Python敲代码做项目,实际上一直在生产对象并不断占用内存,而我们很少会去清理Python的内存,理论上来讲它总有一天把内存消耗殆尽( ...
- Swoole 源码分析之 Coroutine 协程模块
首发原文链接:Swoole 源码分析之 Coroutine 协程模块 大家好,我是码农先森. 引言 协程又称轻量级线程,但与线程不同的是:协程是用户级线程,不需要操作系统参与.由用户显式控制,可以在需 ...
- 继承,super,重写,多态,抽象,接口
继承,super,重写,多态,抽象,接口 继承 extends 用于表示两个类之间的继承关系,继承是OOP的四大特性之一,他允许一个类(称之为子类或派送类) 继承另一个类(称之为父类或基类)的变量和方 ...
- NOIP模拟101(多校33)
T1 ladice 解题思路 我们把一个物品看做 \(A_i\) 与 \(B_i\) 之间的连边. 那么如果加入这条边之后联通块中有超过两个环或者两个环就是不合法的,也就是合法的状态只能是一个基环树和 ...
- BGP中next-hop-self 小实验
next-hop-self 在EBGP和IBGP边界使用,对ibgp下一跳邻居使用 配置命令 router bgp 1234 neighbor 2.2.2.2 next-hop-self 使用Next ...
- LeetCode 146. LRU CacheLRU缓存机制 (C++/Java)
题目: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the ...