@@ -15,37 +15,39 @@ | |||||
</template> | </template> | ||||
<script> | <script> | ||||
import {mapState,mapMutations} from 'vuex' | |||||
export default { | export default { | ||||
name: 'App', | name: 'App', | ||||
data() { | data() { | ||||
return { | return { | ||||
footBarList: [ | |||||
{ | |||||
iconY: require('./assets/images/home-y.png'), | |||||
iconN: require('./assets/images/home-n.png'), | |||||
checked: true, | |||||
title: '首页', | |||||
path: 'home', | |||||
}, | |||||
/* { | |||||
iconY: require('./assets/images/bill1.png'), | |||||
iconN: require('./assets/images/bill.png'), | |||||
checked: false, | |||||
title: '账单', | |||||
path: 'vueView', | |||||
}, */ | |||||
{ | |||||
iconY: require('./assets/images/user-y.png'), | |||||
iconN: require('./assets/images/user-n.png'), | |||||
checked: false, | |||||
title: '我的', | |||||
path: 'person', | |||||
}, | |||||
] | |||||
// footBarList: [ | |||||
// { | |||||
// iconY: require('./assets/images/home-y.png'), | |||||
// iconN: require('./assets/images/home-n.png'), | |||||
// checked: true, | |||||
// title: '首页', | |||||
// path: 'home', | |||||
// }, | |||||
// /* { | |||||
// iconY: require('./assets/images/bill1.png'), | |||||
// iconN: require('./assets/images/bill.png'), | |||||
// checked: false, | |||||
// title: '账单', | |||||
// path: 'vueView', | |||||
// }, */ | |||||
// { | |||||
// iconY: require('./assets/images/user-y.png'), | |||||
// iconN: require('./assets/images/user-n.png'), | |||||
// checked: false, | |||||
// title: '我的', | |||||
// path: 'person', | |||||
// }, | |||||
// ] | |||||
}; | }; | ||||
}, | }, | ||||
computed: { | computed: { | ||||
...mapState(['footBarList']), | |||||
// 动态设置过渡样式 | // 动态设置过渡样式 | ||||
direction: function() { | direction: function() { | ||||
const currentPath = this.$route.path; | const currentPath = this.$route.path; | ||||
@@ -72,17 +74,19 @@ export default { | |||||
} | } | ||||
}, | }, | ||||
created() { | created() { | ||||
let index = sessionStorage.getItem('navIndex') != 'undefined' ? sessionStorage.getItem('navIndex') : 0 | |||||
this.selRouter(index) | |||||
// let index = sessionStorage.getItem('navIndex') != 'undefined' ? sessionStorage.getItem('navIndex') : 0 | |||||
this.selRouter(0) | |||||
console.log(this.selRouter,this.footBarList,"??|"); | |||||
}, | }, | ||||
methods: { | methods: { | ||||
selRouter(index) { | |||||
sessionStorage.setItem('navIndex',index) | |||||
this.footBarList.map(item => { | |||||
item.checked = false; | |||||
}) | |||||
this.footBarList[index].checked = true; | |||||
}, | |||||
...mapMutations(['selRouter']), | |||||
// selRouter(index) { | |||||
// sessionStorage.setItem('navIndex',index) | |||||
// this.footBarList.map(item => { | |||||
// item.checked = false; | |||||
// }) | |||||
// this.footBarList[index].checked = true; | |||||
// }, | |||||
} | } | ||||
@@ -14,9 +14,40 @@ export default new Vuex.Store({ | |||||
token: '461675506000465920', | token: '461675506000465920', | ||||
merchant_id:'', | merchant_id:'', | ||||
merchant_id_scan:'', | merchant_id_scan:'', | ||||
footBarList: [//底部导航 | |||||
{ | |||||
iconY: require('@/assets/images/home-y.png'), | |||||
iconN: require('@/assets/images/home-n.png'), | |||||
checked: true, | |||||
title: '首页', | |||||
path: 'home', | |||||
}, | |||||
/* { | |||||
iconY: require('./assets/images/bill1.png'), | |||||
iconN: require('./assets/images/bill.png'), | |||||
checked: false, | |||||
title: '账单', | |||||
path: 'vueView', | |||||
}, */ | |||||
{ | |||||
iconY: require('@/assets/images/user-y.png'), | |||||
iconN: require('@/assets/images/user-n.png'), | |||||
checked: false, | |||||
title: '我的', | |||||
path: 'person', | |||||
}, | |||||
], | |||||
}, | }, | ||||
mutations: { | mutations: { | ||||
selRouter(state,index) { | |||||
sessionStorage.setItem('navIndex',index) | |||||
state.footBarList.map(item => { | |||||
item.checked = false; | |||||
}) | |||||
state.footBarList[index].checked = true; | |||||
}, | |||||
setToken (state, token) { | setToken (state, token) { | ||||
state.token = token | state.token = token | ||||
}, | }, | ||||
@@ -69,7 +69,7 @@ import { Toast } from "vant"; | |||||
import {formatDate} from '@/filters' | import {formatDate} from '@/filters' | ||||
// 组件 | // 组件 | ||||
export default { | export default { | ||||
name: 'page-index', | |||||
// name: 'page-index', | |||||
components: { | components: { | ||||
}, | }, | ||||
@@ -45,13 +45,14 @@ | |||||
</div> | </div> | ||||
<button class="logout-btn">退出登录</button> | |||||
<button class="logout-btn" @click="eliminate">退出登录</button> | |||||
</div> | </div> | ||||
</template> | </template> | ||||
<script type="text/babel"> | <script type="text/babel"> | ||||
// 组件 | // 组件 | ||||
import {mapMutations} from 'vuex' | |||||
export default { | export default { | ||||
name: 'page-index', | name: 'page-index', | ||||
components: { | components: { | ||||
@@ -77,6 +78,7 @@ export default { | |||||
}, | }, | ||||
methods: { | methods: { | ||||
...mapMutations(['selRouter']), | |||||
goToPage(index) { | goToPage(index) { | ||||
this.$router.push({ | this.$router.push({ | ||||
path: this.routerUrl[index-1], | path: this.routerUrl[index-1], | ||||
@@ -86,6 +88,13 @@ export default { | |||||
}) | }) | ||||
console.log(index) | console.log(index) | ||||
}, | }, | ||||
//回到首页清除路由记录 | |||||
eliminate(){ | |||||
this.selRouter(0) | |||||
this.$router.replace({ | |||||
path:'/' | |||||
}) | |||||
}, | |||||
/** | /** | ||||
* 检查用户是否有权限修改收款账户 | * 检查用户是否有权限修改收款账户 | ||||
*/ | */ | ||||