flat: zanc

This commit is contained in:
Apcallover
2024-04-15 16:26:25 +08:00
parent 4afc5100ae
commit db4a3f118e
4 changed files with 140 additions and 142 deletions

View File

@@ -15,9 +15,9 @@
export default {
onLaunch: function(options) {
if (options.query.token) {
if (options.query.ticket) {
uni.reLaunch({
url: '/pages/login/blank?token=' + options.query.token
url: '/pages/login/blank?ticket=' + options.query.ticket
})
} else if (this.$store.state.user.token) {
this.$store.dispatch('startRefreshTokenTimer')

View File

@@ -1,70 +1,70 @@
import {
request
request
} from '@/untils/AxiosUtils.js';
import {
getStore
getStore
} from '@/untils/store.js'
import website from "@/config/website";
export const loginByUsername = (tenantId, username, password, type, key, code, token) => request({
url: '/api/jobslink-auth/oauth/token',
method: 'post',
headers: {
'Login-Type': 'Type-U',
'Captcha-Key': key,
'Captcha-Code': code,
'Platform-Id': getStore({
name: 'platformId'
}) || ''
},
params: {
tenantId,
username,
password,
grant_type: (website.captchaMode ? "captcha" : "password"),
scope: "all",
type,
token
},
export const loginByUsername = (tenantId, username, password, type, key, code, ticket) => request({
url: '/api/jobslink-auth/oauth/token',
method: 'post',
headers: {
'Login-Type': 'Type-U',
'Captcha-Key': key,
'Captcha-Code': code,
'Platform-Id': getStore({
name: 'platformId'
}) || ''
},
params: {
tenantId,
username,
password,
grant_type: (website.captchaMode ? "captcha" : "password"),
scope: "all",
type,
ticket
},
});
export const refreshToken = (refresh_token, tenantId) => request({
url: '/api/jobslink-auth/oauth/token',
method: 'post',
headers: {
'Tenant-Id': tenantId,
'Login-Type': 'Type-U',
},
params: {
tenantId,
refresh_token,
grant_type: "refresh_token",
scope: "all",
}
url: '/api/jobslink-auth/oauth/token',
method: 'post',
headers: {
'Tenant-Id': tenantId,
'Login-Type': 'Type-U',
},
params: {
tenantId,
refresh_token,
grant_type: "refresh_token",
scope: "all",
}
});
export const getCaptcha = () => request({
url: '/api/jobslink-auth/oauth/captcha',
method: 'get'
url: '/api/jobslink-auth/oauth/captcha',
method: 'get'
});
export const logout = () => request({
url: '/api/jobslink-auth/oauth/logout',
method: 'get'
url: '/api/jobslink-auth/oauth/logout',
method: 'get'
});
export const getUserInfo = () => request({
url: '/api/jobslink-auth/oauth/user-info',
method: 'get'
url: '/api/jobslink-auth/oauth/user-info',
method: 'get'
});
export const sendLogs = (list) => request({
url: '/api/jobslink-auth/oauth/logout',
method: 'post',
data: list
url: '/api/jobslink-auth/oauth/logout',
method: 'post',
data: list
});
export const clearCache = () => request({
url: '/api/jobslink-auth/oauth/clear-cache',
method: 'get'
url: '/api/jobslink-auth/oauth/clear-cache',
method: 'get'
});

View File

@@ -5,7 +5,7 @@
<script>
import {
mapGetters
mapGetters
} from 'vuex'
import website from '@/config/website.js'
export default {
@@ -13,45 +13,45 @@
return {}
},
computed: {
...mapGetters(['auth']),
...mapGetters(['auth']),
},
onLoad(options) {
uni.showLoading({
title: ''
})
if(options.token) {
if (options.ticket) {
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
username: 'admin',
password: "admin",
key: '',
code: '1111',
type: "account",
ticket: options.ticket,
tenantId: website.tenantId
}).then((resp) => {
console.log('123', resp)
this.$store.dispatch('refreshAuthState').then(() => {
that.loading = false
var auth = this.auth
this.$store.dispatch('refreshAuthState').then(() => {
that.loading = false
var auth = this.auth
uni.hideLoading()
if (!auth.bankCardState) {
that.goSign(0)
} else {
if (!auth.bankCardState) {
that.goSign(0)
} else {
uni.switchTab({
url: '/pages/index/index'
})
}
})
uni.switchTab({
url: '/pages/index/index'
})
}
})
}).catch((err) => {
this.loading = false
// this.$refs.code.refushCode()
this.loading = false
// this.$refs.code.refushCode()
});
} else {
uni.reLaunch({
url: '/pages/login/login'
url: '/pages/login/login'
})
}
},
@@ -64,7 +64,5 @@
</script>
<style lang="scss" scoped>
.app-container{
}
.app-container {}
</style>

View File

@@ -80,7 +80,7 @@ const user = {
return new Promise((resolve, reject) => {
loginByUsername(userInfo.tenantId, userInfo.username, md5(userInfo.password), userInfo.type,
userInfo.key,
userInfo.code, userInfo.token).then(res => {
userInfo.code, userInfo.ticket).then(res => {
const data = res.data;
if (data.error_description) {