```
<template>
<div class="login_container">
<div class="login_box">
<!-- 头像 -->
<div class="avatar_box">
<img src="@/assets/logo/logo_lv.png" alt="">
</div>
<!-- 登录表单 -->
<el-form ref="loginFormRef" :model="loginForm" :rules="loginFormRules" label-width="0px" class="login_form">
<!-- 用户名 -->
<el-form-item prop="username">
<el-input v-model="loginForm.username" prefix-icon="fas fa-user"></el-input>
</el-form-item>
<!-- 密码 -->
<el-form-item prop="password">
<el-input v-model="loginForm.password" prefix-icon="fas fa-key" type="password"></el-input>
</el-form-item>
<el-row>
<el-col :span="12"><div class="grid-content bg-purple">
<!-- icon -->
<el-form-item class="le">
<!-- <el-avatar :size="16" src="https://empty" @error="errorHandler">
<img src="@/assets/icon16_wx_logo.png"/>"+"<>"+"
</el-avatar> -->
<el-button type="text"><a href="https://open.weixin.qq.com/connect/qrconnect?appid=wx34a5cf5c6dd0a3e4&redirect_uri=http://json.ui-china.cn/api/openid/imi&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect"><img src="@/assets/logo/icon16_wx_logo.png"/></a></el-button>
<!-- <el-button type="text" @click="wxDialogVisible = true"><img src="@/assets/icon16_wx_logo.png"/></el-button> -->
<!-- <i class="el-icon-edit"></i> -->
</el-form-item>
</div></el-col>
<el-col :span="12"><div class="grid-content bg-purple-light">
<!-- 按钮区 -->
<el-form-item class="btns">
<el-button type="primary" @click="login">登录</el-button>
<el-button type="info" @click="resetLoginForm">重置</el-button>
</el-form-item>
</div></el-col>
</el-row>
</el-form>
</div>
<!-- -->
<!-- -->
<el-dialog title="提示" :visible="wxDialogVisible" width="30%" :before-close="handleClose">
<!-- <span>这是一段信息</span> -->
<span id="login_container"></span>
<span slot="footer" class="dialog-footer">
<el-button @click="wxDialogVisible = false">取 消</el-button>
<!-- <el-button type="primary" @click="wxDialogVisible = false">确 定</el-button> -->
</span>
</el-dialog>
</div>
</template>
<script>
// import $ from 'jquery'
// import { wxlogin } from 'http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js'
export default {
data () {
return {
// 登录表单数据
loginForm: {
username: 'ui-china',
password: ''
},
// 表单验证规则
loginFormRules: {
// 验证用户名
username: [
{ required: true, message: '请输入登录名称', trigger: 'blur' },
{ min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }
],
// 验证密码
password: [
{ required: true, message: '请输入登录密码名称', trigger: 'blur' },
{ min: 3, max: 10, message: '长度在 6 到 15 个字符', trigger: 'blur' }
]
},
wxDialogVisible: false
}
},
// ?token=eb1dcf3d203fc6f10861ec61657e4eda
created () {
this.token = this.$route.query.token
// console.log(this.token)// 输出路径传值
if (this.token) {
this.tokenlogin()
} else { console.log('需要输入登录跳转跳转') }
},
methods: {
// tokenlogin登录验证
tokenlogin: function () {
const axios = require('axios')
axios.get('login/tokenlogin?token=' + this.token).then(res => {
if (res.data.code !== 1) return this.$message.error(res.data.msg)
this.$message.success(res.data.msg)
console.log(res.data.token)
window.sessionStorage.setItem('token', res.data.token)
this.$router.push('/Home')
})
},
// 登录验证
login () {
console.log(this.loginForm)
// console.log(this.loginForm.password)
this.$refs.loginFormRef.validate(async valid => {
console.log(valid)
if (!valid) return
const { data: res } = await this.$http.post('login/login', this.loginForm)
if (res.code !== 1) return this.$message.error(res.msg)
this.$message.success(res.msg)
console.log(res)
window.sessionStorage.setItem('token', res.token)
this.$router.push('/Home')
// console.log(window.sessionStorage.getItem('token'))
})
},
// 重置登录表单
resetLoginForm () {
this.$refs.loginFormRef.resetFields()
},
handleClose (done) {
this.$confirm('确认关闭?')
.then(_ => {
done()
})
.catch(_ => {})
}
}
}
</script>
<style lang="less" scoped>
.login_container{
display: block;
// background-color:#2b4b6b;
width: 100%;
height: 100%;
background: -webkit-linear-gradient(#62B896,#00a377,#00925D); /* Safari 5.1-6.0 */
background: -o-linear-gradient(#62B896,#00a377,#00925D); /* Opera 11.1-12.0 */
background: -moz-linear-gradient(#62B896,#00a377,#00925D); /* Firefox 3.6-15 */
background: linear-gradient(#62B896,#00a377,#00925D); /* 标准语法 */
}
.login_box{
width:400px;
height:300px;
background-color: #fff;
border-radius: 3px;
position: absolute;
left:50%;
top:50%;
transform:translate(-50%,-50%);
.avatar_box{
height: 130px;
width: 130px;
border: 1px solid #eee;
border-radius: 50%;
padding: 10px;
box-shadow: 0 0 10px #ddd;
position: absolute;
left: 50%;
transform: translate(-50%,-50%;);
background-color:#fff;
img{
width: 100%;
height: 100%;
border-radius: 50%;
background-color:#eee;
}
}
}
.login_form{
position: absolute;
bottom:0;
width:100%;
padding:0 10px;
box-sizing: border-box;
}
.btns{
display: flex;
justify-content: flex-end;
}
.le{
display: flex;
justify-content: flex-start;
}
.le i{
margin-left: 16px;
}
</style>
```
- HTML
- 讯飞插件
- Python
- 王者荣耀
- demo_cg.py
- demo_cg_TT.py
- img.py
- MySQL
- 清空表数据
- ID自增长重置
- 用户密码及权限操作
- 外键在数据库中的作用
- MySQL增删改查语句
- DDL-数据库操作
- DDL-表操作-查询
- DDL-表操作-创建
- DDL-表操作-数据类型
- DDL-表操作-修改
- DDL-表操作-删除
- DML-语句
- DML-添加数据
- DML-修改数据
- DML-删除数据
- DQL-语法
- DQL-基本查询
- DQL-条件查询
- DQL-聚合函数
- DQL-分组查询
- DQL-排序查询
- DQL-分页查询
- DCL-介绍
- DCL-管理用户
- DCL-权限控制
- 函数
- JS
- ajax
- ajax get请求
- ajax post提交
- ajax 同时上传文本和文件到数据库(inpt text和input file)
- 路径传值+接收解析
- js 本地sessionStorage
- js Excel导出.xls
- 二维码生成插件
- VUE-CLI4
- 安装手脚架及插件
- ECharts-数据可视化
- element-ui-时间戳
- qrcode二维码生成插件
- vuedraggable-拖拽组件
- vue-drag-resize-自由拖拽、缩放组件
- gitee配置
- src
- plugins
- element.js
- echartsMixin.js
- views
- login
- login.vue
- btn.vue
- home
- home.vue
- Welcome.vue
- user
- users.vue
- router
- main.js
- App.vue
- 引入语法
- 获取路径传值
- ajax请求
- token语法
- NPM更换镜像方案
- PHP
- PHP 微信网页登录
- PHP 判断函数
- PHP 获取微信公众号openid
- PHP 实现发送模板消息(微信公众号版)
- PHP 阳历阴历转换计算生肖闰年
- PHP 接口数组形式
- PHP 同文件夹下顺序命名
- PHP 输出文件
- PHP E-mail发送
- PHP cURL资源
- PHP 远程访问控制服务器
- PHP 8.0 开启mysqli扩展
- PHP 使用 OSS 批量上传图片
- PHP md5 加密与解密
- ThinkPHP
- PT6
- TP6安装多应用
- TP5
- view渲染模板常见语法
- Visual Studio Code
- 介绍
- 插件-eslint
- vs code插件
- VSCode添加自定义模板
- SFTP
- md格式的文档
- mermaid
- frp内网穿透
- 自定义端口
- ui-china.cn
- 常用软件
- 框架
- 服务器
- 微信小程序
- 云函数 Email
- 参数传递
- 其他
- VMware虚拟机centos7设置静态ip 连接外网