index.vue 2.5 KB

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