文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit f25720f5 by Wang Yuhang

修复导航栏bug

parent 81916a6b
var baseURL = 'http://47.92.1.107/api'
var baseURL = 'http://localhost:9100/api'
export {
baseURL
......
......@@ -22,16 +22,21 @@
</template>
<script>
const indexs = new Set(['/taskhall', '/ongoing', '/releasetask', '/completed',
'/check', '/publishtask', '/userhome', '/'])
export default {
name: 'nav-header',
data () {
return {
activeIndex: '/taskhall'
}
},
computed: {
userType () {
return this.$store.state.userInfo && this.$store.state.userInfo.identity === 1
},
activeIndex () {
return this.$store.state.activeIndex
}
},
watch: {
......@@ -39,7 +44,7 @@ export default {
'$route' (to, from) {
var index = to.fullPath.indexOf('/', 1)
var toPath = to.fullPath.substring(0, index === -1 ? to.fullPath.length : index + 1)
this.activeIndex = toPath
if (indexs.has(toPath)) { this.$store.commit('setActiveIndex', toPath) }
}
},
methods: {
......
......@@ -7,27 +7,16 @@ Vue.use(Vuex)
export default new Vuex.Store({
state: {
userInfo: null
// imageData: null,
// layerData: null
userInfo: null,
activeIndex: '/taskhall'
},
mutations: {
setUserInfo (state, userInfo) {
state.userInfo = userInfo
},
setActiveIndex (state, activeIndex) {
state.activeIndex = activeIndex
}
// setImageData (state, imageData) {
// state.imageData = imageData
// },
// clearImageData (state) {
// state.imageData = null
// },
// setLayerData (state, layerData) {
// state.layerData = layerData
// },
// clearlayerData (state) {
// state.layerData = null
// }
},
actions: {
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment