1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <script>
- import storage from '@/utils/storage'
- import constant from '@/utils/constant'
- import config from './config'
- import store from '@/store'
- import { getToken } from '@/utils/auth'
- import {
- getThemeColor
- } from '@/api/basics/miniApp.js'
- export default {
- onLaunch: function() {
- this.initApp()
- },
- methods: {
- // 初始化应用
- initApp() {
- // 初始化应用配置
- this.initConfig()
- // 检查用户登录状态
- //#ifdef H5
- this.checkLogin()
- //#endif
- this.handleGetThemeColor()
- },
- initConfig() {
- this.globalData.config = config
- },
- checkLogin() {
- if (!getToken()) {
- this.$tab.reLaunch('/pages/login')
- }
- },
- handleGetThemeColor(){
- const accountInfo = uni.getAccountInfoSync()
- getThemeColor(accountInfo.miniProgram.appId).then(res=>{
- if(res != "" && res != null && res != undefined )
- {
- this.globalData.config.appInfo.themeColor = res.data
- }
-
- })
- }
- }
- }
- </script>
- <style lang="scss">
- @import '@/static/scss/index.scss'
- </style>
|