loginphone.vue 9.0 KB

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