login.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913
  1. <template>
  2. <view class="container">
  3. <!-- <image @click="navBack" src="../../static/images/index/close.png" style="width: 32upx;height: 32upx;margin-left: 46upx;"></image> -->
  4. <!-- 小程序状态下登录 -->
  5. <!-- #ifdef MP-WEIXIN -->
  6. <view class="login-box">
  7. <view class="mp_wxBox">
  8. <view>
  9. <view class="logo-box">
  10. <image src="@/static/images/jobApplicant/logo.svg" mode="scaleToFill" />
  11. </view>
  12. <view class="content">
  13. <view>申请获取以下权限</view>
  14. <text>获得你的公开信息(昵称,头像、地区等)</text>
  15. </view>
  16. <view v-if="weixinPhone == true || weixinPhone == 'true'" class="login-btn wechat"
  17. open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
  18. <image src="@/static/images/jobApplicant/phone.svg" mode="scaleToFill" />
  19. 授权手机号
  20. </view>
  21. <button v-else style="background: rgba(13, 39, 247, 1); color: #ffffff" class="bottom"
  22. bindtap="getUserProfile" @tap="login()">
  23. 授权登录
  24. </button>
  25. </view>
  26. </view>
  27. <view style="text-align: center">
  28. <view class="footer">
  29. <view class="check-box" @click="checked = !checked">
  30. <image src="@/static/images/jobApplicant/check.svg" v-if="checked" mode="scaleToFill" />
  31. <image src="@/static/images/jobApplicant/border.svg" v-else mode="scaleToFill" />
  32. </view>
  33. 已阅读并同意<navigator url="/my/setting/xieyi">《亿职赞用户协议》</navigator>
  34. 和<navigator url="/my/setting/mimi">《隐私协议》</navigator>,允许亿职赞统一管理本人账号信息
  35. </view>
  36. </view>
  37. </view>
  38. <!-- #endif -->
  39. <!-- #ifndef MP-WEIXIN -->
  40. <view style="text-align: center" class="login-box">
  41. <view class="logo-box">
  42. <image src="@/static/images/jobApplicant/logo.svg" mode="scaleToFill" />
  43. </view>
  44. <!-- <button class="confirm-btn" style="margin-top: 100rpx" @click="register">
  45. 手机号登录
  46. </button> -->
  47. <!-- #ifdef APP -->
  48. <view class="login-btn wechat" :class="{ disabled: !checked }" :disabled="checked" @click="wxAppLogin">
  49. <image src="@/static/images/jobApplicant/wx.svg" mode="scaleToFill" />微信登录
  50. </view>
  51. <!-- #endif -->
  52. <view class="login-btn password" :class="{ disabled: !checked }" :disabled="checked" @click="register(1)">
  53. <image src="@/static/images/jobApplicant/account.svg" mode="scaleToFill" />账号密码登录
  54. </view>
  55. <view class="login-btn wechat" :class="{ disabled: !checked }" :disabled="checked" @click="register(2)">
  56. <image src="@/static/images/jobApplicant/phone.svg" mode="scaleToFill" />手机验证码登录
  57. </view>
  58. <view class="" v-if="isopen" @click="weixinLo" style="width: 100%; padding-top: 100rpx">
  59. <view class="">
  60. <u-icon name="weixin-circle-fill" color="#5fcd73" size="100"></u-icon>
  61. </view>
  62. <view class="login-btn wechat"> 公众号快捷登录 </view>
  63. </view>
  64. <!-- 底部信息 -->
  65. <view class="footer">
  66. <view class="check-box" @click="checked = !checked">
  67. <image src="@/static/images/jobApplicant/check.svg" v-if="checked" mode="scaleToFill" />
  68. <image src="@/static/images/jobApplicant/border.svg" v-else mode="scaleToFill" />
  69. </view>
  70. 已阅读并同意<navigator url="/my/setting/xieyi">《亿职赞用户协议》</navigator>
  71. 和<navigator url="/my/setting/mimi">《隐私协议》</navigator>,允许亿职赞统一管理本人账号信息
  72. </view>
  73. <!-- <view class="footer">
  74. <u-checkbox shape="circle" v-model="checked"> </u-checkbox>
  75. <text>同意</text>
  76. 协议地址
  77. <navigator url="/my/setting/mimi" open-type="navigate">《隐私政策》</navigator>
  78. <navigator url="/my/setting/xieyi" open-type="navigate">《用户协议》</navigator>
  79. </view> -->
  80. </view>
  81. <!-- #endif -->
  82. </view>
  83. </template>
  84. <script>
  85. export default {
  86. data() {
  87. return {
  88. checked: false,
  89. mobile: "",
  90. code: "",
  91. weixinLogin: false,
  92. sending: false,
  93. sendTime: "获取验证码",
  94. count: 60,
  95. weixinPhone: false,
  96. sendDataList: {},
  97. sessionkey: "",
  98. phoneNum: false,
  99. isopen: false,
  100. };
  101. },
  102. onLoad(e) {
  103. if (e.inviterCode) {
  104. this.$queue.setData("inviterCode", e.inviterCode);
  105. }
  106. this.sessionkey = uni.getStorageSync("sessionkey");
  107. this.weixinPhone = uni.getStorageSync("weixinPhone");
  108. console.log(this.weixinPhone);
  109. if (uni.getStorageSync("sendDataList")) {
  110. this.sendDataList = uni.getStorageSync("sendDataList");
  111. }
  112. // //微信登录开启
  113. // this.$Request.getT('/app/common/type/53').then(res => {
  114. // if (res.code == 0) {
  115. // if (res.data && res.data.value && res.data.value == '是') {
  116. // // this.weixinLogin = true;
  117. // }
  118. // }
  119. // });
  120. this.$Request.getT("/app/common/type/188").then((res) => {
  121. if (res.code == 0) {
  122. if (res.data && res.data.value && res.data.value == "是") {
  123. this.phoneNum = true;
  124. }
  125. }
  126. });
  127. // #ifdef H5
  128. let ua = navigator.userAgent.toLowerCase();
  129. if (ua.indexOf("micromessenger") !== -1) {
  130. //公众号是否自动登录 108
  131. this.$Request.getT("/app/common/type/108").then((res) => {
  132. if (res.code == 0) {
  133. if (res.data && res.data.value && res.data.value == "是") {
  134. this.isopen = true;
  135. } else {
  136. this.isopen = false;
  137. }
  138. }
  139. });
  140. } else {
  141. this.isopen = false;
  142. }
  143. this.selbindwx();
  144. // #endif
  145. },
  146. methods: {
  147. selbindwx() {
  148. let ua = navigator.userAgent.toLowerCase();
  149. if (ua.indexOf("micromessenger") !== -1) {
  150. let openid = uni.getStorageSync("openid");
  151. let userId = uni.getStorageSync("userId");
  152. // let that = this;
  153. if (
  154. window.location.href.indexOf("?code=") !== -1 ||
  155. window.location.href.indexOf("&code=") !== -1
  156. ) {
  157. let code;
  158. if (window.location.href.indexOf("?code=") !== -1) {
  159. code = window.location.href.split("?code=")[1].split("&")[0];
  160. } else {
  161. code = window.location.href.split("&code=")[1].split("&")[0];
  162. }
  163. let data = {
  164. code: code,
  165. };
  166. this.$Request.getT("/app/Login/getOpenId", data).then((ret) => {
  167. if (ret.code == 0) {
  168. uni.setStorageSync("openid", ret.data);
  169. this.$Request
  170. .getT("/app/Login/openid/login", {
  171. openId: ret.data,
  172. })
  173. .then((res) => {
  174. if (res.code == 0) {
  175. uni.setStorageSync("token", res.token);
  176. uni.setStorageSync("userName", res.user.userName);
  177. uni.setStorageSync("avatar", res.user.avatar);
  178. uni.setStorageSync("phone", res.user.phone);
  179. uni.setStorageSync("invitationCode", res.user.invitationCode);
  180. this.$queue.setData("inviterCode", res.user.inviterCode);
  181. uni.setStorageSync("sex", res.user.sex);
  182. uni.setStorageSync("userId", res.user.userId);
  183. uni.setStorageSync("openId", res.user.openId);
  184. uni.setStorageSync("userType", res.user.userType);
  185. this.$Request.get("/app/UserVip/isUserVip").then((res) => {
  186. if (res.code == 0 && res.data && res.data.isVip == 2) {
  187. uni.setStorageSync("isVIP", true);
  188. } else {
  189. uni.setStorageSync("isVIP", false);
  190. }
  191. });
  192. //判断是否开启身份选择 是/否
  193. this.$Request.get("/app/common/type/339").then((rest) => {
  194. if (rest.code == 0) {
  195. if (rest.data.value == "是") {
  196. uni.reLaunch({
  197. url: "/pages/public/selectIdentity/selectIdentity",
  198. });
  199. } else {
  200. uni.navigateBack();
  201. }
  202. } else {
  203. uni.navigateBack();
  204. }
  205. });
  206. } else {
  207. uni.navigateTo({
  208. url: "/pages/public/bind",
  209. });
  210. }
  211. });
  212. }
  213. });
  214. }
  215. }
  216. },
  217. //微信公众号登录
  218. weixinLo() {
  219. if (this.checked == false) {
  220. uni.showToast({
  221. title: "请先同意《隐私政策》和《用户服务协议》",
  222. icon: "none",
  223. });
  224. return;
  225. }
  226. let ua = navigator.userAgent.toLowerCase();
  227. if (ua.indexOf("micromessenger") !== -1) {
  228. let openid = uni.getStorageSync("openid");
  229. let userId = uni.getStorageSync("userId");
  230. if (!openid) {
  231. if (
  232. window.location.href.indexOf("?code=") !== -1 ||
  233. window.location.href.indexOf("&code=") !== -1
  234. ) {
  235. let code;
  236. if (window.location.href.indexOf("?code=") !== -1) {
  237. code = window.location.href.split("?code=")[1].split("&")[0];
  238. } else {
  239. code = window.location.href.split("&code=")[1].split("&")[0];
  240. }
  241. let data = {
  242. code: code,
  243. };
  244. this.$Request.getT("/app/Login/getOpenId", data).then((res) => {
  245. if (ret.code == 0) {
  246. uni.setStorageSync("openid", ret.data);
  247. let datas = {
  248. openId: ret.data,
  249. };
  250. this.$Request.getT("/app/Login/openid/login", datas).then((res) => {
  251. if (res.code == 0) {
  252. uni.setStorageSync("token", res.token);
  253. uni.setStorageSync("userName", res.user.userName);
  254. uni.setStorageSync("avatar", res.user.avatar);
  255. uni.setStorageSync("phone", res.user.phone);
  256. uni.setStorageSync("invitationCode", res.user.invitationCode);
  257. this.$queue.setData("inviterCode", res.user.inviterCode);
  258. uni.setStorageSync("sex", res.user.sex);
  259. uni.setStorageSync("userId", res.user.userId);
  260. uni.setStorageSync("openId", res.user.openId);
  261. uni.setStorageSync("userType", res.user.userType);
  262. this.$Request.get("/app/UserVip/isUserVip").then((res) => {
  263. if (res.code == 0 && res.data && res.data.isVip ==
  264. 2) {
  265. uni.setStorageSync("isVIP", true);
  266. } else {
  267. uni.setStorageSync("isVIP", false);
  268. }
  269. });
  270. //判断是否开启身份选择 是/否
  271. this.$Request.get("/app/common/type/339").then((rest) => {
  272. if (rest.code == 0) {
  273. if (rest.data.value == "是") {
  274. uni.reLaunch({
  275. url: "/pages/public/selectIdentity/selectIdentity",
  276. });
  277. } else {
  278. uni.navigateBack();
  279. }
  280. } else {
  281. uni.navigateBack();
  282. }
  283. });
  284. } else {
  285. uni.navigateTo({
  286. url: "/pages/public/bind",
  287. });
  288. }
  289. });
  290. }
  291. });
  292. } else {
  293. let that = this;
  294. window.location.href =
  295. "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
  296. that.$queue.getWxAppid() +
  297. "&redirect_uri=" +
  298. window.location.href.split("#")[0] +
  299. "&response_type=code&scope=snsapi_userinfo#wechat_redirect";
  300. }
  301. } else {
  302. this.$Request
  303. .getT("/app/Login/openid/login", {
  304. openId: openid,
  305. })
  306. .then((res) => {
  307. if (res.code == 0) {
  308. uni.setStorageSync("token", res.token);
  309. uni.setStorageSync("userName", res.user.userName);
  310. uni.setStorageSync("avatar", res.user.avatar);
  311. uni.setStorageSync("phone", res.user.phone);
  312. uni.setStorageSync("invitationCode", res.user.invitationCode);
  313. this.$queue.setData("inviterCode", res.user.inviterCode);
  314. uni.setStorageSync("sex", res.user.sex);
  315. uni.setStorageSync("userId", res.user.userId);
  316. uni.setStorageSync("openId", res.user.openId);
  317. uni.setStorageSync("userType", res.user.userType);
  318. this.$Request.get("/app/UserVip/isUserVip").then((res) => {
  319. if (res.code == 0 && res.data && res.data.isVip == 2) {
  320. uni.setStorageSync("isVIP", true);
  321. } else {
  322. uni.setStorageSync("isVIP", false);
  323. }
  324. });
  325. //判断是否开启身份选择 是/否
  326. this.$Request.get("/app/common/type/339").then((rest) => {
  327. if (rest.code == 0) {
  328. if (rest.data.value == "是") {
  329. uni.reLaunch({
  330. url: "/pages/public/selectIdentity/selectIdentity",
  331. });
  332. } else {
  333. uni.navigateBack();
  334. }
  335. } else {
  336. uni.navigateBack();
  337. }
  338. });
  339. } else {
  340. uni.navigateTo({
  341. url: "/pages/public/bind",
  342. });
  343. }
  344. });
  345. }
  346. }
  347. },
  348. // wxGetUserInfo(e) {
  349. // if (this.checked) {
  350. // wx.getUserProfile({
  351. // desc: "业务需要",
  352. // success: (infoRes) => {
  353. // console.log(
  354. // "infoRes.encryptedData__________:" + JSON.stringify(infoRes.userInfo)
  355. // );
  356. // let nickName = infoRes.userInfo.nickName; //昵称
  357. // let avatarUrl = infoRes.userInfo.avatarUrl; //头像
  358. // let sex = infoRes.userInfo.gender; //头像
  359. // try {
  360. // this.$queue.showLoading("正在登录中...");
  361. // this.login(nickName, avatarUrl, sex);
  362. // } catch (e) {}
  363. // },
  364. // });
  365. // } else {
  366. // uni.showToast({
  367. // title: "请阅读并同意《隐私协议》和《用户服务协议》",
  368. // icon: "none",
  369. // });
  370. // }
  371. // },
  372. // APP微信登录
  373. wxAppLogin() {
  374. if (!this.checked) {
  375. uni.showToast({
  376. title: "请阅读并同意《隐私协议》和《用户服务协议》",
  377. icon: "none",
  378. });
  379. return;
  380. }
  381. let that = this;
  382. uni.login({
  383. provider: "weixin",
  384. success: function(loginRes) {
  385. console.log(loginRes);
  386. uni.setStorageSync("openId", loginRes.authResult.openid)
  387. uni.setStorageSync("unionId", loginRes.authResult.unionid)
  388. let data = {
  389. wxOpenId: loginRes.authResult.openid,
  390. token: loginRes.authResult.access_token
  391. };
  392. that.$Request.postT("/app/Login/wxAppLogin", data)
  393. .then((res) => {
  394. console.log(res)
  395. if (res.code == 0) {
  396. that.$queue.setData("userId", res.user.userId);
  397. that.$queue.setData("token", res.token);
  398. that.$queue.setData("phone", res.user.phone);
  399. that.$queue.setData("userName", res.user.userName);
  400. that.$queue.setData("avatar", res.user.avatar);
  401. that.$queue.setData("invitationCode", res.user.invitationCode);
  402. that.$queue.setData("inviterCode", res.user.inviterCode);
  403. that.getIsVip();
  404. uni.hideLoading();
  405. that.$queue.setData("userType", res.user.userType);
  406. //判断是否开启身份选择 是/否
  407. that.$Request.get("/app/common/type/339").then((rest) => {
  408. if (rest.code == 0) {
  409. if (rest.data.value == "是") {
  410. // 这里是跳转到选择职场身份的界面
  411. uni.reLaunch({
  412. url: "/pages/public/selectIdentity/selectIdentity",
  413. });
  414. } else {
  415. if (res.user.userType == 2) { //企业
  416. // 原有的。判断第一次根据userType ==null
  417. uni.reLaunch({
  418. url: "/pages/my/index",
  419. });
  420. } else if (res.user.userType == 1) {
  421. uni.reLaunch({
  422. url: "/pages/my/index",
  423. });
  424. } else {
  425. //表示是第一次进来,走引导页
  426. uni.navigateTo({
  427. url: "/pages/my/jobApplicant/guidePage",
  428. });
  429. }
  430. }
  431. } else {
  432. if (res.user.userType == 2) { //企业
  433. // 原有的。判断第一次根据userType ==null
  434. uni.reLaunch({
  435. url: "/pages/my/index",
  436. });
  437. } else if (res.user.userType == 1) {
  438. uni.reLaunch({
  439. url: "/pages/my/index",
  440. });
  441. } else {
  442. //表示是第一次进来,走引导页
  443. uni.navigateTo({
  444. url: "/pages/my/jobApplicant/guidePage",
  445. });
  446. }
  447. }
  448. });
  449. } else {
  450. uni.hideLoading();
  451. that.$queue.showToast(res.msg);
  452. }
  453. })
  454. },
  455. });
  456. },
  457. //小程序登录
  458. login(nickName, avatarUrl, sex) {
  459. if (!this.checked) {
  460. uni.showToast({
  461. title: "请阅读并同意《隐私协议》和《用户服务协议》",
  462. icon: "none",
  463. });
  464. return;
  465. }
  466. let that = this;
  467. // 1.wx获取登录用户code
  468. uni.login({
  469. provider: "weixin",
  470. onlyAuthorize: true,
  471. success: function(loginRes) {
  472. console.log(loginRes, "************");
  473. let data = {
  474. code: loginRes.code,
  475. };
  476. that.$Request.get("/app/Login/wxLogin", data)
  477. .then((res) => {
  478. if (res.code == 0) {
  479. uni.hideLoading();
  480. uni.setStorageSync("openId", res.data.open_id);
  481. uni.setStorageSync("unionId", res.data.unionId);
  482. that.sessionkey = res.data.session_key;
  483. let sendData = {
  484. openId: uni.getStorageSync("openId"),
  485. unionId: uni.getStorageSync("unionId"),
  486. userName: "游客",
  487. avatar: "",
  488. sex: "1", //性别
  489. inviterCode: that.$queue.getData(
  490. "inviterCode"), //别人登录进来携带你的邀请码
  491. };
  492. that.sendDataList = sendData;
  493. that.flag = res.data.flag;
  494. // 第一次登录获取手机号
  495. // console.log(that.phoneNum,'**********************1')
  496. // console.log(that.flag,'**********************2')
  497. if (that.flag == "2" && that.phoneNum) {
  498. that.weixinPhone = true;
  499. } else {
  500. that.getWeixinInfo(sendData);
  501. }
  502. } else {
  503. uni.showToast({
  504. icon: "none",
  505. title: res.msg,
  506. duration: 2000,
  507. });
  508. console.log(res, "失败");
  509. }
  510. })
  511. },
  512. });
  513. },
  514. //小程序微信登录后获取手机号
  515. getPhoneNumber: function(e) {
  516. if (e.detail.errMsg == "getPhoneNumber:fail user deny") {
  517. console.log("用户拒绝提供手机号");
  518. } else {
  519. console.log("用户同意提供手机号");
  520. console.log(e);
  521. this.setPhoneByInsert(e.detail.encryptedData, e.detail.iv);
  522. }
  523. },
  524. //小程序微信登录后获取手机号
  525. setPhoneByInsert(decryptData, iv) {
  526. let data = {
  527. decryptData: decryptData,
  528. key: this.sessionkey,
  529. iv: iv,
  530. };
  531. this.$Request.postJson("/app/Login/selectPhone", data).then((res) => {
  532. if (res.code == 0) {
  533. this.phone = res.data.phoneNumber;
  534. this.getWeixinInfo(this.sendDataList);
  535. } else {
  536. uni.showToast({
  537. title: res.msg,
  538. icon: "none",
  539. duration: 2000,
  540. });
  541. }
  542. });
  543. },
  544. getIsVip() {
  545. this.$Request.get("/app/UserVip/isUserVip").then((res) => {
  546. if (res.code == 0) {
  547. // this.isVip = res.data
  548. console.log(res.data);
  549. this.$queue.setData("isVip", res.data);
  550. }
  551. });
  552. },
  553. //获取个人信息
  554. getWeixinInfo(sendData) {
  555. let that = this;
  556. uni.showLoading({
  557. title: "登录中...",
  558. });
  559. let postData = {
  560. openId: sendData.openId, //小程序openId
  561. unionId: sendData.unionId, //unionId
  562. userName: sendData.userName, //微信名称
  563. avatar: sendData.avatar, //头像
  564. sex: sendData.sex, //性别
  565. phone: that.phone,
  566. inviterCode: sendData.inviterCode,
  567. };
  568. that.$Request.postJson("/app/Login/insertWxUser", postData).then((res) => {
  569. uni.hideLoading();
  570. if (res.code == 0) {
  571. uni.setStorageSync("token", res.token);
  572. uni.setStorageSync("userName", res.user.userName);
  573. uni.setStorageSync("avatar", res.user.avatar);
  574. uni.setStorageSync("phone", res.user.phone);
  575. uni.setStorageSync("invitationCode", res.user.invitationCode);
  576. this.$queue.setData("inviterCode", res.user.inviterCode);
  577. uni.setStorageSync("sex", res.user.sex);
  578. uni.setStorageSync("userId", res.user.userId);
  579. uni.setStorageSync("openId", res.user.openId);
  580. uni.setStorageSync("userType", res.user.userType);
  581. this.$Request.get("/app/UserVip/isUserVip").then((res) => {
  582. if (res.code == 0 && res.data && res.data.isVip == 2) {
  583. uni.setStorageSync("isVIP", true);
  584. } else {
  585. uni.setStorageSync("isVIP", false);
  586. }
  587. });
  588. //判断是否开启身份选择 是/否
  589. this.$Request.get("/app/common/type/339").then((rest) => {
  590. if (rest.code == 0) {
  591. if (rest.data.value == "是") {
  592. uni.reLaunch({
  593. url: "/pages/public/selectIdentity/selectIdentity",
  594. });
  595. } else {
  596. uni.navigateBack();
  597. }
  598. } else {
  599. uni.navigateBack();
  600. }
  601. });
  602. } else {
  603. uni.showModal({
  604. showCancel: false,
  605. title: "登录失败",
  606. content: res.msg,
  607. });
  608. }
  609. });
  610. },
  611. forget() {
  612. uni.navigateTo({
  613. url: "/pages/public/pwd",
  614. });
  615. },
  616. register(type) {
  617. if (!this.checked) {
  618. uni.showToast({
  619. title: "请阅读并同意《隐私协议》和《用户服务协议》",
  620. icon: "none",
  621. });
  622. } else {
  623. uni.navigateTo({
  624. url: `/pages/public/loginphone?type=${type}`,
  625. });
  626. }
  627. },
  628. inputChange(e) {
  629. const key = e.currentTarget.dataset.key;
  630. this[key] = e.detail.value;
  631. },
  632. navBack() {
  633. uni.navigateBack();
  634. },
  635. },
  636. };
  637. </script>
  638. <style lang="scss" scoped>
  639. .login-box {
  640. position: absolute;
  641. left: 0;
  642. right: 0;
  643. top: 0;
  644. bottom: 0;
  645. display: flex;
  646. flex-direction: column;
  647. padding: 0 32rpx;
  648. padding-bottom: 180rpx;
  649. box-sizing: border-box;
  650. }
  651. .logo-box {
  652. flex: 1;
  653. display: flex;
  654. justify-content: center;
  655. align-items: center;
  656. image {
  657. width: 160rpx;
  658. height: 160rpx;
  659. }
  660. }
  661. page {
  662. height: 100%;
  663. background: #ffffff !important;
  664. }
  665. /deep/.u-checkbox__label {
  666. margin-right: 0rpx !important;
  667. }
  668. /deep/.u-checkbox {
  669. padding: 0 !important;
  670. }
  671. .footer {
  672. font-family: DM Sans;
  673. font-size: 16rpx;
  674. font-weight: 400;
  675. letter-spacing: 0%;
  676. text-align: left;
  677. display: flex;
  678. align-items: center;
  679. justify-content: center;
  680. color: #605d67;
  681. margin-top: 16rpx;
  682. navigator {
  683. color: #016bf6;
  684. }
  685. .check-box {
  686. display: flex;
  687. justify-content: center;
  688. align-items: center;
  689. margin-right: 16rpx;
  690. image {
  691. width: 24rpx;
  692. height: 24rpx;
  693. }
  694. }
  695. }
  696. .container {
  697. top: 0;
  698. padding: 50rpx 32rpx;
  699. box-sizing: border-box;
  700. position: relative;
  701. overflow: hidden;
  702. color: #fff;
  703. }
  704. .confirm-btn-weixin {
  705. width: 200px;
  706. height: 42px;
  707. line-height: 42px;
  708. border-radius: 30px;
  709. margin-top: 40upx;
  710. background: -moz-linear-gradient(left, #f15b6c, #e10a07 100%);
  711. background: -webkit-gradient(linear,
  712. left top,
  713. left right,
  714. color-stop(0, #f15b6c),
  715. color-stop(100%, #e10a07));
  716. background: -webkit-linear-gradient(left, #f15b6c 0, #e10a07 100%);
  717. background: -o-linear-gradient(left, #f15b6c 0, #e10a07 100%);
  718. background: -ms-linear-gradient(left, #f15b6c 0, #e10a07 100%);
  719. background: linear-gradient(to left, #f15b6c 0, #e10a07 100%);
  720. color: #fff;
  721. font-size: 32upx;
  722. &:after {
  723. border-radius: 60px;
  724. }
  725. }
  726. .confirm-btn {
  727. width: 200px;
  728. height: 42px;
  729. line-height: 42px;
  730. border-radius: 30px;
  731. margin-top: 300upx;
  732. background: -moz-linear-gradient(left, #f15b6c, #e10a07 100%);
  733. background: -webkit-gradient(linear,
  734. left top,
  735. left right,
  736. color-stop(0, #f15b6c),
  737. color-stop(100%, #e10a07));
  738. background: -webkit-linear-gradient(left, #f15b6c 0, #e10a07 100%);
  739. background: -o-linear-gradient(left, #f15b6c 0, #e10a07 100%);
  740. background: -ms-linear-gradient(left, #f15b6c 0, #e10a07 100%);
  741. background: linear-gradient(to left, #f15b6c 0, #e10a07 100%);
  742. color: #fff;
  743. font-size: 32upx;
  744. &:after {
  745. border-radius: 60px;
  746. }
  747. }
  748. .headers {
  749. text-align: center;
  750. }
  751. .headers>image {
  752. width: 400upx;
  753. height: 400upx;
  754. }
  755. // .footer {
  756. // padding-left: 100upx;
  757. // margin-top: 32upx;
  758. // font-size: 24upx;
  759. // color: #666666;
  760. // text-align: center;
  761. // display: flex;
  762. // }
  763. .login-btn {
  764. padding: 0 32rpx;
  765. box-sizing: border-box;
  766. border-radius: 252rpx;
  767. color: rgba(255, 255, 255, 1) !important;
  768. font-family: DM Sans;
  769. font-size: 32rpx;
  770. font-weight: 400;
  771. line-height: 90rpx;
  772. display: flex;
  773. justify-content: center;
  774. align-items: center;
  775. margin-bottom: 16rpx;
  776. width: 100%;
  777. image {
  778. width: 28rpx;
  779. height: 28rpx;
  780. margin-right: 20rpx;
  781. }
  782. }
  783. .wechat {
  784. background: linear-gradient(90.00deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  785. }
  786. .password {
  787. background: rgba(1, 107, 246, 1);
  788. }
  789. .disabled {
  790. background: #99c4fa;
  791. }
  792. uni-button[disabled]:not([type]) {
  793. background-color: rgba(1, 107, 246, 1);
  794. }
  795. uni-button:after {
  796. border: none;
  797. }
  798. page {
  799. background: #fff;
  800. }
  801. .send-msg {
  802. border-radius: 30px;
  803. color: black;
  804. background: white;
  805. height: 30px;
  806. font-size: 14px;
  807. line-height: 30px;
  808. }
  809. .container {
  810. top: 0;
  811. padding-top: 32rpx;
  812. position: relative;
  813. width: 100%;
  814. height: 100vh;
  815. overflow: hidden;
  816. background: #ffffff;
  817. color: #fff;
  818. .mp_wxBox {
  819. .headers {
  820. margin: 35% auto 50rpx;
  821. text-align: center;
  822. border-radius: 60rpx;
  823. width: 650rpx;
  824. height: 300rpx;
  825. line-height: 450rpx;
  826. image {
  827. width: 300rpx;
  828. height: 300rpx;
  829. }
  830. }
  831. .content {
  832. text-align: center;
  833. }
  834. text {
  835. display: block;
  836. color: #9d9d9d;
  837. margin-top: 40rpx;
  838. }
  839. .bottom {
  840. line-height: 80upx;
  841. border-radius: 80upx;
  842. margin: 70rpx 50rpx;
  843. height: 80upx;
  844. font-size: 35rpx;
  845. }
  846. }
  847. }
  848. .wrapper {
  849. position: relative;
  850. z-index: 90;
  851. background: #fff;
  852. padding-bottom: 20px;
  853. }
  854. .input-content {
  855. padding: 0 20px;
  856. }
  857. .confirm-btn {
  858. width: 300px;
  859. height: 42px;
  860. line-height: 42px;
  861. border-radius: 30px;
  862. margin-top: 40px;
  863. background: #016bf6;
  864. color: #fff;
  865. // font-size: $font-lg;
  866. &:after {
  867. border-radius: 60px;
  868. }
  869. }
  870. </style>