当前位置:   article > 正文

Vue常用静态模板_vue模板

vue模板

多种登录方式模板

代码

  1. <template>
  2. <div>
  3. <div class="login_warp">
  4. <div class="loginbox fl">
  5. <!-- 三个选项卡按钮 -->
  6. <div class="login_header">
  7. <span @click="cur=0" :class="{active:cur==0}">账号登录</span>
  8. <span @click="cur=1" :class="{active:cur==1}">快捷登录</span>
  9. <span @click="cur=2" :class="{active:cur==2}">扫码登录</span>
  10. </div>
  11. <div class="login_content">
  12. <!-- 在cur==0时此板块显示 其他时候此板块不显示 -->
  13. <div v-show="cur==0" class="Cbody_item">
  14. <div class="form_item"><input type="text" name="fname" placeholder="用户名"></div>
  15. <div class="form_item"><input type="password" name="fpassword" placeholder="密码"></div>
  16. <div class="form_item">
  17. <div class="fl"><input type="checkbox">记住密码</div>
  18. <div class="fr"><a href="javascript:;" >找回密码</a></div>
  19. </div>
  20. <div class="clear"></div>
  21. <div class="form_item">
  22. <input type="submit" name="" value="登录">
  23. </div>
  24. </div>
  25. <!-- 在cur==1时此板块显示 其他时候此板块不显示 -->
  26. <div v-show="cur==1" class="Cbody_item">
  27. <div class="form_item"><input type="text" name="fname" placeholder="手机号"></div>
  28. <div class="form_item"><input type="password" name="fpassword" placeholder="验证码"></div>
  29. <div class="form_item">
  30. <!-- <div class="fl"><input type="checkbox">记住密码</div>
  31. <div class="fr"><a href="javascript:;" >找回密码</a></div> -->
  32. </div>
  33. <div class="clear"></div>
  34. <div class="form_item">
  35. <input type="submit" name="" value="登录">
  36. </div>
  37. </div>
  38. <!-- 在cur==2时此板块显示 其他时候此板块不显示 -->
  39. <div v-show="cur==2" class="Cbody_item">
  40. <div class="qcode"><img src="../../public/img/1709633675060.jpg" width="160" height="160" alt="二维码" /></div>
  41. <div class="beizhu">打开手机客户端扫码注册</div>
  42. </div>
  43. </div>
  44. </div>
  45. <!-- 右边蓝色板块 -->
  46. <div class="loginrslider fl"></div>
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. export default {
  52. name: 'MyLogin',
  53. data(){
  54. return {
  55. cur:0 //默认选中第一个tab
  56. };
  57. },
  58. methods:{
  59. }
  60. }
  61. </script>
  62. <!-- Add "scoped" attribute to limit CSS to this component only -->
  63. <style scoped>
  64. .fl{
  65. float: left;
  66. }
  67. .fr{
  68. float: right;
  69. }
  70. .clear{
  71. clear: both;
  72. }
  73. a{
  74. text-decoration: none;
  75. color: #333;
  76. transition: ease all 0.5s;
  77. }
  78. a{
  79. color: #1c65ff
  80. }
  81. .login_header{
  82. margin-bottom: 40px;
  83. }
  84. .login_header span{
  85. margin-right: 20px;
  86. cursor: pointer;
  87. }
  88. .loginbox{
  89. width: 300px;
  90. overflow: hidden;
  91. padding: 20px;
  92. padding-top: 15px;
  93. }
  94. .Cbody_item{
  95. border: 0px solid #999;
  96. overflow: hidden;
  97. }
  98. .form_item{
  99. font-size: 13px;
  100. }
  101. .form_item input[type="text"],.form_item input[type="password"]{
  102. display: block;
  103. width: calc(100% - 18px);
  104. height: 36px;
  105. margin:0 auto;
  106. padding-left: 16px;
  107. outline: none;
  108. border: 1px solid #999;
  109. transition: ease all 0.5s;
  110. margin-bottom: 20px;
  111. }
  112. .form_item input[type="text"]:focus,.form_item input[type="password"]:focus{
  113. border: 1px solid #1c65ff
  114. }
  115. .form_item input[type="submit"]{
  116. display: block;
  117. width: calc(100% - 0px);
  118. height: 40px;
  119. margin:0 auto;
  120. padding-left: 16px;
  121. outline: none;
  122. border: 1px solid #1c65ff;
  123. transition: ease all 0.5s;
  124. margin-top: 20px;
  125. margin-bottom: 20px;
  126. background-color: #1c65ff;
  127. color: #fff;
  128. cursor: pointer;
  129. }
  130. .form_item input[type="submit"]:hover{
  131. background-color: #3f7dff;
  132. border: 1px solid #3f7dff;
  133. }
  134. .active{
  135. color: #3f7dff;
  136. padding-bottom: 10px;
  137. border-bottom: 3px solid #3f7dff;
  138. }
  139. .loginrslider{
  140. width: 160px;
  141. height: 322px;
  142. background-color: #1c65ff;
  143. }
  144. .login_warp{
  145. width: 500px;
  146. margin: 50px auto;
  147. border-radius: 10px;
  148. box-shadow: 0 0px 0px #ccc;
  149. overflow: hidden;
  150. border:1px solid #3f7dff;
  151. margin-top: 10%;
  152. transition: ease all 0.5s;
  153. position: relative;
  154. top: 0px;
  155. cursor: pointer;
  156. }
  157. .login_warp:hover{
  158. top: -30px;
  159. box-shadow: 0 15px 21px #ccc;
  160. }
  161. .loginrslider{
  162. color: #fff;
  163. }
  164. .qcode{
  165. width: 160px;
  166. height: 160px;
  167. background-color: #ccc;
  168. margin: 0 auto;
  169. margin-top: 2px;
  170. }
  171. .beizhu{
  172. text-align: center;
  173. font-size: 13px;
  174. margin-top: 10px;
  175. color: #999
  176. }
  177. </style>

