index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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:'',
  28. password:'',
  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. uni.setStorageSync('shop_id',res.data.shop_id);
  48. tools.success("登录成功");
  49. setTimeout(() => {
  50. this.isAJAX = false;
  51. uni.redirectTo({
  52. url: "/pages/index/index",
  53. });
  54. }, 1000);
  55. }else{
  56. this.isAJAX = false;
  57. }
  58. })
  59. },
  60. }
  61. }
  62. </script>
  63. <style scoped lang="scss">
  64. .login-index{
  65. .bg-img{
  66. width: 100%;
  67. height: 430rpx;
  68. background-image: url('@/static/img/login-bg.png');
  69. background-size: 100% 100%;
  70. box-sizing: border-box;
  71. padding: 90rpx 25rpx 0 25rpx;
  72. .hi-img{
  73. width: 118rpx;
  74. height: 60rpx;
  75. margin-bottom: 10rpx;
  76. }
  77. }
  78. .info-box{
  79. box-sizing: border-box;
  80. padding: 10rpx 27rpx;
  81. input{
  82. width: 100%;
  83. height: 83rpx;
  84. background: #F3F4F6;
  85. border-radius: 104rpx;
  86. box-sizing: border-box;
  87. padding: 0 70rpx 0 25rpx;
  88. font-size: 30rpx;
  89. margin-bottom: 35rpx;
  90. }
  91. .p-f{
  92. position: relative;
  93. .p-c{
  94. position: absolute;
  95. top: 20rpx;
  96. right: 20rpx;
  97. }
  98. }
  99. .button-save{
  100. width: 100%;
  101. height: 83rpx;
  102. line-height: 83rpx;
  103. background: #1778FD;
  104. border-radius: 104rpx;
  105. }
  106. }
  107. }
  108. </style>