loginphone.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="container">
  3. <view class="wrapper">
  4. <!-- <view style="text-align: center;">
  5. <image src="../../static/logo.png" style="border-radius: 64upx;"></image>
  6. </view>
  7. -->
  8. <view class="input-content">
  9. <view class="cu-form-group"
  10. style="border: 2upx solid whitesmoke;margin-bottom: 20px;border-radius: 30px">
  11. <view class="title text-black">账号</view>
  12. <input type="number" :value="phone" placeholder="请输入手机号" maxlength="11" data-key="phone"
  13. @input="inputChange" />
  14. </view>
  15. <view class="cu-form-group" style="border: 2upx solid whitesmoke;border-radius: 30px">
  16. <view class="title text-black">密码</view>
  17. <input type="password" placeholder="请输入密码" maxlength="20" :value="password" data-key="password"
  18. @input="inputChange" @confirm="toLogin" />
  19. <text class="send-msg" @click="forget">忘记密码</text>
  20. </view>
  21. </view>
  22. <button class="confirm-btn" @click="toLogin">登录</button>
  23. <view style="margin-top: 32px;text-align: center">
  24. <view><text style="font-size: 28upx;">没有账号?</text>
  25. <text style="color: #FF6E98" @click="register()">立即注册</text>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. phone: '',
  36. password: '',
  37. banners: [],
  38. invitation: '',
  39. loginName: '',
  40. sending: false,
  41. sendTime: '获取验证码',
  42. count: 60,
  43. }
  44. },
  45. onLoad() {
  46. },
  47. methods: {
  48. forget() {
  49. uni.navigateTo({
  50. url: '/pages/public/forgetPwd'
  51. });
  52. },
  53. register() {
  54. uni.navigateTo({
  55. url: '/pages/public/register'
  56. });
  57. },
  58. inputChange(e) {
  59. const key = e.currentTarget.dataset.key;
  60. this[key] = e.detail.value;
  61. },
  62. navBack() {
  63. uni.navigateBack();
  64. },
  65. toLogin() {
  66. this.$queue.loginClear();
  67. let openid = this.$queue.getData("openid");
  68. const {
  69. phone,
  70. password
  71. } = this;
  72. if (!phone) {
  73. this.$queue.showToast("请输入手机号");
  74. } else if (phone.length != 11) {
  75. this.$queue.showToast("请输入正确的手机号");
  76. } else if (!password) {
  77. this.$queue.showToast("请输入密码");
  78. } else {
  79. this.$queue.showLoading("正在登录中...");
  80. this.$Request.post("/app/Login/loginApp", {
  81. password: password,
  82. phone: phone,
  83. openId: this.$queue.getData('openid') ? this.$queue.getData('openid') : ''
  84. }).then(res => {
  85. if (res.code == 0) {
  86. this.$queue.setData("userId", res.user.userId);
  87. this.$queue.setData("token", res.token);
  88. this.$queue.setData("phone", res.user.phone);
  89. this.$queue.setData("userName", res.user.userName);
  90. this.$queue.setData("avatar", res.user.avatar);
  91. this.$queue.setData("invitationCode", res.user.invitationCode);
  92. this.$queue.setData("inviterCode", res.user.inviterCode);
  93. this.getIsVip()
  94. uni.hideLoading();
  95. uni.switchTab({
  96. url: '/pages/my/index'
  97. })
  98. } else {
  99. uni.hideLoading();
  100. this.$queue.showToast(res.msg);
  101. }
  102. });
  103. }
  104. },
  105. getIsVip() {
  106. this.$Request.get("/app/UserVip/isUserVip").then(res => {
  107. if (res.code == 0) {
  108. // this.isVip = res.data
  109. console.log(res.data)
  110. this.$queue.setData("isVip", res.data);
  111. }
  112. });
  113. }
  114. },
  115. }
  116. </script>
  117. <style lang='scss'>
  118. page {
  119. height: 100%;
  120. background: #F5F5F5 !important;
  121. }
  122. .bg {
  123. background-color: #FFFFFF;
  124. }
  125. .send-msg {
  126. border-radius: 30px;
  127. color: black;
  128. background: white;
  129. height: 30px;
  130. font-size: 14px;
  131. line-height: 30px;
  132. }
  133. .container {
  134. top: 0;
  135. padding-top: 32upx;
  136. position: relative;
  137. width: 100%;
  138. height: 100%;
  139. overflow: hidden;
  140. background: #FFFFFF !important;
  141. }
  142. .wrapper {
  143. position: relative;
  144. z-index: 90;
  145. background: #FFFFFF;
  146. padding-bottom: 32upx;
  147. }
  148. .input-content {
  149. /* margin-top: 300upx; */
  150. /* padding-top: 300upx; */
  151. padding: 32upx 80upx;
  152. }
  153. .confirm-btn {
  154. width: 582rpx;
  155. height: 100rpx;
  156. line-height: 100rpx;
  157. text-align: center;
  158. background: linear-gradient( 143deg, #FFE6EE 0%, #FF9AB2 100%);
  159. border-radius: 86rpx 86rpx 86rpx 86rpx;
  160. font-weight: bold;
  161. font-size: 32rpx;
  162. color: #222222;
  163. margin-top: 40rpx;
  164. }
  165. </style>