flat:登录调用顺序

This commit is contained in:
Apcallover
2024-07-24 14:45:29 +08:00
parent 23aaa5a4ab
commit ba14872e89
3 changed files with 222 additions and 215 deletions

View File

@@ -191,16 +191,16 @@
</view> </view>
</view> </view>
<view class="info_market"> <!-- <view class="info_market">
<view class="market_top"> <view class="market_top">
<view class="top_log"></view> <view class="top_log"></view>
<view class="next_market" @click="navTo('/pages/market/market')">去市场</view> <view class="next_market" @click="navTo('/pages/market/market')">去市场</view>
</view> </view>
<!-- <view class="market_bottom"> <view class="market_bottom">
<view>了解市场<u-icon name="arrow-right" color="#666666" size="13"></u-icon></view> <view>了解市场<u-icon name="arrow-right" color="#666666" size="13"></u-icon></view>
<view>我要咨询<u-icon name="arrow-right" color="#666666" size="13"></u-icon></view> <view>我要咨询<u-icon name="arrow-right" color="#666666" size="13"></u-icon></view>
</view> --> </view>
</view> </view> -->
<view class="latestMission"> <view class="latestMission">
<view class="cardTips" <view class="cardTips"
@@ -289,18 +289,11 @@
policyContentList: [], policyContentList: [],
policyType: 1, policyType: 1,
swiperType: 1, swiperType: 1,
isResume: true,
}; };
}, },
onLoad: function(options) { onLoad: function(options) {
myResume().then(res => {
const data = res.data.data
if (!(data.education && data.telephone && data.wage && data.workplace)) {
this.goures()
this.$api.sleep(1000).then(() => {
this.$api.msg('请输入基本信息')
})
}
})
}, },
onShow: function() { onShow: function() {
if (!this.$store.state.user.token) { if (!this.$store.state.user.token) {
@@ -319,6 +312,18 @@
this.download() this.download()
this.getSwiperList() this.getSwiperList()
this.getPolicy() this.getPolicy()
if (this.isResume) {
this.isResume = false
myResume().then(res => {
const data = res.data.data
if (!(data.education && data.telephone && data.wage && data.workplace)) {
this.goures()
this.$api.sleep(1000).then(() => {
this.$api.msg('请输入基本信息')
})
}
})
}
}, },
onReady() { onReady() {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({

View File

@@ -1,170 +1,172 @@
<template> <template>
<login-template title="账号登录"> <login-template title="账号登录">
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<!-- <view class="login-go-home" @click="goHome"> <!-- <view class="login-go-home" @click="goHome">
<image class="login-go-home-image" src="@/static/img/home.svg"></image> <image class="login-go-home-image" src="@/static/img/home.svg"></image>
</view> --> </view> -->
<!-- #endif --> <!-- #endif -->
<jl-input type="text" v-model="phone" placeholder="请输入手机号" @confirm="login"></jl-input> <jl-input type="text" v-model="phone" placeholder="请输入手机号" @confirm="login"></jl-input>
<jl-input type="text" v-model="password" placeholder="请输入登录密码" @confirm="login" showPassword clearable></jl-input> <jl-input type="text" v-model="password" placeholder="请输入登录密码" @confirm="login" showPassword
<!-- <code-input ref="code" v-model="code" :getCode="getCaptcha" @key-change="keyChange" @confirm="login"></code-input> --> clearable></jl-input>
<view v-if="loading" class="btn nocheck" loading="true"></view> <!-- <code-input ref="code" v-model="code" :getCode="getCaptcha" @key-change="keyChange" @confirm="login"></code-input> -->
<view v-else-if="validate" class="btn" @click="login">立即登录</view> <view v-if="loading" class="btn nocheck" loading="true"></view>
<view v-else class="btn nocheck">立即登录</view> <view v-else-if="validate" class="btn" @click="login">立即登录</view>
<!-- <view class="changeLogintype"> <view v-else class="btn nocheck">立即登录</view>
<view class="" @click="goReg">手机注册</view> <!-- <view class="changeLogintype">
<view class="" @click="goForget">忘记密码</view> <view class="" @click="goReg">手机注册</view>
</view> --> <view class="" @click="goForget">忘记密码</view>
</login-template> </view> -->
</template> </login-template>
</template>
<script>
import { <script>
mapGetters import {
} from 'vuex' mapGetters
import { } from 'vuex'
getCaptcha import {
} from '@/api/user.js' getCaptcha
import { } from '@/api/user.js'
isMobile import {
} from '@/untils/validate.js' isMobile
import website from '@/config/website.js' } from '@/untils/validate.js'
import codeInput from './codeInput.vue' import website from '@/config/website.js'
import jlInput from '@/components/jl-input/main.vue' import codeInput from './codeInput.vue'
import loginTemplate from './template.vue' import jlInput from '@/components/jl-input/main.vue'
import loginTemplate from './template.vue'
export default {
components: { export default {
jlInput, components: {
codeInput, jlInput,
loginTemplate codeInput,
}, loginTemplate
data() { },
return { data() {
phone: '', return {
password: '', phone: '',
code: '1111', password: '',
key: '', code: '1111',
loading: false key: '',
} loading: false
}, }
created() { },
if (this.userInfo.token) { created() {
uni.navigateBack() if (this.userInfo.token) {
} uni.navigateBack()
}, }
onShow() { },
// #ifdef MP-WEIXIN onShow() {
wx.hideHomeButton(); // #ifdef MP-WEIXIN
//#endif wx.hideHomeButton();
this.password = '' //#endif
if (this.$store.state.user.token) { this.password = ''
this.$store.dispatch('LogOut').then(() => { if (this.$store.state.user.token) {
this.$store.dispatch('clearAuthState') this.$store.dispatch('LogOut').then(() => {
this.$store.dispatch('endRefreshNewsTimer') this.$store.dispatch('clearAuthState')
}) this.$store.dispatch('endRefreshNewsTimer')
} })
}, }
methods: { },
goHome() { methods: {
uni.switchTab({ goHome() {
url: '/pages/index/index' uni.switchTab({
}) url: '/pages/index/index'
}, })
login(e) { },
if (this.validate) { login(e) {
this.userChecked = true; if (this.validate) {
console.log(this.userChecked) this.userChecked = true;
// if (!this.userChecked) { console.log(this.userChecked)
// uni.showToast({ // if (!this.userChecked) {
// title:'请先阅读并同意《服务及隐私协议》', // uni.showToast({
// icon:'none', // title:'请先阅读并同意《服务及隐私协议》',
// }) // icon:'none',
// } else { // })
var that = this // } else {
this.loading = true var that = this
this.$store.dispatch("LoginByUsername", { this.loading = true
username: this.phone, this.$store.dispatch("LoginByUsername", {
password: this.password, username: this.phone,
key: this.key, password: this.password,
code: this.code, key: this.key,
type: "account", code: this.code,
tenantId: website.tenantId type: "account",
}).then((resp) => { tenantId: website.tenantId
this.$store.dispatch('refreshAuthState').then(() => { }).then((resp) => {
that.loading = false this.$store.dispatch('refreshAuthState').then(() => {
var auth = this.auth that.loading = false
if (!auth.bankCardState) { var auth = this.auth
that.goSign(0) if (!auth.bankCardState) {
} else { that.goSign(0)
uni.switchTab({ } else {
url: '/pages/index/index' uni.switchTab({
}) url: '/pages/index/index'
} })
}) }
}).catch((err) => { })
this.loading = false }).catch((err) => {
// this.$refs.code.refushCode() this.loading = false
location.href = "https://dy12333.org.cn/h5/" // this.$refs.code.refushCode()
}); // location.href = "https://dy12333.org.cn/h5/"
// } this.$api.msg('登录失败')
} });
}, // }
// 步骤 }
goSign(active) { },
uni.navigateTo({ // 步骤
url: `/pages/projectInfo/signContract?active=${active}` goSign(active) {
}) uni.navigateTo({
}, url: `/pages/projectInfo/signContract?active=${active}`
keyChange(val) { })
this.key = val },
}, keyChange(val) {
goReg() { this.key = val
uni.navigateTo({ },
url: './reg' goReg() {
}) uni.navigateTo({
}, url: './reg'
goForget() { })
uni.navigateTo({ },
url: './forgetPwd' goForget() {
}) uni.navigateTo({
}, url: './forgetPwd'
getCaptcha })
}, },
computed: { getCaptcha
...mapGetters(['userInfo', 'auth', 'autograph', 'userChecked']), },
validate() { computed: {
return this.phone && this.password && this.code ...mapGetters(['userInfo', 'auth', 'autograph', 'userChecked']),
} validate() {
} return this.phone && this.password && this.code
} }
</script> }
}
<style> </script>
@import "./css.css";
<style>
/* #ifdef H5 */ @import "./css.css";
.login-go-home {
position: absolute; /* #ifdef H5 */
top: 10rpx; .login-go-home {
left: 0; position: absolute;
border-radius: 50%; top: 10rpx;
width: 60rpx; left: 0;
height: 60rpx; border-radius: 50%;
background: rgb(217, 217, 217); width: 60rpx;
border: 1px solid rgb(198, 198, 198); height: 60rpx;
} background: rgb(217, 217, 217);
border: 1px solid rgb(198, 198, 198);
.login-go-home-image { }
width: 40rpx;
height: 40rpx; .login-go-home-image {
margin: auto; width: 40rpx;
position: absolute; height: 40rpx;
top: 0; margin: auto;
bottom: 0; position: absolute;
left: 0; top: 0;
right: 0; bottom: 0;
} left: 0;
right: 0;
/* #endif */ }
</style>
/* #endif */
</style>

View File

@@ -1,32 +1,32 @@
import { import {
getStore, getStore,
setStore setStore
} from '@/untils/store.js' } from '@/untils/store.js'
export default { export default {
state: { state: {
homeNavShow: getStore({ homeNavShow: getStore({
name: 'homeNavShow' name: 'homeNavShow'
}) !== false, }) !== false,
homeTitle: getStore({ homeTitle: getStore({
name: 'homeTitle' name: 'homeTitle'
}) || '德阳市智慧就业服务平台' }) || '管陶县智慧就业服务平台'
}, },
actions: {}, actions: {},
mutations: { mutations: {
SET_HOME_TITLE: (state, status) => { SET_HOME_TITLE: (state, status) => {
state.homeTitle = status state.homeTitle = status
setStore({ setStore({
name: 'homeTitle', name: 'homeTitle',
content: state.homeTitle content: state.homeTitle
}) })
}, },
SET_HOME_NAV_SHOW: (state, status) => { SET_HOME_NAV_SHOW: (state, status) => {
state.homeNavShow = status state.homeNavShow = status
setStore({ setStore({
name: 'homeNavShow', name: 'homeNavShow',
content: state.homeNavShow content: state.homeNavShow
}) })
}, },
} }
} }