123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <template>
- <view>
- <!-- 头部 -->
- <headContent>
- <template #left>
- <view class="head-revers-back iconfont" @click.stop="reversBackBtn()"></view>
- </template>
- </headContent>
- <view class="page-content">
- <text class="login-title">登录</text>
- <text class="login-content">Hi, 欢迎来到币王</text>
- <tabList ref="tabListRef" :tabIndex.sync="tabIndexs" />
- <!-- <component :is="phoneLogin"/> -->
- <phoneLogin v-show="tabIndexs === 0" :formData="formData" :areaCode="areaCode" />
- <emailLogin v-show="tabIndexs === 1" :formData="formData" />
- <view class="form-btn" style="margin-top: 28rpx;" @click.stop="formSubmit">
- 登录
- </view>
- <view class="form-hint">
- <text @click.stop="retrievePswd()">忘记密码?</text>
- <text class="form-hint-link"></text>
- <text @click.stop="register">立即注册</text>
- </view>
- </view>
- <load ref="loadRef" />
- <slider-verify ref="sliderVerifyRef" @slideImgSuccess="slideImgSuccess" />
- </view>
- </template>
- <script>
- import {
- reverseBack
- } from "@/utils/common.js"
- import {
- Api_userLogin
- } from "@/api/index.js"
- import phoneLogin from "./modules/phone.vue"
- import emailLogin from "./modules/email.vue"
- // import mailboxLogin from "./modules/mailbox.vue"
- import tabList from "./modules/tab.vue"
- export default {
- name: 'login',
- components: {
- phoneLogin,
- emailLogin,
- // mailboxLogin,
- tabList
- },
- data() {
- return {
- limina: false,
- tabIndexs: 0,
- areaCode: 86,
- formData: {
- user_string: '14100000001',
- password: '123456'
- }
- };
- },
- methods: {
- setAreaCode(e) {
- if (e) {
- this.areaCode = e.area_code;
- }
- },
- reversBackBtn() {
- reverseBack()
- },
- register() {
- uni.navigateTo({
- url: '/pages/login/register'
- })
- },
- // 忘记密码
- retrievePswd() {
- uni.navigateTo({
- url: '/pages/login/retrieve-pswd'
- })
- },
- // 提交登录
- formSubmit() {
- this.$nextTick(() => {
- this.$refs.loadRef.open();
- })
- setTimeout(() => {
- this.$refs.loadRef.close();
- setTimeout(() => {
- this.$nextTick(() => {
- this.$refs.sliderVerifyRef.open()
- })
- }, 100)
- }, 1500)
- },
- slideImgSuccess() {
- if (this.limina) {
- return false
- };
- this.limina = true
- uni.showLoading({
- title: '',
- mask: true
- });
- Api_userLogin(this.formData).then(res => {
- setTimeout(() => {
- if (res) {
- uni.showToast({
- title: '登录成功',
- icon: "none"
- })
- this.$store.dispatch("app/setToken", res)
- setTimeout(() => {
- uni.reLaunch({
- url: '/pages/index/index'
- });
- }, 500)
- }
- }, 300)
- }).catch(err => {
- }).finally(() => {
- setTimeout(() => {
- this.limina = false;
- uni.hideLoading({
- title: '',
- mask: true
- });
- },200)
- })
- }
- }
- }
- </script>
- <style>
- page {
- background-color: #fff;
- }
- </style>
- <style lang="scss" scoped>
- @import "~./common.scss"
- </style>
|