login.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845
  1. <template>
  2. <view style="height: 100%">
  3. <image mode="widthFix" src="/pages4/static/login_bg.jpg" class="full_img"></image>
  4. <!-- #ifdef MP-WEIXIN -->
  5. <u-navbar title="登录" :border-bottom="false" background="{ background: '#ffffff',opacity:0.4; }"
  6. title-color="#ffffff" back-icon-color="#ffffff"></u-navbar>
  7. <!-- #endif -->
  8. <view style="padding: 30rpx">
  9. <view style="width: 400rpx">
  10. <u-subsection @change="sectionChange" :list="list" :current="current" active-color="#007AFF"
  11. inactive-color="#ffffff" bg-color="rgba(255,255,255,0.52)"></u-subsection>
  12. </view>
  13. <view class="login_box">
  14. <u-form :model="form" ref="uForm1" v-show="current == 0">
  15. <u-form-item prop="account" v-if="!isDualAuth"><u-input type="idcard" v-model="form.account"
  16. placeholder-style="color:#999999" placeholder="手机号/学员身份证" /></u-form-item>
  17. <u-form-item prop="account" ref="account" v-else><u-input type="number" maxlength="11"
  18. placeholder-style="color:#999999" v-model="form.account" placeholder="手机号" /></u-form-item>
  19. <u-form-item prop="pwd"><u-input class="password" v-model="form.pwd"
  20. placeholder-style="color:#999999" type="password" placeholder="登录密码" /></u-form-item>
  21. <u-form-item prop="code" v-if="isDualAuth">
  22. <u-input v-model="form.code" type="number" placeholder-style="color:#999999"
  23. placeholder="验证码" />
  24. <u-button slot="right" size="mini" @click="getCodepre('account')">{{
  25. codeTips
  26. }}</u-button>
  27. </u-form-item>
  28. </u-form>
  29. <u-form :model="form" ref="uForm2" v-show="current == 1">
  30. <u-form-item prop="tel" ref="tel"><u-input type="number" maxlength="11"
  31. placeholder-style="color:#999999" v-model="form.tel" placeholder="手机号" /></u-form-item>
  32. <u-form-item prop="code">
  33. <u-input v-model="form.code" type="number" placeholder-style="color:#999999"
  34. placeholder="验证码" />
  35. <u-button slot="right" size="mini" @click="getCodepre('tel')">{{
  36. codeTips
  37. }}</u-button>
  38. </u-form-item>
  39. </u-form>
  40. </view>
  41. <button class="loginBtn" :class="{ able: canLogin() }" @click="pwlogin" v-if="current == 0">
  42. 登录
  43. </button>
  44. <button :disabled="isUse" :class="{ able: canLogin() }" class="loginBtn" @click="sms_login"
  45. v-if="current == 1">
  46. 登录
  47. </button>
  48. <view style="width: 100%; margin: 40rpx auto">
  49. <view style="
  50. display: flex;
  51. align-items: center;
  52. color: #007aff;
  53. font-size: 24rpx;
  54. justify-content: center;
  55. ">
  56. <!-- <navigator hover-class="none" :url="'/pages2/register/register?scanCode=' + scanCode" style="margin: 0 40rpx;">立即注册</navigator> -->
  57. <view style="margin: 0 40rpx" @click="toRegister">立即注册</view>
  58. <view style="width: 3rpx; height: 20rpx; background-color: #007aff"></view>
  59. <navigator hover-class="none" url="/pages2/register/forget" style="margin: 0 40rpx">忘记密码</navigator>
  60. </view>
  61. </view>
  62. <!-- #ifdef MP-WEIXIN -->
  63. <view class="wxBtn" v-if="false">
  64. <view class="wxBtn_title">
  65. <view class="line"></view>
  66. <view class="text">快捷登录</view>
  67. <view class="line"></view>
  68. </view>
  69. <button type="default" @click="quickLogin" class="wxloginBtn fl_c">
  70. <image mode="widthFix" src="/static/icon_phone.png"></image>
  71. </button>
  72. <!-- <button
  73. type="default"
  74. open-type="getPhoneNumber"
  75. @getphonenumber="wxLogin"
  76. class="wxloginBtn fl_c"
  77. >
  78. <image mode="widthFix" src="/static/icon_phone.png"></image>
  79. </button> -->
  80. </view>
  81. <!-- #endif -->
  82. </view>
  83. <u-verification-code seconds="60" ref="uCode" @change="codeChange"></u-verification-code>
  84. <u-popup v-model="codeModal" :mask-close-able="false" closeable mode="center" width="80%" border-radius="24">
  85. <view class="rf-popup-main">
  86. <view class="title">获取手机验证码</view>
  87. <u-form >
  88. <u-form-item prop="imageCode">
  89. <u-input v-model="imageCode" type="number" placeholder-style="color:#999999"
  90. placeholder="图形验证码" />
  91. <image slot="right" style="width: 212rpx;height: 80rpx;margin-bottom: 40rpx;" :src="codeUrl" @click="getCodepre"></image>
  92. </u-form-item>
  93. </u-form>
  94. <u-button type="primary" style="border-radius: 60rpx;" @click="getCode">获取手机验证码</u-button>
  95. </view>
  96. </u-popup>
  97. </view>
  98. </template>
  99. <script>
  100. const PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
  101. MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4qkbwIKErstK1sFESPEhOShpR
  102. pj4+sOVpJHxl5r/2xLBfA/MrXcAEra5Ro9cXNQSqmLLt8wecoLk/glfa5IdhXV0h
  103. RVQplIVs5z3MxcUa9ptKPHUTgh8xMCBvl8sUJKwkmn4vYWeDfHT22EL7Hr1pTMwU
  104. hF6WiNlWfQTVoF1rhwIDAQAB
  105. -----END PUBLIC KEY-----`;
  106. import JSEncrypt from "@/pages4/static/jsencrypt.min.js";
  107. import {
  108. getOpenid
  109. } from "../../utils/authority";
  110. export default {
  111. data() {
  112. return {
  113. code: "",
  114. codeModal: false,
  115. imageCode:"",
  116. imageUuid:"",
  117. codeUrl:"",
  118. telform:"tel",
  119. form: {
  120. tel: "",
  121. code: "",
  122. account: "",
  123. pwd: "",
  124. },
  125. list: [{
  126. name: "密码登录",
  127. },
  128. {
  129. name: "短信登录",
  130. },
  131. ],
  132. rules: {
  133. tel: [{
  134. required: true,
  135. message: "请输入手机号",
  136. // 可以单个或者同时写两个触发验证方式
  137. trigger: ["change"],
  138. },
  139. {
  140. validator: (rule, value, callback) => {
  141. // 上面有说,返回true表示校验通过,返回false表示不通过
  142. // this.$u.test.mobile()就是返回true或者false的
  143. return this.$u.test.mobile(value);
  144. },
  145. message: "手机号码格式不正确",
  146. // 触发器可以同时用blur和change
  147. trigger: ["change"],
  148. },
  149. ],
  150. account: [{
  151. required: true,
  152. message: "请输入手机号/学员身份证",
  153. trigger: ["change"],
  154. }, ],
  155. pwd: [{
  156. required: true,
  157. message: "请输入密码",
  158. // 可以单个或者同时写两个触发验证方式
  159. trigger: ["change"],
  160. }, ],
  161. code: [{
  162. required: true,
  163. message: "请输入验证码",
  164. // 可以单个或者同时写两个触发验证方式
  165. trigger: ["change"],
  166. }, ],
  167. },
  168. current: 1,
  169. codeTips: "",
  170. isUse: false,
  171. scanCode: "", // pc端扫码登录获取的标志码
  172. newUser_sc: "", // 用户扫码进来详情页获取的sc
  173. shareActivityCode: "", // 用户扫码进来详情页获取的
  174. isBack: false,
  175. isDualAuth: false,
  176. isAct: "",
  177. bindForm: {},
  178. };
  179. },
  180. onLoad(option) {
  181. if (option.isBack) {
  182. this.isBack = option.isBack;
  183. }
  184. if (option.isAct) {
  185. this.isAct = option.isAct;
  186. }
  187. if (uni.getStorageSync("newUser_sc")) {
  188. this.newUser_sc = uni.getStorageSync("newUser_sc");
  189. }
  190. if (uni.getStorageSync("shareActivityCode")) {
  191. this.shareActivityCode = uni.getStorageSync("shareActivityCode");
  192. }
  193. this.getDualAuth();
  194. },
  195. onShow() {
  196. // 获取code
  197. // #ifdef MP-WEIXIN
  198. // this.getwxCode();
  199. // #endif
  200. },
  201. onReady() {
  202. this.$refs.uForm1.setRules(this.rules);
  203. this.$refs.uForm2.setRules(this.rules);
  204. },
  205. methods: {
  206. getwxCode() {
  207. uni.login({
  208. provider: "weixin",
  209. success: (loginRes) => {
  210. this.code = loginRes.code;
  211. console.log("获取的code:", this.code);
  212. },
  213. });
  214. },
  215. toRegister() {
  216. if (this.isBack) {
  217. uni.redirectTo({
  218. url: "/pages2/register/register?isBack=" +
  219. this.isBack +
  220. "&isAct=" +
  221. this.isAct,
  222. });
  223. } else {
  224. uni.navigateTo({
  225. url: "/pages2/register/register?isAct=" + this.isAct,
  226. });
  227. }
  228. },
  229. getDualAuth() {
  230. this.$api.getDualAuth().then((res) => {
  231. if (res.data.code == 200) {
  232. this.isDualAuth = res.data.data * 1;
  233. if (this.isDualAuth === 1) {
  234. this.rules.account = [{
  235. required: true,
  236. message: "请输入手机号",
  237. trigger: ["change"],
  238. },
  239. {
  240. validator: (rule, value, callback) => {
  241. return this.$u.test.mobile(value);
  242. },
  243. message: "手机号码格式不正确",
  244. trigger: ["change"],
  245. },
  246. ];
  247. }
  248. }
  249. });
  250. },
  251. wxLogin(e) {
  252. this.$api
  253. .wxLogin({
  254. code: this.code,
  255. encryptedData: e.detail.encryptedData,
  256. iv: e.detail.iv,
  257. shareCode: this.newUser_sc,
  258. shareActivityCode: this.shareActivityCode,
  259. })
  260. .then((res) => {
  261. if (res.data.code == 200) {
  262. this.loginCallback(res, "wxlogin");
  263. } else {
  264. if (res.data.code == 666) {
  265. this.$u.toast(res.data.msg);
  266. setTimeout(() => {
  267. this.toRegister();
  268. }, 500);
  269. return;
  270. }
  271. this.getwxCode(); // code用完一次就会过期,防止用户点击取消后再点微信登录后code过期
  272. // this.$u.toast(res.data.msg);
  273. }
  274. });
  275. },
  276. canLogin() {
  277. if (this.current == 0) {
  278. if (this.form.account && this.form.pwd) {
  279. return true;
  280. }
  281. return false;
  282. } else if (this.current == 1) {
  283. if (this.form.tel && this.form.code) {
  284. return true;
  285. }
  286. return false;
  287. }
  288. },
  289. sms_login() {
  290. this.$refs.uForm2.validate((valid) => {
  291. if (valid) {
  292. let that = this;
  293. if (!this.form.tel) {
  294. this.$u.toast("请输入手机号码");
  295. return;
  296. }
  297. if (!this.form.code) {
  298. this.$u.toast("请输入验证码");
  299. return;
  300. }
  301. that.isUse = true;
  302. let datas = {
  303. shareActivityCode: this.shareActivityCode,
  304. tel: this.form.tel,
  305. code: this.form.code,
  306. };
  307. that.$api.smsLogin(datas).then(
  308. (res) => {
  309. that.isUse = false;
  310. if (res.data.code == 200) {
  311. this.loginCallback(res, "smslogin");
  312. } else if (res.data.code == 699) {
  313. uni.showModal({
  314. title: '温馨提示',
  315. content: "系统升级中,请点击按钮 “复制” 链接,打开手机浏览器,粘贴登录即可学习",
  316. confirmText: "复制",
  317. success: (result) => {
  318. if (result.confirm) {
  319. uni.setClipboardData({
  320. data: res.data.msg,
  321. success: function() {
  322. uni.showToast({
  323. title: '链接已复制成功',
  324. icon: 'none',
  325. duration: 2000
  326. });
  327. }
  328. })
  329. } else if (result.cancel) {
  330. console.log('用户点击取消');
  331. }
  332. }
  333. });
  334. } else {
  335. that.$u.toast(res.data.msg);
  336. }
  337. },
  338. (err) => {
  339. that.isUse = false;
  340. }
  341. );
  342. }
  343. });
  344. },
  345. fakeLogin() {
  346. uni.setStorageSync("user_account", "123");
  347. uni.setStorageSync("token", "123");
  348. uni.switchTab({
  349. url: "/pages/index/index",
  350. });
  351. },
  352. /**
  353. *
  354. * @param {*} data
  355. * @returns
  356. * 加密
  357. */
  358. encryptor(data) {
  359. const encrypt = new JSEncrypt();
  360. encrypt.setPublicKey(PUBLIC_KEY);
  361. return encrypt.encrypt(data);
  362. },
  363. pwlogin() {
  364. let that = this;
  365. if (!this.form.account) {
  366. this.$u.toast("请输入手机号码/身份证号");
  367. return;
  368. }
  369. if (!this.form.pwd) {
  370. this.$u.toast("请输入密码");
  371. return;
  372. }
  373. if (this.isDualAuth) {
  374. if (!this.form.code) {
  375. this.$u.toast("请输入验证码");
  376. return;
  377. }
  378. this.form.tel = this.form.account;
  379. }
  380. //虚拟登录
  381. /* that.fakeLogin()
  382. return */
  383. that.isUse = true;
  384. let form = JSON.parse(JSON.stringify(this.form));
  385. form.pwd = this.encryptor(form.pwd);
  386. form["shareActivityCode"] = this.shareActivityCode;
  387. // 账号登录用户 /app/common/account_login
  388. that.$api.accountLogin(form).then(
  389. (res) => {
  390. that.isUse = false;
  391. if (res.data.code == 200) {
  392. // 记住账号
  393. uni.setStorageSync("rememberPwLoginMsg", {
  394. account: this.form.account,
  395. pwd: this.form.pwd,
  396. });
  397. this.loginCallback(res, "pwlogin");
  398. } else if (res.data.code == 699) {
  399. uni.showModal({
  400. title: '温馨提示',
  401. content: "系统升级中,请点击按钮 “复制” 链接,打开手机浏览器,粘贴登录即可学习",
  402. confirmText: "复制",
  403. success: (result) => {
  404. if (result.confirm) {
  405. uni.setClipboardData({
  406. data: res.data.msg,
  407. success: function() {
  408. uni.showToast({
  409. title: '链接已复制成功',
  410. icon: 'none',
  411. duration: 2000
  412. });
  413. }
  414. })
  415. } else if (result.cancel) {
  416. console.log('用户点击取消');
  417. }
  418. }
  419. });
  420. } else {
  421. that.$u.toast(res.data.msg);
  422. }
  423. },
  424. (err) => {
  425. that.isUse = false;
  426. }
  427. );
  428. },
  429. codeChange(text) {
  430. this.codeTips = text;
  431. },
  432. //获取图形验证码
  433. getCodepre(key){
  434. this.codeModal=true;
  435. this.telform=key;
  436. this.$api.captchaImage({}).then(
  437. (res) => {
  438. if (res.data.code == 200) {
  439. this.codeUrl = "data:image/gif;base64," + res.data.data.img;
  440. this.imageUuid= res.data.data.uuid;
  441. } else {
  442. this.$u.toast(res.data.msg);
  443. }
  444. },
  445. (err) => {
  446. console.log(err);
  447. }
  448. );
  449. },
  450. // 获取验证码
  451. getCode() {
  452. let that = this;
  453. var key=this.telform;
  454. if(!this.imageCode)
  455. {
  456. that.$u.toast("请输入图形验证码");
  457. return;
  458. }
  459. if (that.$refs.uCode.canGetCode) {
  460. if (that.$refs[key].validateState == "success") {
  461. let datas = {
  462. tel: this.form[key],
  463. imageCode:this.imageCode,
  464. imageUuid:this.imageUuid
  465. };
  466. that.$api.loginSms(datas).then(
  467. (res) => {
  468. if (res.data.code == 200) {
  469. this.codeModal=false;
  470. that.$u.toast("验证码已发送");
  471. // 通知验证码组件内部开始倒计时
  472. that.$refs.uCode.start();
  473. } else {
  474. that.$u.toast(res.data.msg);
  475. }
  476. },
  477. (err) => {
  478. console.log(err);
  479. }
  480. );
  481. } else {
  482. this.$refs[key].onFieldChange();
  483. }
  484. }
  485. },
  486. sectionChange(index) {
  487. this.current = index;
  488. // #ifdef H5
  489. if (index == 0) {
  490. const rememberPwLoginMsg = uni.getStorageSync("rememberPwLoginMsg");
  491. if (rememberPwLoginMsg) {
  492. let {
  493. account,
  494. pwd
  495. } = rememberPwLoginMsg;
  496. this.form.account = account;
  497. this.form.pwd = pwd;
  498. }
  499. }
  500. // #endif
  501. },
  502. getPhoneNumber(e) {
  503. let that = this;
  504. uni.checkSession({
  505. success() {
  506. //session_key 未过期,并且在本生命周期一直有效
  507. that.putInfo(e);
  508. },
  509. fail() {
  510. // session_key 已经失效,需要重新执行登录流程
  511. uni.login({
  512. provider: "weixin",
  513. success: function(loginRes) {
  514. that.code = loginRes.code;
  515. that.putInfo(e);
  516. },
  517. });
  518. },
  519. });
  520. },
  521. putInfo(e) {
  522. let that = this;
  523. if (e.detail.encryptedData) {
  524. let inviteCode = uni.getStorageSync("inviteCode");
  525. //用户同意授权
  526. var datas = {
  527. iv: e.detail.iv,
  528. encryptedData: e.detail.encryptedData,
  529. code: that.code,
  530. };
  531. if (inviteCode) {
  532. datas.inviteCode = inviteCode;
  533. }
  534. that.$api.login(datas).then(
  535. (res) => {
  536. if (res.data.code == 200) {
  537. uni.setStorageSync("union_id", res.data.data.union_id);
  538. uni.setStorageSync("token", res.data.data.token);
  539. that.$api.getInfo({
  540. fromPlat: 1
  541. }).then((resdata) => {
  542. if (resdata.data.code == 200) {
  543. uni.navigateBack();
  544. that.$store.state.userInfo = resdata.data.data;
  545. }
  546. });
  547. } else {
  548. uni.showModal({
  549. title: "提示",
  550. content: res.data.msg,
  551. showCancel: false,
  552. });
  553. }
  554. },
  555. (err) => {
  556. console.log(err);
  557. }
  558. );
  559. }
  560. },
  561. // 微信、密码、验证码 登录成功的回调
  562. loginCallback(res, types) {
  563. // if(res.data.data && res.data.data.full_info){
  564. uni.removeStorageSync("newUser_sc");
  565. uni.removeStorageSync("shareActivityCode");
  566. //信息完善,直接进入页面
  567. uni.setStorageSync("user_account", res.data.data.user_account);
  568. uni.setStorageSync("token", res.data.data.token);
  569. // 修改邀请码
  570. let sac = this.$store.getters.sac;
  571. sac &&
  572. this.$api.shareActivityCode({
  573. shareActivityCode: sac
  574. }).then((res) => {
  575. // if (res.data.code == 200) {
  576. // uni.removeStorageSync("sac");
  577. // }
  578. });
  579. // /app/user/getInfo 登录用户信息// fromPlat来源平台 1小程序 2PC网站
  580. this.$api.getInfo({
  581. fromPlat: 1
  582. }).then((resdata) => {
  583. if (resdata.data.code == 200) {
  584. this.$store.state.userInfo = resdata.data.data;
  585. if (this.bindForm.openId) {
  586. this.$api.openIdLogin({
  587. ...this.bindForm,
  588. userId: resdata.data.data.userId,
  589. });
  590. }
  591. if(res.data.data.pwd_sign==1)
  592. {
  593. uni.showModal({
  594. title: '温馨提示',
  595. content: "您的密码已长时间未变更,为了您的账号安全,请前往更改密码。",
  596. confirmText: "前往",
  597. success: (result) => {
  598. if (result.confirm) {
  599. uni.navigateTo({
  600. url: "/pages2/wd/pwd",
  601. });
  602. } else if (result.cancel) {
  603. if (!this.isBack) {
  604. let goPath = "";
  605. if (types == "wxlogin" || types == "smslogin") {
  606. //密码登录不用判断电脑goPath, 直接到首页
  607. goPath = uni.getStorageSync("goPath");
  608. }
  609. if (goPath == "course") {
  610. uni.redirectTo({
  611. url: "/pages2/wd/class",
  612. });
  613. types == "wxlogin" &&
  614. this.$method.setUuid(new Date().valueOf() + "");
  615. } else if (goPath == "bank") {
  616. uni.redirectTo({
  617. url: "/pages2/wd/question_bank",
  618. });
  619. types == "wxlogin" &&
  620. this.$method.setUuid(new Date().valueOf() + "");
  621. } else {
  622. console.log("登录后跳转");
  623. uni.removeStorageSync("h5_code");
  624. uni.reLaunch({
  625. url: "/pages/index/index?show=1",
  626. });
  627. types == "wxlogin" &&
  628. this.$method.setUuid(new Date().valueOf() + "");
  629. }
  630. } else {
  631. uni.navigateBack();
  632. }
  633. }
  634. }
  635. });
  636. return
  637. }
  638. //
  639. if (!this.isBack) {
  640. let goPath = "";
  641. if (types == "wxlogin" || types == "smslogin") {
  642. //密码登录不用判断电脑goPath, 直接到首页
  643. goPath = uni.getStorageSync("goPath");
  644. }
  645. if (goPath == "course") {
  646. uni.redirectTo({
  647. url: "/pages2/wd/class",
  648. });
  649. types == "wxlogin" &&
  650. this.$method.setUuid(new Date().valueOf() + "");
  651. } else if (goPath == "bank") {
  652. uni.redirectTo({
  653. url: "/pages2/wd/question_bank",
  654. });
  655. types == "wxlogin" &&
  656. this.$method.setUuid(new Date().valueOf() + "");
  657. } else {
  658. console.log("登录后跳转");
  659. uni.removeStorageSync("h5_code");
  660. uni.reLaunch({
  661. url: "/pages/index/index?show=1",
  662. });
  663. types == "wxlogin" &&
  664. this.$method.setUuid(new Date().valueOf() + "");
  665. }
  666. } else {
  667. uni.navigateBack();
  668. }
  669. }
  670. });
  671. },
  672. async quickLogin() {
  673. let openId = await getOpenid();
  674. let res = await this.$api.openIdLogin({
  675. openId
  676. });
  677. if (res.data.code === 200) {
  678. this.loginCallback(res);
  679. } else {
  680. this.bindForm = {
  681. openId,
  682. unionId: uni.getStorageSync("unionId")
  683. };
  684. uni.showToast({
  685. icon: "none",
  686. title: res.data.msg + "请用密码或验证码登录!",
  687. });
  688. }
  689. },
  690. },
  691. };
  692. </script>
  693. <style scoped lang="scss">
  694. .wxBtn {
  695. position: fixed;
  696. bottom: 10%;
  697. width: 100%;
  698. left: 0;
  699. .wxBtn_title {
  700. display: flex; //生成浏览器兼容性代码
  701. width: 70%;
  702. margin: 0 auto 48rpx;
  703. .line {
  704. flex: 1;
  705. position: relative;
  706. top: -16rpx;
  707. border-bottom: 2rpx solid #d9d9d9;
  708. }
  709. .text {
  710. padding: 0 28rpx;
  711. font-size: 28rpx;
  712. color: #666666;
  713. }
  714. }
  715. .wxloginBtn {
  716. margin: 0 auto;
  717. width: 100rpx;
  718. height: 100rpx;
  719. background: #66c8f9;
  720. border-radius: 50%;
  721. border: none;
  722. padding: 0;
  723. image {
  724. width: 64rpx;
  725. height: 64rpx;
  726. }
  727. }
  728. }
  729. /deep/ .wxBtn button::after {
  730. border: none;
  731. }
  732. .loginBtn {
  733. width: 526rpx;
  734. height: 80rpx;
  735. background: linear-gradient(90deg, #015eea, #00c0fa);
  736. box-shadow: 0rpx 10rpx 16rpx 4rpx rgba(1, 99, 235, 0.04);
  737. opacity: 0.6;
  738. border-radius: 40rpx;
  739. color: #ffffff;
  740. text-align: center;
  741. line-height: 80rpx;
  742. margin: 40rpx auto;
  743. &.able {
  744. opacity: 1;
  745. }
  746. }
  747. /deep/page {
  748. background-color: #ffffff;
  749. height: 100%;
  750. width: 100%;
  751. }
  752. .login_box {
  753. width: 100%;
  754. height: 360rpx;
  755. background: #ffffff;
  756. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(1, 99, 235, 0.1);
  757. border-radius: 24rpx;
  758. margin-top: 30rpx;
  759. padding: 40rpx 35rpx;
  760. .password {
  761. /deep/.uicon-eye-fill {
  762. &::before {
  763. color: #007aff;
  764. content: "\e613";
  765. }
  766. }
  767. }
  768. }
  769. /deep/ .u-item-bg {
  770. border-radius: 32px !important;
  771. }
  772. /deep/ .u-subsection {
  773. border-radius: 32px !important;
  774. }
  775. .full_img {
  776. position: absolute;
  777. left: 0;
  778. display: block;
  779. width: 100%;
  780. z-index: -999;
  781. top: 0;
  782. }
  783. .head {
  784. height: 96rpx;
  785. width: 100%;
  786. line-height: 96rpx;
  787. margin-top: 40rpx;
  788. text-align: center;
  789. display: flex;
  790. position: relative;
  791. justify-content: center;
  792. }
  793. .icon {
  794. position: absolute;
  795. left: 30rpx;
  796. }
  797. .rf-popup-main {
  798. text-align: center;
  799. padding: 40rpx;
  800. .title {
  801. font-size: 40rpx;
  802. font-weight: 600;
  803. }
  804. .tip {
  805. margin: 30rpx 0 40rpx;
  806. font-size: 32rpx;
  807. }
  808. .u-input {
  809. border-radius: 20rpx;
  810. background: #eee;
  811. padding-left: 20rpx !important;
  812. margin-bottom: 40rpx;
  813. }
  814. .u-button {
  815. border-radius: 60rpx !important;
  816. }
  817. }
  818. </style>