login.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  1. <!-- 新版登录弹窗 / 页面内嵌 -->
  2. <template>
  3. <component
  4. :is="asPage ? 'div' : 'el-dialog'"
  5. v-bind="rootBind"
  6. @update:model-value="onDialogVisibleChange"
  7. >
  8. <div v-if="!asPage" class="login-header">
  9. <!-- 关闭按钮 -->
  10. <icon-svg name="closeMessage" size="24px" class="dialog-close" @click="handleClose" />
  11. </div>
  12. <div class="login-box">
  13. <!-- 轮播图 -->
  14. <div v-if="isPC" class="login-side-view">
  15. <el-carousel height="430px" arrow="never">
  16. <el-carousel-item v-for="item in sideViewList" :key="item.id">
  17. <div class="login-side-view-item">
  18. <img :src="item.img" alt="">
  19. </div>
  20. </el-carousel-item>
  21. </el-carousel>
  22. </div>
  23. <!-- 登录方式切换 -->
  24. <div class="login-way">
  25. <!-- 切换 -->
  26. <div class="way-tab">
  27. <div
  28. v-for="item in visibleLoginWayTab"
  29. :key="item.index"
  30. class="way-tab-item"
  31. :class="{ 'is-active': item.index === loginWayIndex }"
  32. @click="handleWayIndex(item.index)"
  33. >
  34. <icon-svg :name="item.icon" size="18px" class="way-tab-icon" />
  35. <span class="way-tab-text">{{ item.title }}</span>
  36. </div>
  37. </div>
  38. <!-- 内容展示 -->
  39. <div class="way-item">
  40. <!-- 密码登录 -->
  41. <div class="way-item-center" v-show="loginWayIndex === 0">
  42. <h3 class="wic-title">云助手账号登录</h3>
  43. <!-- 手机号 -->
  44. <input class="way-item-input" id="username" placeholder="请输入手机号" v-model="phoneNumber" />
  45. <!-- 密码 -->
  46. <div class="way-item-lcl">
  47. <input class="way-item-input" id="password" placeholder="请输入密码"
  48. :type="showPassword ? 'text' : 'password'" autocomplete="off"
  49. v-model="passwordNumber" />
  50. <icon-svg :name="showPassword ? 'password_eye_off' : 'password_eye_on'" size="14px"
  51. style="cursor:pointer" @click="showPassword = !showPassword" />
  52. </div>
  53. <!-- 记住密码 -->
  54. <div class="way-checkbox">
  55. <el-checkbox v-model="checkRemember"></el-checkbox>
  56. <span class="way-checkbox-password">记住密码</span>
  57. </div>
  58. <!-- 登录按钮 -->
  59. <span class="way-login-btn" @click="submitForm">登录</span>
  60. </div>
  61. <!-- 验证码登录 -->
  62. <div class="way-item-center" v-show="loginWayIndex === 1">
  63. <h3 class="wic-title">手机验证码登录/注册</h3>
  64. <!-- 手机号 -->
  65. <input class="way-item-input" id="username" placeholder="请输入手机号" v-model="phoneNumber" />
  66. <!-- 验证码 -->
  67. <div class="way-item-lcl">
  68. <input class="way-item-input" id="code" placeholder="请输入验证码" v-model="codeNumber" />
  69. <span class="way-item-code" @click="sendMessage">{{ codeText }}</span>
  70. </div>
  71. <!-- 登录协议 -->
  72. <div class="way-checkbox">
  73. <el-checkbox v-model="checkProtocol"></el-checkbox>
  74. <span class="way-checkbox-text">我已阅读并同意<span
  75. @click="openUrl('https://www.eiacloud.com/hpy/lawstandardApp/getDetailYS?type=agreement')">《用户协议》</span>和<span
  76. @click="openUrl('https://www.eiacloud.com/hpy/lawstandardApp/getDetailYS')">《隐私政策》</span></span>
  77. </div>
  78. <span class="way-login-btn" @click="submitForm">登录/注册</span>
  79. </div>
  80. <div class="way-item-center" v-show="loginWayIndex === 2">
  81. <div class="scan-subtab">
  82. <div class="scan-subtab-item" :class="{'is-active': scanTab === 'app'}" @click="handleAppScanClick">
  83. <icon-svg name="lg_app" size="20px" class="scan-subtab-icon" />
  84. <span>APP扫码登录</span>
  85. </div>
  86. <div class="scan-subtab-item" :class="{'is-active': scanTab === 'wechat'}" @click="wechatLogin">
  87. <icon-svg name="lg_weixin" size="20px" class="scan-subtab-icon" />
  88. <span>微信登录</span>
  89. </div>
  90. </div>
  91. <!-- APP 二维码 -->
  92. <div v-show="scanTab === 'app'" class="way-qr-container">
  93. <div class="way-qr">
  94. <img v-if="qrCodeImage" :src="qrCodeImage" alt="二维码">
  95. <!-- 二维码失效 -->
  96. <div class="error-qr" v-show="!qrCodeValid && qrCodeImage">
  97. <p>二维码已失效</p>
  98. <span @click="resetQrCode">点击刷新</span>
  99. </div>
  100. </div>
  101. <!-- 提示 -->
  102. <div class="way-qr-text">请使用<span>环评云助手APP</span>扫码登录</div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. <div class="confirm-box" v-show="qrCodeType == 2">
  109. <p class="p-h3">扫码成功</p>
  110. <p class="p-text">请按照APP提示完成相关操作</p>
  111. </div>
  112. <div class="confirm-box-fail" v-show="qrCodeType == 4">
  113. <p class="p-h3">用户取消授权</p>
  114. </div>
  115. </component>
  116. </template>
  117. <script setup>
  118. import { watch, computed, onBeforeMount, onBeforeUnmount, reactive, ref } from 'vue';
  119. import globalStore from "@/store/modules/global";
  120. import { codeLogin, passwordLogin, getCode, selectQrCode, selectQrLoop, qrLogin } from "@/api/login";
  121. import { ElMessage } from 'element-plus';
  122. import { getRememberInfo, remember } from '@/utils/auth';
  123. import { checkPhone, IsPC } from "@/utils/common";
  124. import { wechatLoginUrl } from '@/utils/config.js';
  125. const props = defineProps({
  126. /** 作为独立页面内容展示,非弹窗 */
  127. asPage: {
  128. type: Boolean,
  129. default: false,
  130. },
  131. });
  132. const global = globalStore();
  133. const isPC = IsPC();
  134. const loginVisable = computed(() => global.loginVisable);
  135. const emit = defineEmits(["update:modelValue", "saveUser", "closed"]);
  136. const dialogVisible = computed(() => props.asPage || loginVisable.value);
  137. const rootBind = computed(() => {
  138. const className = [
  139. "lc-dialog",
  140. { "lc-dialog--mobile": !isPC, "lc-dialog--page": props.asPage },
  141. ];
  142. if (props.asPage) {
  143. return { class: className };
  144. }
  145. return {
  146. modelValue: dialogVisible.value,
  147. class: className,
  148. alignCenter: true,
  149. showClose: false,
  150. beforeClose: handleClose,
  151. style: "padding: 0;border-radius: 12px;",
  152. };
  153. });
  154. const onDialogVisibleChange = (visible) => {
  155. if (props.asPage) return;
  156. triggerLoginVisible.value(visible);
  157. };
  158. const loginWayTab = ref([
  159. {
  160. title: "账号",
  161. index: 0,
  162. icon: "lg_account",
  163. },
  164. {
  165. title: "手机",
  166. index: 1,
  167. icon: "lg_phone",
  168. },
  169. {
  170. title: "扫码",
  171. index: 2,
  172. icon: "lg_scan",
  173. },
  174. ]);
  175. const visibleLoginWayTab = computed(() =>
  176. isPC ? loginWayTab.value : loginWayTab.value.filter((item) => item.index !== 2),
  177. );
  178. const sideViewList = ref([
  179. {
  180. id: 0,
  181. img: 'https://cdntest.eiacloud.com/ai/approval/icons/sideView1.png',
  182. },
  183. {
  184. id: 1,
  185. img: 'https://cdntest.eiacloud.com/ai/approval/icons/sideView2.png',
  186. },
  187. {
  188. id: 2,
  189. img: 'https://cdntest.eiacloud.com/ai/approval/icons/sideView3.png',
  190. },
  191. ])
  192. const loginWayIndex = ref(0); // 选中的方式
  193. const scanTab = ref('app'); // 扫码方式:'app' 或 'wechat'
  194. const showPassword = ref(false); // 是否显示密码
  195. const phoneNumber = ref(''); // 手机号
  196. const passwordNumber = ref(''); // 密码
  197. const checkRemember = ref(false); //是否记住密码
  198. const codeNumber = ref(''); // 验证码
  199. const codeText = ref("获取验证码"); // 验证码文本
  200. const codeTimer = ref(null); //验证码定时器
  201. const codeSecond = ref(60); //验证码倒计时
  202. const checkProtocol = ref(false); //是否同意协议
  203. const qrCodeImage = ref(''); // 二维码图片
  204. const qrCodeType = ref(0);// 0 超时 1 等待扫描 2 已扫描 3 已确认 4 已取消
  205. const qrCodeTimer = ref(null);//二维码定时器
  206. const qrCodeValid = ref(false);//二维码是否有效
  207. const stopAppScanLogin = () => {
  208. if (qrCodeTimer.value) {
  209. clearInterval(qrCodeTimer.value);
  210. qrCodeTimer.value = null;
  211. }
  212. qrCodeValid.value = false;
  213. }
  214. const startAppScanLogin = () => {
  215. if (loginWayIndex.value !== 2 || scanTab.value !== 'app' || !dialogVisible.value) {
  216. return;
  217. }
  218. qrCode.getQrCode();
  219. }
  220. // 点击切换登录方式
  221. const handleWayIndex = (index) => {
  222. if (!isPC && index === 2) {
  223. return;
  224. }
  225. loginWayIndex.value = index;
  226. if (index === 2 && scanTab.value === 'app') {
  227. startAppScanLogin();
  228. return;
  229. }
  230. stopAppScanLogin();
  231. }
  232. const handleAppScanClick = () => {
  233. scanTab.value = 'app';
  234. startAppScanLogin();
  235. }
  236. // 关闭弹窗
  237. const handleClose = () => {
  238. if (!props.asPage) {
  239. triggerLoginVisible.value(false);
  240. }
  241. if (codeTimer.value) {
  242. clearInterval(codeTimer.value);
  243. }
  244. stopAppScanLogin();
  245. emit("closed");
  246. }
  247. onBeforeMount(() => {
  248. // 回显记住密码的数据
  249. const rememberInfo = getRememberInfo();
  250. if (rememberInfo) {
  251. checkRemember.value = true;
  252. phoneNumber.value = rememberInfo.username;
  253. passwordNumber.value = rememberInfo.password;
  254. }
  255. watch(() => dialogVisible.value, (newValue, oldValue) => {
  256. if (newValue) {
  257. // 每次打开登录弹窗时默认回到账号登录,不自动开启APP扫码
  258. loginWayIndex.value = 0;
  259. scanTab.value = 'app';
  260. stopAppScanLogin();
  261. } else {
  262. stopAppScanLogin();
  263. }
  264. }, { immediate: true })
  265. })
  266. // 发送验证码
  267. const sendMessage = () => {
  268. // 查看手机号
  269. if (!checkPhone(phoneNumber.value)) {
  270. document.getElementById("username")?.focus();
  271. return false;
  272. };
  273. // 发送
  274. if (!codeTimer.value) {
  275. const username = phoneNumber.value;
  276. getCode(username).then((res) => {
  277. console.log("发送验证码", res);
  278. document.getElementById("username")?.focus();
  279. if (res.code !== 200) {
  280. ElMessage.error({
  281. message: res.msg,
  282. offset: window.innerHeight / 2 - 50,
  283. center: true
  284. });
  285. return false;
  286. }
  287. ElMessage.success({
  288. message: res.msg,
  289. offset: window.innerHeight / 2 - 50,
  290. center: true
  291. });
  292. codeTimer.value = setInterval(() => {
  293. if (codeSecond.value > 1) {
  294. codeSecond.value--;
  295. codeText.value = codeSecond.value + "s后重发";
  296. } else {
  297. clearInterval(codeTimer.value);
  298. codeText.value = "重发";
  299. codeSecond.value = 60;
  300. codeTimer.value = null;
  301. }
  302. }, 1000);
  303. })
  304. }
  305. }
  306. // 点击协议跳转
  307. const openUrl = (url) => {
  308. window.open(url, "_blank");
  309. }
  310. // 获取二维码
  311. const qrCode = reactive({
  312. token: "",
  313. count: 0,
  314. getQrCode: () => {
  315. stopAppScanLogin();
  316. selectQrCode().then((res) => {
  317. console.log("获取二维码", res);
  318. if (res.status) {
  319. qrCode.token = res.data.token;
  320. qrCode.count = 0;
  321. qrCodeImage.value = "data:image/png;base64," + res.data.image;
  322. qrCodeType.value = 1;
  323. qrCodeTimer.value = setInterval(qrCode.waitScan, 2000);
  324. qrCodeValid.value = true;
  325. }
  326. });
  327. },
  328. waitScan: () => {
  329. if (qrCode.count > 60) {
  330. stopAppScanLogin();
  331. } else {
  332. qrCode.count++;
  333. selectQrLoop(qrCode.token).then((res) => {
  334. if (res.status) {
  335. if (res.type === 0) {
  336. // 有效时间结束
  337. stopAppScanLogin();
  338. } else if (res.type === 1) {
  339. // 等待扫描
  340. } else if (res.type === 2) {
  341. // 已扫描,等待确定
  342. qrCodeType.value = 2;
  343. } else if (res.type === 3) {
  344. // 确认登录
  345. stopAppScanLogin();
  346. qrAjaxLogin(qrCode.token, res.userName);
  347. } else if (res.type === 4) {
  348. // 取消登录
  349. stopAppScanLogin();
  350. qrCodeType.value = 3;
  351. setTimeout(() => {
  352. qrCode.getQrCode();
  353. }, 3000);
  354. } else {
  355. stopAppScanLogin();
  356. qrCode.getQrCode();
  357. }
  358. }
  359. })
  360. }
  361. }
  362. })
  363. // 登录成功
  364. const afterSuccessLogin = (res) => {
  365. emit("saveUser", res);
  366. ElMessage.success({
  367. message: res.msg,
  368. offset: window.innerHeight / 2 - 50,
  369. center: true
  370. });
  371. handleClose();
  372. }
  373. // 点击登录
  374. const submitForm = () => {
  375. if (!checkPhone(phoneNumber.value)) {
  376. document.getElementById("username")?.focus();
  377. return false;
  378. }
  379. if (loginWayIndex.value === 1) {
  380. // 验证码登录
  381. if (!codeNumber.value) {
  382. document.getElementById("code")?.focus();
  383. ElMessage.error({
  384. message: "验证码不能为空",
  385. offset: window.innerHeight / 2 - 50,
  386. center: true
  387. });
  388. return false;
  389. }
  390. if (!checkProtocol.value) {
  391. ElMessage.error({
  392. message: "请先阅读并同意《用户协议》和《隐私政策》",
  393. offset: window.innerHeight / 2 - 50,
  394. center: true
  395. });
  396. return false;
  397. }
  398. codeLogin(phoneNumber.value, codeNumber.value).then((res) => {
  399. console.log("验证码登录", res);
  400. if (res.code !== 200) {
  401. ElMessage.error({
  402. message: res.msg,
  403. offset: window.innerHeight / 2 - 50,
  404. center: true
  405. })
  406. return false;
  407. }
  408. afterSuccessLogin(res);
  409. })
  410. } else if (loginWayIndex.value === 0) {
  411. // 密码登录
  412. if (!passwordNumber.value) {
  413. document.getElementById("password")?.focus();
  414. ElMessage.error({
  415. message: "密码不能为空",
  416. offset: window.innerHeight / 2 - 50,
  417. center: true
  418. });
  419. return false;
  420. }
  421. const username = phoneNumber.value;
  422. const password = passwordNumber.value;
  423. passwordLogin(username, password).then((res) => {
  424. console.log("密码登录", res);
  425. if (res.code !== 200) {
  426. ElMessage.error(res.msg);
  427. return false;
  428. }
  429. // 密码记忆
  430. if (checkRemember.value) {
  431. remember(phoneNumber.value, passwordNumber.value);
  432. } else {
  433. if (getRememberInfo()) {
  434. remember(null, null);
  435. }
  436. }
  437. afterSuccessLogin(res);
  438. })
  439. }
  440. }
  441. // ajax 异步登录
  442. const qrAjaxLogin = (token, userName) => {
  443. const data = {
  444. qrToken: token,
  445. username: userName
  446. }
  447. qrLogin(data).then((res) => {
  448. console.log("ajax 异步登录", res);
  449. if (res.code === 200) {
  450. afterSuccessLogin(res);
  451. } else {
  452. stopAppScanLogin();
  453. qrCode.getQrCode();
  454. ElMessage.error({
  455. message: res.msg,
  456. offset: window.innerHeight / 2 - 50,
  457. center: true
  458. })
  459. }
  460. })
  461. }
  462. // 重新获取二维码
  463. const resetQrCode = () => {
  464. qrCode.getQrCode();
  465. }
  466. let childWindow = null;
  467. const closeWechatLoginChildWindow = () => {
  468. if (childWindow && !childWindow.closed) {
  469. childWindow.close();
  470. }
  471. childWindow = null;
  472. }
  473. const handleWechatLoginSuccess = (message) => {
  474. ElMessage.success({
  475. message: message || '登录成功',
  476. offset: window.innerHeight / 2 - 50,
  477. center: true
  478. });
  479. handleClose();
  480. window.location.reload();
  481. }
  482. /**
  483. * 打开微信扫码登录窗口,并让弹窗在当前屏幕区域内水平垂直居中。
  484. */
  485. const wechatLogin = () => {
  486. // scanTab.value = 'wechat';
  487. stopAppScanLogin();
  488. const popupWidth = 804;
  489. const popupHeight = 610;
  490. const left = window.screenX + Math.max((window.outerWidth - popupWidth) / 2, 0);
  491. const top = window.screenY + Math.max((window.outerHeight - popupHeight) / 2, 0);
  492. // const top = Math.round(window.innerHeight * 0.15);
  493. childWindow = window.open(
  494. wechatLoginUrl,
  495. '_blank',
  496. `width=${popupWidth},height=${popupHeight},left=${left},top=${top}`
  497. );
  498. }
  499. window.__closeWechatLoginChildWindow = closeWechatLoginChildWindow;
  500. window.__handleWechatLoginSuccess = handleWechatLoginSuccess;
  501. onBeforeUnmount(() => {
  502. if (window.__closeWechatLoginChildWindow === closeWechatLoginChildWindow) {
  503. delete window.__closeWechatLoginChildWindow;
  504. }
  505. if (window.__handleWechatLoginSuccess === handleWechatLoginSuccess) {
  506. delete window.__handleWechatLoginSuccess;
  507. }
  508. });
  509. </script>
  510. <style lang="scss">
  511. .lc-dialog.el-dialog {
  512. .el-dialog__header {
  513. padding: 0 !important;
  514. margin: 0 !important;
  515. }
  516. .el-dialog__body {
  517. padding: 0 !important;
  518. }
  519. }
  520. .lc-dialog {
  521. max-width: 782px;
  522. max-height: 430px;
  523. padding: 0;
  524. background: #FFFFFF;
  525. box-shadow: 0px 2px 10px 0px rgba(66, 133, 244, 0.1);
  526. border-radius: 12px;
  527. position: relative;
  528. &.lc-dialog--page {
  529. position: relative;
  530. margin: 0 auto;
  531. flex-shrink: 0;
  532. width: 782px;
  533. max-width: calc(100vw - 32px);
  534. }
  535. &.lc-dialog--mobile {
  536. width: calc(100vw - 32px) !important;
  537. max-width: calc(100vw - 32px);
  538. max-height: none;
  539. .login-box {
  540. flex-direction: column;
  541. .login-way {
  542. min-width: 0;
  543. width: 100%;
  544. height: auto;
  545. min-height: auto;
  546. padding: 48px 20px 24px;
  547. gap: 24px;
  548. }
  549. }
  550. .login-header {
  551. top: 16px;
  552. right: 16px;
  553. }
  554. }
  555. .login-header {
  556. position: absolute;
  557. top: 20px;
  558. right: 20px;
  559. cursor: pointer;
  560. }
  561. .login-box {
  562. width: 100%;
  563. height: 100%;
  564. display: flex;
  565. align-items: center;
  566. justify-content: center;
  567. border-radius: 12px;
  568. .login-side-view {
  569. width: 360px;
  570. height: 430px;
  571. border-radius: 12px 0px 0px 12px;
  572. overflow: hidden;
  573. // 设置指示器为圆形
  574. .el-carousel__indicators {
  575. .el-carousel__indicator {
  576. .el-carousel__button {
  577. width: 8px; // 圆形直径
  578. height: 8px; // 圆形直径
  579. border-radius: 50%; // 确保是圆形
  580. background-color: rgba(255, 255, 255, 0.5); // 未激活状态颜色
  581. }
  582. &.is-active .el-carousel__button {
  583. background-color: rgba(255, 255, 255, 1); // 激活状态颜色
  584. width: 8px; // 激活状态大小(可以设置不同大小)
  585. height: 8px;
  586. }
  587. }
  588. }
  589. .login-side-view-item {
  590. width: 100%;
  591. height: 100%;
  592. border-radius: 12px 0px 0px 12px;
  593. >img {
  594. width: 100%;
  595. height: 100%;
  596. border-radius: 12px 0px 0px 12px;
  597. }
  598. }
  599. }
  600. .login-way {
  601. flex: 1;
  602. min-width: 420px;
  603. height: 430px;
  604. padding: 40px;
  605. display: flex;
  606. align-items: center;
  607. flex-direction: column;
  608. gap: 30px;
  609. .way-tab {
  610. display: flex;
  611. align-items: center;
  612. justify-content: center;
  613. gap: 4px;
  614. width: 100%;
  615. padding: 4px;
  616. background: #F5F6F8;
  617. border-radius: 24px;
  618. font-family: PingFang SC, PingFang SC;
  619. font-weight: 400;
  620. font-size: 16px;
  621. color: #333333;
  622. line-height: 19px;
  623. margin: 0;
  624. box-sizing: border-box;
  625. .way-tab-item {
  626. flex: 1;
  627. min-width: 0;
  628. height: 36px;
  629. margin: 0;
  630. padding: 0;
  631. cursor: pointer;
  632. display: flex;
  633. align-items: center;
  634. justify-content: center;
  635. gap: 4px;
  636. font-size: 14px;
  637. color: #666666;
  638. border-radius: 20px;
  639. transition: all 0.2s ease;
  640. }
  641. .way-tab-icon {
  642. flex-shrink: 0;
  643. }
  644. .way-tab-text {
  645. line-height: 20px;
  646. }
  647. .way-tab-item.is-active {
  648. background: #FFFFFF;
  649. color: #1678FF;
  650. font-weight: 600;
  651. }
  652. }
  653. .way-item {
  654. width: 100%;
  655. .way-item-center {
  656. display: flex;
  657. align-items: center;
  658. flex-direction: column;
  659. margin: 0;
  660. .wic-title {
  661. font-weight: 600;
  662. font-size: 18px;
  663. color: #333333;
  664. line-height: 24px;
  665. margin: 0 0 20px 0;
  666. }
  667. .way-item-input {
  668. width: 100%;
  669. padding: 12px;
  670. background: #FFFFFF;
  671. border-radius: 8px;
  672. border: 1px solid #DCDFE6;
  673. font-family: PingFang SC, PingFang SC;
  674. font-weight: 400;
  675. font-size: 14px;
  676. color: #333333;
  677. line-height: 20px;
  678. &::placeholder {
  679. color: #888888; // 占位符
  680. }
  681. }
  682. .way-item-lcl {
  683. margin-top: 20px;
  684. width: 100%;
  685. display: flex;
  686. align-items: center;
  687. padding: 12px;
  688. background: #FFFFFF;
  689. border-radius: 8px;
  690. border: 1px solid #DCDFE6;
  691. .way-item-input {
  692. height: 100%;
  693. border: none;
  694. padding: 0;
  695. border-radius: 0px;
  696. font-family: PingFang SC, PingFang SC;
  697. font-weight: 400;
  698. font-size: 14px;
  699. color: #333333;
  700. line-height: 20px;
  701. &::placeholder {
  702. color: #888888; // 占位符
  703. }
  704. }
  705. .way-item-code {
  706. min-width: max-content;
  707. font-family: PingFang SC, PingFang SC;
  708. font-weight: 400;
  709. font-size: 12px;
  710. color: #1678FF;
  711. cursor: pointer;
  712. }
  713. }
  714. .way-checkbox {
  715. margin-top: 24px;
  716. width: 100%;
  717. display: flex;
  718. align-items: center;
  719. justify-content: start;
  720. flex-wrap: nowrap;
  721. gap: 10px;
  722. margin-left: 0;
  723. margin-right: 0;
  724. margin-bottom: 0;
  725. padding: 0;
  726. :deep(.el-checkbox) {
  727. height: 20px;
  728. margin: 0;
  729. }
  730. :deep(.el-checkbox__inner) {
  731. width: 20px;
  732. height: 20px;
  733. }
  734. :deep(.el-checkbox__inner::after) {
  735. width: 4px;
  736. height: 10px;
  737. left: 6px;
  738. top: 2px;
  739. }
  740. .way-checkbox-password {
  741. cursor: pointer;
  742. font-family: PingFang SC, PingFang SC;
  743. font-weight: 400;
  744. font-size: 12px;
  745. color: #888888;
  746. line-height: 14px;
  747. text-align: left;
  748. }
  749. .way-checkbox-text {
  750. cursor: pointer;
  751. white-space: nowrap;
  752. flex-shrink: 0;
  753. font-family: PingFang SC, PingFang SC;
  754. font-weight: 400;
  755. font-size: 12px;
  756. line-height: 14px;
  757. text-align: left;
  758. >span {
  759. color: #1678FF;
  760. }
  761. }
  762. }
  763. .way-login-btn {
  764. margin-top: 24px;
  765. width: 100%;
  766. background: #1678FF;
  767. border-radius: 8px;
  768. text-align: center;
  769. padding: 14px 0px;
  770. font-family: PingFang SC, PingFang SC;
  771. font-weight: 400;
  772. font-size: 16px;
  773. color: #FFFFFF;
  774. line-height: 20px;
  775. cursor: pointer;
  776. }
  777. .scan-subtab {
  778. display: inline-flex;
  779. align-items: center;
  780. justify-content: center;
  781. gap: 12px;
  782. margin: 0 auto 18px;
  783. padding: 4px;
  784. border-radius: 12px;
  785. .scan-subtab-item {
  786. height: 28px;
  787. padding: 4px;
  788. border-radius: 6px;
  789. display: inline-flex;
  790. align-items: center;
  791. justify-content: space-between;
  792. gap: 4px;
  793. color: #666666;
  794. font-size: 14px;
  795. cursor: pointer;
  796. transition: all 0.2s ease;
  797. &:hover {
  798. color: #1678FF;
  799. }
  800. &.is-active {
  801. background: rgba(22, 120, 255, 0.1);
  802. font-weight: 600;
  803. color: #1678FF;
  804. }
  805. .scan-subtab-icon {
  806. width: 20px;
  807. height: 20px;
  808. display: block;
  809. }
  810. }
  811. }
  812. .way-qr-container {
  813. display: flex;
  814. flex-direction: column;
  815. align-items: center;
  816. width: 100%;
  817. &.wechat-login-container {
  818. height: 240px;
  819. justify-content: center;
  820. iframe {
  821. width: 300px;
  822. height: 300px;
  823. }
  824. }
  825. }
  826. .way-qr {
  827. width: max-content;
  828. height: max-content;
  829. min-width: 160px;
  830. min-height: 160px;
  831. position: relative;
  832. >img {
  833. width: 100%;
  834. height: 100%;
  835. object-fit: contain;
  836. border-radius: 10px;
  837. box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.1);
  838. }
  839. .error-qr {
  840. width: 100%;
  841. height: 100%;
  842. border-radius: 10px;
  843. background: rgba(0, 0, 0, 0.7);
  844. position: absolute;
  845. top: 50%;
  846. left: 50%;
  847. transform: translate(-50%, -50%);
  848. display: flex;
  849. align-items: center;
  850. justify-content: center;
  851. flex-direction: column;
  852. gap: 20px;
  853. font-weight: 400;
  854. font-size: 14px;
  855. color: #ffffff;
  856. line-height: 20px;
  857. cursor: pointer;
  858. >span {
  859. color: #ffffff;
  860. background-color: #1678ff;
  861. padding: 8px 28px;
  862. border-radius: 19px 19px 19px 19px;
  863. display: flex;
  864. align-items: center;
  865. justify-content: center;
  866. }
  867. }
  868. }
  869. .way-qr-text {
  870. font-family: PingFang SC, PingFang SC;
  871. font-weight: 400;
  872. font-size: 14px;
  873. color: #888888;
  874. margin-top: 20px;
  875. >span {
  876. color: #1678ff;
  877. }
  878. }
  879. }
  880. }
  881. }
  882. }
  883. .confirm-box,
  884. .confirm-box-fail {
  885. background-color: rgba(255, 255, 255, 0.9);
  886. position: absolute;
  887. text-align: center;
  888. top: 0;
  889. left: 0;
  890. width: 100%;
  891. height: 100%;
  892. z-index: 8;
  893. .p-h3 {
  894. margin-top: 150px;
  895. font-size: 24px;
  896. line-height: 40px;
  897. font-weight: bold;
  898. color: #333;
  899. }
  900. .p-text {
  901. color: #333;
  902. margin-top: 20px;
  903. font-size: 18px;
  904. line-height: 28px;
  905. }
  906. }
  907. .confirm-box {
  908. .p-h3 {
  909. color: #1678ff;
  910. }
  911. }
  912. .confirm-box-fail {
  913. .p-h3 {
  914. color: #d90100;
  915. }
  916. }
  917. }
  918. </style>