loginphone.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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="item-label">手机号码</view>
  10. <view class="cu-form-group">
  11. <view class="input-box">
  12. <input
  13. type="number"
  14. :value="phone"
  15. placeholder="请输入手机号"
  16. maxlength="11"
  17. data-key="phone"
  18. @input="inputChange"
  19. />
  20. </view>
  21. </view>
  22. <view class="item-label">登录密码</view>
  23. <view class="cu-form-group">
  24. <view class="input-box">
  25. <input
  26. type="password"
  27. placeholder="请输入密码"
  28. maxlength="20"
  29. :value="password"
  30. data-key="password"
  31. @input="inputChange"
  32. @confirm="toLogin"
  33. />
  34. </view>
  35. </view>
  36. <view class="forgot-password">
  37. <view @click="forget">忘记密码</view>
  38. </view>
  39. <button class="confirm-btn" @click="toLogin">登录</button>
  40. <view style="margin-top: 32rpx; text-align: center">
  41. <view>
  42. <text class="register-section" @click="register()">注册</text>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. data() {
  52. return {
  53. phone: "",
  54. password: "",
  55. banners: [],
  56. invitation: "",
  57. loginName: "",
  58. sending: false,
  59. sendTime: "获取验证码",
  60. count: 60,
  61. };
  62. },
  63. onLoad() {},
  64. methods: {
  65. forget() {
  66. uni.navigateTo({
  67. url: "/pages/public/forgetPwd",
  68. });
  69. },
  70. register() {
  71. uni.navigateTo({
  72. url: "/pages/public/register",
  73. });
  74. },
  75. inputChange(e) {
  76. const key = e.currentTarget.dataset.key;
  77. this[key] = e.detail.value;
  78. },
  79. navBack() {
  80. uni.navigateBack();
  81. },
  82. toLogin() {
  83. this.$queue.loginClear();
  84. let openid = this.$queue.getData("openid");
  85. const { phone, password } = this;
  86. if (!phone) {
  87. this.$queue.showToast("请输入手机号");
  88. } else if (phone.length != 11) {
  89. this.$queue.showToast("请输入正确的手机号");
  90. } else if (!password) {
  91. this.$queue.showToast("请输入密码");
  92. } else {
  93. this.$queue.showLoading("正在登录中...");
  94. this.$Request
  95. .post("/app/Login/loginApp", {
  96. password: password,
  97. phone: phone,
  98. openId: this.$queue.getData("openid"),
  99. })
  100. .then((res) => {
  101. if (res.code == 0) {
  102. this.$queue.setData("userId", res.user.userId);
  103. this.$queue.setData("token", res.token);
  104. this.$queue.setData("phone", res.user.phone);
  105. this.$queue.setData("userName", res.user.userName);
  106. this.$queue.setData("avatar", res.user.avatar);
  107. this.$queue.setData("invitationCode", res.user.invitationCode);
  108. this.$queue.setData("inviterCode", res.user.inviterCode);
  109. this.getIsVip();
  110. uni.hideLoading();
  111. this.$queue.setData("userType", res.user.userType);
  112. //判断是否开启身份选择 是/否
  113. this.$Request.get("/app/common/type/339").then((rest) => {
  114. if (rest.code == 0) {
  115. if (rest.data.value == "是") {
  116. uni.reLaunch({
  117. url: "/pages/public/selectIdentity/selectIdentity",
  118. });
  119. } else {
  120. if (res.user.userType == 2) {
  121. uni.reLaunch({
  122. url: "/pages/my/index",
  123. });
  124. } else {
  125. uni.reLaunch({
  126. url: "/pages/my/index",
  127. });
  128. }
  129. }
  130. } else {
  131. if (res.user.userType == 2) {
  132. uni.reLaunch({
  133. url: "/pages/my/index",
  134. });
  135. } else {
  136. uni.reLaunch({
  137. url: "/pages/my/index",
  138. });
  139. }
  140. }
  141. });
  142. // uni.switchTab({
  143. // url: '/pages/my/index'
  144. // })
  145. } else {
  146. uni.hideLoading();
  147. this.$queue.showToast(res.msg);
  148. }
  149. });
  150. }
  151. },
  152. getIsVip() {
  153. this.$Request.get("/app/UserVip/isUserVip").then((res) => {
  154. if (res.code == 0) {
  155. // this.isVip = res.data
  156. console.log(res.data);
  157. this.$queue.setData("isVip", res.data);
  158. }
  159. });
  160. },
  161. },
  162. };
  163. </script>
  164. <style lang="scss" scoped>
  165. ::v-deep .input-placeholder {
  166. color: #9ea1a8;
  167. font-family: DM Sans;
  168. font-size: 28rpx;
  169. font-weight: 400;
  170. text-align: left;
  171. }
  172. page {
  173. height: 100%;
  174. background: #fff;
  175. }
  176. .forgot-password {
  177. text-align: left;
  178. margin-top: 8rpx;
  179. color: rgba(102, 112, 133, 1);
  180. font-family: Inter;
  181. font-size: 24rpx;
  182. font-weight: 400;
  183. line-height: 40rpx;
  184. }
  185. .item-label {
  186. color: rgba(18, 26, 44, 1);
  187. font-family: Roboto;
  188. font-size: 32rpx;
  189. font-weight: 400;
  190. line-height: 51.2rpx;
  191. letter-spacing: 0px;
  192. text-align: left;
  193. padding-bottom: 6rpx;
  194. margin-top: 32rpx;
  195. }
  196. .cu-form-group {
  197. box-sizing: border-box;
  198. border: 2rpx solid rgba(158, 161, 168, 1);
  199. border-radius: 24rpx;
  200. background: rgba(255, 255, 255, 1);
  201. padding: 8rpx 24rpx !important;
  202. }
  203. .bg {
  204. background-color: #ffffff;
  205. }
  206. .send-msg {
  207. border-radius: 30px;
  208. color: black;
  209. background: white;
  210. height: 30px;
  211. font-size: 14px;
  212. line-height: 30px;
  213. }
  214. .container {
  215. top: 0;
  216. padding-top: 32upx;
  217. position: relative;
  218. width: 100%;
  219. height: 100%;
  220. overflow: hidden;
  221. background: #ffffff !important;
  222. }
  223. .wrapper {
  224. position: relative;
  225. z-index: 90;
  226. background: #ffffff;
  227. padding-bottom: 32upx;
  228. }
  229. .input-content {
  230. padding: 32rpx;
  231. box-sizing: border-box;
  232. }
  233. .confirm-btn {
  234. width: 100%;
  235. border-radius: 100rpx;
  236. margin-top: 32rpx;
  237. background: #016bf6;
  238. color: rgba(255, 255, 255, 1);
  239. font-family: DM Sans;
  240. font-size: 32rpx;
  241. font-weight: 400;
  242. &:after {
  243. border-radius: 60px;
  244. }
  245. }
  246. .register-section {
  247. display: flex;
  248. justify-content: center;
  249. align-items: center;
  250. color: #016bf6;
  251. font-family: Inter;
  252. font-size: 12px;
  253. font-weight: 400;
  254. line-height: 20px;
  255. letter-spacing: 0%;
  256. text-align: right;
  257. text-decoration-line: underline;
  258. }
  259. </style>