index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. <template>
  2. <view class="login-wrapper" :style="colorStyle">
  3. <view class="shading">
  4. <!-- <image :src="logoUrl" v-if="logoUrl" /> -->
  5. <image src="@/static/images/logo@2x.png" />
  6. </view>
  7. <view class="whiteBg" v-if="formItem === 1">
  8. <view class="list" v-if="current !== 1">
  9. <form @submit.prevent="submit">
  10. <view class="item">
  11. <view class="acea-row row-middle">
  12. <image src="../static/phone_1.png" style="width: 24rpx; height: 34rpx;"></image>
  13. <input type="text" :placeholder="$t(`输入手机号码`)" v-model="account" maxlength="11" required />
  14. </view>
  15. </view>
  16. <view class="item">
  17. <view class="acea-row row-middle">
  18. <image src="../static/code_1.png" style="width: 28rpx; height: 32rpx;"></image>
  19. <input type="password" :placeholder="$t(`填写登录密码`)" v-model="password" required />
  20. </view>
  21. </view>
  22. </form>
  23. <!-- <navigator class="forgetPwd" hover-class="none" url="/pages/users/retrievePassword/index">
  24. <span class="iconfont icon-wenti"></span>忘记密码
  25. </navigator> -->
  26. </view>
  27. <view class="list" v-if="current !== 0 || appLoginStatus || appleLoginStatus">
  28. <view class="item">
  29. <view class="acea-row row-middle">
  30. <image src="../static/phone_1.png" style="width: 24rpx; height: 34rpx;"></image>
  31. <input type="text" :placeholder="$t(`请输入手机号码`)" v-model="account" maxlength="11" />
  32. </view>
  33. </view>
  34. <view class="item">
  35. <view class="acea-row row-middle">
  36. <image src="../static/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
  37. <input type="text" :placeholder="$t(`请输入验证码`)" maxlength="6" class="codeIput"
  38. v-model="captcha" />
  39. <view class="wrap">
  40. <u-toast ref="uToast"></u-toast>
  41. <u-code :seconds="seconds" @end="end" @start="start" ref="uCode" @change="codeChange">
  42. </u-code>
  43. <u-button class="code" size="small" shape="circle" @click="getCode" plain>{{
  44. tips
  45. }}
  46. </u-button>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="item" v-if="isShowCode">
  51. <view class="acea-row row-middle">
  52. <image src="../static/code_2.png" style="width: 28rpx; height: 32rpx;"></image>
  53. <input type="text" :placeholder="$t(`请输入验证码`)" class="codeIput" v-model="codeVal" />
  54. <view class="code" @click="again"><img :src="codeUrl" /></view>
  55. </view>
  56. </view>
  57. <view class="item">
  58. <view class="acea-row row-middle">
  59. <image src="../static/code_1.png" style="width: 28rpx; height: 32rpx;"></image>
  60. <input type="password" :placeholder="$t(`请输入登录密码`)" v-model="password" required />
  61. </view>
  62. </view>
  63. <view class="item">
  64. <view class="acea-row row-middle">
  65. <image src="../static/code_1.png" style="width: 28rpx; height: 32rpx;"></image>
  66. <input type="password" :placeholder="$t(`请确认登录密码`)" v-model="passwordConfirm" required />
  67. </view>
  68. </view>
  69. <view class="item">
  70. <view class="acea-row row-middle">
  71. <!-- <image src="@/static/images/contact.png" style="width: 28rpx; height: 32rpx;"></image> -->
  72. <u-icon name="share" color="#b7b5b5"></u-icon>
  73. <input type="text" :placeholder="$t(`邀请码(6KYSYX)`)" v-model="codeInvitation" required />
  74. </view>
  75. </view>
  76. </view>
  77. <view class="protocol">
  78. <checkbox-group @change='ChangeIsDefault'>
  79. <checkbox :class="inAnimation ? 'trembling' : ''" @animationend='inAnimation = false'
  80. :checked="protocol ? true : false" />{{ $t(`已同意`) }} <text class="main-color"
  81. @click="privacy('2.html', '注册协议')">{{ $t(`《注册协议》`) }}</text>
  82. <text class="main-color" @click="privacy('3.html', '商城须知')">{{ $t(`《商城须知》`) }}</text>
  83. <text class="main-color" @click="privacy('1.html', '隐私政策')">{{ $t(`《隐私政策》`) }}</text>
  84. </checkbox-group>
  85. </view>
  86. <view class="logon" @click="loginMobile" v-if="current !== 0">{{ $t(`同意协议注册`) }}</view>
  87. <view class="logon" @click="submit" v-if="current === 0">{{ $t(`同意协议注册`) }}</view>
  88. <!-- #ifndef APP-PLUS -->
  89. <!-- <view class="tips">
  90. <view v-if="current == 0" @click="current = 1">{{ $t(`快速登录`) }}</view>
  91. <view v-if="current == 1" @click="current = 0">{{ $t(`账号登录`) }}</view>
  92. </view> -->
  93. <!-- #endif -->
  94. <!-- #ifdef APP-PLUS -->
  95. <view class="appLogin" v-if="!appLoginStatus && !appleLoginStatus">
  96. <view class="hds">
  97. <span class="line"></span>
  98. <p>{{ $t(`其他方式登录`) }}</p>
  99. <span class="line"></span>
  100. </view>
  101. <view class="btn-wrapper">
  102. <view class="btn wx" @click="wxLogin">
  103. <span class="iconfont icon-s-weixindenglu1"></span>
  104. </view>
  105. <view class="btn mima" v-if="current == 1" @click="current = 0">
  106. <span class="iconfont icon-s-mimadenglu1"></span>
  107. </view>
  108. <view class="btn yanzheng" v-if="current == 0" @click="current = 1">
  109. <span class="iconfont icon-s-yanzhengmadenglu1"></span>
  110. </view>
  111. <view class="apple-btn" @click="appleLogin" v-if="appleShow">
  112. <view class="iconfont icon-s-pingguo"></view>
  113. </view>
  114. </view>
  115. </view>
  116. <!-- #endif -->
  117. </view>
  118. <view class="bottom"></view>
  119. </view>
  120. </template>
  121. <script>
  122. import dayjs from "@/plugin/dayjs/dayjs.min.js";
  123. import sendVerifyCode from "@/mixins/SendVerifyCode";
  124. import {
  125. loginH5,
  126. loginMobile,
  127. registerVerify,
  128. register,
  129. getCodeApi,
  130. getUserInfo,
  131. appleLogin
  132. } from "@/api/user";
  133. import {
  134. postSendValidate,
  135. postUserRegister
  136. } from "@/api/home";
  137. import attrs, {
  138. required,
  139. alpha_num,
  140. chs_phone
  141. } from "@/utils/validate";
  142. import {
  143. getLogo
  144. } from "@/api/public";
  145. // import cookie from "@/utils/store/cookie";
  146. import {
  147. VUE_APP_API_URL
  148. } from "@/utils";
  149. // #ifdef APP-PLUS
  150. import {
  151. wechatAppAuth
  152. } from '@/api/api.js'
  153. // #endif
  154. const BACK_URL = "login_back_url";
  155. import colors from '@/mixins/color.js';
  156. export default {
  157. name: "Login",
  158. mixins: [sendVerifyCode, colors],
  159. data: function () {
  160. return {
  161. tips: '',
  162. seconds: 60,
  163. inAnimation: false,
  164. protocol: false,
  165. navList: [this.$t(`快速登录`), this.$t(`账号登录`)],
  166. current: 1,
  167. account: "",
  168. password: "",
  169. passwordConfirm: "",
  170. codeInvitation: "",
  171. captchaId: "",
  172. captcha: "",
  173. formItem: 1,
  174. type: "login",
  175. logoUrl: "",
  176. keyCode: "",
  177. codeUrl: "",
  178. codeVal: "",
  179. isShowCode: false,
  180. appLoginStatus: false, // 微信登录强制绑定手机号码状态
  181. appUserInfo: null, // 微信登录保存的用户信息
  182. appleLoginStatus: false, // 苹果登录强制绑定手机号码状态
  183. appleUserInfo: null,
  184. appleShow: false, // 苹果登录版本必须要求ios13以上的
  185. keyLock: true
  186. };
  187. },
  188. watch: {
  189. formItem: function (nval, oVal) {
  190. if (nval == 1) {
  191. this.type = 'login'
  192. } else {
  193. this.type = 'register'
  194. }
  195. }
  196. },
  197. onLoad(options) {
  198. let self = this
  199. if(options.account){
  200. self.account = options.account
  201. }
  202. uni.getSystemInfo({
  203. success: (res) => {
  204. if (res.platform.toLowerCase() == 'ios' && this.getSystem(res.system)) {
  205. self.appleShow = true
  206. }
  207. }
  208. });
  209. },
  210. mounted: function () {
  211. this.codeInvitation = this.$Cache.get('INVITE_CODE_LOGIN');
  212. // this.getCode();
  213. // this.getLogoImage();
  214. },
  215. methods: {
  216. codeChange(text) {
  217. this.tips = text;
  218. },
  219. end() {
  220. this.keyLock = false
  221. },
  222. start() {
  223. // this.keyLock = !this.keyLock
  224. },
  225. ChangeIsDefault(e) {
  226. this.$set(this, 'protocol', !this.protocol);
  227. },
  228. privacy(type, title) {
  229. uni.navigateTo({
  230. url: "/pages/users/privacy/index?type=" + type + "&title=" + title
  231. })
  232. },
  233. // IOS 版本号判断
  234. getSystem(system) {
  235. let str
  236. system.toLowerCase().indexOf('ios') === -1 ? str = system : str = system.split(' ')[1]
  237. if (str.indexOf('.'))
  238. return str.split('.')[0] >= 13
  239. return str >= 13
  240. },
  241. // 苹果登录
  242. appleLogin() {
  243. let self = this
  244. this.account = ''
  245. this.captcha = ''
  246. if (!self.protocol) {
  247. this.inAnimation = true
  248. return self.$util.Tips({
  249. title: '请先阅读并同意协议'
  250. });
  251. }
  252. uni.showLoading({
  253. title: this.$t(`登录中`)
  254. })
  255. uni.login({
  256. provider: 'apple',
  257. timeout: 10000,
  258. success(loginRes) {
  259. uni.getUserInfo({
  260. provider: 'apple',
  261. success: function (infoRes) {
  262. self.appleUserInfo = infoRes.userInfo
  263. self.appleLoginApi()
  264. },
  265. fail() {
  266. uni.showToast({
  267. title: self.$t(`获取用户信息失败`),
  268. icon: 'none',
  269. duration: 2000
  270. })
  271. },
  272. complete() {
  273. uni.hideLoading()
  274. }
  275. });
  276. },
  277. fail(error) {
  278. console.log(error)
  279. }
  280. })
  281. },
  282. // 苹果登录Api
  283. appleLoginApi() {
  284. let self = this
  285. appleLogin({
  286. openId: self.appleUserInfo.openId,
  287. email: self.appleUserInfo.email || '',
  288. phone: this.account,
  289. captcha: this.captcha
  290. }).then(({
  291. data
  292. }) => {
  293. if (data.isbind) {
  294. uni.showModal({
  295. title: self.$t(`提示`),
  296. content: self.$t(`请绑定手机号后,继续操作`),
  297. showCancel: false,
  298. success: function (res) {
  299. if (res.confirm) {
  300. self.current = 1
  301. self.appleLoginStatus = true
  302. }
  303. }
  304. });
  305. } else {
  306. self.$store.commit("LOGIN", {
  307. 'token': data.token,
  308. 'time': data.expires_time - self.$Cache.time()
  309. });
  310. let backUrl = self.$Cache.get(BACK_URL) || "/pages/index/index";
  311. self.$Cache.clear(BACK_URL);
  312. self.$store.commit("SETUID", data.userInfo.userId);
  313. uni.reLaunch({
  314. url: backUrl
  315. });
  316. }
  317. }).catch(error => {
  318. uni.showModal({
  319. title: self.$t(`提示`),
  320. content: self.$t(`错误信息`) + `${error}`,
  321. success: function (res) {
  322. if (res.confirm) {
  323. console.log(self.$t(`用户点击确定`));
  324. } else if (res.cancel) {
  325. console.log(self.$t(`用户点击取消`));
  326. }
  327. }
  328. });
  329. })
  330. },
  331. // App微信登录
  332. wxLogin() {
  333. let self = this
  334. this.account = ''
  335. this.captcha = ''
  336. if (!self.protocol) {
  337. this.inAnimation = true
  338. return self.$util.Tips({
  339. title: '请先阅读并同意协议'
  340. });
  341. }
  342. uni.showLoading({
  343. title: self.$t(`登录中`)
  344. })
  345. uni.login({
  346. provider: 'weixin',
  347. success: function (loginRes) {
  348. // 获取用户信息
  349. uni.getUserInfo({
  350. provider: 'weixin',
  351. success: function (infoRes) {
  352. self.appUserInfo = infoRes.userInfo
  353. self.wxLoginApi()
  354. },
  355. fail() {
  356. uni.showToast({
  357. title: self.$t(`获取用户信息失败`),
  358. icon: 'none',
  359. duration: 2000
  360. })
  361. },
  362. complete() {
  363. uni.hideLoading()
  364. }
  365. });
  366. },
  367. fail() {
  368. uni.showToast({
  369. title: self.$t(`登录失败`),
  370. icon: 'none',
  371. duration: 2000
  372. })
  373. }
  374. });
  375. },
  376. wxLoginApi() {
  377. let self = this
  378. wechatAppAuth({
  379. userInfo: self.appUserInfo,
  380. phone: this.account,
  381. code: this.captcha
  382. }).then(({
  383. data
  384. }) => {
  385. if (data.isbind) {
  386. uni.showModal({
  387. title: self.$t(`提示`),
  388. content: self.$t(`请绑定手机号后,继续操作`),
  389. showCancel: false,
  390. success: function (res) {
  391. if (res.confirm) {
  392. self.current = 1
  393. self.appLoginStatus = true
  394. }
  395. }
  396. });
  397. } else {
  398. self.$store.commit("LOGIN", {
  399. 'token': data.token,
  400. 'time': data.expires_time - self.$Cache.time()
  401. });
  402. let backUrl = self.$Cache.get(BACK_URL) || "/pages/index/index";
  403. self.$Cache.clear(BACK_URL);
  404. self.$store.commit("SETUID", data.userInfo.userId);
  405. uni.reLaunch({
  406. url: backUrl
  407. });
  408. }
  409. }).catch(error => {
  410. uni.showModal({
  411. title: self.$t(`提示`),
  412. content: self.$t(`错误信息`) + `${error}`,
  413. success: function (res) {
  414. if (res.confirm) {
  415. console.log(self.$t(`用户点击确定`));
  416. } else if (res.cancel) {
  417. console.log(self.$t(`用户点击取消`));
  418. }
  419. }
  420. });
  421. })
  422. },
  423. again() {
  424. this.codeUrl =
  425. VUE_APP_API_URL +
  426. "/sms_captcha?" +
  427. "key=" +
  428. this.keyCode +
  429. Date.parse(new Date());
  430. },
  431. code() {
  432. let that = this
  433. if (!that.protocol) {
  434. this.inAnimation = true
  435. return that.$util.Tips({
  436. title: '请先阅读并同意协议'
  437. });
  438. }
  439. getCodeApi()
  440. .then(res => {
  441. that.keyCode = res.data.key;
  442. that.getCode();
  443. })
  444. .catch(res => {
  445. that.$util.Tips({
  446. title: res
  447. });
  448. });
  449. },
  450. async getLogoImage() {
  451. let that = this;
  452. let logoUrl = "https://demo26.crmeb.net/statics/system_images/login_logo.jpeg"
  453. that.logoUrl = logoUrl;
  454. getLogo(2).then(res => {
  455. that.logoUrl = res.data.logo_url;
  456. });
  457. },
  458. async loginMobile() {
  459. let that = this;
  460. if (!that.account) return that.$util.Tips({
  461. title: that.$t(`请输入手机号码`)
  462. });
  463. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
  464. title: that.$t(`请输入正确的手机号码`)
  465. });
  466. if (!that.captcha) return that.$util.Tips({
  467. title: that.$t(`请输入验证码`)
  468. });
  469. if (!/^[\w\d]+$/i.test(that.captcha) || that.captcha.length != 6) return that.$util.Tips({
  470. title: that.$t(`请输入正确的验证码`)
  471. });
  472. if (!that.password) return that.$util.Tips({
  473. title: that.$t(`请输入登录密码`)
  474. });
  475. if (/^([0-9]|[a-z]|[A-Z]){0,6}$/i.test(that.password)) return that.$util.Tips({
  476. title: that.$t(`您输入的密码过于简单`)
  477. });
  478. if (!that.passwordConfirm) return that.$util.Tips({
  479. title: that.$t(`请确认登录密码`)
  480. });
  481. if (that.passwordConfirm != that.password) return that.$util.Tips({
  482. title: that.$t(`确认密码与登录密码不一致,请修正后注册`)
  483. });
  484. if (!that.codeInvitation) return that.$util.Tips({
  485. title: that.$t(`请输入邀请码`)
  486. });
  487. if (!that.protocol) {
  488. this.inAnimation = true
  489. return that.$util.Tips({
  490. title: '请先阅读并同意协议'
  491. });
  492. }
  493. if (that.appLoginStatus) {
  494. that.wxLoginApi()
  495. } else if (that.appleLoginStatus) {
  496. that.appleLoginApi()
  497. } else {
  498. if (this.keyLock) {
  499. this.keyLock = !this.keyLock
  500. } else {
  501. return that.$util.Tips({
  502. title: that.$t(`请勿重复点击`)
  503. });
  504. }
  505. uni.showLoading({
  506. title: that.$t(`注册中`)
  507. });
  508. postUserRegister({
  509. phone: that.account,
  510. captchaCode: that.captcha,
  511. password: that.password,
  512. inviteCode: that.codeInvitation,
  513. captchaId: that.captchaId,
  514. // spread: that.$Cache.get("spread")
  515. })
  516. .then(res => {
  517. uni.hideLoading();
  518. uni.$u.toast('注册成功');
  519. setTimeout(() => {
  520. uni.navigateTo({
  521. url: '/pages/users/wechat_login/index'
  522. })
  523. }, 1500);
  524. // let data = res.data;
  525. // that.$store.commit("LOGIN", {
  526. // 'token': data.token,
  527. // 'time': data.expires_time - this.$Cache.time()
  528. // });
  529. // let backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
  530. // that.$Cache.clear(BACK_URL);
  531. // getUserInfo().then(res => {
  532. // this.keyLock = true
  533. // that.$store.commit("SETUID", res.data.userId);
  534. // if (backUrl.indexOf('/pages/users/login/index') !== -1) {
  535. // backUrl = '/pages/index/index';
  536. // }
  537. // uni.reLaunch({
  538. // url: backUrl
  539. // });
  540. // })
  541. })
  542. .catch(res => {
  543. this.keyLock = true
  544. that.$util.Tips({
  545. title: res
  546. });
  547. });
  548. }
  549. },
  550. async register() {
  551. let that = this;
  552. if (!that.protocol) {
  553. this.inAnimation = true
  554. return that.$util.Tips({
  555. title: '请先阅读并同意协议'
  556. });
  557. }
  558. if (!that.account) return that.$util.Tips({
  559. title: that.$t(`请填写手机号码`)
  560. });
  561. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
  562. title: that.$t(`请输入正确的手机号码`)
  563. });
  564. if (!that.captcha) return that.$util.Tips({
  565. title: that.$t(`请填写验证码`)
  566. });
  567. if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
  568. title: that.$t(`请输入正确的验证码`)
  569. });
  570. if (!that.password) return that.$util.Tips({
  571. title: that.$t(`请填写密码`)
  572. });
  573. if (/^([0-9]|[a-z]|[A-Z]){0,6}$/i.test(that.password)) return that.$util.Tips({
  574. title: that.$t(`您输入的密码过于简单`)
  575. });
  576. register({
  577. account: that.account,
  578. captcha: that.captcha,
  579. password: that.password,
  580. spread: that.$Cache.get("spread")
  581. })
  582. .then(res => {
  583. that.$util.Tips({
  584. title: res
  585. });
  586. that.formItem = 1;
  587. })
  588. .catch(res => {
  589. that.$util.Tips({
  590. title: res
  591. });
  592. });
  593. },
  594. async getCode() {
  595. let that = this;
  596. if (this.$refs.uCode.canGetCode) {
  597. // 模拟向后端请求验证码
  598. uni.showLoading({
  599. title: '正在获取验证码'
  600. })
  601. if (!that.account) return that.$util.Tips({
  602. title: that.$t(`请填写手机号码`)
  603. });
  604. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
  605. title: that.$t(`请输入正确的手机号码`)
  606. });
  607. await postSendValidate({
  608. phone: that.account
  609. })
  610. .then(res => {
  611. uni.hideLoading();
  612. that.captchaId = res.data.id
  613. // 这里此提示会被this.start()方法中的提示覆盖
  614. uni.$u.toast('验证码已发送');
  615. // 通知验证码组件内部开始倒计时
  616. this.$refs.uCode.start();
  617. })
  618. .catch(res => {
  619. that.$util.Tips({
  620. title: res
  621. });
  622. });
  623. } else {
  624. uni.$u.toast('倒计时结束后再发送');
  625. }
  626. // if (!that.protocol) {
  627. // this.inAnimation = true
  628. // return that.$util.Tips({
  629. // title: '请先阅读并同意协议'
  630. // });
  631. // }
  632. },
  633. navTap: function (index) {
  634. this.current = index;
  635. },
  636. async submit() {
  637. let that = this;
  638. if (!that.protocol) {
  639. this.inAnimation = true
  640. return that.$util.Tips({
  641. title: '请先阅读并同意协议'
  642. });
  643. }
  644. if (!that.account) return that.$util.Tips({
  645. title: that.$t(`请填写账号`)
  646. });
  647. if (!/^[\w\d]{5,16}$/i.test(that.account)) return that.$util.Tips({
  648. title: that.$t(`请输入正确的账号`)
  649. });
  650. if (!that.password) return that.$util.Tips({
  651. title: that.$t(`请填写密码`)
  652. });
  653. if (this.keyLock) {
  654. this.keyLock = !this.keyLock
  655. } else {
  656. return that.$util.Tips({
  657. title: that.$t(`请勿重复点击`)
  658. });
  659. }
  660. loginH5({
  661. account: that.account,
  662. password: that.password,
  663. spread: that.$Cache.get("spread")
  664. })
  665. .then(({
  666. data
  667. }) => {
  668. that.$store.commit("LOGIN", {
  669. 'token': data.token,
  670. 'time': data.expires_time - this.$Cache.time()
  671. });
  672. let backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
  673. that.$Cache.clear(BACK_URL);
  674. getUserInfo().then(res => {
  675. this.keyLock = true
  676. that.$store.commit("SETUID", res.data.userId);
  677. uni.reLaunch({
  678. url: backUrl
  679. });
  680. }).catch(error => {
  681. this.keyLock = true
  682. })
  683. })
  684. .catch(e => {
  685. this.keyLock = true
  686. that.$util.Tips({
  687. title: e
  688. });
  689. });
  690. }
  691. }
  692. };
  693. </script>
  694. <style>
  695. page {
  696. background: #fff;
  697. }
  698. </style>
  699. <style lang="scss">
  700. .appLogin {
  701. margin-top: 60rpx;
  702. .hds {
  703. display: flex;
  704. justify-content: center;
  705. align-items: center;
  706. font-size: 24rpx;
  707. color: #B4B4B4;
  708. .line {
  709. width: 68rpx;
  710. height: 1rpx;
  711. background: #CCCCCC;
  712. }
  713. p {
  714. margin: 0 20rpx;
  715. }
  716. }
  717. .btn-wrapper {
  718. display: flex;
  719. align-items: center;
  720. justify-content: center;
  721. margin-top: 30rpx;
  722. .btn {
  723. display: flex;
  724. align-items: center;
  725. justify-content: center;
  726. width: 68rpx;
  727. height: 68rpx;
  728. border-radius: 50%;
  729. }
  730. .apple-btn {
  731. display: flex;
  732. align-items: center;
  733. justify-content: center;
  734. width: 68rpx;
  735. height: 68rpx;
  736. border-radius: 50%;
  737. background: #000;
  738. .icon-s-pingguo {
  739. color: #fff;
  740. font-size: 44rpx;
  741. }
  742. }
  743. .iconfont {
  744. font-size: 40rpx;
  745. color: #fff;
  746. }
  747. .wx {
  748. margin-right: 30rpx;
  749. background-color: #61C64F;
  750. }
  751. .mima {
  752. margin-right: 30rpx;
  753. background-color: #28B3E9;
  754. }
  755. .yanzheng {
  756. margin-right: 30rpx;
  757. background-color: #F89C23;
  758. }
  759. }
  760. }
  761. .code img {
  762. width: 100%;
  763. height: 100%;
  764. }
  765. .acea-row.row-middle {
  766. input {
  767. margin-left: 20rpx;
  768. display: block;
  769. }
  770. }
  771. .login-wrapper {
  772. padding: 30rpx;
  773. .shading {
  774. display: flex;
  775. align-items: center;
  776. justify-content: center;
  777. width: 100%;
  778. /* #ifdef APP-VUE */
  779. margin-top: 50rpx;
  780. /* #endif */
  781. /* #ifndef APP-VUE */
  782. margin-top: 20rpx;
  783. /* #endif */
  784. image {
  785. width: 240rpx;
  786. height: 120rpx;
  787. }
  788. }
  789. .whiteBg {
  790. margin-top: 100rpx;
  791. .list {
  792. border-radius: 16rpx;
  793. overflow: hidden;
  794. .item {
  795. border-bottom: 1px solid #F0F0F0;
  796. background: #fff;
  797. .row-middle {
  798. position: relative;
  799. padding: 16rpx 45rpx;
  800. input {
  801. flex: 1;
  802. font-size: 28rpx;
  803. height: 80rpx;
  804. }
  805. .code {
  806. position: absolute;
  807. right: 30rpx;
  808. top: 50%;
  809. color: var(--view-theme);
  810. font-size: 26rpx;
  811. transform: translateY(-50%);
  812. }
  813. }
  814. }
  815. }
  816. .logon {
  817. display: flex;
  818. align-items: center;
  819. justify-content: center;
  820. width: 100%;
  821. height: 86rpx;
  822. margin-top: 80rpx;
  823. background-color: var(--view-theme);
  824. border-radius: 120rpx;
  825. color: #FFFFFF;
  826. font-size: 30rpx;
  827. }
  828. .tips {
  829. margin: 30rpx;
  830. text-align: center;
  831. color: #999;
  832. }
  833. }
  834. }
  835. .protocol {
  836. margin-top: 40rpx;
  837. color: #999999;
  838. font-size: 24rpx;
  839. text-align: center;
  840. bottom: 20rpx;
  841. }
  842. .trembling {
  843. animation: shake 0.6s;
  844. }
  845. .main-color {
  846. color: var(--view-theme);
  847. }
  848. </style>