简便注册模板

界面

代码

  1. <template>
  2. <div class="register-page">
  3. <form class="register-form" >
  4. <dic class="tip">请输入你的信息创建账号</dic>
  5. <div class="number">学号</div>
  6. <input class="form-number" placeholder="输入学号" type="text" v-model="userNumber" >
  7. <div class="name">你的姓名</div>
  8. <input class="form-name" placeholder="输入姓名" type="text" v-model="userName" >
  9. <div class="phone">手机号码</div>
  10. <input class="form-phone" placeholder="输入手机号码" type="text" v-model="userPhone" >
  11. <div class="code-tip">
  12. <input class="code" placeholder="输入验证码" type="text" v-model="code" >
  13. <div @click="sendSMS" :class="tip">{{tipContent}}</div>
  14. </div>
  15. <div class="campus">所属校区</div>
  16. <select class="form-campus" v-model="userCampus">
  17. <option value="0">白云校区</option>
  18. <option value="1">东校区</option>
  19. <option value="2">河源校区</option>
  20. </select>
  21. <div class="address">用户地址</div>
  22. <textarea placeholder="输入地址" class="form-address" v-model="userAddress"></textarea>
  23. <div class="pwd">密码</div>
  24. <input placeholder="输入密码" class="form-pwd" type="password" v-model="userPassword" >
  25. <div class="pwd">再次输入密码:</div>
  26. <input placeholder="再次输入密码" class="form-pwd" type="password" v-model="rePassword" >
  27. <div class="form-but" @click="sumbit">提交</div>
  28. </form>
  29. </div>
  30. </template>
  31. <script>
  32. import { ElNotification } from 'element-plus'
  33. import axios from 'axios';
  34. export default {
  35. name: 'MyRegister',
  36. data(){
  37. return {
  38. userNumber:'',
  39. userName:'',
  40. userPhone:'',
  41. userAddress:'',
  42. code:'',
  43. userCampus:0,
  44. userPassword:'',
  45. rePassword:'',
  46. tip:'tip',
  47. tipContent:'发送验证码',
  48. secondsRemaining: 60 // 设置倒计时初始值为60
  49. };
  50. },
  51. methods:{
  52. sumbit(){
  53. if (this.userPassword !== this.rePassword) {
  54. ElNotification({
  55. title: 'Error',
  56. message: '密码不一致',
  57. type: 'error',
  58. })
  59. return;
  60. }
  61. this.$axios.post('/login/userRegister', {
  62. data: {
  63. userNumber: this.userNumber,
  64. userPassword: this.userPassword,
  65. userName: this.userName,
  66. userAddress: this.userAddress,
  67. userCampus:this.userCampus,
  68. userPhone: this.userPhone,
  69. code: this.code,
  70. key: ''
  71. }
  72. })
  73. .then(response => {
  74. console.log(response.data);
  75. })
  76. .catch(error => {
  77. console.error(error);
  78. });
  79. },
  80. async sendSMS(){
  81. if(this.tip == 'clicked-tip'){
  82. return;
  83. }
  84. if (this.userPhone === '') {
  85. ElNotification({
  86. title: 'Error',
  87. message: '手机号码不能为空',
  88. type: 'error',
  89. })
  90. return;
  91. }
  92. try {
  93. const response = await axios.get('/login/SMSCode/'+this.userPhone);
  94. console.log(response.data);
  95. } catch (error) {
  96. console.error('发生错误:', error);
  97. }
  98. this.tip='clicked-tip'
  99. // 每秒钟更新计数器
  100. this.timer = setInterval(() => {
  101. if (this.secondsRemaining > 0) {
  102. this.secondsRemaining--; // 每秒减一
  103. this.tipContent=this.secondsRemaining+'s';
  104. } else {
  105. clearInterval(this.timer); // 当倒计时结束时清除计时器
  106. // 执行倒计时结束后的操作
  107. this.tip='tip'
  108. this.tipContent='发送验证码'
  109. this.secondsRemaining=60
  110. }
  111. }, 1000);
  112. }
  113. }
  114. }
  115. </script>
  116. <!-- Add "scoped" attribute to limit CSS to this component only -->
  117. <style scoped>
  118. .register-page{
  119. display: flex;
  120. width: 100%;
  121. flex-direction: column;
  122. justify-content: center;
  123. align-items: center;
  124. .register-form{
  125. margin-top: 30px;
  126. width: 80%;
  127. text-align: left;
  128. border: 2px solid rgb(186, 208, 255);
  129. .tip{
  130. width: 100%;
  131. text-align: center;
  132. display: flex;
  133. justify-content: center;
  134. }
  135. .number{
  136. margin-left: 15px;
  137. margin-top: 20px;
  138. }
  139. .form-number{
  140. display: flex;
  141. margin-top: 10px;
  142. margin-left: 15px;
  143. width: 70%;
  144. }
  145. .name{
  146. margin-left: 15px;
  147. margin-top: 10px;
  148. }
  149. .form-name{
  150. display: flex;
  151. margin-top: 10px;
  152. margin-left: 15px;
  153. width: 70%;
  154. }
  155. .phone{
  156. margin-left: 10px;
  157. margin-top: 15px;
  158. }
  159. .form-phone{
  160. display: flex;
  161. margin-top: 10px;
  162. margin-left: 15px;
  163. width: 70%;
  164. }
  165. .code-tip{
  166. margin-top: 10px;
  167. margin-left: 15px;
  168. width: 80%;
  169. display: flex;
  170. flex-direction: row;
  171. .code{
  172. display: flex;
  173. width: 40%;
  174. }
  175. .tip{
  176. display: flex;
  177. align-items: center;
  178. justify-content: center;
  179. margin-left: 20px;
  180. border-radius: 1.5rem;
  181. background-color: blue;
  182. color: white;
  183. padding: 5px;
  184. width: 35%;
  185. cursor: pointer;
  186. }
  187. .clicked-tip{
  188. display: flex;
  189. align-items: center;
  190. justify-content: center;
  191. margin-left: 20px;
  192. border-radius: 1.5rem;
  193. background-color: rgb(229, 232, 236);
  194. color: white;
  195. padding: 5px;
  196. width: 35%;
  197. }
  198. }
  199. .campus{
  200. margin-left: 15px;
  201. margin-top: 15px;
  202. }
  203. .form-campus{
  204. display: flex;
  205. margin-top: 15px;
  206. margin-left: 15px;
  207. width: 70%;
  208. }
  209. .address{
  210. margin-left: 15px;
  211. margin-top: 15px;
  212. }
  213. .form-address{
  214. display: flex;
  215. margin-top: 15px;
  216. margin-left: 15px;
  217. width: 70%;
  218. height: 40PX;
  219. }
  220. .pwd{
  221. margin-left: 15px;
  222. margin-top: 10px;
  223. }
  224. .form-pwd{
  225. display: flex;
  226. margin-top: 15px;
  227. margin-left: 15px;
  228. width: 70%;
  229. }
  230. .form-but{
  231. width: 50%;
  232. display: flex;
  233. align-items: center;
  234. justify-content: center;
  235. background-color: blue;
  236. color: white;
  237. margin: 20px 0 30px 70px;
  238. border-radius: 1.5rem;
  239. padding: 10px;
  240. }
  241. }
  242. }
  243. </style>
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/运维做开发/article/detail/827012
推荐阅读
相关标签
  

闽ICP备14008679号