Commit c0eceec1 by 高淑倩

modify:apimode

parents 327ad411 6f792df8
......@@ -8,5 +8,12 @@
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"]
"plugins": [
"syntax-flow",
"transform-vue-jsx",
"babel-plugin-transform-class-properties",
"babel-plugin-syntax-flow",
"babel-plugin-transform-flow-strip-types",
"transform-runtime"
]
}
\ No newline at end of file
......@@ -16,18 +16,20 @@ module.exports = {
'standard',
],
globals: {
$: true
$: true,
},
// required to lint *.vue files
plugins: ['vue'],
plugins: ['vue', 'html', 'flowtype-errors'],
// add your custom rules here
rules: {
'flowtype-errors/show-errors': 2,
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-useless-escape': 'off',
'no-tabs': 'off',
'no-mixed-spaces-and-tabs': 0,
'comma-dangle': 0,
'space-before-function-paren': [0, 'always'],
},
......
[ignore]
.*/test/.*
.*/build/.*
.*/config/.*
[include]
[libs]
[options]
module.file_ext=.vue
module.file_ext=.js
module.file_ext=.scss
\ No newline at end of file
......@@ -6,5 +6,5 @@ module.exports = merge(prodEnv, {
'NODE_ENV': "'development'",
'host': "'//localhost'",
'project': "'crm/vue'",
'requestUrl': "'mina'"
'requestUrl': "'crm'"
})
module.exports = {
"host": "'//wxapp.hotwind.net'",
'project': "'crm/vue'",
'requestUrl': "'mina'"
'requestUrl': "'crm'"
}
module.exports = {
"host": "'//wxapp.hotwind.net'",
'project': "'crm/vue'",
'requestUrl': "'mina'"
'requestUrl': "'crm'"
}
module.exports = {
"host": "'//10.0.16.178:8080'",
'project': "'crm/vue'",
'requestUrl': "'mina'"
host: "'//10.0.16.178:8080'",
project: "'crm/vue'",
requestUrl: "'crm'",
}
......@@ -10,30 +10,37 @@
"lint": "eslint --fix --ext .js,.vue src",
"build:dev": "node build/build.js --env=dev",
"build:uat": "node build/build.js --env=uat",
"build": "node build/build.js --env=prod"
"build": "node build/build.js --env=prod",
"flow": "flow"
},
"dependencies": {
"animate.css": "^3.7.0",
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"cross-storage": "^1.0.0",
"echarts": "^4.2.0-rc.2",
"element-ui": "^2.4.9",
"jquery": "^3.3.1",
"moment": "^2.22.2",
"rxjs": "^6.3.3",
"underscore": "^1.9.1",
"v-charts": "^1.19.0",
"velocity-animate": "^1.5.0",
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"vue-rx": "^6.0.1",
"vuex": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^8.2.1",
"babel-eslint": "^8.2.6",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-flow": "^6.18.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
......@@ -42,17 +49,22 @@
"compression-webpack-plugin": "^1.1.12",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"eslint": "^4.15.0",
"eslint": "^4.19.1",
"eslint-config-standard": "^10.2.1",
"eslint-config-vue": "^2.0.2",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-flowtype-errors": "^3.6.0",
"eslint-plugin-html": "^4.0.6",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"eslint-plugin-vue": "^4.7.1",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"flow-bin": "^0.86.0",
"flow-webpack-plugin": "^1.2.0",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"less": "^3.8.1",
......
<template>
<div id="app">
<div id="app" v-if="project">
<router-view />
</div>
</template>
<script>
import {mapGetters, mapActions} from 'vuex'
export default {
name: 'App'
name: 'App',
created () {
this.getProjectInfo()
},
computed: {
...mapGetters({
menus: 'getMenus',
project: 'getProjectInfo'
})
},
methods:{
...mapActions([
'getProjectInfo'
])
}
}
</script>
......@@ -15,6 +31,6 @@ export default {
/** 重置element-ui theme **/
$--color-primary: #337ab7 !default;
$--font-path: '~element-ui/lib/theme-chalk/fonts';
$--font-path: "~element-ui/lib/theme-chalk/fonts";
@import "~element-ui/packages/theme-chalk/src/index";
</style>
import { Http } from '@/http'
class Global extends Http {
getMenus (params) {
getMenus(params) {
return this.get('getMenus', params)
}
getProjectInfo() {
return this.get('securityManage/menuList!getStoreInfo.do')
}
}
export default new Global(true)
......@@ -34,8 +34,8 @@
.opration-list--item.clearfix(v-for='opration in oprations ')
.name.fl(@click="gotoPage(opration.link)") {{opration.name}}
a.link(slot="reference")
img.user-img(':src'="user.headerImage")
span.user-name {{user.name}}
img.user-img(':src'="project.user_logo")
span.user-name {{project.StoreShortName}}
i.fa.fa-angle-down
li.nav-item.fr
a.link(@click="showMessage()")
......@@ -48,7 +48,7 @@
popper-class="helpers-popper",
trigger="click")
.helpers-body
.helper-list--item.clearfix(v-for='help in helpers ')
.helper-list--item.clearfix(v-for='help in helpers ',@click="handlerHelperClick(help)")
i.fa.fl.helper-item--icon(:class="help.icon",:style="help.style",style={width:'22px',height:'22px'})
.name.fl {{help.name}}
a.link(slot="reference")
......@@ -278,9 +278,12 @@
}
</style>
<script>
import {setCookie, getCookie} from '@/utils'
import { mapGetters, mapActions } from 'vuex'
import message from './message'
require('@/lib/slimscroll/slimscroll')
export default {
name: 'headerNav',
data () {
......@@ -288,22 +291,22 @@ export default {
showMenusPanel: false,
showEditMenusPanel: false,
showMessagePanelcontrol: null,
currentIndexPath: [1,2,0],
currentSelectIndex: -1,
oprations: [{name: '修改密码', link: 'http://www.baidu.com'}, {name: '安全退出', link: 'http://www.baidu.com'}],
helpers: [{
name: '点击联系客服',
link:'http://wpa.qq.com/msgrd?v=3&uin=2844377940&site=qq&menu=yes',
icon: 'fa-qq',
style: {background: '#ff9293', color: '#fff'}
}, {name: '使用帮助',
link:'http://help.bigaka.com/',
style: {background: '#40b0ff', color: '#fff'},
icon: 'fa-info'},
{name: '舞象客服',
link:'http://help.bigaka.com/',
style: {background: '#e0e0e0', color: '#000'},
icon: 'fa-user-circle-o'}],
user: {
headerImage: 'http://photo.bigaka.com/photos//2132/201805/56741525659969939_144_144.jpg',
name: '测试商户组'
},
historys: [{'name': '自动标签', 'index': '1,0,2', 'time': '2018-11-01 10:06:07'}, {'name': '快速查询', 'index': '1,0,0', 'time': '2018-10-31 17:17:09'}, {'name': '营销推送', 'index': '2,0,0', 'time': '2018-10-31 17:12:53'}, {'name': '会员圈选', 'index': '1,0,1', 'time': '2018-10-31 16:52:47'}, {'name': '概览', 'index': '0,0,0', 'time': '2018-10-31 13:31:59'}, {'name': '趋势', 'index': '0,1,0', 'time': '2018-10-29 15:52:31'}, {'name': '会员卡设置', 'index': '1,1,0', 'time': '2018-10-29 15:51:00'}, {'name': '生日营销(new)', 'index': '2,0,2', 'time': '2018-10-29 15:50:18'}]
}
},
......@@ -329,6 +332,7 @@ export default {
}
},
...mapGetters({
project: 'getProjectInfo',
menus: 'getMenus',
editMenus: 'getEditMenus',
sidebarUnfoldInfo: 'getSidebarUnfoldInfo'
......@@ -338,41 +342,16 @@ export default {
message
},
mounted () {
this.$nextTick(() => {
this.initSlimscroll()
})
const index = getCookie('cur_menu_index')
const indexPath = index.split(',').reverse()
this.currentSelectIndex = indexPath[1]
},
methods: {
...mapActions([
'showEditMenus',
'hideEditMenus'
]),
initSlimscroll () {
$('.message-panel.el-notification').slimScroll({
width: '100%', // 可滚动区域宽度
height: '100%', // 可滚动区域高度
size: '10px', // 滚动条宽度,即组件宽度
color: '#000', // 滚动条颜色
position: 'right', // 组件位置:left/right
distance: '0px', // 组件与侧边之间的距离
start: 'top', // 默认滚动位置:top/bottom
opacity: 0.4, // 滚动条透明度
alwaysVisible: true, // 是否 始终显示组件
disableFadeOut: false, // 是否 鼠标经过可滚动区域时显示组件,离开时隐藏组件
railVisible: true, // 是否 显示轨道
railColor: '#333', // 轨道颜色
railOpacity: 0.2, // 轨道透明度
railDraggable: true, // 是否 滚动条可拖动
railClass: 'slimScrollRail', // 轨道div类名
barClass: 'slimScrollBar', // 滚动条div类名
wrapperClass: 'slimScrollDiv', // 外包div类名
allowPageScroll: true, // 是否 使用滚轮到达顶端/底端时,滚动窗口
wheelStep: 20, // 滚轮滚动量
touchScrollStep: 200, // 滚动量当用户使用手势
borderRadius: '7px', // 滚动条圆角
railBorderRadius: '7px' // 轨道圆角
})
},
clickItem () {
console.log('this is header index %o', this)
},
......@@ -415,10 +394,16 @@ export default {
formatPathString (...args) {
return args.join('-')
},
handlerHelperClick (item) {
this.$router.push({
path: `/${item.link}`
})
},
gotoPage (link) {
if (link) {
location.href = link
}
this.$router.push({
path: `/${link}`
})
}
}
}
......
......@@ -4,12 +4,9 @@
<div id="pullDown">
<span class="pullDownIcon" style="display: none"></span><span class="pullDownLabel">释放刷新</span>
</div>
<ul id="thelist"
@mouseup="handlerMouseUp($event)"
@mousedown="handlerMousedown($event)"
>
<li v-for="(item, index) in items" class="message-item"
:key="index" @click="openMessageContent(item,$event)">
<ul id="thelist">
<li v-for="(item, index) in items" :data-index="index" class="message-item"
:key="index">
<div class="message-item-title">{{item.title}}</div>
<div class="message-desc">{{item.content_text}}</div>
<div class="message-desc">{{item.push_time | fomatDate}}</div>
......@@ -23,11 +20,14 @@
</template>
<script>
import {Observable} from 'rxjs'
import {throttleTime, switchMap, filter} from 'rxjs/operators'
require('@/lib/iscroll/iscroll')
const IScroll = window.iScroll
let pullDownEl, pullDownOffset, pullUpEl, pullUpOffset
export default {
name: 'message',
subscriptions () {},
data () {
return {
items: [],
......@@ -48,7 +48,10 @@ export default {
computed: {},
mounted () {
this.$nextTick(() => {
this.loaded()
this.bindMessageTapEvent()
setTimeout(() => {
this.initSlimscroll()
},100)
})
},
methods: {
......@@ -78,7 +81,7 @@ export default {
this.isLastPage = true
}
}
this.myScroll.refresh()
this.loaded()
},
loaded () {
pullDownEl = document.getElementById('pullDown')
......@@ -86,8 +89,19 @@ export default {
pullUpEl = document.getElementById('pullUp')
pullUpOffset = pullUpEl.offsetHeight
this.myScroll = new IScroll('wrapper', {
probeType: 2, // probeType:1对性能没有影响。在滚动事件被触发时,滚动轴是不是忙着做它的东西。probeType:2总执行滚动,除了势头,反弹过程中的事件。这类似于原生的onscroll事件。probeType:3发出的滚动事件与到的像素精度。注意,滚动被迫requestAnimationFrame(即:useTransition:假)。
scrollbars: true, // 有滚动条
mouseWheel: true, // 允许滑轮滚动
fadeScrollbars: true, // 滚动时显示滚动条,默认影藏,并且是淡出淡入效果
bounce: true, // 边界反弹
interactiveScrollbars: true, // 滚动条可以拖动
shrinkScrollbars: 'scale', // 当滚动边界之外的滚动条是由少量的收缩。'clip' or 'scale'.
click: true, // 允许点击事件
tap: true, // 允许tap事件
keyBindings: true, // 允许使用按键控制
momentum: true, // 允许有惯性滑动,
scrollbarClass: 'myScrollbar' /* 重要样式 */,
useTransition: false /* 此属性不知用意,本人从true改为false */,
useTransition: true /* 此属性不知用意,本人从true改为false */,
topOffset: pullDownOffset,
onRefresh: () => {
this.$nextTick(() => {
......@@ -100,6 +114,7 @@ export default {
? '没有更多数据'
: '释放加载'
}
})
},
onScrollMove: function () {
......@@ -150,12 +165,38 @@ export default {
false
)
},
handlerMouseUp(event) {
handlerKeydown(event) {
this.eventMouseStarEl = event.target
this.eventType = ''
console.log(event)
},
handlerMousedown(event) {
bindMessageTapEvent () {
const clickEl$ = Observable.create(observer => {
$('body').on('click','.message-item',(event) => {
// const item = $(event.currentTarget)
observer.next(event)
})
})
const mousemoveEl$ = Observable.create(observer => {
$('body').on('mousemove','.message-item',(event) => {
// const item = $(event.currentTarget)
observer.next(event)
})
})
mousemoveEl$.pipe(
switchMap(ev => clickEl$),
throttleTime(300),
filter(ev => ev.type === 'click')
)
.subscribe(event => {
const index = $(event.currentTarget).data('index')
const item = this.items[index]
this.openMessageContent(item)
},(ev) => {
console.log(ev)
})
},
handlerKeypress(event) {
this.eventMouseEndEl = event.target
console.log(event)
if (this.eventMouseStarEl && this.eventMouseStarEl === this.eventMouseEndEl) {
......@@ -163,7 +204,7 @@ export default {
} else {
this.eventType = 'mousemove'
}
this.eventMouseStarEl = this.eventMouseEndEl = null
// this.eventMouseStarEl = this.eventMouseEndEl = null
},
pullDownAction () {
this.items = []
......@@ -176,18 +217,80 @@ export default {
this.getListDataFromNet()
},
initSlimscroll () {
$('#wrapper').slimScroll({
width: '100%', // 可滚动区域宽度
height: '700px', // 可滚动区域高度
size: '10px', // 滚动条宽度,即组件宽度
color: '#000', // 滚动条颜色
position: 'right', // 组件位置:left/right
distance: '0px', // 组件与侧边之间的距离
start: 'top', // 默认滚动位置:top/bottom
opacity: 0.4, // 滚动条透明度
alwaysVisible: true, // 是否 始终显示组件
disableFadeOut: false, // 是否 鼠标经过可滚动区域时显示组件,离开时隐藏组件
railVisible: true, // 是否 显示轨道
railColor: '#333', // 轨道颜色
railOpacity: 0.2, // 轨道透明度
railDraggable: true, // 是否 滚动条可拖动
railClass: 'slimScrollRail', // 轨道div类名
barClass: 'slimScrollBar', // 滚动条div类名
wrapperClass: 'slimScrollDiv', // 外包div类名
allowPageScroll: true, // 是否 使用滚轮到达顶端/底端时,滚动窗口
wheelStep: 20, // 滚轮滚动量
touchScrollStep: 200, // 滚动量当用户使用手势
borderRadius: '7px', // 滚动条圆角
railBorderRadius: '7px' // 轨道圆角
})
},
openMessageContent (item) {
console.log(arguments)
if (this.eventType === 'click') {
this.$alert(`${item.content}`, '', {
this.$alert(`<div><session class="model-body">${item.content}</session></div>`, '', {
dangerouslyUseHTMLString: true,
customClass: 'message-panel'
customClass: 'message-panel',
confirmButtonText: '知道了',
title:item.title,
callback:(action) => {
this.axios.post('http://testcenter.bigaka.net/b/store/notice!addNoticeUserRelationAction.do', {
params:{
"userId":"3956",
"noticeId":"68"
}
})
}
})
this.$nextTick(() => {
$(".el-message-box__message")
.slimscroll({
height: '530px',
distance: '10px',
alwaysVisible: false,
railVisible: true,
railColor: '#e1e1e1',
railOpacity: 1,
size: '6px',
color: '#77c2f7',
opacity: 1
})
})
}
}
}
</script>
<style>
.message-panel .el-message-box__title {
min-height: 16.428571429px;
padding: 15px;
border-bottom: 1px solid #e5e5e5;
}
.model-body {
position: relative;
overflow: hidden;
width: auto;
height: 500px;
}
</style>
<style scoped>
#wrapper {
......
<template lang='pug'>
.sidebar-wrapper
.control(':class'="{open:unfold,close:!unfold}")
.control(':class'="{open:sidebarUnfoldInfo,close:!sidebarUnfoldInfo}")
.sidebar('@mouseover'="showUnfoldBtn()",'@mouseout'="hiddenUnfoldBtn()")
.logo
img(':src'="logo")
.item('v-if'="menus.length",'v-for'="(item,itemIndex) in menus" ,':key'="item.id",'@click'='choseMenu(item,itemIndex)',':class'="{active:currentMenusIndex === itemIndex}")
.item('v-if'="menus.length",'v-for'="(item,itemIndex) in menus" ,':key'="item.id",'@click'='choseMenu(item,itemIndex)',':class'="{active:currentMainMenuIndex === itemIndex}")
sidebar-item&attributes({
':icon':'item.ico',
':link':'item.link',
......@@ -17,119 +17,190 @@
})
transition(name="fade",mode="out-in",appear)
.childrens-meuns('v-show'="sidebarUnfoldInfo",'v-if'="currentMenus")
.children-item('v-for'="(it,index) in currentMenus.children",':key'="it.id",'@click'="choseChildrenItem(it)")
.children-item
el-menu&attributes({
'ref':"menu",
'default-active':"2",
'class':"el-menu-vertical",
'background-color':"#374A5E",
'text-color':"#fff",
'unique-opened':true,
'active-text-color':"#fff",
'mode':'vertical'
'mode':'vertical',
'@select':"selectItemMenu"
})
el-submenu(':index'="index | toString",'@select'="selectItemMenu")
el-submenu(':index'="index | toString",'v-for'="(it,index) in currentMenus.children",':key'="it.id",'@click'="choseChildrenItem(it)")
template(slot="title")
span {{it.name}}
template
el-menu-item(':index'="idx | pipeString(index)",'v-if'="it.children",'v-for'="(i,idx) in it.children",':key'="i.id",'@click'="choseSubChildren(i)")
el-menu-item(':index'="idx | pipeString(index)",'v-if'="it.children",'v-for'="(i,idx) in it.children",':key'="i.id",@click="choseSubChildren(i)")
span.menu-item-name {{i.name}}
.arrow-tip(':class'="{'left-l':!sidebarUnfoldInfo,'left-ll':sidebarUnfoldInfo}",'@click'="toggleUnfold()",'v-show'="unfoldBtn")
img(class='icon-arrow',':class'="{right:!sidebarUnfoldInfo}","src"='@/assets/images/sidebar/left-arrow-gray.png')
</template>
<script>
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`, {
timeout: 5000,
frameId: 'storageFrame',
})
const logo = require('@/assets/images/sidebar/logo-blue.png')
export default {
data () {
data() {
return {
collapse: false,
currentRouteIndex: 0,
logo,
unfold: false, // 水平展开
// unfold: false, // 水平展开
unfoldBtn: false, // 展开按钮
currentMenusIndex: -1
currentMainMenuIndex: 0, //mainIndex
}
},
filters: {
toString (value) {
toString(value) {
return value + ''
},
pipeString (...args) {
pipeString(...args) {
return args.join('-')
}
},
},
components: {
sidebarItem
sidebarItem,
},
mounted () {},
computed: {
...mapGetters({menus: 'getMenus', sidebarUnfoldInfo: 'getSidebarUnfoldInfo'}),
currentMenus: {
get () {
const currentIndex = this.currentMenusIndex
return currentIndex === -1 ? this.getCurrentMenus(0) : this.getCurrentMenus(currentIndex)
...mapGetters({
menus: 'getMenus',
currentPath: 'getCurrentPath',
project: 'getProjectInfo',
sidebarUnfoldInfo: 'getSidebarUnfoldInfo',
}),
currentMenusIndex() {
let res = -1
if (this.currentPath && this.currentPath.length) {
res = this.currentPath[0]
this.$nextTick(() => {
this.handleOpen()
})
}
return res
},
currentMenus: {
get() {
// const currentIndex = this.currentMenusIndex
const currentIndex = this.currentMainMenuIndex
const currentMenus = currentIndex === -1 ? this.getCurrentMenus(0) : this.getCurrentMenus(currentIndex)
this.$nextTick(() => {
if (this.currentMenus) {
this.handleOpen()
// console.log('---', this.currentMenus)
}
})
return currentMenus
},
},
created () {
},
mounted() {},
methods: {
handleOpen() {
const menus = this.$refs.menu
const openIndex = this.currentPath.length === 3 ? this.currentPath[1] : 0
console.log('openIndex', openIndex)
menus.open(openIndex)
},
// calcRouter(menus) {
// const currentRoute = location.href
// const indexPath = calcIndexPathByCurrentRouter(menus, currentRoute)
// this.selectIndexPath = indexPath
// console.log(this.selectIndexPath)
// },
// 隐藏边侧栏,边侧栏最小化
handerNoSidebar() {
console.log('handerNoSidebar')
this.setSidebarUnfold(false)
},
/**
* 选择边测菜单主菜单
*/
choseMenu (selectItem, selectItemIndex) {
this.currentMenusIndex = selectItemIndex
if (!this.unfold) {
choseMenu(selectItem, selectItemIndex) {
this.currentMainMenuIndex = selectItemIndex
if (!this.sidebarUnfoldInfo) {
this.toggleUnfold(true)
}
},
/**
* 二级菜单
**/
choseChildrenItem (...args) {
console.log('this is sidebar 二级菜单 %o', args)
choseChildrenItem(item) {
if (item.link) {
this.$router.push({
path: `/${item.link}`,
})
}
},
/**
* 三级菜单
* @param args
**/
selectItemMenu (item) {
console.log('this is sidebar 三级菜单 %o', item)
selectItemMenu(item) {
console.log(item)
const currentMenusIndex = this.currentMenusIndex
if (currentMenusIndex > -1) {
const [idx1, idx2] = item.split('-').reverse()
const historyItemName = this.menus[currentMenusIndex].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({
name: historyItemName,
time,
index: `${(currentMenusIndex, idx1, idx2)}`,
})
localStorage.setItem('menuHistoryJson' + storeId, JSON.stringify(menuHistoryJson))
crossStorage.onConnect().then(function() {
return crossStorage.set('menuHistoryJson' + storeId, JSON.stringify(menuHistoryJson))
})
}
},
toggleUnfold (...args) {
toggleUnfold(...args) {
console.log(args)
if (!args.length) {
this.unfold = !this.unfold
this.setSidebarUnfold(!this.sidebarUnfoldInfo)
} else {
this.unfold = args[0]
this.setSidebarUnfold(args[0])
}
this.setSidebarUnfold(this.unfold)
},
hiddenUnfoldBtn () {
hiddenUnfoldBtn() {
this.unfoldBtn = false
},
showUnfoldBtn () {
showUnfoldBtn() {
this.unfoldBtn = true
},
choseSubChildren (item) {
choseSubChildren(item) {
this.$router.push({
path: `/${item.link}`
path: `/${item.link}`,
})
},
getCurrentMenus (index) {
getCurrentMenus(index) {
return this.menus[index]
},
...mapActions(['setSidebarUnfold'])
}
...mapActions(['setSidebarUnfold']),
},
}
</script>
<style lang="stylus" scoped>
.sidebar-wrapper
.sidebar-wrapper
position relative
height 100px
display inline-block
z-index 100
.sidebar
.sidebar
position fixed
left 0
top 0
......@@ -144,7 +215,7 @@ export default {
content ''
background #2A3F54
z-index -1
.arrow-tip
.arrow-tip
position absolute
top 50%
width 48px
......@@ -152,7 +223,7 @@ export default {
line-height 48px
border-radius 50%
text-align center
background-color rgba(55, 74, 94, .5)
background-color rgba(55, 74, 94, 0.5)
transform translateX(-50%)
transition all 0.2s
cursor pointer
......@@ -161,22 +232,22 @@ export default {
left 70px
&.left-ll
left 240px
.icon-arrow
.icon-arrow
display inline-block
margin-left 15px
width 8px
&.right
transform rotateY(180deg)
.control
.control
visibility hidden
height 100px
&.close
width 70px
transition width ease-in-out .2s
transition width ease-in-out 0.2s
&.open
width 240px
transition width ease-in-out .2s
.logo
transition width ease-in-out 0.2s
.logo
text-overflow ellipsis
overflow hidden
font-weight 400
......@@ -191,14 +262,14 @@ export default {
padding-top 5px
img
width 60px
.item
.item
position relative
display block
cursor pointer
text-align center
& + &
margin-bottom 6px
.active::after
.active::after
display block
content ''
background #1ABB9C
......@@ -207,7 +278,7 @@ export default {
right 0
top 10px
height 47px
.childrens-meuns
.childrens-meuns
position absolute
top 0
left 70px
......@@ -219,19 +290,19 @@ export default {
.children-item
text-align left
margin-bottom 6px
.el-menu
.el-menu
border-right none
.el-submenu .el-menu-item
min-width auto
.el-menu-item
.el-menu-item
position relative
padding: 0 10px 0 36px
padding 0 10px 0 36px
box-sizing border-box
&::before
box-sizing border-box
background #425668
bottom auto
content ""
content ''
height 9px
left 18px
margin-top 20px
......@@ -244,11 +315,11 @@ export default {
box-sizing border-box
border-left 1px solid #425668
bottom 0
content ""
content ''
left 22px
position absolute
top 0
.menu-item-name
.menu-item-name
position relative
display block
font-weight 400
......
<template lang='pug'>
.sidebar-wrapper
.control(':class'="{open:sidebarUnfoldInfo,close:!sidebarUnfoldInfo}")
.sidebar('@mouseover'="showUnfoldBtn()",'@mouseout'="hiddenUnfoldBtn()")
.logo
img(':src'="logo")
.item('v-if'="menus.length",'v-for'="(item,itemIndex) in menus" ,':key'="item.id",'@click'='choseMenu(item,itemIndex)',':class'="{active:currentMenusIndex === itemIndex}")
sidebar-item&attributes({
':icon':'item.ico',
':link':'item.link',
':type':'item.type',
':id':'item.id',
':name':'item.name',
':pid':'item.pid',
':grade':'item.grade',
':sort':'item.sort'
})
transition(name="fade",mode="out-in",appear)
.childrens-meuns('v-show'="sidebarUnfoldInfo",'v-if'="currentMenus")
.children-item
el-menu&attributes({
'ref':"menu",
'default-active':"2",
'class':"el-menu-vertical",
'background-color':"#374A5E",
'text-color':"#fff",
'unique-opened':true,
'active-text-color':"#fff",
'mode':'vertical',
'@select':"selectItemMenu"
})
el-submenu(':index'="index | toString",'v-for'="(it,index) in currentMenus.children",':key'="it.id",'@click'="choseChildrenItem(it)")
template(slot="title")
span {{it.name}}
template
el-menu-item(':index'="idx | pipeString(index)",'v-if'="it.children",'v-for'="(i,idx) in it.children",':key'="i.id",@click="choseSubChildren(i)")
span.menu-item-name {{i.name}}
.arrow-tip(':class'="{'left-l':!sidebarUnfoldInfo,'left-ll':sidebarUnfoldInfo}",'@click'="toggleUnfold()",'v-show'="unfoldBtn")
img(class='icon-arrow',':class'="{right:!sidebarUnfoldInfo}","src"='@/assets/images/sidebar/left-arrow-gray.png')
</template>
<script>
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`, {
timeout: 5000,
frameId: 'storageFrame',
})
const logo = require('@/assets/images/sidebar/logo-blue.png')
export default {
data() {
return {
collapse: false,
logo,
// unfold: false, // 水平展开
unfoldBtn: false, // 展开按钮
}
},
filters: {
toString(value) {
return value + ''
},
pipeString(...args) {
return args.join('-')
},
},
components: {
sidebarItem,
},
computed: {
...mapGetters({
menus: 'getMenus',
currentPath: 'getCurrentPath',
project: 'getProjectInfo',
sidebarUnfoldInfo: 'getSidebarUnfoldInfo',
}),
currentMenusIndex() {
let res = -1
if (this.currentPath && this.currentPath.length) {
res = this.currentPath[0]
this.$nextTick(() => {
this.handleOpen()
})
}
return res
},
currentMenus: {
get() {
const currentIndex = this.currentMenusIndex
const currentMenus = currentIndex === -1 ? this.getCurrentMenus(0) : this.getCurrentMenus(currentIndex)
this.$nextTick(() => {
if (this.currentMenus) {
this.handleOpen()
}
})
return currentMenus
},
},
},
mounted() {},
methods: {
handleOpen() {
const menus = this.$refs.menu
const openIndex = this.currentPath.length === 3 ? this.currentPath[1] : 0
menus.open(openIndex)
},
calcRouter(menus) {
const currentRoute = location.href
const indexPath = calcIndexPathByCurrentRouter(menus, currentRoute)
this.selectIndexPath = indexPath
console.log(this.selectIndexPath)
},
// 隐藏边侧栏,边侧栏最小化
handerNoSidebar() {
console.log('handerNoSidebar')
this.setSidebarUnfold(false)
},
/**
* 选择边测菜单主菜单
*/
choseMenu(selectItem, selectItemIndex) {
console.log('--', selectItem, selectItemIndex)
this.currentMenusIndex = selectItemIndex
console.log('current', this.currentMenusIndex)
if (!this.sidebarUnfoldInfo) {
this.toggleUnfold(true)
}
},
/**
* 二级菜单
**/
choseChildrenItem(item) {
if (item.link) {
this.$router.push({
path: `/${item.link}`,
})
}
},
/**
* 三级菜单
* @param args
**/
selectItemMenu(item) {
console.log(item)
const currentMenusIndex = this.currentMenusIndex
if (currentMenusIndex > -1) {
const [idx1, idx2] = item.split('-').reverse()
const historyItemName = this.menus[currentMenusIndex].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({
name: historyItemName,
time,
index: `${(currentMenusIndex, idx1, idx2)}`,
})
localStorage.setItem('menuHistoryJson' + storeId, JSON.stringify(menuHistoryJson))
crossStorage.onConnect().then(function() {
return crossStorage.set('menuHistoryJson' + storeId, JSON.stringify(menuHistoryJson))
})
}
},
toggleUnfold(...args) {
console.log(args)
if (!args.length) {
this.setSidebarUnfold(!this.sidebarUnfoldInfo)
} else {
this.setSidebarUnfold(args[0])
}
},
hiddenUnfoldBtn() {
this.unfoldBtn = false
},
showUnfoldBtn() {
this.unfoldBtn = true
},
choseSubChildren(item) {
this.$router.push({
path: `/${item.link}`,
})
},
getCurrentMenus(index) {
return this.menus[index]
},
...mapActions(['setSidebarUnfold']),
},
}
</script>
<style lang="stylus" scoped>
.sidebar-wrapper
position relative
height 100px
display inline-block
z-index 100
.sidebar
position fixed
left 0
top 0
bottom 0
width 70px
&::after
position absolute
top 0
left 0
bottom 0
right 0
content ''
background #2A3F54
z-index -1
.arrow-tip
position absolute
top 50%
width 48px
height 48px
line-height 48px
border-radius 50%
text-align center
background-color rgba(55, 74, 94, 0.5)
transform translateX(-50%)
transition all 0.2s
cursor pointer
z-index -2
&.left-l
left 70px
&.left-ll
left 240px
.icon-arrow
display inline-block
margin-left 15px
width 8px
&.right
transform rotateY(180deg)
.control
visibility hidden
height 100px
&.close
width 70px
transition width ease-in-out 0.2s
&.open
width 240px
transition width ease-in-out 0.2s
.logo
text-overflow ellipsis
overflow hidden
font-weight 400
font-size 22px
width 100%
color #ECF0F1
line-height 59px
display block
height 65px
margin 10px auto
padding-left 5px
padding-top 5px
img
width 60px
.item
position relative
display block
cursor pointer
text-align center
& + &
margin-bottom 6px
.active::after
display block
content ''
background #1ABB9C
width 5px
position absolute
right 0
top 10px
height 47px
.childrens-meuns
position absolute
top 0
left 70px
bottom 0
width 170px
background #374A5E
z-index -1
zoom 1
.children-item
text-align left
margin-bottom 6px
.el-menu
border-right none
.el-submenu .el-menu-item
min-width auto
.el-menu-item
position relative
padding 0 10px 0 36px
box-sizing border-box
&::before
box-sizing border-box
background #425668
bottom auto
content ''
height 9px
left 18px
margin-top 20px
position absolute
right auto
width 9px
z-index 1
border-radius 50%
&::after
box-sizing border-box
border-left 1px solid #425668
bottom 0
content ''
left 22px
position absolute
top 0
.menu-item-name
position relative
display block
font-weight 400
font-size 10px
</style>
......@@ -93,10 +93,10 @@ export default {
data () {
return {
dialogFormVisible: false,
selectList: [],
tempSelectList: [],
quickItems: [],
tempQuickItems: [],
selectList: [], // 已选择的条目,存的是路径 ['1-1-0','1-1-1']
tempSelectList: [], // 没有点确定选择的临时条目,存的是路径 ['1-1-0','1-1-1']
quickItems: [], // 已选择的条目,存的是选择的对象 [{},{}]
tempQuickItems: [], // 没有点确定选择的临时条目,存的是选择的对象 [{},{}]
limitLength: 10,
isSure: false
}
......@@ -147,7 +147,7 @@ export default {
const totalLength = this.tempQuickItems.length + this.quickItems.length
if (this.limitLength < totalLength) {
this.$message({
message: '最多选择十个快捷菜单',
message: `最多选择${this.limitLength}个快捷菜单`,
type: 'warning'
})
return false
......@@ -168,15 +168,6 @@ export default {
this.tempQuickItems.slice(idx, 1)
}
}
},
handlerLength (length) {
if (this.limitLength < length) {
this.$message({
message: '最多选择十个快捷菜单',
type: 'warning'
})
return false
}
}
}
}
......
<template lang="pug">
.menus-templete
//- 快捷菜单设置菜单,有确定,取消按钮
el-row.meuns-nav
el-menu(@click="toggleMenus($event)")&attributes({
'default-active':"2",
......
......@@ -19,17 +19,30 @@ import VCharts from 'v-charts'
import plugins from './plugin'
import 'babel-polyfill'
import VueRx from 'vue-rx'
Vue.use(VueRx)
Vue.use(ElementUI)
Vue.use(VCharts)
Object.keys(plugins).forEach(key => {
const plugin = plugins[key]
Vue.use(plugin)
})
// 全局过滤器
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
Axios.defaults.withCredentials = true // 让ajax携带cookie
const AUTH_TOKEN = 'doX8dJusNpe3Tb77mzRhz2JgdCU'
Axios.defaults.headers.common['token'] = AUTH_TOKEN
// axios 全局注入, request
Axios.interceptors.request.use(
config => {
if (config.method === 'post') {
// config.data = qs.stringify(config.data)
config.headers['Content-Type'] = 'application/json'
}
return config
......@@ -39,22 +52,8 @@ Axios.interceptors.request.use(
}
)
Object.keys(plugins).forEach(key => {
const plugin = plugins[key]
Vue.use(plugin)
})
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
Vue.config.productionTip = false
Vue.prototype.axios = Axios
// Vue.prototype.$echarts = echarts
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
/* eslint-disable no-new */
new Vue({
......
......@@ -97,6 +97,8 @@
</div>
</template>
<script>
import api from '@/tool/api'
export default {
data() {
return {
......@@ -223,9 +225,10 @@ export default {
this.submitDialogVisible = false
this.save()
},
save() {
this.axios
.post('http://testcenter.bigaka.net/crm/back/wechat/msg-mass/save', {
// 确认推送
async save() {
await this.axios
.post(api.add.save, {
mediaId: this.currentImgId,
msgId: '',
scope: this.form.resource === '全体推送' ? '0' : '1',
......@@ -245,9 +248,9 @@ export default {
})
},
// tagcount
getTagCount() {
this.axios
.post('http://testcenter.bigaka.net/crm/back/wechat/msg-mass/tag-count', {
async getTagCount() {
await this.axios
.post(api.add.tagCount, {
tagIds: this.tagIds,
type: '1',
})
......@@ -257,9 +260,9 @@ export default {
})
},
// all
getTagCountAll() {
this.axios
.post('http://testcenter.bigaka.net/crm/back/wechat/msg-mass/tag-count', {
async getTagCountAll() {
await this.axios
.post(api.add.tagCount, {
tagIds: this.tagIdsList,
type: '1',
})
......@@ -269,8 +272,8 @@ export default {
})
},
// 初始化 taglist
getTagList() {
this.axios.post('http://testcenter.bigaka.net/crm/back/tag/customer-cache-list').then(res => {
async getTagList() {
await this.axios.post(api.add.customerCacheList).then(res => {
this.tagList = res.data
this.tagList.forEach(item => {
this.tagIdsList.push(item.tagId)
......@@ -280,10 +283,10 @@ export default {
})
},
// 图文推送预览人数
getViewCount() {
async getViewCount() {
this.isCount = true
this.axios
.post('http://testcenter.bigaka.net/crm/back/wechat/msg-mass/pre_view_count', {
await this.axios
.post(api.add.getPreViewCount, {
tagIds: this.tagIds,
})
.then(res => {
......
......@@ -67,12 +67,6 @@
</template>
<script>
export default {
data() {
return {}
},
components: {},
computed: {},
mounted() {},
methods: {
handleAddMaterial() {
this.$router.push('addmarketing')
......
......@@ -53,17 +53,6 @@
</div>
</div>
</template>
<script>
export default {
data() {
return {}
},
components: {},
computed: {},
mounted() {},
methods: {},
}
</script>
<style lang='stylus' scoped>
.marketing-title
height 177px
......
......@@ -15,7 +15,6 @@
</el-tabs>
</template>
<script>
import http from '@/tool/http'
import api from '@/tool/api'
import MateriaList from './MateriaList'
......@@ -53,10 +52,11 @@ export default {
created() {
// 初始化
this.getData()
// 点击
// 点击展示
// this.getDataList()
},
methods: {
// 短信
handleMsgSearch(e) {
this.handleGetSearchData(e)
},
......@@ -69,14 +69,15 @@ export default {
pageChange(pageNo) {
this.getTempList((this.pageNo = pageNo))
},
// 模板
handleSearch(e) {
this.handleGetSearchData(e)
},
handleReset(e) {
this.handleGetSearchData(e)
},
handleGetSearchData(params) {
this.axios.post('http://testcenter.bigaka.net/crm/back/wechat/msg-mass/list-data', params).then(res => {
async handleGetSearchData(params) {
await this.axios.post(api.getTempList, params).then(res => {
this.templist = res.data.result
this.msgList = res.data.result
})
......@@ -95,7 +96,7 @@ export default {
pageSize: 10,
}
this.loading = true
let getMaterialsRes = await http.post(params, api.getMaterialsList)
let getMaterialsRes = await this.axios.post(api.getMaterialsList, params)
if (getMaterialsRes.data.code === 0) {
this.imgList = getMaterialsRes.data.result.result
localStorage.materList = JSON.stringify(this.imgList)
......@@ -106,7 +107,7 @@ export default {
type,
mediaId: imgId,
}
let getPushRes = await http.post(params, api.getPushList)
let getPushRes = await this.axios.post(api.getPushList, params)
if (getPushRes.data.code === 0) {
this.loading = false
......@@ -115,7 +116,7 @@ export default {
let params = {
mediaId: imgId,
}
let getArticleRes = await http.post(params, api.getarticlesummary)
let getArticleRes = await this.axios.post(api.getarticlesummary, params)
if (getArticleRes.data.code === 0) {
// 素材总流量分析
......@@ -134,9 +135,9 @@ export default {
this.getMaterianDatail(this.mediaId)
},
// 获取图文素材列表
getDataList() {
this.axios
.post('http://testcenter.bigaka.net/crm/back/wechat/msg-mass/materials-list', {
async getDataList() {
await this.axios
.post(api.getMaterialsList, {
pageNo: 1,
pageSize: 10,
})
......@@ -148,9 +149,9 @@ export default {
})
},
// 推送列表
getPushDetail(id = this.mediaId) {
this.axios
.post('http://testcenter.bigaka.net/crm/back/wechat/msg-mass/medialist', {
async getPushDetail(id = this.mediaId) {
await this.axios
.post(api.getPushList, {
pageNo: 1,
pageSize: 10,
type: 1,
......@@ -169,13 +170,13 @@ export default {
pageNo: 1,
pageSize: 10,
}
let getMaterialsRes = await http.post(params, api.getMaterialsList)
let getMaterialsRes = await this.axios.post(api.getMaterialsList, params)
if (getMaterialsRes.data.code === 0) {
this.imgList = getMaterialsRes.data.result.result
localStorage.materList = JSON.stringify(this.imgList)
let imgId = this.imgList[0].media_id
this.axios
.post('http://testcenter.bigaka.net/crm/back/wechat/msg-mass/medialist', {
await this.axios
.post(api.getPushList, {
pageNo: this.pageNo,
pageSize: 10,
type: 2,
......@@ -194,13 +195,13 @@ export default {
pageNo: 1,
pageSize: 10,
}
let getMaterialsRes = await http.post(params, api.getMaterialsList)
let getMaterialsRes = await this.axios.post(api.getMaterialsList, params)
if (getMaterialsRes.data.code === 0) {
this.imgList = getMaterialsRes.data.result.result
localStorage.materList = JSON.stringify(this.imgList)
let imgId = this.imgList[0].media_id
this.axios
.post('http://testcenter.bigaka.net/crm/back/wechat/msg-mass/medialist', {
await this.axios
.post(api.getPushList, {
pageNo: pageNo,
pageSize: 10,
type: 3,
......@@ -214,9 +215,9 @@ export default {
}
},
// 素材详情
getMaterianDatail(id = this.mediaId) {
this.axios
.post('http://testcenter.bigaka.net/crm/back/wechat/msg-mass/getarticlesummary', {
async getMaterianDatail(id = this.mediaId) {
await this.axios
.post(api.getarticlesummary, {
mediaId: id,
})
.then(res => {
......
......@@ -7,29 +7,25 @@ export default new Router({
base: `/${config.project}/`,
routes: [
{
path: '/',
redirect: '/home',
component: () => import(/* webpackChunkName: 'wxhome' */ 'pages/home'),
},
{
path: '/login',
name: 'Login',
component: () => import(/* webpackChunkName: 'wxlogin' */ 'pages/login'),
component: () => import(/* webpackChunkName: 'wxlogin' */ '@/pages/login'),
},
{
path: '/home',
name: 'Home',
component: () => import(/* web packChunkName: 'wxhome' */ 'pages/home'),
path: '/salesCenter/activity/lotteryActivity.do',
name: 'test',
component: () => import(/* web packChunkName: 'wxhome' */ '@/pages/home'),
children: [
{
path: 'marketing',
name: 'marketing',
component: () => import(/* webpackChunkName: 'marketing' */ 'pages/marketing-center'),
component: () => import(/* webpackChunkName: 'marketing' */ '@/pages/marketingCenter'),
},
{
path: 'addmarketing',
name: 'addmarketing',
component: () => import(/* webpackChunkName: 'wxlogin' */ 'pages/addmarketing'),
component: () => import(/* webpackChunkName: 'wxlogin' */ '@/pages/addmarketing'),
},
],
},
......
import { globalApi } from '@/api'
import { calcIndexPathByCurrentRouter } from '@/utils'
// 获取菜单数据
const GET_MEUMS = 'GET_MEUMS'
......@@ -12,55 +13,95 @@ const HIDE_EDIT_MENUS = 'HIDE_EDIT_MENUS'
// 边侧菜单
const SIDEBAR_UNFOLD = 'SIDEBAR_UNFOLD'
// 基本信息
const GET_PROJECT_INFO = 'GET_PROJECT_INFO'
//
const CALC_TOUTER_INDEX = 'CALC_TOUTER_INDEX'
const state = {
menus: [],
editMenus: false,
sidebarUnfold: false // false:边侧菜单收缩, true:边侧菜单展开
projectInfo: null,
currentPath: [],
sidebarUnfold: true // false:边侧菜单收缩, true:边侧菜单展开
}
const actions = {
async getMenus ({
async getMenus({
commit, dispatch
}, parmas) {
let res = await globalApi.getMenus(parmas)
let menus = res.data.data
dispatch('calcIndexPathByrouter', menus)
commit(GET_MEUMS, menus)
},
showEditMenus ({commit}) {
showEditMenus({ commit }) {
commit(SHOW_EDIT_MENUS, true)
},
hideEditMenus ({commit}) {
hideEditMenus({ commit }) {
commit(HIDE_EDIT_MENUS, false)
},
setSidebarUnfold ({commit}, type) {
setSidebarUnfold({ commit }, type) {
commit(SIDEBAR_UNFOLD, type)
},
calcIndexPathByrouter ({commit}, menus) {
const currentRoute = location.href
const indexPath = calcIndexPathByCurrentRouter(menus, currentRoute)
console.log('this is indexPath %O', indexPath)
commit(CALC_TOUTER_INDEX, indexPath)
// calcIndexPathByCurrentRouter(menus)
},
async getProjectInfo({ commit, dispatch }) {
let res = await globalApi.getProjectInfo()
let projectInfo = res.data
commit(GET_PROJECT_INFO, projectInfo)
}
}
const getters = {
getMenus (state) {
getMenus(state) {
return state.menus
},
getEditMenus (state) {
getEditMenus(state) {
return state.editMenus
},
getSidebarUnfoldInfo (state) {
getSidebarUnfoldInfo(state) {
return state.sidebarUnfold
},
getProjectInfo(state) {
return state.projectInfo
},
getCurrentMenus(state) {
return state.currentMenus
},
getCurrentPath (state) {
return state.currentPath
}
}
const mutations = {
[GET_MEUMS] (state, menus) {
state.menus = menus
[GET_MEUMS](state, menus) {
state.menus = [...menus]
},
[SHOW_EDIT_MENUS] (state, status) {
[SHOW_EDIT_MENUS](state, status) {
state.editMenus = status
},
[HIDE_EDIT_MENUS] (state, status) {
[HIDE_EDIT_MENUS](state, status) {
state.editMenus = status
},
[SIDEBAR_UNFOLD] (state, type) {
[SIDEBAR_UNFOLD](state, type) {
state.sidebarUnfold = type
},
[GET_PROJECT_INFO](state, projectInfo) {
state.projectInfo = { ...projectInfo }
},
[CALC_TOUTER_INDEX](state, indexPath) {
console.log('this is CALC_TOUTER_INDEX %o', indexPath)
state.currentPath = [...indexPath]
}
}
......
export default {
getMaterialsList: 'http://testcenter.bigaka.net/crm/back/wechat/msg-mass/materials-list',
getPushList: 'http://testcenter.bigaka.net/crm/back/wechat/msg-mass/medialist',
getarticlesummary: 'http://testcenter.bigaka.net/crm/back/wechat/msg-mass/getarticlesummary',
// 营销中心
getMaterialsList: 'http://testcenter.bigaka.net/crm/back/wechat/msg-mass/materials-list', // 获取图文素材列表
getPushList: 'http://testcenter.bigaka.net/crm/back/wechat/msg-mass/medialist', // 获取图文推送列表
getarticlesummary: 'http://testcenter.bigaka.net/crm/back/wechat/msg-mass/getarticlesummary', // 获取图文分析数据接口
getTempList: 'http://testcenter.bigaka.net/crm/back/wechat/msg-mass/list-data', // 营销模板列表
add: {
save: 'http://testcenter.bigaka.net/crm/back/wechat/msg-mass/save', // 确认推送
tagCount: 'http://testcenter.bigaka.net/crm/back/wechat/msg-mass/tag-count', // 标签数量
customerCacheList: 'http://testcenter.bigaka.net/crm/back/tag/customer-cache-list', // 标签列表
getPreViewCount: 'http://testcenter.bigaka.net/crm/back/wechat/msg-mass/pre_view_count', // 图文推送预览人数
},
}
// export default {
// getCode: 'http://rap2api.taobao.org/app/mock/115626/materials-list',
// getPush: 'http://rap2api.taobao.org/app/mock/115626/list-data',
// getData: 'http://rap2api.taobao.org/app/mock/115626/getarticlesummary',
// getTagCount: 'http://rap2api.taobao.org/app/mock/115626/testCount',
// getAllTag: '',
// }
......@@ -2,7 +2,9 @@ import axios from 'axios'
// import qs from 'qs'
axios.interceptors.request.use(
config => {
// loading
if (config.method === 'post') {
config.headers['Content-Type'] = 'application/json'
}
return config
},
error => {
......@@ -49,7 +51,6 @@ export default {
return axios({
method: 'post',
url: url,
// data: qs.stringify(data),
data: data,
timeout: 10000,
headers: {
......
import date from './moment'
export function setCookie(name, value, exptime) {
const ctx = location.hostname
var now = new Date()
var time = now.getTime()
var anhour = (exptime + 8) * 3600
time += anhour * 1000
now.setTime(time)
document.cookie = name + '=' + value + ';path=' + ctx + '/;expires=' + now.toUTCString()
}
export function getCookie(name) {
const cArr = document.cookie.split('; ')
for (var i = 0; i < cArr.length; i++) {
let cArr2 = cArr[i].split('=')
if (cArr2[0] === name) {
return cArr2[1]
}
}
return ''
}
export const M = date
// 获取边侧栏路径indexPath与点击跳转链接link的mapping
export function indexPathMapping(menus = [], mapping = {}, indexPath = []) {
menus.forEach((item, index) => {
let indexTemp = [...indexPath]
indexTemp.push(index)
if (item.children && indexPath <= 3) {
indexPathMapping(item.children, mapping, indexTemp)
}
if (item.link) {
let link = item.link
mapping[link] = indexTemp
}
})
}
export function calcIndexPathByRouter(mapping = {}, route = '') {
console.log(route)
console.log('this is mapping %o', mapping)
const key = Object.keys(mapping).filter(item => route.indexOf(item) > -1)[0]
console.log('this is key %o', mapping[key])
return mapping[key]
}
export function calcIndexPathByCurrentRouter(menus = [], currentRoute = '') {
let indexPathMappingWithLink = {}
indexPathMapping(menus, indexPathMappingWithLink)
return calcIndexPathByRouter(indexPathMappingWithLink, currentRoute)
}
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