flat: 国庆节暂存

This commit is contained in:
史典卓
2024-10-09 10:14:51 +08:00
parent 6504a558ac
commit a4ffe68ec2
32 changed files with 2663 additions and 2135 deletions

69
App.vue
View File

@@ -7,26 +7,42 @@
import {
mapGetters
} from 'vuex'
import {
GoLogin
} from '@/untils/AxiosUtils.js';
// #ifdef H5
import {
setPlatformByHostName
} from '@/untils/customized.js'
import {
reject
} from 'lodash';
// #endif
export default {
onLaunch: function(options) {
this.$store.dispatch('InitArea')
if (options.query.token) {
uni.reLaunch({
url: '/pages/login/blank?token=' + options.query.token
this.tokenlogin(options.query.token).then(() => {
this.$store.dispatch('getUserLocation')
this.$store.dispatch('getMobileIsCms')
this.$store.dispatch('getResumeInfo')
})
} else if (this.$store.state.user.token) {
this.$store.dispatch('startRefreshTokenTimer')
this.$store.dispatch('startRefreshNewsTimer')
this.$store.dispatch('refreshAuthState')
this.$store.dispatch('getUserLocation')
this.$store.dispatch('getMobileIsCms')
} else {
this.$store.dispatch('FedLogOut')
}
// if (options.query.token) {
// // uni.reLaunch({
// // url: '/pages/login/blank?token=' + options.query.token
// // })
// this.tokenlogin(options.query.token)
// } else if (this.$api.haslogin()) {
// this.$store.dispatch('startRefreshTokenTimer')
// this.$store.dispatch('startRefreshNewsTimer')
// this.$store.dispatch('refreshAuthState')
// this.$store.dispatch('getUserLocation')
// this.$store.dispatch('getMobileIsCms')
// }
// #ifdef H5
// 企业定制
setPlatformByHostName(this.$store)
@@ -35,7 +51,7 @@
onShow: function() {},
onHide: function() {},
computed: {
...mapGetters(['news']),
...mapGetters(['news', 'auth']),
allUnread() {
return this.news.allUnread
}
@@ -43,10 +59,41 @@
mounted() {
this.$config.showTitle && document.documentElement.style.setProperty('--hide-title', 'block');
},
methods: {
tokenlogin(token) {
return new Promise((resolve, reject) => {
uni.showLoading({
title: '登录中'
})
if (token) {
const that = this
this.$store.dispatch("LoginByUsername", {
username: 'admin',
password: "admin",
key: '',
code: '1111',
type: "account",
token: token,
tenantId: website.tenantId
}).then((resp) => {
this.$store.dispatch('refreshAuthState').then(() => {
uni.hideLoading()
resolve()
})
}).catch((err) => {
uni.hideLoading()
});
} else {
GoLogin()
}
})
}
},
watch: {
allUnread(value) {
console.log('allUnread', value)
if (!this.$store.state.user.token) {} else if (value > 0) {
if (!this.$api.haslogin()) {} else if (value > 0) {
uni.showTabBarRedDot({
index: 2
})
@@ -65,7 +112,7 @@
})
})
}
}
},
}
};
</script>