index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="login-index">
  3. <view class="bg-img">
  4. <image class="hi-img" src="@/static/img/hi.png" mode="scaleToFill"></image>
  5. <view class="fs-42 fc-3 fw-b">欢迎使用振合网收银系统</view>
  6. </view>
  7. <view class="info-box">
  8. <view class="fs-32 fc-3 fw-b mb-25">密码登录</view>
  9. <input v-model="phone" placeholder="请输入手机号" type="number" />
  10. <view class="p-f">
  11. <input v-model="password" placeholder="请输入密码" :password="inputType" />
  12. <view class="p-c" @click="openeye()">
  13. <uni-icons type="eye-filled" size="20" color="#999"></uni-icons>
  14. </view>
  15. </view>
  16. <view class="button-save text-align-center fs-32 fc-f" @click="toLogin()">立即登录</view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import tools from "@/common/js/tools.js";
  22. import {Login} from '@/api/cashierApi.js';
  23. export default {
  24. data(){
  25. return{
  26. inputType:true,
  27. phone:'19112107434',
  28. password:'123456',
  29. isAJAX:false,
  30. }
  31. },
  32. mounted() {
  33. },
  34. methods:{
  35. openeye(){
  36. this.inputType = !this.inputType
  37. },
  38. toLogin(){
  39. if(this.isAJAX){
  40. return
  41. }
  42. this.isAJAX = true;
  43. Login({phone:this.phone,password:this.password}).then((res)=>{
  44. if(res.code == 1){
  45. uni.setStorageSync('token',res.data.token);
  46. uni.setStorageSync('u_id',res.data.u_id);
  47. tools.success("登录成功");
  48. setTimeout(() => {
  49. this.isAJAX = false;
  50. uni.redirectTo({
  51. url: "/pages/index/index",
  52. });
  53. }, 1000);
  54. }else{
  55. this.isAJAX = false;
  56. }
  57. })
  58. },
  59. }
  60. }
  61. </script>
  62. <style scoped lang="scss">
  63. .login-index{
  64. .bg-img{
  65. width: 100%;
  66. height: 430rpx;
  67. background-image: url('@/static/img/login-bg.png');
  68. background-size: 100% 100%;
  69. box-sizing: border-box;
  70. padding: 90rpx 25rpx 0 25rpx;
  71. .hi-img{
  72. width: 118rpx;
  73. height: 60rpx;
  74. margin-bottom: 10rpx;
  75. }
  76. }
  77. .info-box{
  78. box-sizing: border-box;
  79. padding: 10rpx 27rpx;
  80. input{
  81. width: 100%;
  82. height: 83rpx;
  83. background: #F3F4F6;
  84. border-radius: 104rpx;
  85. box-sizing: border-box;
  86. padding: 0 70rpx 0 25rpx;
  87. font-size: 30rpx;
  88. margin-bottom: 35rpx;
  89. }
  90. .p-f{
  91. position: relative;
  92. .p-c{
  93. position: absolute;
  94. top: 20rpx;
  95. right: 20rpx;
  96. }
  97. }
  98. .button-save{
  99. width: 100%;
  100. height: 83rpx;
  101. line-height: 83rpx;
  102. background: #1778FD;
  103. border-radius: 104rpx;
  104. }
  105. }
  106. }
  107. </style>