1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import {
- getToken,
- setToken
- } from "@/utils/common.js"
- const state = {
- token: getToken(),
- headHeight: '100rpx',
- statusBarHeight: 0,
- windowInfo:{},
- PageContentHeight:0,
- // 涨跌颜色
- stocksColor: 'green_rise', // green_rise:绿涨红跌 , red_rise:绿跌红涨
- }
- const mutations = {
- SET_statusBarHeight: (state, Height) => {
- state.statusBarHeight = Height
- },
- SET_windowInfo: (state, info) => {
- state.windowInfo = info;
- const headH = state.headHeight.split('rpx')[0];
- const contentHeight = info.windowHeight - state.statusBarHeight - uni.upx2px(headH);
- state.PageContentHeight = contentHeight;
- console.log('PageContentHeight ' , contentHeight)
-
-
- },
- SET_STOCKS_COLOR: (state, code) => {
- state.stocksColor = code
- },
- SET_TOKEN: (state, token) => {
- setToken(token)
- state.token = token
- },
- // PageContentHeight: (state, contentHeight) => {
- // state.PageContentHeight = contentHeight
- // },
- }
- const actions = {
- // setToken = (token) => {
- // console.log('token = ' , token)
- // }
- setToken({
- commit
- }, token) {
- commit('SET_TOKEN', token)
- },
- }
- export default {
- namespaced: true,
- state,
- mutations,
- actions
- }
|