Files
jobslink-user-clent/App.vue

143 lines
4.6 KiB
Vue
Raw Normal View History

2024-04-12 17:57:52 +08:00
<style lang="scss">
/* 注意要写在第一行同时给style标签加入lang="scss"属性 */
@import "@/uni_modules/uview-ui/index.scss";
</style>
<script>
import website from '@/config/website.js'
import {
mapGetters
} from 'vuex'
2024-10-09 10:14:51 +08:00
import {
GoLogin
} from '@/untils/AxiosUtils.js';
2024-04-12 17:57:52 +08:00
// #ifdef H5
import {
setPlatformByHostName
} from '@/untils/customized.js'
2024-10-09 10:14:51 +08:00
import {
reject
} from 'lodash';
2024-04-12 17:57:52 +08:00
// #endif
export default {
onLaunch: function(options) {
this.$store.dispatch('InitArea')
2024-04-16 10:41:03 +08:00
if (options.query.token) {
2024-10-09 10:14:51 +08:00
this.tokenlogin(options.query.token).then(() => {
this.$store.dispatch('getUserLocation')
this.$store.dispatch('getMobileIsCms')
this.$store.dispatch('getResumeInfo')
2024-04-12 17:57:52 +08:00
})
2024-10-09 10:14:51 +08:00
} else {
this.$store.dispatch('FedLogOut')
2024-04-12 17:57:52 +08:00
}
2024-10-09 10:14:51 +08:00
// 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')
// }
2024-04-12 17:57:52 +08:00
// #ifdef H5
// 企业定制
setPlatformByHostName(this.$store)
// #endif
},
onShow: function() {},
onHide: function() {},
computed: {
2024-10-09 10:14:51 +08:00
...mapGetters(['news', 'auth']),
2024-04-12 17:57:52 +08:00
allUnread() {
return this.news.allUnread
}
},
2024-04-14 16:13:44 +08:00
mounted() {
this.$config.showTitle && document.documentElement.style.setProperty('--hide-title', 'block');
},
2024-10-09 10:14:51 +08:00
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()
}
})
}
},
2024-04-12 17:57:52 +08:00
watch: {
allUnread(value) {
2024-04-30 11:20:41 +08:00
console.log('allUnread', value)
2024-10-09 10:14:51 +08:00
if (!this.$api.haslogin()) {} else if (value > 0) {
2024-04-12 17:57:52 +08:00
uni.showTabBarRedDot({
index: 2
})
uni.$once('newsReadChange', () => {
uni.showTabBarRedDot({
index: 2
})
})
} else {
uni.hideTabBarRedDot({
index: 2
})
uni.$once('newsReadChange', () => {
uni.hideTabBarRedDot({
index: 2
})
})
}
2024-10-09 10:14:51 +08:00
},
2024-04-12 17:57:52 +08:00
}
};
</script>
2024-04-14 16:13:44 +08:00
<style lang="scss">
2024-04-12 17:57:52 +08:00
/*每个页面公共css */
/* tabbar 字体大小 */
/* .uni-tabbar__label{
font-size: 14px !important;
} */
@font-face {
font-family: 'uicon-iconfont';
font-weight: mormal;
font-style: mormal;
src: url('/static/font/font_2225171_8kdcwk4po24.ttf') format('truetype');
}
2024-04-14 16:13:44 +08:00
:root {
--hide-title: none;
}
/* #ifdef H5 */
uni-page-head {
display: var(--hide-title);
}
/* #endif */
2024-04-12 17:57:52 +08:00
</style>