Commit 58e7576b by 高淑倩

modified:histroy

parent 258bb80d
import { Http } from '@/http' import { Http } from '@/http'
class Global extends Http { class Global extends Http {
getMenus(params) { getMenus(params) {
return this.get('getMenus', params) // return this.get('getMenus', params)
return this.get('securityManage/menuList!menuMapList.do', params)
} }
getProjectInfo() { getProjectInfo() {
return this.get('securityManage/menuList!getStoreInfo.do') return this.get('securityManage/menuList!getStoreInfo.do')
} }
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'
import { calcIndexPathByCurrentRouter } from '@/utils' import { calcIndexPathByCurrentRouter } from '@/utils'
import sidebarItem from '../sidebarItem' import sidebarItem from '../sidebarItem'
const CrossStorageClient = require('cross-storage').CrossStorageClient const CrossStorageClient = require('cross-storage').CrossStorageClient
const crmDomain = location.hostname const crmDomain = location.hostname
const crossStorage = new CrossStorageClient(`${crmDomain}/hub.jsp`, { const crossStorage = new CrossStorageClient(`${crmDomain}/hub.jsp`, {
...@@ -48,6 +49,7 @@ const crossStorage = new CrossStorageClient(`${crmDomain}/hub.jsp`, { ...@@ -48,6 +49,7 @@ const crossStorage = new CrossStorageClient(`${crmDomain}/hub.jsp`, {
frameId: 'storageFrame', frameId: 'storageFrame',
}) })
const logo = require('@/assets/images/sidebar/logo-blue.png') const logo = require('@/assets/images/sidebar/logo-blue.png')
export default { export default {
data() { data() {
return { return {
...@@ -85,16 +87,12 @@ export default { ...@@ -85,16 +87,12 @@ export default {
methods: { methods: {
handleOpen() { handleOpen() {
const currentIndexPath = [this.firstIndex, this.secondIndex, this.thirdIndex] const currentIndexPath = [this.firstIndex, this.secondIndex, this.thirdIndex]
console.log(currentIndexPath)
const menus = this.$refs.menu const menus = this.$refs.menu
console.log(menus)
this.$nextTick(() => { this.$nextTick(() => {
if (currentIndexPath.join('-') === this.currentPath.join('-')) { if (currentIndexPath.join('-') === this.currentPath.join('-')) {
menus.open(this.secondIndex) menus.open(this.secondIndex)
console.log('open')
} else { } else {
menus.close(this.secondIndex) menus.close(this.secondIndex)
console.log('close')
} }
}) })
}, },
...@@ -106,9 +104,7 @@ export default { ...@@ -106,9 +104,7 @@ export default {
* 选择边测菜单主菜单 * 选择边测菜单主菜单
*/ */
choseMenu(selectItem, selectItemIndex) { choseMenu(selectItem, selectItemIndex) {
console.log('--', selectItem, selectItemIndex)
this.firstIndex = selectItemIndex this.firstIndex = selectItemIndex
console.log('current', this.firstIndex)
if (!this.sidebarUnfoldInfo) { if (!this.sidebarUnfoldInfo) {
this.toggleUnfold(true) this.toggleUnfold(true)
} }
...@@ -118,9 +114,9 @@ export default { ...@@ -118,9 +114,9 @@ export default {
**/ **/
choseChildrenItem(item) { choseChildrenItem(item) {
if (item.link) { if (item.link) {
this.$router.push({ // this.$router.push({
path: `/${item.link}`, // path: `/${item.link}`,
}) // })
} }
}, },
/** /**
...@@ -128,20 +124,27 @@ export default { ...@@ -128,20 +124,27 @@ export default {
* @param args * @param args
**/ **/
selectItemMenu(item) { selectItemMenu(item) {
console.log(item)
const firstIndex = this.firstIndex const firstIndex = this.firstIndex
if (firstIndex > -1) { if (firstIndex > -1) {
const [idx1, idx2] = item.split('-').reverse() const [idx1, idx2] = item.split('-').reverse()
const historyIndex = (firstIndex + '' + idx1 + '' + idx2 + '').split('').join(',')
const historyItemName = this.menus[firstIndex].children[idx1].children[idx2].name const historyItemName = this.menus[firstIndex].children[idx1].children[idx2].name
const time = this.$moment().format('YYYY-MM-DD hh:mm:ss') const time = this.$moment().format('YYYY-MM-DD hh:mm:ss')
const storeId = this.project.store_id const storeId = this.project.data.userDto.storeUserInfo.storeId
const menuHistoryJson = localStorage.getItem('menuHistoryJson' + storeId) const menuHistoryJson = localStorage.getItem('menuHistoryJson' + storeId) ? JSON.parse(localStorage.getItem('menuHistoryJson' + storeId)): []
? JSON.parse(localStorage.getItem('menuHistoryJson' + storeId))
: [] // 1.相同不添加 2.相同提到最前面
menuHistoryJson.push({ menuHistoryJson.forEach((item,i)=> {
if(item.index === historyIndex){
menuHistoryJson.splice(i, 1);
return false;
}
})
// 开头添加
menuHistoryJson.unshift({
name: historyItemName, name: historyItemName,
index: historyIndex,
time, time,
index: `${(firstIndex, idx1, idx2)}`,
}) })
localStorage.setItem('menuHistoryJson' + storeId, JSON.stringify(menuHistoryJson)) localStorage.setItem('menuHistoryJson' + storeId, JSON.stringify(menuHistoryJson))
crossStorage.onConnect().then(function() { crossStorage.onConnect().then(function() {
...@@ -150,7 +153,6 @@ export default { ...@@ -150,7 +153,6 @@ export default {
} }
}, },
toggleUnfold(...args) { toggleUnfold(...args) {
console.log(args)
if (!args.length) { if (!args.length) {
this.setSidebarUnfold(!this.sidebarUnfoldInfo) this.setSidebarUnfold(!this.sidebarUnfoldInfo)
} else { } else {
...@@ -164,9 +166,9 @@ export default { ...@@ -164,9 +166,9 @@ export default {
this.unfoldBtn = true this.unfoldBtn = true
}, },
choseSubChildren(item) { choseSubChildren(item) {
this.$router.push({ // this.$router.push({
path: `/${item.link}`, // path: `/${item.link}`,
}) // })
}, },
getCurrentMenus(index) { getCurrentMenus(index) {
return this.menus[index] return this.menus[index]
......
...@@ -33,7 +33,8 @@ const api = axios.create({ ...@@ -33,7 +33,8 @@ const api = axios.create({
}) })
const mockApi = axios.create({ const mockApi = axios.create({
baseURL: 'http://rap2api.taobao.org/app/mock/115626/' // baseURL: 'http://rap2api.taobao.org/app/mock/115626/'
baseURL: 'http://testcenter.bigaka.net/b/'
}) })
api.interceptors.request.use(function (config) { api.interceptors.request.use(function (config) {
......
...@@ -12,7 +12,8 @@ export default new Router({ ...@@ -12,7 +12,8 @@ export default new Router({
component: () => import(/* webpackChunkName: 'wxlogin' */ '@/pages/login'), component: () => import(/* webpackChunkName: 'wxlogin' */ '@/pages/login'),
}, },
{ {
path: '/salesCenter/activity/lotteryActivity.do', // path: '/salesCenter/activity/lotteryActivity.do',
path: '/',
name: 'test', name: 'test',
component: () => import(/* web packChunkName: 'wxhome' */ '@/pages/home'), component: () => import(/* web packChunkName: 'wxhome' */ '@/pages/home'),
children: [ children: [
......
...@@ -19,12 +19,15 @@ const GET_PROJECT_INFO = 'GET_PROJECT_INFO' ...@@ -19,12 +19,15 @@ const GET_PROJECT_INFO = 'GET_PROJECT_INFO'
// //
const CALC_TOUTER_INDEX = 'CALC_TOUTER_INDEX' const CALC_TOUTER_INDEX = 'CALC_TOUTER_INDEX'
const HEADER_HISTORY = 'HEADER_HISTORY'
const state = { const state = {
menus: [], menus: [],
editMenus: false, editMenus: false,
projectInfo: null, projectInfo: null,
currentPath: [], currentPath: [],
sidebarUnfold: true // false:边侧菜单收缩, true:边侧菜单展开 sidebarUnfold: true, // false:边侧菜单收缩, true:边侧菜单展开
headerHistory: []
} }
const actions = { const actions = {
...@@ -83,6 +86,16 @@ const getters = { ...@@ -83,6 +86,16 @@ const getters = {
} }
const mutations = { const mutations = {
[HEADER_HISTORY](state, history) {
state.headerHistory = [...history]
try {
if (localStorage.history) {
localStorage.history = history
}
} catch (error) {
}
},
[GET_MEUMS](state, menus) { [GET_MEUMS](state, menus) {
state.menus = [...menus] state.menus = [...menus]
}, },
......
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