| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <script>
- import { getUserInfo } from '@/utils/auth'
- import { CheckAttendance } from '@/api/mine.js'
- import $tab from '@/plugins/tab.js'
- export default {
- onLaunch: function () {
- console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!')
- this.initApp()
- console.log('App Launch')
- },
- onShow: function () {
- console.log('App Show')
- },
- onHide: function () {
- console.log('App Hide')
- },
- methods: {
- // 初始化应用
- initApp() {
- // 初始化应用配置
- // this.initConfig()
- // 检查用户登录状态
- this.checkLogin()
- },
- checkLogin() {
- const user = getUserInfo()
- if (!getUserInfo()) {
- $tab.reLaunch('/pages/login')
- } else {
- const now = new Date()
- const params = {
- universalid: user.useId,
- rizi: (now.getFullYear()) + '-' + (now.getMonth() + 1) + '-' + (now.getDate())
- }
- CheckAttendance(params).then(({ returnParams }) => { // 获取当天考勤信息
- if (returnParams.list.length) {
- // 已签到 跳转消息页面
- $tab.reLaunch('/pages/message/index')
- } else {
- // 未签到 跳转考勤页面
- $tab.reLaunch('/pages/message/index?to=clockIn')
- }
- })
- }
- }
- }
- }
- </script>
- <style lang="scss">
- /*每个页面公共css */
- @import '@/uni_modules/uni-scss/index.scss';
- /* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
- @import '@/common/uni.css';
- /* #ifndef APP-NVUE */
- @import '@/static/font/customicons.css';
- /* uParse富文本框渲染 样式 */
- @import url("/components/gaoyia-parse/parse.css");
- // 设置整个项目的背景色
- page {
- background-color: #f5f5f5;
- }
- /* #endif */
- .example-info {
- font-size: 14px;
- color: #333; padding: 10px;
- }
- </style>
|