Commit 806d3bce by 高淑倩

vuexhistory&&stateMsg

parent 258bb80d
import { Http } from '@/http'
class Global extends Http {
getMenus(params) {
return this.get('getMenus', params)
// return this.get('getMenus', params)
return this.get('securityManage/menuList!menuMapList.do', params)
}
getProjectInfo() {
return this.get('securityManage/menuList!getStoreInfo.do')
}
......
......@@ -41,6 +41,7 @@
import { mapGetters, mapActions } from 'vuex'
import { calcIndexPathByCurrentRouter } from '@/utils'
import sidebarItem from '../sidebarItem'
const CrossStorageClient = require('cross-storage').CrossStorageClient
const crmDomain = location.hostname
const crossStorage = new CrossStorageClient(`${crmDomain}/hub.jsp`, {
......@@ -48,6 +49,7 @@ const crossStorage = new CrossStorageClient(`${crmDomain}/hub.jsp`, {
frameId: 'storageFrame',
})
const logo = require('@/assets/images/sidebar/logo-blue.png')
export default {
data() {
return {
......@@ -85,16 +87,12 @@ export default {
methods: {
handleOpen() {
const currentIndexPath = [this.firstIndex, this.secondIndex, this.thirdIndex]
console.log(currentIndexPath)
const menus = this.$refs.menu
console.log(menus)
this.$nextTick(() => {
if (currentIndexPath.join('-') === this.currentPath.join('-')) {
menus.open(this.secondIndex)
console.log('open')
} else {
menus.close(this.secondIndex)
console.log('close')
}
})
},
......@@ -106,9 +104,7 @@ export default {
* 选择边测菜单主菜单
*/
choseMenu(selectItem, selectItemIndex) {
console.log('--', selectItem, selectItemIndex)
this.firstIndex = selectItemIndex
console.log('current', this.firstIndex)
if (!this.sidebarUnfoldInfo) {
this.toggleUnfold(true)
}
......@@ -118,9 +114,9 @@ export default {
**/
choseChildrenItem(item) {
if (item.link) {
this.$router.push({
path: `/${item.link}`,
})
// this.$router.push({
// path: `/${item.link}`,
// })
}
},
/**
......@@ -128,29 +124,45 @@ export default {
* @param args
**/
selectItemMenu(item) {
console.log(item)
const firstIndex = this.firstIndex
if (firstIndex > -1) {
const [idx1, idx2] = item.split('-').reverse()
const historyItemName = this.menus[firstIndex].children[idx1].children[idx2].name
const [idx1, idx2] = item.split('-').reverse()
const historyIndex = (firstIndex + '' + idx1 + '' + idx2 + '').split('').join(',')
const historyItemName = this.menus[firstIndex].children[idx1].children[idx2].name
const time = this.$moment().format('YYYY-MM-DD hh:mm:ss')
const storeId = this.project.store_id
const menuHistoryJson = localStorage.getItem('menuHistoryJson' + storeId)
? JSON.parse(localStorage.getItem('menuHistoryJson' + storeId))
: []
menuHistoryJson.push({
const storeId = this.project.data.userDto.storeUserInfo.storeId
const menuHistoryJson = localStorage.getItem('menuHistoryJson' + storeId) ? JSON.parse(localStorage.getItem('menuHistoryJson' + storeId)): []
// 1.相同不添加 2.相同提到最前面
menuHistoryJson.forEach((item,i)=> {
if(item.index === historyIndex){
menuHistoryJson.splice(i, 1);
return false;
}
})
// 开头添加
menuHistoryJson.unshift({
name: historyItemName,
index: historyIndex,
time,
index: `${(firstIndex, idx1, idx2)}`,
})
localStorage.setItem('menuHistoryJson' + storeId, JSON.stringify(menuHistoryJson))
})
let list = [...menuHistoryJson]
if (list.length > 15) {
list = list.slice(0, 15)
}
this.$store.commit('MENU_HISTORY_JSON', {
name:'menuHistoryJson' + storeId,
value: JSON.stringify(list)
})
localStorage.setItem('menuHistoryJson' + storeId, JSON.stringify(list))
crossStorage.onConnect().then(function() {
return crossStorage.set('menuHistoryJson' + storeId, JSON.stringify(menuHistoryJson))
return crossStorage.set('menuHistoryJson' + storeId, JSON.stringify(list))
})
}
},
toggleUnfold(...args) {
console.log(args)
if (!args.length) {
this.setSidebarUnfold(!this.sidebarUnfoldInfo)
} else {
......@@ -164,9 +176,9 @@ export default {
this.unfoldBtn = true
},
choseSubChildren(item) {
this.$router.push({
path: `/${item.link}`,
})
// this.$router.push({
// path: `/${item.link}`,
// })
},
getCurrentMenus(index) {
return this.menus[index]
......
......@@ -31,9 +31,9 @@ axios.interceptors.response.use(function (response) {
const api = axios.create({
baseURL: config.base
})
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) {
......
......@@ -5,7 +5,7 @@
<span class="gray"><span class="star-red">*</span> 推送名称仅供数据中心操作记录查询,您推送的会员将不会看到此信息。</span>
</el-form-item>
<el-form-item label="推送名称">
<el-input v-model.trim="form.name" placeholder="请输入推送名称,10字以内"></el-input>
<el-input v-model.trim="form.name" maxlength="10" placeholder="请输入推送名称,10字以内"></el-input>
</el-form-item>
<el-form-item label="选择推送素材" class="step-choose">
<span class="gray"><span class="star-red">*</span> 推送素材需前往<a href="#">微信公众平台</a>-管理-素材管理维护。</span>
......
......@@ -22,7 +22,7 @@
</span>
<span class="detail-title result-add">推送成功:</span> {{item.sentCount}}
</span>
<span v-if="item.status !== -1 && item.status !==0 && item.status !==1" class="detail-title">失败原因: {{item.status}}</span>
<span v-if="item.status === -1" class="detail-title">失败原因: <span style="color:red">{{item.statusMsg}}</span> </span>
<el-button class="fr" slot="reference" v-if="item.scope === 0">全体推送</el-button>
<el-popover placement="right" title="标签" width="200" trigger="click" v-if="item.scope === 1">
<div>
......
......@@ -19,12 +19,21 @@ const GET_PROJECT_INFO = 'GET_PROJECT_INFO'
//
const CALC_TOUTER_INDEX = 'CALC_TOUTER_INDEX'
const HEADER_HISTORY = 'HEADER_HISTORY'
const MENU_HISTORY_JSON = 'MENU_HISTORY_JSON'
const state = {
menus: [],
editMenus: false,
projectInfo: null,
currentPath: [],
sidebarUnfold: true // false:边侧菜单收缩, true:边侧菜单展开
sidebarUnfold: true, // false:边侧菜单收缩, true:边侧菜单展开
headerHistory: [],
menuHistoryJson: {
name: '',
value: []
}
}
const actions = {
......@@ -83,6 +92,31 @@ const getters = {
}
const mutations = {
[MENU_HISTORY_JSON](state, history) {
const {name, value} = history
// 判断是否是数组
let list = Array.isArray(value) ? value : JSON.parse(value)
// 取前15条
if (list.length > 15) {
list = list.slice(0, 15)
}
state.menuHistoryJson = {
name,
value: list
}
// 存入localStorage
localStorage.setItem(name, list)
},
[HEADER_HISTORY](state, history) {
state.headerHistory = [...history]
try {
if (localStorage.history) {
localStorage.history = history
}
} catch (error) {
}
},
[GET_MEUMS](state, 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