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 class="info_market">
<!-- <view class="info_market">
<view class="market_top">
<view class="top_log"></view>
<view class="next_market" @click="navTo('/pages/market/market')">去市场</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> -->
</view>
</view>
</view> -->
<view class="latestMission">
<view class="cardTips"
@@ -289,18 +289,11 @@
policyContentList: [],
policyType: 1,
swiperType: 1,
isResume: true,
};
},
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() {
if (!this.$store.state.user.token) {
@@ -319,6 +312,18 @@
this.download()
this.getSwiperList()
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() {
uni.setNavigationBarTitle({

View File

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