index.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004
  1. <template>
  2. <div id="">
  3. <div class="loginDialog">
  4. <el-dialog
  5. title=""
  6. width="675px"
  7. :visible.sync="dialogVisible"
  8. :close-on-press-escape="false"
  9. :close-on-click-modal="false"
  10. >
  11. <div class="login_box">
  12. <img class="left" src="@/assets/new1/dlgg.png" alt="" />
  13. <div class="right">
  14. <el-form
  15. v-show="
  16. activeName == 'generalLogin' ||
  17. activeName == 'quickLogin' ||
  18. activeName == 'wxLogin'
  19. "
  20. :model="ruleForm"
  21. :rules="rules"
  22. ref="ruleForm"
  23. label-width="100px"
  24. class="demo-ruleForm"
  25. ><el-tabs stretch v-model="activeName" @tab-click="handleClick">
  26. <el-tab-pane label="普通登录" name="generalLogin">
  27. <template v-if="activeName == 'generalLogin'">
  28. <el-form-item
  29. label=""
  30. prop="account"
  31. style="margin-top: 20px"
  32. >
  33. <el-input
  34. clearable
  35. class="input_300"
  36. placeholder="手机号码/身份证号"
  37. v-model="ruleForm.account"
  38. ></el-input> </el-form-item
  39. ><el-form-item label="" prop="pwd">
  40. <el-input
  41. clearable
  42. class="input_300"
  43. show-password
  44. placeholder="密码"
  45. v-model="ruleForm.pwd"
  46. ></el-input>
  47. </el-form-item>
  48. <div class="find_res">
  49. <span @click="signIn">立即注册</span>
  50. <span @click="forget">找回密码</span>
  51. </div>
  52. <el-button
  53. class="submit"
  54. type="primary"
  55. :loading="islogin"
  56. round
  57. @click="login"
  58. >登录</el-button
  59. >
  60. <div
  61. v-if="false"
  62. class="wx_login"
  63. @click="login_open"
  64. ></div>
  65. </template>
  66. </el-tab-pane>
  67. <el-tab-pane label="手机快速登录" name="quickLogin">
  68. <template v-if="activeName == 'quickLogin'">
  69. <el-form-item label="" prop="tel" style="margin-top: 20px">
  70. <el-input
  71. clearable
  72. class="input_300"
  73. placeholder="手机号码"
  74. v-model="ruleForm.tel"
  75. ></el-input> </el-form-item
  76. ><el-form-item label="" prop="code">
  77. <el-input
  78. clearable
  79. class="input_300"
  80. placeholder="短信验证码"
  81. v-model="ruleForm.code"
  82. >
  83. <template slot="append"
  84. ><span class="getCode" @click="loginSmsForm">{{
  85. registerCountDown == 0
  86. ? "获取验证码"
  87. : `${registerCountDown}秒重新获取`
  88. }}</span></template
  89. ></el-input
  90. >
  91. </el-form-item>
  92. <drag-verify
  93. v-if="showHk"
  94. style="margin: 0 auto 10px"
  95. :width="300"
  96. ref="dragVerify"
  97. handlerBg="#8ec6e9"
  98. :isPassing.sync="isPassing"
  99. text="请按住滑块拖动以完成验证"
  100. successText="验证通过"
  101. handlerIcon="el-icon-d-arrow-right"
  102. successIcon="el-icon-circle-check"
  103. @passcallback="passcallback"
  104. >
  105. <i
  106. v-show="!isPassing"
  107. slot="textBefore"
  108. class="el-icon-lock"
  109. ></i>
  110. </drag-verify>
  111. <div class="find_res">
  112. <span @click="signIn">立即注册</span>
  113. <span @click="forget">找回密码</span>
  114. </div>
  115. <el-button
  116. class="submit"
  117. type="primary"
  118. :loading="islogin"
  119. round
  120. @click="login"
  121. >登录</el-button
  122. >
  123. <div
  124. v-if="false"
  125. class="wx_login"
  126. @click="login_open"
  127. ></div>
  128. </template>
  129. </el-tab-pane>
  130. <!-- <el-tab-pane label="微信登录" name="wxLogin">
  131. <div class="dis_flex">
  132. <img
  133. :src="
  134. imgUrl && !scanningStatus
  135. ? imgUrl
  136. : require('@/assets/qrcode.png')
  137. "
  138. alt=""
  139. />
  140. <p v-if="scanningStatus" style="color: red">小程序已扫码</p>
  141. <p class="headerTitle">使用微信扫一扫快捷登录</p>
  142. <p class="clickFuncStyle">
  143. 扫描即表示同意<br /><span @click="innerVisibleOpenFunc(1)"
  144. >《用户使用协议》</span
  145. >及<span @click="innerVisibleOpenFunc(2)"
  146. >《个人信息保护政策》</span
  147. >
  148. </p>
  149. </div>
  150. </el-tab-pane> -->
  151. </el-tabs></el-form
  152. >
  153. <el-form
  154. v-show="activeName == 'signIn' || activeName == 'forget'"
  155. :model="bindForm"
  156. :rules="binds"
  157. ref="bindForm"
  158. label-width="100px"
  159. class="demo-ruleForm"
  160. ><el-tabs stretch v-model="activeName" @tab-click="handleClick">
  161. <el-tab-pane label="账号注册" name="signIn">
  162. <template v-if="activeName == 'signIn'">
  163. <el-form-item label="" prop="tel" style="margin-top: 20px">
  164. <el-input
  165. clearable
  166. class="input_300"
  167. placeholder="手机号码"
  168. v-model="bindForm.tel"
  169. ></el-input> </el-form-item
  170. ><el-form-item label="" prop="code">
  171. <el-input
  172. clearable
  173. class="input_300"
  174. placeholder="短信验证码"
  175. v-model="bindForm.code"
  176. >
  177. <template slot="append"
  178. ><span class="getCode" @click="loginSmsForm">{{
  179. registerCountDown == 0
  180. ? "获取验证码"
  181. : `${registerCountDown}秒重新获取`
  182. }}</span></template
  183. ></el-input
  184. > </el-form-item
  185. ><drag-verify
  186. v-if="showHk"
  187. style="margin: 0 auto 10px"
  188. :width="300"
  189. ref="dragVerify"
  190. handlerBg="#8ec6e9"
  191. :isPassing.sync="isPassing"
  192. text="请按住滑块拖动以完成验证"
  193. successText="验证通过"
  194. handlerIcon="el-icon-d-arrow-right"
  195. successIcon="el-icon-circle-check"
  196. @passcallback="passcallback"
  197. >
  198. <i
  199. v-show="!isPassing"
  200. slot="textBefore"
  201. class="el-icon-lock"
  202. ></i> </drag-verify
  203. ><el-form-item label="" prop="pwd">
  204. <el-input
  205. clearable
  206. class="input_300"
  207. show-password
  208. placeholder="设置密码"
  209. v-model="bindForm.pwd"
  210. ></el-input>
  211. </el-form-item>
  212. <el-form-item prop="idcard" style="margin-bottom: 10px">
  213. <el-input
  214. class="input_300"
  215. placeholder="身份证号码"
  216. v-model="bindForm.idcard"
  217. maxlength="18"
  218. >
  219. </el-input
  220. ></el-form-item>
  221. <el-form-item
  222. prop="read"
  223. style="margin-bottom: 0px; margin-top: 6px"
  224. >
  225. <div
  226. class="find_res"
  227. style="margin-bottom: 0px; height: 24px"
  228. >
  229. <el-checkbox v-model="bindForm.read"
  230. >我已认真阅读并同意</el-checkbox
  231. >
  232. <span @click="activeName = 'generalLogin'"
  233. >前往登录</span
  234. >
  235. </div>
  236. </el-form-item>
  237. <p
  238. class="clickFuncStyle"
  239. style="margin-top: 20px"
  240. v-if="$store.state.TENANT_NANE == '867735392558919680'"
  241. >
  242. <span @click="innerVisibleOpenFunc(1)"
  243. >《用户使用协议》</span
  244. >及<span @click="innerVisibleOpenFunc(2)"
  245. >《个人信息保护政策》</span
  246. >
  247. </p>
  248. <el-button
  249. class="submit"
  250. type="primary"
  251. :loading="islogin"
  252. round
  253. @click="register"
  254. >注册</el-button
  255. >
  256. </template>
  257. </el-tab-pane>
  258. <el-tab-pane label="找回密码" name="forget"
  259. ><template v-if="activeName == 'forget'">
  260. <el-form-item label="" prop="tel" style="margin-top: 20px">
  261. <el-input
  262. clearable
  263. class="input_300"
  264. placeholder="手机号码"
  265. v-model="bindForm.tel"
  266. ></el-input> </el-form-item
  267. ><el-form-item label="" prop="code">
  268. <el-input
  269. clearable
  270. class="input_300"
  271. placeholder="短信验证码"
  272. v-model="bindForm.code"
  273. >
  274. <template slot="append"
  275. ><span class="getCode" @click="loginSmsForm">{{
  276. registerCountDown == 0
  277. ? "获取验证码"
  278. : `${registerCountDown}秒重新获取`
  279. }}</span></template
  280. ></el-input
  281. > </el-form-item
  282. ><drag-verify
  283. v-if="showHk"
  284. style="margin: 0 auto 10px"
  285. :width="300"
  286. ref="dragVerify"
  287. handlerBg="#8ec6e9"
  288. :isPassing.sync="isPassing"
  289. text="请按住滑块拖动以完成验证"
  290. successText="验证通过"
  291. handlerIcon="el-icon-d-arrow-right"
  292. successIcon="el-icon-circle-check"
  293. @passcallback="passcallback"
  294. >
  295. <i
  296. v-show="!isPassing"
  297. slot="textBefore"
  298. class="el-icon-lock"
  299. ></i> </drag-verify
  300. ><el-form-item label="" prop="pwd">
  301. <el-input
  302. clearable
  303. class="input_300"
  304. show-password
  305. placeholder="设置密码"
  306. v-model="bindForm.pwd"
  307. ></el-input>
  308. </el-form-item>
  309. <el-form-item label="" prop="pwdAgain">
  310. <el-input
  311. clearable
  312. class="input_300"
  313. show-password
  314. placeholder="再次输入密码"
  315. v-model="bindForm.pwdAgain"
  316. ></el-input>
  317. </el-form-item>
  318. <div class="find_res">
  319. <span @click="activeName = 'generalLogin'">前往登录</span>
  320. </div>
  321. <el-button
  322. class="submit"
  323. type="primary"
  324. :loading="islogin"
  325. round
  326. @click="forgetFunc"
  327. >确定</el-button
  328. >
  329. </template></el-tab-pane
  330. ></el-tabs
  331. >
  332. </el-form>
  333. </div>
  334. <i class="close_btn el-icon-circle-close" @click="closeTang"></i>
  335. </div>
  336. </el-dialog>
  337. </div>
  338. <!-- 检查是否有二建班级10天过期提示弹窗 -->
  339. <div>
  340. <el-dialog
  341. class="dialogBox"
  342. width="430px"
  343. :visible.sync="checkDialogVisible"
  344. :close-on-click-modal="false"
  345. :close-on-press-escape="false"
  346. :modal-append-to-body="false"
  347. :show-close="false"
  348. >
  349. <template>
  350. <div style="color: #000; display: flex">
  351. <div
  352. class="el-icon-warning"
  353. style="color: #f59a23; margin: 8px 5px 0 0"
  354. ></div>
  355. <div>
  356. 尊敬的用户:您购买的课程
  357. <span v-for="item, index in checkTwoClassList" :key="index">
  358. 【{{ item.gradeName }}】班级有效期还剩 {{
  359. $tools.GetRTime(item.classEndTime) > 0
  360. ? $tools.GetRTime(item.classEndTime)
  361. : 0
  362. }}天,请在
  363. {{
  364. $tools.timestampToTime(item.classEndTime, true, true)
  365. }}前完成学习及考试,到期未完成学时清零,需重新学习。<br>
  366. </span>
  367. </div>
  368. </div>
  369. <div style="margin-left: 15px">
  370. <el-button
  371. class="btn"
  372. type="primary"
  373. @click="$router.push('/person-center/my-course')"
  374. size="small"
  375. >进入学习</el-button
  376. >
  377. <el-button
  378. class="btn"
  379. plain
  380. size="small"
  381. @click="checkDialogVisible = false"
  382. >取 消</el-button
  383. >
  384. </div>
  385. </template>
  386. </el-dialog>
  387. </div>
  388. <agree ref="agree"></agree>
  389. </div>
  390. </template>
  391. <script>
  392. import { mapMutations, mapGetters } from "vuex";
  393. import agree from "./agree.vue";
  394. export default {
  395. components: { agree },
  396. data() {
  397. const pwdAgainCheck = async (rule, value, callback) => {
  398. if (!value) {
  399. return callback(new Error("请再次输入新密码"));
  400. } else if (this.bindForm.pwd != this.bindForm.pwdAgain) {
  401. return callback(new Error("两次输入密码不一致!"));
  402. } else {
  403. callback();
  404. }
  405. };
  406. const validatorTel = (rule, value, callback) => {
  407. var reg = /^1[3456789][0-9]{9}$/;
  408. if (!reg.test(value)) {
  409. return callback(new Error("请输入正确手机号码"));
  410. } else {
  411. callback();
  412. }
  413. };
  414. var validateAccept = (rule, value, callback) => {
  415. if (!value) {
  416. callback(new Error("请勾选服务协议"));
  417. } else {
  418. callback();
  419. }
  420. };
  421. const validateRegisAccept = (rule, value, callback) => {
  422. let _IDRe18 =
  423. /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
  424. let _IDre15 =
  425. /^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/;
  426. if (!_IDRe18.test(value) && !_IDre15.test(value)) {
  427. return callback(new Error("请输入正确身份证号码"));
  428. } else {
  429. callback();
  430. }
  431. };
  432. return {
  433. checkTwoClassList: {}, // 检查是否有二建班级10天过期
  434. checkDialogVisible: false, // 检查是否有二建班级10天过期
  435. showHk: false, // 是否展示滑块 点击登录按钮是 设置为true 同时隐藏登录按钮
  436. isPassing: false, // 滑块状态
  437. checked: false,
  438. islogin: false,
  439. imgUrl: "",
  440. scanningStatus: false, //扫码状态
  441. interValTime: null,
  442. interValupdate: null,
  443. scanCode: "",
  444. dialogVisible: false,
  445. activeName: "generalLogin",
  446. ruleForm: {},
  447. bindForm: {
  448. read: false,
  449. },
  450. registerCountDown: 0,
  451. getRegisterCodeLock: false,
  452. registerCountDownTimer: null,
  453. rules: {
  454. account: [
  455. { required: true, trigger: "blur", message: "请输入手机号/身份证号" },
  456. ],
  457. pwd: [{ required: true, trigger: "blur", message: "请输入密码" }],
  458. tel: [
  459. { required: true, trigger: "blur", message: "请输入手机号" },
  460. { validator: validatorTel, trigger: "blur" },
  461. ],
  462. code: [{ required: true, trigger: "blur", message: "请输入验证码" }],
  463. },
  464. binds: {
  465. tel: [{ validator: validatorTel, trigger: "blur" }],
  466. pwd: [
  467. { required: true, trigger: "blur", message: "请输入密码" },
  468. { min: 8, max: 10, message: "要求长度8-10位", trigger: "blur" },
  469. ],
  470. pwdAgain: [
  471. {
  472. required: true,
  473. validator: pwdAgainCheck,
  474. trigger: "blur",
  475. },
  476. ],
  477. code: [{ required: true, trigger: "blur", message: "请输入验证码" }],
  478. idcard: [{ validator: validateRegisAccept, trigger: "blur" }],
  479. read: [
  480. {
  481. required: true,
  482. trigger: ["blur", "change"],
  483. validator: validateAccept,
  484. },
  485. ],
  486. },
  487. };
  488. },
  489. beforeDestroy() {
  490. this.closeFunc();
  491. console.log("销毁");
  492. },
  493. computed: {
  494. ...mapGetters(["userInfo"])
  495. },
  496. watch: {
  497. activeName() {
  498. this.showHk = false;
  499. this.isPassing = false;
  500. },
  501. },
  502. methods: {
  503. ...mapMutations(["setUserInfo", "setCurrentRouter"]),
  504. closeTang() {
  505. this.closeFunc();
  506. this.dialogVisible = false;
  507. },
  508. forgetFunc() {
  509. this.$refs.bindForm.validate((valid) => {
  510. if (valid) {
  511. this.islogin = true;
  512. const { tel, code, pwd, pwdAgain } = this.bindForm;
  513. this.$request
  514. .forgetUser({ tel, code, pwd, pwdAgain })
  515. .then((res) => {
  516. this.islogin = false;
  517. this.$message({
  518. message: "修改成功",
  519. type: "success",
  520. });
  521. this.$refs.bindForm.resetFields();
  522. })
  523. .catch((err) => {
  524. this.islogin = false;
  525. this.$message.warning(err.msg);
  526. });
  527. }
  528. });
  529. },
  530. /**
  531. * 注册
  532. */
  533. registerFunc() {
  534. this.$refs.bindForm.validate((valid) => {
  535. if (valid) {
  536. this.islogin = true;
  537. const { tel, code, pwd, idcard } = this.bindForm;
  538. this.$request
  539. .registerUser({ tel, code, pwd, idcard })
  540. .then((res) => {
  541. //自动登录
  542. this.autoLogin();
  543. })
  544. .catch((err) => {
  545. this.islogin = false;
  546. this.$message.warning(err.msg);
  547. });
  548. }
  549. });
  550. },
  551. /**
  552. * 注册后自动登录并跳转绑定身份信息
  553. */
  554. autoLogin() {
  555. let loginForm = JSON.parse(JSON.stringify(this.bindForm));
  556. var account = loginForm.tel;
  557. var pwd = this.$tools.encryptor(loginForm.pwd);
  558. this.$request
  559. .login({
  560. account,
  561. pwd,
  562. })
  563. .then((res) => {
  564. localStorage.setItem("user_account", res.data.user_account);
  565. localStorage.setItem("token", res.data.token);
  566. this.$tools.setUuid(new Date().valueOf() + "");
  567. this.getInfo();
  568. this.islogin = false;
  569. })
  570. .catch((err) => {
  571. this.islogin = false;
  572. this.$message({
  573. message: err.msg,
  574. type: "error",
  575. });
  576. });
  577. },
  578. //注册
  579. signIn() {
  580. this.activeName = "signIn";
  581. },
  582. forget() {
  583. this.activeName = "forget";
  584. },
  585. register() {
  586. this.$refs.bindForm.validate((valid) => {
  587. if (valid) {
  588. this.registerFunc();
  589. }
  590. });
  591. },
  592. login() {
  593. this.$refs.ruleForm.validate((valid) => {
  594. if (valid) {
  595. this.islogin = true;
  596. let loginForm = null;
  597. const A = JSON.parse(JSON.stringify(this.ruleForm));
  598. switch (this.activeName) {
  599. case "generalLogin":
  600. loginForm = {
  601. account: A.account,
  602. pwd: this.$tools.encryptor(A.pwd),
  603. };
  604. break;
  605. case "quickLogin":
  606. loginForm = {
  607. tel: A.tel,
  608. code: A.code,
  609. };
  610. break;
  611. default:
  612. break;
  613. }
  614. if (!loginForm) {
  615. this.$message({
  616. message: "异常错误,请联系管理员",
  617. type: "error",
  618. });
  619. return;
  620. }
  621. this.$request[
  622. this.activeName == "generalLogin" ? "login" : "loginSms"
  623. ](loginForm)
  624. .then((res) => {
  625. localStorage.setItem("user_account", res.data.user_account);
  626. localStorage.setItem("token", res.data.token);
  627. this.$tools.setUuid(new Date().valueOf() + "");
  628. this.getInfo();
  629. })
  630. .catch((err) => {
  631. this.islogin = false;
  632. this.$message({
  633. message: err.msg,
  634. type: "error",
  635. });
  636. });
  637. }
  638. });
  639. },
  640. /**
  641. * 查看协议
  642. */
  643. innerVisibleOpenFunc(int) {
  644. this.$refs.agree.openBox(int, true);
  645. },
  646. /**
  647. * 更新二维码
  648. */
  649. updateQRcode() {
  650. this.$request.pc_login_url().then((res) => {
  651. if (res.code === 200) {
  652. this.imgUrl = res.data.urlBase64;
  653. this.scanCode = res.data.scanCode;
  654. } else {
  655. this.imgUrl = "";
  656. }
  657. });
  658. },
  659. /**
  660. * 获取用户登录信息
  661. */
  662. getInfo() {
  663. this.$request
  664. .getInfo({ fromPlat: 2 })
  665. .then((res) => {
  666. this.$store.commit("setUserInfo", res.data);
  667. this.$message.success("登录成功");
  668. this.closeFunc();
  669. this.checkTenClassGradeUser(); // 登陆成功后检查二建剩余时间
  670. this.dialogVisible = false;
  671. })
  672. .catch((err) => {
  673. this.islogin = false;
  674. this.$message({
  675. message: err.msg,
  676. type: "error",
  677. });
  678. });
  679. },
  680. /**
  681. * 更新登入状态
  682. */
  683. updateBackApi() {
  684. this.$request
  685. .check_login_url({
  686. scanCode: this.scanCode,
  687. })
  688. .then((res) => {
  689. this.backData(res);
  690. this.scanningStatus = false;
  691. })
  692. .catch((err) => {
  693. if (err.msg === "小程序已扫码" && this.interValTime !== null) {
  694. clearInterval(this.interValTime);
  695. this.interValTime = null;
  696. this.scanningStatus = true;
  697. } else if (err.msg === "暂未登录" && !this.interValTime) {
  698. this.interValTime = setInterval(() => {
  699. this.updateQRcode();
  700. }, 60000);
  701. this.scanningStatus = false;
  702. }
  703. });
  704. },
  705. /**
  706. * 组件返回数据
  707. */
  708. async backData(res) {
  709. localStorage.setItem("user_account", res.data.user_account);
  710. localStorage.setItem("token", res.data.token);
  711. this.$tools.setUuid(new Date().valueOf() + "");
  712. this.getInfo();
  713. },
  714. /**
  715. * 关闭方法合集
  716. */
  717. closeFunc() {
  718. clearInterval(this.interValTime);
  719. clearInterval(this.interValupdate);
  720. this.interValTime = null;
  721. this.interValupdate = null;
  722. this.islogin = false;
  723. this.scanCode = "";
  724. this.checkDialogVisible = false;
  725. },
  726. login_open() {
  727. this.activeName = "wxLogin";
  728. this.updateQRcode();
  729. this.interValTime = setInterval(() => {
  730. this.updateQRcode();
  731. }, 60000);
  732. this.interValupdate = setInterval(() => {
  733. this.updateBackApi();
  734. }, 3000);
  735. },
  736. handleClick(e) {
  737. if (e.name == "wxLogin") {
  738. this.updateQRcode();
  739. this.interValTime = setInterval(() => {
  740. this.updateQRcode();
  741. }, 60000);
  742. this.interValupdate = setInterval(() => {
  743. this.updateBackApi();
  744. }, 3000);
  745. } else {
  746. if (
  747. this.activeName == "generalLogin" ||
  748. this.activeName == "quickLogin"
  749. ) {
  750. this.$nextTick(() => {
  751. this.$refs.ruleForm.clearValidate();
  752. });
  753. }
  754. if (this.activeName == "signIn" || this.activeName == "forget") {
  755. this.$nextTick(() => {
  756. this.$refs.bindForm.clearValidate();
  757. });
  758. }
  759. this.closeFunc();
  760. }
  761. },
  762. loginSmsForm() {
  763. this.$refs[
  764. this.activeName == "quickLogin" ? "ruleForm" : "bindForm"
  765. ].validateField("tel", (valid) => {
  766. if (!valid) {
  767. if (this.registerCountDown == 0) {
  768. if (this.getRegisterCodeLock) {
  769. return;
  770. }
  771. this.showHk = true;
  772. }
  773. }
  774. });
  775. },
  776. // 滑块完成函数
  777. passcallback() {
  778. this.$message.success("校验成功");
  779. setTimeout(() => {
  780. this.showHk = false;
  781. this.isPassing = false;
  782. this.loginSmsFormBack();
  783. }, 500);
  784. },
  785. /**
  786. * 获取验证码
  787. */
  788. loginSmsFormBack() {
  789. var self = this;
  790. this.getRegisterCodeLock = true;
  791. this.$request[
  792. this.activeName == "quickLogin"
  793. ? "getLoginSms"
  794. : this.activeName == "signIn"
  795. ? "getRegisterSms"
  796. : "getRegisterSmsforget"
  797. ]({
  798. tel: this[this.activeName == "quickLogin" ? "ruleForm" : "bindForm"]
  799. .tel,
  800. })
  801. .then((res) => {
  802. this.getRegisterCodeLock = false;
  803. this.$message({
  804. message: `验证码已发送`,
  805. type: "success",
  806. });
  807. this.registerCountDown = 60;
  808. this.registerCountDownTimer = setInterval(() => {
  809. self.registerCountDown--;
  810. if (self.registerCountDown == 0) {
  811. clearInterval(self.registerCountDownTimer);
  812. }
  813. }, 1000);
  814. })
  815. .catch((err) => {
  816. this.$message({
  817. message: err.msg,
  818. type: "error",
  819. });
  820. this.getRegisterCodeLock = false;
  821. });
  822. },
  823. openBox() {
  824. this.islogin = false;
  825. this.activeName = "generalLogin";
  826. this.dialogVisible = true;
  827. },
  828. // 检查是否有二建班级15天过期
  829. checkTenClassGradeUser() {
  830. this.$request
  831. .checkTenClassGradeUser()
  832. .then((res) => {
  833. if (res.data && res.data.length > 0) {
  834. let ary = JSON.parse(localStorage.getItem("loaclCheckClass")) || []
  835. let orderGoodsIds = []
  836. if (ary && ary.length > 0) {
  837. ary.forEach(i => {
  838. if (i.userId == this.userInfo.userId) {
  839. orderGoodsIds = i.orderGoodsIds || []
  840. }
  841. })
  842. this.checkTwoClassList = res.data.filter(i => orderGoodsIds.indexOf(i.orderGoodsId.toString()) == -1 )
  843. } else {
  844. this.checkTwoClassList = res.data
  845. }
  846. this.checkDialogVisible = true;
  847. if (!this.checkTwoClassList.length) this.checkDialogVisible = false;
  848. }
  849. })
  850. .catch(() => {
  851. this.checkDialogVisible = false;
  852. });
  853. }
  854. },
  855. };
  856. </script>
  857. <style lang="scss" scoped>
  858. .dialogBox {
  859. line-height: 30px;
  860. /deep/ .el-dialog__header {
  861. display: none;
  862. }
  863. /deep/ .el-dialog {
  864. transform: all 0.1s, 0.3s ease 0.1s;
  865. line-height: 30px;
  866. border-radius: 15px;
  867. .btn {
  868. margin-top: 15px;
  869. width: 100px;
  870. border-radius: 8px;
  871. }
  872. }
  873. }
  874. .loginDialog {
  875. /deep/ .el-dialog {
  876. background: transparent;
  877. }
  878. .dis_flex {
  879. display: flex;
  880. flex-direction: column;
  881. align-items: center;
  882. margin-bottom: 30px;
  883. img {
  884. width: 184px;
  885. height: 184px;
  886. }
  887. .headerTitle {
  888. margin: 34px 0px;
  889. font-size: 18px;
  890. font-weight: bold;
  891. color: #000;
  892. }
  893. }
  894. .clickFuncStyle {
  895. text-align: center;
  896. margin-bottom: 10px;
  897. span {
  898. user-select: none;
  899. color: rgb(0, 122, 255);
  900. cursor: pointer;
  901. }
  902. }
  903. .getCode {
  904. cursor: pointer;
  905. user-select: none;
  906. color: #409eff;
  907. }
  908. /deep/ .el-input-group__append {
  909. background-color: #fff;
  910. }
  911. .el-tab-pane {
  912. display: flex;
  913. flex-direction: column;
  914. align-items: center;
  915. }
  916. .find_res {
  917. display: flex;
  918. align-items: center;
  919. justify-content: space-between;
  920. width: 300px;
  921. margin-bottom: 20px;
  922. user-select: none;
  923. & > span {
  924. cursor: pointer;
  925. &:hover {
  926. color: #409eff;
  927. }
  928. }
  929. }
  930. .submit {
  931. width: 300px;
  932. background-color: rgb(0, 122, 255);
  933. &:hover {
  934. background-color: rgb(51, 149, 255);
  935. }
  936. }
  937. /deep/ .el-form-item__content {
  938. margin-left: 0px !important;
  939. }
  940. .input_300 {
  941. width: 300px;
  942. }
  943. /deep/ .el-dialog__header {
  944. display: none;
  945. }
  946. /deep/ .el-dialog__body {
  947. padding: 0;
  948. }
  949. .login_box {
  950. border-radius: 8px;
  951. position: relative;
  952. width: 675px;
  953. height: 450px;
  954. display: flex;
  955. align-items: center;
  956. background-color: #fff;
  957. .left {
  958. border-top-left-radius: 8px;
  959. border-bottom-left-radius: 8px;
  960. flex-shrink: 0;
  961. width: 225px;
  962. height: 100%;
  963. }
  964. .right {
  965. flex: 1;
  966. height: 100%;
  967. }
  968. }
  969. .close_btn {
  970. position: absolute;
  971. left: 101%;
  972. top: -27px;
  973. color: #fff;
  974. font-size: 32px;
  975. cursor: pointer;
  976. user-select: none;
  977. }
  978. .wx_login {
  979. cursor: pointer;
  980. margin: 30px auto 0px;
  981. width: 48px;
  982. height: 48px;
  983. background: url("../../assets/new1/wechat.png") no-repeat center center;
  984. background-size: contain;
  985. &:hover {
  986. background: url("../../assets/new1/wechat2.png") no-repeat center center;
  987. background-size: contain;
  988. }
  989. }
  990. /deep/ .el-tabs__item {
  991. height: 50px;
  992. line-height: 50px;
  993. }
  994. /deep/ .el-tabs__item {
  995. padding: 0px !important;
  996. }
  997. }
  998. </style>