flat: 123
This commit is contained in:
32
App.vue
32
App.vue
@@ -3,6 +3,7 @@
|
||||
@import "@/uni_modules/uview-ui/index.scss";
|
||||
</style>
|
||||
<script>
|
||||
import website from '@/config/website.js'
|
||||
import {
|
||||
mapGetters
|
||||
} from 'vuex'
|
||||
@@ -13,8 +14,35 @@
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
if (this.$store.state.user.token) {
|
||||
onLaunch: function(options) {
|
||||
console.log(options.query)
|
||||
if(options.query.token) {
|
||||
const { token } = options
|
||||
this.$store.dispatch("LoginByUsername", {
|
||||
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'
|
||||
})
|
||||
}
|
||||
})
|
||||
}).catch((err) => {
|
||||
this.loading = false
|
||||
// this.$refs.code.refushCode()
|
||||
});
|
||||
} else if (this.$store.state.user.token) {
|
||||
this.$store.dispatch('startRefreshTokenTimer')
|
||||
this.$store.dispatch('startRefreshNewsTimer')
|
||||
this.$store.dispatch('refreshAuthState')
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
} from '@/untils/store.js'
|
||||
import website from "@/config/website";
|
||||
|
||||
export const loginByUsername = (tenantId, username, password, type, key, code) => request({
|
||||
export const loginByUsername = (tenantId, username, password, type, key, code, token) => request({
|
||||
url: '/api/jobslink-auth/oauth/token',
|
||||
method: 'post',
|
||||
headers: {
|
||||
@@ -24,6 +24,9 @@ export const loginByUsername = (tenantId, username, password, type, key, code) =
|
||||
grant_type: (website.captchaMode ? "captcha" : "password"),
|
||||
scope: "all",
|
||||
type
|
||||
},
|
||||
data: {
|
||||
token
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@
|
||||
icon:'none',
|
||||
})
|
||||
} else {
|
||||
debugger
|
||||
var that = this
|
||||
this.loading = true
|
||||
this.$store.dispatch("LoginByUsername", {
|
||||
|
||||
@@ -301,6 +301,7 @@ const news = {
|
||||
commit,
|
||||
dispatch
|
||||
}) {
|
||||
console.log('触发2')
|
||||
dispatch('newsInit').then(() => {
|
||||
startRefreshToken(dispatch);
|
||||
})
|
||||
|
||||
@@ -283,6 +283,7 @@ const news = {
|
||||
stopRefreshToken();
|
||||
},
|
||||
startRefreshNewsTimer({ state, commit, dispatch }) {
|
||||
console.log('触发1')
|
||||
dispatch("newsInit").then(() => {
|
||||
startRefreshToken(dispatch);
|
||||
});
|
||||
|
||||
@@ -75,7 +75,7 @@ const user = {
|
||||
}, userInfo) {
|
||||
return new Promise((resolve, reject) => {
|
||||
loginByUsername(userInfo.tenantId, userInfo.username, md5(userInfo.password), userInfo.type, userInfo.key,
|
||||
userInfo.code).then(res => {
|
||||
userInfo.code, userInfo.token).then(res => {
|
||||
const data = res.data;
|
||||
if (data.error_description) {
|
||||
uni.showToast({
|
||||
@@ -88,6 +88,7 @@ const user = {
|
||||
commit('SET_TENANT_ID', data.tenant_id);
|
||||
commit('SET_USER_INFO', data);
|
||||
dispatch('refreshAuthState')
|
||||
cons.log('开始1')
|
||||
dispatch('startRefreshNewsTimer')
|
||||
startRefreshToken();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ module.exports = {
|
||||
proxy: {
|
||||
'/api': {
|
||||
// target: 'http://192.168.3.108:8000', // 本地服务接口地址
|
||||
target: 'http://192.168.3.173:8000', // 本地服务接口地址
|
||||
target: 'http://192.168.3.112:8000', // 本地服务接口地址
|
||||
// target: 'http://10.165.0.173:8000', // 本地服务接口地址
|
||||
ws: true,
|
||||
pathRewrite: {
|
||||
'^/api': '/'
|
||||
|
||||
Reference in New Issue
Block a user