导航标签缓存

This commit is contained in:
2024-04-18 15:11:55 +08:00
parent 92ef6a11d4
commit 3f98374988
5 changed files with 101 additions and 12 deletions

View File

@@ -286,6 +286,46 @@
}
}
,{
"path" : "pages/SecondPhase/production/SboProdProgress",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/SecondPhase/production/SboProcess",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/SecondPhase/production/BakeProcess",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/SecondPhase/production/ManmadeBake",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/SecondPhase/production/SurfaceProcess",
"style" :
{
"navigationStyle": "custom"
}
}
],
"globalStyle": {
// "pageOrientation": "landscape",

View File

@@ -31,7 +31,7 @@
</view>
</view>
<view class="sec_menu_wraper" :class="show ? 'popshow' : 'pophide'">
<view class="line"></view>
<view class="pop-title">{{title}}</view>
<view class="sec_menu_w">
<view class="sec_menu-item" :style="{'background-image': 'url(' + require('../../static/image/menu/' + icon + '.png') + ')'}" v-for="(e, i) in secM" :key="i" @click="toPage2(e)">
<view class="menu-name_inner" :class="'bgc_' + (i + 1)">{{e.title}}</view>
@@ -43,8 +43,8 @@
</template>
<script>
import {authority} from '@/utils/getData2.js'
// import {authority} from '@/utils/mork2.js'
// import {authority} from '@/utils/getData2.js'
import {authority} from '@/utils/mork2.js'
export default {
data() {
return {
@@ -55,7 +55,8 @@
show: false,
secM: [],
icon: '',
tab: 1
title: '',
tab: this.$store.getters.navTab
};
},
created () {
@@ -70,7 +71,11 @@
if (res.code === '1') {
this.menuList1 = [...res.result.rf_menu0.sonTree]
this.menuList2 = [...res.result.rf_menu1.sonTree]
this.menuList = [...this.menuList1]
if (this.tab === 2) {
this.menuList = [...this.menuList2]
} else {
this.menuList = [...this.menuList1]
}
} else {
uni.showToast({
title: res.desc,
@@ -87,12 +92,14 @@
this.menuList = [...this.menuList2]
this.tab = 2
}
this.$store.dispatch('setNavTab', type)
},
toPage1 (e) {
if (e.sonTree.length > 0) {
this.show = true
this.secM = e.sonTree
this.icon = e.path
this.title = e.title
}
},
toPage2 (e) {
@@ -229,11 +236,9 @@
border-radius 10rpx
padding 10rpx
overflow hidden
.line
_wh(90rpx, 10rpx)
background-color #e0e0e1
border-radius 4rpx
margin 20rpx auto 40rpx
.pop-title
margin 60rpx 38rpx 0 38rpx
_font(30rpx, 60rpx, #000,700,center)
.cancel
_wh(calc(100% - 76rpx), 100rpx)
margin 0 auto

39
vuex/modules/data.js Normal file
View File

@@ -0,0 +1,39 @@
import * as types from '../types'
const state = {
publicObj: '',
publicArr: '',
navTab: uni.getStorageSync('navTab') || 1,
}
const getters = {
publicObj: state => state.publicObj,
publicArr: state => state.publicArr,
navTab: state => state.navTab
}
const actions = {
setPublicObj ({commit}, res) {
commit(types.PUBLIC_OBJ, res)
},
setPublicArr ({commit}, res) {
commit(types.PUBLIC_ARR, res)
},
setNavTab ({commit}, res) {
commit(types.SET_NAV_TAB, res)
}
}
const mutations = {
[types.PUBLIC_OBJ] (state, res) {
state.publicObj = res
},
[types.PUBLIC_ARR] (state, res) {
state.publicArr = res
},
[types.SET_NAV_TAB] (state, res) {
state.navTab = res
}
}
export default {
state,
getters,
actions,
mutations
}

View File

@@ -2,11 +2,13 @@ import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import data from './modules/data'
Vue.use(Vuex)
export default new Vuex.Store({
modules: {
user
user,
data
}
})

View File

@@ -6,4 +6,7 @@ export const DEL_LOGIN_NAME = 'DEL_LOGIN_NAME'
export const COM_CONFIG = 'COM_CONFIG'
export const SAVE_USER_INFO = 'SAVE_USER_INFO'
export const DEL_USER_INFO = 'DEL_USER_INFO'
export const SAVE_TOKEN = 'SAVE_TOKEN'
export const SAVE_TOKEN = 'SAVE_TOKEN'
export const PUBLIC_OBJ = 'PUBLIC_OBJ'
export const PUBLIC_ARR = 'PUBLIC_ARR'
export const SET_NAV_TAB = 'SET_NAV_TAB'