flat: 登陆
This commit is contained in:
28
App.vue
28
App.vue
@@ -15,33 +15,11 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function(options) {
|
onLaunch: function(options) {
|
||||||
console.log(options.query)
|
|
||||||
if(options.query.token) {
|
if(options.query.token) {
|
||||||
const { token } = options
|
uni.reLaunch({
|
||||||
this.$store.dispatch("LoginByUsername", {
|
url: '/pages/login/blank?token=' + options.query.token
|
||||||
username: 'admin',
|
|
||||||
password: "admin",
|
|
||||||
key: '',
|
|
||||||
code: '1111',
|
|
||||||
type: "account",
|
|
||||||
token: options.query.token,
|
|
||||||
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'
|
|
||||||
})
|
})
|
||||||
}
|
this.$store.commit('changeLoginType', options.query.token)
|
||||||
})
|
|
||||||
}).catch((err) => {
|
|
||||||
this.loading = false
|
|
||||||
// this.$refs.code.refushCode()
|
|
||||||
});
|
|
||||||
} else if (this.$store.state.user.token) {
|
} else if (this.$store.state.user.token) {
|
||||||
this.$store.dispatch('startRefreshTokenTimer')
|
this.$store.dispatch('startRefreshTokenTimer')
|
||||||
this.$store.dispatch('startRefreshNewsTimer')
|
this.$store.dispatch('startRefreshNewsTimer')
|
||||||
|
|||||||
11
pages.json
11
pages.json
@@ -358,6 +358,17 @@
|
|||||||
"navigationBarTitleText": "推送政策",
|
"navigationBarTitleText": "推送政策",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/login/blank",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
|
"navigationBarTextStyle": "white",
|
||||||
|
"navigationBarShadow": {
|
||||||
|
"colorType": "none"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"subPackages": [
|
"subPackages": [
|
||||||
|
|||||||
@@ -275,8 +275,15 @@
|
|||||||
swiperType:1,//轮播图类型:冀联:1、衡水3
|
swiperType:1,//轮播图类型:冀联:1、衡水3
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad: function() {},
|
onLoad: function(options) { },
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
|
console.log(this.$store.state.auth.loginType, 'index')
|
||||||
|
// if(this.$store.state.auth.loginType !== 0) {
|
||||||
|
// uni.reLaunch({
|
||||||
|
// url: '/pages/login/blank'
|
||||||
|
// })
|
||||||
|
// return
|
||||||
|
// }
|
||||||
if (!this.$store.state.user.token) {
|
if (!this.$store.state.user.token) {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/login/login'
|
url: '/pages/login/login'
|
||||||
|
|||||||
70
pages/login/blank.vue
Normal file
70
pages/login/blank.vue
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
mapGetters
|
||||||
|
} from 'vuex'
|
||||||
|
import website from '@/config/website.js'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['auth']),
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '登陆中'
|
||||||
|
})
|
||||||
|
if(options.token) {
|
||||||
|
const that = this
|
||||||
|
console.log(options)
|
||||||
|
this.$store.dispatch("LoginByUsername", {
|
||||||
|
username: 'admin',
|
||||||
|
password: "admin",
|
||||||
|
key: '',
|
||||||
|
code: '1111',
|
||||||
|
type: "account",
|
||||||
|
token: options.token,
|
||||||
|
tenantId: website.tenantId
|
||||||
|
}).then((resp) => {
|
||||||
|
console.log('123', resp)
|
||||||
|
this.$store.dispatch('refreshAuthState').then(() => {
|
||||||
|
that.loading = false
|
||||||
|
var auth = this.auth
|
||||||
|
uni.hideLoading()
|
||||||
|
if (!auth.bankCardState) {
|
||||||
|
that.goSign(0)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch((err) => {
|
||||||
|
this.loading = false
|
||||||
|
// this.$refs.code.refushCode()
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
method: {
|
||||||
|
callback(token) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.app-container{
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -31,7 +31,8 @@ const auth = {
|
|||||||
}) || false,
|
}) || false,
|
||||||
authInfo: getStore({
|
authInfo: getStore({
|
||||||
name: 'authInfo'
|
name: 'authInfo'
|
||||||
}) || []
|
}) || [],
|
||||||
|
loginType: 0, // 0
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
//刷新token
|
//刷新token
|
||||||
@@ -109,6 +110,9 @@ const auth = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
changeLoginType(state, payload) {
|
||||||
|
state.loginType = payload
|
||||||
|
},
|
||||||
SET_AUTH_LABOR: (state, status) => {
|
SET_AUTH_LABOR: (state, status) => {
|
||||||
state.laborState = status
|
state.laborState = status
|
||||||
setStore({
|
setStore({
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ const user = {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
loginByUsername(userInfo.tenantId, userInfo.username, md5(userInfo.password), userInfo.type, userInfo.key,
|
loginByUsername(userInfo.tenantId, userInfo.username, md5(userInfo.password), userInfo.type, userInfo.key,
|
||||||
userInfo.code, userInfo.token).then(res => {
|
userInfo.code, userInfo.token).then(res => {
|
||||||
|
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
if (data.error_description) {
|
if (data.error_description) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -88,7 +89,6 @@ const user = {
|
|||||||
commit('SET_TENANT_ID', data.tenant_id);
|
commit('SET_TENANT_ID', data.tenant_id);
|
||||||
commit('SET_USER_INFO', data);
|
commit('SET_USER_INFO', data);
|
||||||
dispatch('refreshAuthState')
|
dispatch('refreshAuthState')
|
||||||
cons.log('开始1')
|
|
||||||
dispatch('startRefreshNewsTimer')
|
dispatch('startRefreshNewsTimer')
|
||||||
startRefreshToken();
|
startRefreshToken();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user