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